]> git.sesse.net Git - vlc/commitdiff
* Moved input_DecodePES() to input_dec.c ;
authorChristophe Massiot <massiot@videolan.org>
Fri, 22 Dec 2000 10:58:27 +0000 (10:58 +0000)
committerChristophe Massiot <massiot@videolan.org>
Fri, 22 Dec 2000 10:58:27 +0000 (10:58 +0000)
* Fixed an segfault in input_programs.c ;
* Added -fomit-frame-pointer optimization.

Makefile.in
src/input/input_dec.c
src/input/input_dec.h
src/input/input_programs.c
src/input/mpeg_system.c
src/input/mpeg_system.h

index b849bf7e268110f20470cd7717d4a4443789b821..df4a6fb93e4b45be7b35f1c5db74c3a0ab9cf32b 100644 (file)
@@ -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)))
index 922e2f65f22b1dd4aaeaad49dc7f1cb086852734..3bfd489929f8c53dd7526114364806983dfc27e1 100644 (file)
@@ -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 <massiot@via.ecp.fr>
  *
@@ -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 );
+}
index df883707cc5eb2d2c195fca86606c63465900ff7..87002ccbd7462b7b19d518ca478b4934d10771a0 100644 (file)
@@ -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 <massiot@via.ecp.fr>
  *
@@ -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 * );
index 4c31ade4e833ecc639f5c2fedbcc7eb7bebe776a..8e0ca3efdc36705b62c2cf76a0e05c72d738b11f 100644 (file)
@@ -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 )
index b131c348cdc085ff10131ceb702872d1c0f79e40..fe74675473cd1dba396160387181b28812841bb5 100644 (file)
@@ -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 */
 
  * 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;
index 456af7507e3804302f12cb0011f6b86590f78233..9c27e7aa610b7d4ce80ad70cd04afe885c57d7df 100644 (file)
@@ -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 );