Commit abde4bbf authored by Christophe Massiot's avatar Christophe Massiot

* Changed the way decoder_fifo_t works ;

* Minor optimizations in the Next Generation Buffer Manager.
parent ea6f82b8
......@@ -118,7 +118,7 @@ PLUGINS_TARGETS := ac3_adec/ac3_adec \
# C Objects
#
INTERFACE := main interface intf_msg intf_playlist
INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_netlist input_clock mpeg_system
INPUT := input input_ext-dec input_ext-intf input_dec input_programs input_clock mpeg_system
VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures
AUDIO_OUTPUT := audio_output aout_ext-dec aout_u8 aout_s8 aout_u16 aout_s16 aout_spdif
MISC := mtime tests modules netutils iso_lang
......
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: common.h,v 1.60 2001/12/19 03:50:22 sam Exp $
* $Id: common.h,v 1.61 2001/12/27 01:49:34 massiot Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -525,18 +525,6 @@ typedef struct module_symbols_s
struct pgrm_descriptor_s *,
mtime_t );
int ( * input_NetlistInit ) ( struct input_thread_s *,
int, int, int, size_t, int );
struct iovec * ( * input_NetlistGetiovec ) ( void * p_method_data );
void ( * input_NetlistMviovec ) ( void * , int,
struct data_packet_s **);
struct data_packet_s * ( * input_NetlistNewPacket ) ( void *, size_t );
struct data_packet_s * ( * input_NetlistNewPtr ) ( void * );
struct pes_packet_s * ( * input_NetlistNewPES ) ( void * );
void ( * input_NetlistDeletePacket ) ( void *, struct data_packet_s * );
void ( * input_NetlistDeletePES ) ( void *, struct pes_packet_s * );
void ( * input_NetlistEnd ) ( struct input_thread_s * );
struct aout_fifo_s * ( * aout_CreateFifo )
( int, int, long, long, long, void * );
void ( * aout_DestroyFifo ) ( struct aout_fifo_s * );
......
/*****************************************************************************
* input_ext-dec.h: structures exported to the VideoLAN decoders
*****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN
* $Id: input_ext-dec.h,v 1.45 2001/12/19 10:00:00 massiot Exp $
* Copyright (C) 1999-2000 VideoLAN
* $Id: input_ext-dec.h,v 1.46 2001/12/27 01:49:34 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
* Michel Kaempf <maxx@via.ecp.fr>
......@@ -42,9 +42,6 @@
*****************************************************************************/
typedef struct data_packet_s
{
/* Nothing before this line, the code relies on that */
byte_t * p_buffer; /* raw data packet */
/* Decoders information */
byte_t * p_demux_start; /* start of the PS or TS packet */
byte_t * p_payload_start;
......@@ -52,12 +49,12 @@ typedef struct data_packet_s
byte_t * p_payload_end; /* guess ? :-) */
boolean_t b_discard_payload; /* is the packet messed up ? */
int * pi_refcount;
unsigned int i_size; /* buffer size */
long l_size; /* buffer size */
/* Used to chain the TS packets that carry data for a same PES or PSI */
struct data_packet_s * p_next;
/* Buffer manager information */
byte_t * p_buffer; /* raw data packet */
unsigned int i_size; /* buffer size */
} data_packet_t;
/*****************************************************************************
......@@ -81,13 +78,13 @@ typedef struct pes_packet_s
int i_pes_size; /* size of the current PES packet */
/* Pointers to packets (packets are then linked by the p_prev and
p_next fields of the data_packet_t struct) */
/* Chained list to packets */
data_packet_t * p_first; /* The first packet contained by this
* PES (used by decoders). */
data_packet_t * p_last; /* The last packet contained by this
PES (used by the buffer allocator) */
int i_nb_data;
int i_nb_data; /* Number of data packets in the chained
list */
/* Chained list used by the input buffers manager */
struct pes_packet_s * p_next;
......@@ -105,9 +102,9 @@ typedef struct decoder_fifo_s
vlc_cond_t data_wait; /* fifo data conditional variable */
/* Data */
pes_packet_t * buffer[FIFO_SIZE + 1];
int i_start;
int i_end;
pes_packet_t * p_first;
pes_packet_t ** pp_last;
int i_depth; /* number of PES packets in the stack */
/* Communication interface between input and decoders */
boolean_t b_die; /* the decoder should return now */
......@@ -118,18 +115,6 @@ typedef struct decoder_fifo_s
/* function to use when releasing a PES */
} decoder_fifo_t;
/* Macros to manage a decoder_fifo_t structure. Please remember to take
* data_lock before using them. */
#define DECODER_FIFO_ISEMPTY( fifo ) ( (fifo).i_start == (fifo).i_end )
#define DECODER_FIFO_ISFULL( fifo ) ( ( ((fifo).i_end + 1 - (fifo).i_start)\
& FIFO_SIZE ) == 0 )
#define DECODER_FIFO_START( fifo ) ( (fifo).buffer[ (fifo).i_start ] )
#define DECODER_FIFO_INCSTART( fifo ) ( (fifo).i_start = ((fifo).i_start + 1)\
& FIFO_SIZE )
#define DECODER_FIFO_END( fifo ) ( (fifo).buffer[ (fifo).i_end ] )
#define DECODER_FIFO_INCEND( fifo ) ( (fifo).i_end = ((fifo).i_end + 1) \
& FIFO_SIZE )
/*****************************************************************************
* bit_fifo_t : bit fifo descriptor
*****************************************************************************
......
......@@ -2,8 +2,8 @@
* input_ext-plugins.h: structures of the input not exported to other modules,
* but exported to plug-ins
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: input_ext-plugins.h,v 1.11 2001/12/19 10:00:00 massiot Exp $
* Copyright (C) 1999-2001 VideoLAN
* $Id: input_ext-plugins.h,v 1.12 2001/12/27 01:49:34 massiot Exp $
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
......@@ -136,69 +136,6 @@ static __inline__ void input_NullPacket( input_thread_t * p_input,
}
/*
* Optional netlist management
*/
/*****************************************************************************
* netlist_t: structure to manage a netlist
*****************************************************************************/
typedef struct netlist_s
{
vlc_mutex_t lock;
size_t i_buffer_size;
/* Buffers */
byte_t * p_buffers; /* Big malloc'ed area */
data_packet_t * p_data; /* malloc'ed area */
pes_packet_t * p_pes; /* malloc'ed area */
/* FIFOs of free packets */
data_packet_t ** pp_free_data;
pes_packet_t ** pp_free_pes;
struct iovec * p_free_iovec;
/* FIFO size */
unsigned int i_nb_iovec;
unsigned int i_nb_pes;
unsigned int i_nb_data;
/* Index */
unsigned int i_iovec_start, i_iovec_end;
unsigned int i_data_start, i_data_end;
unsigned int i_pes_start, i_pes_end;
/* Reference counters for iovec */
unsigned int * pi_refcount;
/* Number of blocs read once by readv */
unsigned int i_read_once;
} netlist_t;
/*****************************************************************************
* Prototypes
*****************************************************************************/
int input_NetlistInit( struct input_thread_s *,
int i_nb_iovec,
int i_nb_data,
int i_nb_pes,
size_t i_buffer_size,
int i_read_once );
struct iovec * input_NetlistGetiovec( void * p_method_data );
void input_NetlistMviovec( void * , int,
struct data_packet_s **);
struct data_packet_s * input_NetlistNewPtr( void * );
struct data_packet_s * input_NetlistNewPacket( void *, size_t );
struct pes_packet_s * input_NetlistNewPES( void * );
void input_NetlistDeletePacket( void *,
struct data_packet_s * );
void input_NetlistDeletePES( void *,
struct pes_packet_s * );
void input_NetlistEnd( struct input_thread_s * );
/*
* Optional Next Generation buffer manager
*
......@@ -213,8 +150,7 @@ void input_NetlistEnd( struct input_thread_s * );
/* Flags */
#define BUFFERS_NOFLAGS 0
#define BUFFERS_SHARED 1
#define BUFFERS_UNIQUE_SIZE 2 /* Only with NB_LIFO == 1 */
#define BUFFERS_UNIQUE_SIZE 1 /* Only with NB_LIFO == 1 */
/*****************************************************************************
* input_buffers_t: defines a LIFO per data type to keep
......@@ -584,37 +520,45 @@ static __inline__ void _input_DeletePacket( void * _p_buffers, \
input_buffers_t * p_buffers = (input_buffers_t *)_p_buffers; \
int i_select; \
\
EXTRA( FLAGS, NB_LIFO, DATA_CACHE_SIZE ); \
\
for( i_select = 0; i_select < NB_LIFO - 1; i_select++ ) \
while( p_data != NULL ) \
{ \
if( p_buf->i_size <= (2 * p_buffers->NAME[i_select].i_average_size \
+ p_buffers->NAME[i_select + 1].i_average_size) / 3 ) \
data_packet_t * p_next = p_data->p_next; \
\
EXTRA( FLAGS, NB_LIFO, DATA_CACHE_SIZE ); \
\
for( i_select = 0; i_select < NB_LIFO - 1; i_select++ ) \
{ \
break; \
if( p_buf->i_size <= \
(2 * p_buffers->NAME[i_select].i_average_size \
+ p_buffers->NAME[i_select + 1].i_average_size) / 3 ) \
{ \
break; \
} \
} \
} \
\
if( p_buffers->NAME[i_select].i_depth < DATA_CACHE_SIZE ) \
{ \
/* Cache not full : store the packet in it */ \
p_buf->p_next = p_buffers->NAME[i_select].p_stack; \
p_buffers->NAME[i_select].p_stack = p_buf; \
p_buffers->NAME[i_select].i_depth++; \
if( p_buffers->NAME[i_select].i_depth < DATA_CACHE_SIZE ) \
{ \
/* Cache not full : store the packet in it */ \
p_buf->p_next = p_buffers->NAME[i_select].p_stack; \
p_buffers->NAME[i_select].p_stack = p_buf; \
p_buffers->NAME[i_select].i_depth++; \
\
if( !(FLAGS & BUFFERS_UNIQUE_SIZE) ) \
if( !(FLAGS & BUFFERS_UNIQUE_SIZE) ) \
{ \
/* Update Bresenham mean (very approximative) */ \
p_buffers->NAME[i_select].i_average_size = ( p_buf->i_size \
+ p_buffers->NAME[i_select].i_average_size \
* (INPUT_BRESENHAM_NB - 1) ) \
/ INPUT_BRESENHAM_NB; \
} \
} \
else \
{ \
/* Update Bresenham mean (very approximative) */ \
p_buffers->NAME[i_select].i_average_size = ( p_buf->i_size \
+ p_buffers->NAME[i_select].i_average_size \
* (INPUT_BRESENHAM_NB - 1) ) \
/ INPUT_BRESENHAM_NB; \
p_buffers->i_allocated -= p_buf->i_size; \
free( p_buf ); \
} \
} \
else \
{ \
p_buffers->i_allocated -= p_buf->i_size; \
free( p_buf ); \
\
p_data = p_next; \
} \
} \
\
......@@ -680,38 +624,65 @@ static pes_packet_t * input_NewPES( void * _p_buffers ) \
/*****************************************************************************
* input_DeletePES: put a pes and all data packets back into the cache
*****************************************************************************/
#define DECLARE_BUFFERS_DELETEPES( FLAGS, NB_LIFO, PES_CACHE_SIZE ) \
#define BUFFERS_DELETEPES_EXTRA( FLAGS, NB_LIFO, DATA_CACHE_SIZE ) \
/* Small hopeless optimization */ \
if( (FLAGS & BUFFERS_UNIQUE_SIZE) \
&& p_buffers->data[0].i_depth < DATA_CACHE_SIZE ) \
{ \
p_buffers->data[0].i_depth += p_pes->i_nb_data; \
p_pes->p_last->p_next = p_buffers->data[0].p_stack; \
p_buffers->data[0].p_stack = p_pes->p_first; \
} \
else /* No semicolon after this or you will die */
#define BUFFERS_DELETEPES_EXTRA_SHARED( FLAGS, NB_LIFO, DATA_CACHE_SIZE )
#define BUFFERS_DELETEPES( FLAGS, NB_LIFO, DATA_CACHE_SIZE, PES_CACHE_SIZE, \
EXTRA ) \
static void input_DeletePES( void * _p_buffers, pes_packet_t * p_pes ) \
{ \
input_buffers_t * p_buffers = (input_buffers_t *)_p_buffers; \
\
vlc_mutex_lock( &p_buffers->lock ); \
\
while( p_pes != NULL ) \
{ \
data_packet_t * p_data = p_pes->p_first; \
while( p_data != NULL ) \
pes_packet_t * p_next = p_pes->p_next; \
\
/* Delete all data packets - no semicolon, PLEASE */ \
EXTRA( FLAGS, NB_LIFO, DATA_CACHE_SIZE ) \
{ \
data_packet_t * p_next = p_data->p_next; \
_input_DeletePacket( _p_buffers, p_data ); \
p_data = p_next; \
_input_DeletePacket( _p_buffers, p_pes->p_first ); \
} \
} \
\
if( p_buffers->pes.i_depth < PES_CACHE_SIZE ) \
{ \
/* Cache not full : store the packet in it */ \
p_pes->p_next = p_buffers->pes.p_stack; \
p_buffers->pes.p_stack = p_pes; \
p_buffers->pes.i_depth++; \
} \
else \
{ \
free( p_pes ); \
if( p_buffers->pes.i_depth < PES_CACHE_SIZE ) \
{ \
/* Cache not full : store the packet in it */ \
p_pes->p_next = p_buffers->pes.p_stack; \
p_buffers->pes.p_stack = p_pes; \
p_buffers->pes.i_depth++; \
} \
else \
{ \
free( p_pes ); \
} \
\
p_pes = p_next; \
} \
\
vlc_mutex_unlock( &p_buffers->lock ); \
}
#define DECLARE_BUFFERS_DELETEPES( FLAGS, NB_LIFO, DATA_CACHE_SIZE, \
PES_CACHE_SIZE ) \
BUFFERS_DELETEPES( FLAGS, NB_LIFO, DATA_CACHE_SIZE, PES_CACHE_SIZE, \
BUFFERS_DELETEPES_EXTRA )
#define DECLARE_BUFFERS_DELETEPES_SHARED( FLAGS, NB_LIFO, DATA_CACHE_SIZE, \
PES_CACHE_SIZE ) \
BUFFERS_DELETEPES( FLAGS, NB_LIFO, DATA_CACHE_SIZE, PES_CACHE_SIZE, \
BUFFERS_DELETEPES_EXTRA_SHARED )
/*****************************************************************************
* input_BuffersToIO: return an io vector (only with BUFFERS_UNIQUE_SIZE)
*****************************************************************************/
......
......@@ -75,15 +75,6 @@
(p_symbols)->input_DemuxTS = input_DemuxTS; \
(p_symbols)->input_DemuxPSI = input_DemuxPSI; \
(p_symbols)->input_ClockManageControl = input_ClockManageControl; \
(p_symbols)->input_NetlistInit = input_NetlistInit; \
(p_symbols)->input_NetlistGetiovec = input_NetlistGetiovec; \
(p_symbols)->input_NetlistMviovec = input_NetlistMviovec; \
(p_symbols)->input_NetlistNewPacket = input_NetlistNewPacket; \
(p_symbols)->input_NetlistNewPtr = input_NetlistNewPtr; \
(p_symbols)->input_NetlistNewPES = input_NetlistNewPES; \
(p_symbols)->input_NetlistDeletePacket = input_NetlistDeletePacket; \
(p_symbols)->input_NetlistDeletePES = input_NetlistDeletePES; \
(p_symbols)->input_NetlistEnd = input_NetlistEnd; \
(p_symbols)->aout_CreateFifo = aout_CreateFifo; \
(p_symbols)->aout_DestroyFifo = aout_DestroyFifo; \
(p_symbols)->vout_CreateThread = vout_CreateThread; \
......@@ -185,16 +176,6 @@
# define input_ClockManageControl p_symbols->input_ClockManageControl
# define input_NetlistInit p_symbols->input_NetlistInit
# define input_NetlistGetiovec p_symbols->input_NetlistGetiovec
# define input_NetlistMviovec p_symbols->input_NetlistMviovec
# define input_NetlistNewPacket p_symbols->input_NetlistNewPacket
# define input_NetlistNewPtr p_symbols->input_NetlistNewPtr
# define input_NetlistNewPES p_symbols->input_NetlistNewPES
# define input_NetlistDeletePacket p_symbols->input_NetlistDeletePacket
# define input_NetlistDeletePES p_symbols->input_NetlistDeletePES
# define input_NetlistEnd p_symbols->input_NetlistEnd
# define aout_CreateFifo p_symbols->aout_CreateFifo
# define aout_DestroyFifo p_symbols->aout_DestroyFifo
......
......@@ -2,7 +2,7 @@
* ac3_adec.c: ac3 decoder module main file
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: ac3_adec.c,v 1.8 2001/12/16 16:18:36 sam Exp $
* $Id: ac3_adec.c,v 1.9 2001/12/27 01:49:34 massiot Exp $
*
* Authors: Michel Lespinasse <walken@zoy.org>
*
......@@ -169,12 +169,12 @@ static int ac3_adec_Run ( decoder_config_t * p_config )
sync = 1;
}
if (DECODER_FIFO_START(*p_ac3thread->p_fifo)->i_pts)
if (p_ac3thread->p_fifo->p_first->i_pts)
{
p_ac3thread->p_aout_fifo->date[
p_ac3thread->p_aout_fifo->l_end_frame] =
DECODER_FIFO_START(*p_ac3thread->p_fifo)->i_pts;
DECODER_FIFO_START(*p_ac3thread->p_fifo)->i_pts = 0;
p_ac3thread->p_fifo->p_first->i_pts;
p_ac3thread->p_fifo->p_first->i_pts = 0;
} else {
p_ac3thread->p_aout_fifo->date[
p_ac3thread->p_aout_fifo->l_end_frame] =
......@@ -384,13 +384,9 @@ static void ac3_adec_ErrorThread (ac3dec_thread_t * p_ac3thread)
while (!p_ac3thread->p_fifo->b_die)
{
/* Trash all received PES packets */
while (!DECODER_FIFO_ISEMPTY(*p_ac3thread->p_fifo))
{
p_ac3thread->p_fifo->pf_delete_pes(
p_ac3thread->p_fifo->p_packets_mgt,
DECODER_FIFO_START(*p_ac3thread->p_fifo));
DECODER_FIFO_INCSTART (*p_ac3thread->p_fifo);
}
p_ac3thread->p_fifo->pf_delete_pes(
p_ac3thread->p_fifo->p_packets_mgt,
p_ac3thread->p_fifo->p_first );
/* Waiting for the input thread to put new PES packets in the fifo */
vlc_cond_wait (&p_ac3thread->p_fifo->data_wait,
......
......@@ -2,7 +2,7 @@
* ac3_spdif.c: ac3 pass-through to external decoder with enabled soundcard
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: ac3_spdif.c,v 1.7 2001/12/10 04:53:10 sam Exp $
* $Id: ac3_spdif.c,v 1.8 2001/12/27 01:49:34 massiot Exp $
*
* Authors: Stphane Borel <stef@via.ecp.fr>
* Juha Yrjola <jyrjola@cc.hut.fi>
......@@ -315,12 +315,9 @@ static void ac3_spdif_ErrorThread( ac3_spdif_thread_t * p_spdif )
while( !p_spdif->p_fifo->b_die )
{
/* Trash all received PES packets */
while( !DECODER_FIFO_ISEMPTY( *p_spdif->p_fifo ) )
{
p_spdif->p_fifo->pf_delete_pes(p_spdif->p_fifo->p_packets_mgt,
DECODER_FIFO_START( *p_spdif->p_fifo ) );
DECODER_FIFO_INCSTART( *p_spdif->p_fifo );
}
p_spdif->p_fifo->pf_delete_pes(
p_spdif->p_fifo->p_packets_mgt,
p_spdif->p_fifo->p_first );
/* Waiting for the input thread to put new PES packets in the fifo */
vlc_cond_wait( &p_spdif->p_fifo->data_wait,
......@@ -374,7 +371,7 @@ static void BitstreamCallback ( bit_stream_t * p_bit_stream,
p_bit_stream->p_byte += 3;
p_spdif->i_pts =
DECODER_FIFO_START( *p_bit_stream->p_decoder_fifo )->i_pts;
DECODER_FIFO_START( *p_bit_stream->p_decoder_fifo )->i_pts = 0;
p_bit_stream->p_decoder_fifo->p_first->i_pts;
p_bit_stream->p_decoder_fifo->p_first->i_pts = 0;
}
}
......@@ -9,7 +9,7 @@
* -dvd_udf to find files
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: input_dvd.c,v 1.109 2001/12/19 23:19:20 sam Exp $
* $Id: input_dvd.c,v 1.110 2001/12/27 01:49:34 massiot Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -126,7 +126,7 @@ DECLARE_BUFFERS_END_SHARED( FLAGS, NB_LIFO );
DECLARE_BUFFERS_NEWPACKET_SHARED( FLAGS, NB_LIFO );
DECLARE_BUFFERS_DELETEPACKET_SHARED( FLAGS, NB_LIFO, 150 );
DECLARE_BUFFERS_NEWPES( FLAGS, NB_LIFO );
DECLARE_BUFFERS_DELETEPES( FLAGS, NB_LIFO, 150 );
DECLARE_BUFFERS_DELETEPES_SHARED( FLAGS, NB_LIFO, 150, 150 );
DECLARE_BUFFERS_TOIO( FLAGS, DVD_LB_SIZE );
DECLARE_BUFFERS_SHAREBUFFER( FLAGS );
......@@ -981,12 +981,7 @@ intf_WarnMsg( 2, "Sector: 0x%x Read: %d Chapter: %d", p_dvd->i_sector, i_block_o
pp_packets[i_packet] = NULL;
while( p_data != NULL )
{
data_packet_t * p_next = p_data->p_next;
p_input->pf_delete_packet( p_input->p_method_data, p_data );
p_data = p_next;
}
p_input->pf_delete_packet( p_input->p_method_data, p_data );
vlc_mutex_lock( &p_input->stream.stream_lock );
......
......@@ -6,7 +6,7 @@
* It depends on: libdvdread for ifo files and block reading.
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: input_dvdread.c,v 1.5 2001/12/20 23:53:49 massiot Exp $
* $Id: input_dvdread.c,v 1.6 2001/12/27 01:49:34 massiot Exp $
*
* Author: Stphane Borel <stef@via.ecp.fr>
*
......@@ -116,7 +116,7 @@ DECLARE_BUFFERS_END_SHARED( FLAGS, NB_LIFO );
DECLARE_BUFFERS_NEWPACKET_SHARED( FLAGS, NB_LIFO );
DECLARE_BUFFERS_DELETEPACKET_SHARED( FLAGS, NB_LIFO, 150 );
DECLARE_BUFFERS_NEWPES( FLAGS, NB_LIFO );
DECLARE_BUFFERS_DELETEPES( FLAGS, NB_LIFO, 150 );
DECLARE_BUFFERS_DELETEPES_SHARED( FLAGS, NB_LIFO, 150, 150 );
DECLARE_BUFFERS_TOIO( FLAGS, DVD_LB_SIZE );
DECLARE_BUFFERS_SHAREBUFFER( FLAGS );
......@@ -922,12 +922,7 @@ static int DvdReadRead( input_thread_t * p_input,
pp_packets[i_packet] = NULL;
while( p_data_p != NULL )
{
data_packet_t * p_next = p_data_p->p_next;
p_input->pf_delete_packet( p_input->p_method_data, p_data_p );
p_data_p = p_next;
}
p_input->pf_delete_packet( p_input->p_method_data, p_data_p );
vlc_mutex_lock( &p_input->stream.stream_lock );
......
......@@ -2,7 +2,7 @@
* lpcm_decoder_thread.c: lpcm decoder thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: lpcm_adec.c,v 1.5 2001/12/10 04:53:11 sam Exp $
* $Id: lpcm_adec.c,v 1.6 2001/12/27 01:49:34 massiot Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Henri Fallon <henri@videolan.org>
......@@ -184,11 +184,11 @@ void lpcm_adec_DecodeFrame( lpcmdec_thread_t * p_lpcmdec )
int i_loop;
byte_t byte1, byte2;
if( DECODER_FIFO_START(*p_lpcmdec->p_fifo)->i_pts )
if( p_lpcmdec->p_fifo->p_first->i_pts )
{
p_lpcmdec->p_aout_fifo->date[p_lpcmdec->p_aout_fifo->l_end_frame] =
DECODER_FIFO_START(*p_lpcmdec->p_fifo)->i_pts;
DECODER_FIFO_START(*p_lpcmdec->p_fifo)->i_pts = 0;
p_lpcmdec->p_fifo->p_first->i_pts;
p_lpcmdec->p_fifo->p_first->i_pts = 0;
}
else
{
......@@ -246,12 +246,9 @@ static void lpcm_adec_ErrorThread( lpcmdec_thread_t * p_lpcmdec )
while( !p_lpcmdec->p_fifo->b_die )
{
/* Trash all received PES packets */
while( !DECODER_FIFO_ISEMPTY(*p_lpcmdec->p_fifo) )
{
p_lpcmdec->p_fifo->pf_delete_pes( p_lpcmdec->p_fifo->p_packets_mgt,
DECODER_FIFO_START(*p_lpcmdec->p_fifo ));
DECODER_FIFO_INCSTART( *p_lpcmdec->p_fifo );
}
p_lpcmdec->p_fifo->pf_delete_pes(
p_lpcmdec->p_fifo->p_packets_mgt,
p_lpcmdec->p_fifo->p_first );
/* Waiting for the input thread to put new PES packets in the fifo */
vlc_cond_wait ( &p_lpcmdec->p_fifo->data_wait,
......
......@@ -237,13 +237,9 @@ static void mad_adec_ErrorThread (mad_adec_thread_t * p_mad_adec)
while (!p_mad_adec->p_fifo->b_die)
{
/* Trash all received PES packets */
while (!DECODER_FIFO_ISEMPTY(*p_mad_adec->p_fifo))
{
p_mad_adec->p_fifo->pf_delete_pes(
p_mad_adec->p_fifo->p_packets_mgt,
DECODER_FIFO_START(*p_mad_adec->p_fifo));
DECODER_FIFO_INCSTART (*p_mad_adec->p_fifo);
}
p_mad_adec->p_fifo->pf_delete_pes(
p_mad_adec->p_fifo->p_packets_mgt,
p_mad_adec->p_fifo->p_first );
/* Waiting for the input thread to put new PES packets in the fifo */
vlc_cond_wait (&p_mad_adec->p_fifo->data_wait,
......
......@@ -61,9 +61,9 @@ enum mad_flow libmad_input(void *data, struct mad_stream *p_libmad_stream)
byte_t buffer[ADEC_FRAME_SIZE];
/* Store time stamp of current frame */
if ( DECODER_FIFO_START(*p_mad_adec->p_fifo)->i_pts ) {
p_mad_adec->i_pts_save = DECODER_FIFO_START(*p_mad_adec->p_fifo)->i_pts;
DECODER_FIFO_START(*p_mad_adec->p_fifo)->i_pts = 0;
if ( p_mad_adec->p_fifo->p_first->i_pts ) {
p_mad_adec->i_pts_save = p_mad_adec->p_fifo->p_first->i_pts;
p_mad_adec->p_fifo->p_first->i_pts = 0;
}
else {
p_mad_adec->i_pts_save = LAST_MDATE;
......
......@@ -2,7 +2,7 @@
* mpeg_adec.c: MPEG audio decoder thread
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: mpeg_adec.c,v 1.7 2001/12/10 04:53:11 sam Exp $
* $Id: mpeg_adec.c,v 1.8 2001/12/27 01:49:34 massiot Exp $
*
* Authors: Michel Kaempf <maxx@via.ecp.fr>
* Michel Lespinasse <walken@via.ecp.fr>
......@@ -202,11 +202,11 @@ static void adec_Decode( adec_thread_t * p_adec )
buffer = ((s16 *)p_adec->p_aout_fifo->buffer)
+ (p_adec->p_aout_fifo->l_end_frame * ADEC_FRAME_SIZE);
if( DECODER_FIFO_START( *p_adec->p_fifo)->i_pts )
if( p_adec->p_fifo->p_first->i_pts )
{
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] =
DECODER_FIFO_START( *p_adec->p_fifo )->i_pts;
DECODER_FIFO_START(*p_adec->p_fifo)->i_pts = 0;
p_adec->p_fifo->p_first->i_pts;
p_adec->p_fifo->p_first->i_pts = 0;
}
else
{
......@@ -248,12 +248,9 @@ static void adec_ErrorThread ( adec_thread_t *p_adec )
while ( !p_adec->p_fifo->b_die )
{
/* Trash all received PES packets */
while ( !DECODER_FIFO_ISEMPTY(*p_adec->p_fifo) )
{
p_adec->p_fifo->pf_delete_pes ( p_adec->p_fifo->p_packets_mgt,
DECODER_FIFO_START(*p_adec->p_fifo) );
DECODER_FIFO_INCSTART ( *p_adec->p_fifo );
}
p_adec->p_fifo->pf_delete_pes(
p_adec->p_fifo->p_packets_mgt,
p_adec->p_fifo->p_first );
/* Waiting for the input thread to put new PES packets in the fifo */