From: Christophe Massiot Date: Fri, 22 Dec 2000 10:58:27 +0000 (+0000) Subject: * Moved input_DecodePES() to input_dec.c ; X-Git-Tag: 0.2.70~289 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=174e05473738ae94b77a12a36f6501a03c7f07a4;p=vlc * Moved input_DecodePES() to input_dec.c ; * Fixed an segfault in input_programs.c ; * Added -fomit-frame-pointer optimization. --- diff --git a/Makefile.in b/Makefile.in index b849bf7e26..df4a6fb93e 100644 --- a/Makefile.in +++ b/Makefile.in @@ -106,7 +106,7 @@ ifeq ($(OPTIMS),1) CFLAGS += -O6 CFLAGS += -ffast-math -funroll-loops -fargument-noalias-global CFLAGS += -funroll-all-loops -fstrict-aliasing -#CFLAGS += -fomit-frame-pointer +CFLAGS += -fomit-frame-pointer # Optimizations for x86 familiy ifneq (,$(findstring 86,$(ARCH))) diff --git a/src/input/input_dec.c b/src/input/input_dec.c index 922e2f65f2..3bfd489929 100644 --- a/src/input/input_dec.c +++ b/src/input/input_dec.c @@ -2,7 +2,7 @@ * input_dec.c: Functions for the management of decoders ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: input_dec.c,v 1.1 2000/12/21 19:24:27 massiot Exp $ + * $Id: input_dec.c,v 1.2 2000/12/22 10:58:27 massiot Exp $ * * Authors: Christophe Massiot * @@ -31,6 +31,7 @@ #include "common.h" #include "threads.h" #include "mtime.h" +#include "intf_msg.h" #include "stream_control.h" #include "input_ext-dec.h" @@ -68,3 +69,29 @@ void input_EndDecoder( decoder_fifo_t * p_decoder_fifo, vlc_thread_t thread_id ) } } +/***************************************************************************** + * input_DecodePES + ***************************************************************************** + * Put a PES in the decoder's fifo. + *****************************************************************************/ +void input_DecodePES( decoder_fifo_t * p_decoder_fifo, pes_packet_t * p_pes ) +{ + vlc_mutex_lock( &p_decoder_fifo->data_lock ); + + if( !DECODER_FIFO_ISFULL( *p_decoder_fifo ) ) + { + p_decoder_fifo->buffer[p_decoder_fifo->i_end] = p_pes; + DECODER_FIFO_INCEND( *p_decoder_fifo ); + + /* Warn the decoder that it's got work to do. */ + vlc_cond_signal( &p_decoder_fifo->data_wait ); + } + else + { + /* The FIFO is full !!! This should not happen. */ + p_decoder_fifo->pf_delete_pes( p_decoder_fifo->p_packets_mgt, + p_pes ); + intf_ErrMsg( "PES trashed - fifo full !" ); + } + vlc_mutex_unlock( &p_decoder_fifo->data_lock ); +} diff --git a/src/input/input_dec.h b/src/input/input_dec.h index df883707cc..87002ccbd7 100644 --- a/src/input/input_dec.h +++ b/src/input/input_dec.h @@ -3,7 +3,7 @@ * decoder ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: input_dec.h,v 1.1 2000/12/21 19:24:27 massiot Exp $ + * $Id: input_dec.h,v 1.2 2000/12/22 10:58:27 massiot Exp $ * * Authors: Christophe Massiot * @@ -28,3 +28,4 @@ //decoder_capabilities_s * input_ProbeDecoder( void ); vlc_thread_t input_RunDecoder( struct decoder_capabilities_s *, void * ); void input_EndDecoder( struct decoder_fifo_s *, vlc_thread_t ); +void input_DecodePES( struct decoder_fifo_s *, struct pes_packet_s * ); diff --git a/src/input/input_programs.c b/src/input/input_programs.c index 4c31ade4e8..8e0ca3efdc 100644 --- a/src/input/input_programs.c +++ b/src/input/input_programs.c @@ -3,7 +3,7 @@ * FIXME : check the return value of realloc() and malloc() ! ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: input_programs.c,v 1.13 2000/12/21 19:24:27 massiot Exp $ + * $Id: input_programs.c,v 1.14 2000/12/22 10:58:27 massiot Exp $ * * Authors: * @@ -263,6 +263,10 @@ es_descriptor_t * input_AddES( input_thread_t * p_input, p_es->p_demux_data = malloc( i_data_len ); memset( p_es->p_demux_data, 0, i_data_len ); } + else + { + p_es->p_demux_data = NULL; + } /* Add this ES to the program definition if one is given */ if( p_pgrm ) diff --git a/src/input/mpeg_system.c b/src/input/mpeg_system.c index b131c348cd..fe74675473 100644 --- a/src/input/mpeg_system.c +++ b/src/input/mpeg_system.c @@ -2,7 +2,7 @@ * mpeg_system.c: TS, PS and PES management ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: mpeg_system.c,v 1.14 2000/12/21 19:24:27 massiot Exp $ + * $Id: mpeg_system.c,v 1.15 2000/12/22 10:58:27 massiot Exp $ * * Authors: * @@ -42,6 +42,7 @@ #include "input.h" #include "mpeg_system.h" +#include "input_dec.h" #include "main.h" /* AC3/MPEG channel, SPU channel */ @@ -54,62 +55,6 @@ * PES Packet management */ -/***************************************************************************** - * input_DecodePES - ***************************************************************************** - * Put a PES in the decoder's fifo. - *****************************************************************************/ -void input_DecodePES( input_thread_t * p_input, es_descriptor_t * p_es ) -{ -#define p_pes (p_es->p_pes) - - if( p_es->p_decoder_fifo != NULL ) - { - vlc_mutex_lock( &p_es->p_decoder_fifo->data_lock ); - -#if 0 - if( p_input->stream.b_pace_control ) - { - /* FIXME : normally we shouldn't need this... */ - while( DECODER_FIFO_ISFULL( *p_es->p_decoder_fifo ) ) - { - vlc_mutex_unlock( &p_es->p_decoder_fifo->data_lock ); - msleep( 20000 ); - vlc_mutex_lock( &p_es->p_decoder_fifo->data_lock ); - } - } -#endif - - if( !DECODER_FIFO_ISFULL( *p_es->p_decoder_fifo ) ) - { - //intf_DbgMsg("Putting %p into fifo %p/%d\n", - // p_pes, p_fifo, p_fifo->i_end); - p_es->p_decoder_fifo->buffer[p_es->p_decoder_fifo->i_end] = p_pes; - DECODER_FIFO_INCEND( *p_es->p_decoder_fifo ); - - /* Warn the decoder that it's got work to do. */ - vlc_cond_signal( &p_es->p_decoder_fifo->data_wait ); - } - else - { - /* The FIFO is full !!! This should not happen. */ - p_input->p_plugin->pf_delete_pes( p_input->p_method_data, p_pes ); - intf_ErrMsg( "PES trashed - fifo full ! (%d, %d)", - p_es->i_id, p_es->i_type); - } - vlc_mutex_unlock( &p_es->p_decoder_fifo->data_lock ); - } - else - { - intf_ErrMsg("No fifo to receive PES %p (who wrote this damn code ?)", - p_pes); - p_input->p_plugin->pf_delete_pes( p_input->p_method_data, p_pes ); - } - p_pes = NULL; - -#undef p_pes -} - /***************************************************************************** * input_ParsePES ***************************************************************************** @@ -385,7 +330,17 @@ void input_ParsePES( input_thread_t * p_input, es_descriptor_t * p_es ) /* Now we can eventually put the PES packet in the decoder's * PES fifo */ - input_DecodePES( p_input, p_es ); + if( p_es->p_decoder_fifo != NULL ) + { + input_DecodePES( p_es->p_decoder_fifo, p_pes ); + } + else + { + intf_ErrMsg("No fifo to receive PES %p (who wrote this damn code ?)", + p_pes); + p_input->p_plugin->pf_delete_pes( p_input->p_method_data, p_pes ); + } + p_pes = NULL; } #undef p_pes } @@ -438,7 +393,7 @@ void input_GatherPES( input_thread_t * p_input, data_packet_t * p_data, p_pes->p_first = p_pad_data; p_pes->b_messed_up = p_pes->b_discontinuity = 1; - input_DecodePES( p_input, p_es ); + input_DecodePES( p_es->p_decoder_fifo, p_pes ); } p_es->b_discontinuity = 0; diff --git a/src/input/mpeg_system.h b/src/input/mpeg_system.h index 456af7507e..9c27e7aa61 100644 --- a/src/input/mpeg_system.h +++ b/src/input/mpeg_system.h @@ -3,7 +3,7 @@ * and TS system layers ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: mpeg_system.h,v 1.2 2000/12/20 16:04:31 massiot Exp $ + * $Id: mpeg_system.h,v 1.3 2000/12/22 10:58:27 massiot Exp $ * * Authors: * @@ -111,7 +111,6 @@ typedef struct stream_ps_data_s /***************************************************************************** * Prototypes *****************************************************************************/ -void input_DecodePES( struct input_thread_s *, struct es_descriptor_s * ); void input_ParsePES( struct input_thread_s *, struct es_descriptor_s * ); void input_GatherPES( struct input_thread_s *, struct data_packet_s *, struct es_descriptor_s *, boolean_t, boolean_t );