Commit 1ecbcf15 authored by Christophe Massiot's avatar Christophe Massiot

* configure.ac.in: Renamed mpeg_video to mpeg_video_old, so that even

  people who explicitely set mpeg_video in the previous version will end
  up with libmpeg2 in 0.6.0.
* modules/codec/libmpeg2.c: Fixed a potential segfault, especially
  with DVDs.
* modules/codec/lpcm.c: Send two PES packets in one aout buffer, because
  some audio filters (read: coreaudio resampler) don't like too small
  packets (I know, this is ugly).
parent 85d9938a
......@@ -786,7 +786,7 @@ esac
case "${ARCH}" in
hppa64)
CFLAGS_mpeg_video="${CFLAGS_mpeg_video} -ffunction-sections"
CFLAGS_mpeg_video_old="${CFLAGS_mpeg_video_old} -ffunction-sections"
;;
esac
......@@ -803,7 +803,7 @@ AM_CONDITIONAL(CPROF, test "${enable_gprof}" = "yes")
dnl
dnl default modules
dnl
#BUILTINS="${BUILTINS} mpeg_video idct idctclassic motion"
#BUILTINS="${BUILTINS} mpeg_video_old idct idctclassic motion"
PLUGINS="${PLUGINS} dummy rc logger gestures memcpy"
PLUGINS="${PLUGINS} es audio m4v mpeg_system ps ts avi asf aac mp4 rawdv"
PLUGINS="${PLUGINS} spudec mpeg_audio lpcm a52 dts cinepak"
......
......@@ -2,7 +2,7 @@
* libmpeg2.c: mpeg2 video decoder module making use of libmpeg2.
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: libmpeg2.c,v 1.21 2003/06/10 11:12:38 massiot Exp $
* $Id: libmpeg2.c,v 1.22 2003/06/10 23:01:40 massiot Exp $
*
* Authors: Gildas Bazin <gbazin@netcourrier.com>
*
......@@ -179,7 +179,8 @@ static int RunDecoder( decoder_fifo_t *p_fifo )
break;
}
if( p_dec->p_pes->b_discontinuity && p_dec->p_synchro )
if( p_dec->p_pes->b_discontinuity && p_dec->p_synchro
&& p_dec->p_info->sequence->width != (unsigned)-1 )
{
vout_SynchroReset( p_dec->p_synchro );
if ( p_dec->p_info->current_fbuf != NULL
......
......@@ -2,7 +2,7 @@
* lpcm.c: lpcm decoder module
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: lpcm.c,v 1.15 2003/03/31 22:39:28 massiot Exp $
* $Id: lpcm.c,v 1.16 2003/06/10 23:01:40 massiot Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@videolan.org>
......@@ -47,6 +47,11 @@ typedef struct dec_thread_t
* Input properties
*/
decoder_fifo_t * p_fifo; /* stores the PES stream data */
/* Some filters don't handle well too small buffers (coreaudio resampler).
* Thus an aout buffer will be two PES packets. */
pes_packet_t * p_buffered_pes;
data_packet_t * p_buffered_data;
size_t i_buffered_size;
/*
* Output properties
......@@ -127,6 +132,7 @@ static int RunDecoder( decoder_fifo_t * p_fifo )
/* Initialize the thread properties */
p_dec->p_fifo = p_fifo;
p_dec->i_buffered_size = 0;
p_dec->output_format.i_format = VLC_FOURCC('s','1','6','b');
p_dec->p_aout = NULL;
......@@ -308,6 +314,13 @@ static void DecodeFrame( dec_thread_t * p_dec )
input_DeletePES( p_dec->p_fifo->p_packets_mgt, p_pes );
return;
}
if ( p_dec->i_buffered_size )
{
input_DeletePES( p_dec->p_fifo->p_packets_mgt,
p_dec->p_buffered_pes );
p_dec->i_buffered_size = 0;
}
}
if ( !aout_DateGet( &p_dec->end_date ) )
......@@ -317,35 +330,62 @@ static void DecodeFrame( dec_thread_t * p_dec )
return;
}
p_buffer = aout_DecNewBuffer( p_dec->p_aout, p_dec->p_aout_input,
(i_size - LPCM_HEADER_LEN)
/ p_dec->output_format.i_bytes_per_frame );
if( p_buffer == NULL )
if ( p_dec->i_buffered_size != 0 )
{
msg_Err( p_dec->p_fifo, "cannot get aout buffer" );
p_dec->p_fifo->b_error = 1;
p_buffer = aout_DecNewBuffer( p_dec->p_aout, p_dec->p_aout_input,
(i_size - LPCM_HEADER_LEN + p_dec->i_buffered_size)
/ p_dec->output_format.i_bytes_per_frame );
if( p_buffer == NULL )
{
msg_Err( p_dec->p_fifo, "cannot get aout buffer" );
p_dec->p_fifo->b_error = 1;
input_DeletePES( p_dec->p_fifo->p_packets_mgt, p_pes );
return;
}
p_buffer->start_date = aout_DateGet( &p_dec->end_date );
p_buffer->end_date = aout_DateIncrement( &p_dec->end_date,
(i_size - LPCM_HEADER_LEN + p_dec->i_buffered_size)
/ p_dec->output_format.i_bytes_per_frame );
/* Get the whole frame. */
p_dest = p_buffer->p_buffer;
while ( p_dec->p_buffered_data != NULL )
{
p_dec->p_fifo->p_vlc->pf_memcpy( p_dest,
p_dec->p_buffered_data->p_payload_start,
p_dec->p_buffered_data->p_payload_end
- p_dec->p_buffered_data->p_payload_start );
p_dest += p_dec->p_buffered_data->p_payload_end
- p_dec->p_buffered_data->p_payload_start;
p_dec->p_buffered_data = p_dec->p_buffered_data->p_next;
}
input_DeletePES( p_dec->p_fifo->p_packets_mgt,
p_dec->p_buffered_pes );
p_dest = p_buffer->p_buffer + p_dec->i_buffered_size;
while ( p_data != NULL )
{
p_dec->p_fifo->p_vlc->pf_memcpy( p_dest, p_data->p_payload_start,
p_data->p_payload_end - p_data->p_payload_start );
p_dest += p_data->p_payload_end - p_data->p_payload_start;
p_data = p_data->p_next;
}
input_DeletePES( p_dec->p_fifo->p_packets_mgt, p_pes );
return;
}
p_buffer->start_date = aout_DateGet( &p_dec->end_date );
p_buffer->end_date = aout_DateIncrement( &p_dec->end_date,
(i_size - LPCM_HEADER_LEN)
/ p_dec->output_format.i_bytes_per_frame );
/* Get the whole frame. */
p_dest = p_buffer->p_buffer;
while ( p_data != NULL )
/* Send the buffer to the aout core. */
aout_DecPlay( p_dec->p_aout, p_dec->p_aout_input, p_buffer );
p_dec->i_buffered_size = 0;
}
else
{
p_dec->p_fifo->p_vlc->pf_memcpy( p_dest, p_data->p_payload_start,
p_data->p_payload_end - p_data->p_payload_start );
p_dest += p_data->p_payload_end - p_data->p_payload_start;
p_data = p_data->p_next;
p_dec->i_buffered_size = i_size - LPCM_HEADER_LEN;
p_dec->p_buffered_pes = p_pes;
p_dec->p_buffered_data = p_data;
}
input_DeletePES( p_dec->p_fifo->p_packets_mgt, p_pes );
/* Send the buffer to the aout core. */
aout_DecPlay( p_dec->p_aout, p_dec->p_aout_input, p_buffer );
}
/*****************************************************************************
......@@ -358,5 +398,12 @@ static void EndThread( dec_thread_t * p_dec )
aout_DecDelete( p_dec->p_aout, p_dec->p_aout_input );
}
if ( p_dec->i_buffered_size )
{
input_DeletePES( p_dec->p_fifo->p_packets_mgt,
p_dec->p_buffered_pes );
p_dec->i_buffered_size = 0;
}
free( p_dec );
}
SOURCES_mpeg_video = \
SOURCES_mpeg_video_old = \
modules/codec/mpeg_video/parser.c \
modules/codec/mpeg_video/parser.h \
modules/codec/mpeg_video/headers.c \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment