[vlc-devel] commit: Do not access to internal p_input sout in input_DecoderNew. ( Laurent Aimar )

git version control git at videolan.org
Wed Aug 27 00:21:03 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Aug 26 15:56:57 2008 +0200| [92a4a5b33bdeb2ea8060a5511c035ef7fb1c7cd9] | committer: Laurent Aimar 

Do not access to internal p_input sout in input_DecoderNew.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=92a4a5b33bdeb2ea8060a5511c035ef7fb1c7cd9
---

 include/vlc_input.h          |    2 +-
 modules/stream_out/display.c |    2 +-
 src/input/decoder.c          |   19 +++++++++----------
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index 70f56c6..f9f5678 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -540,7 +540,7 @@ static inline input_state_e input_GetState( input_thread_t * p_input )
     input_Control( p_input, INPUT_GET_STATE, &state );
     return state;
 }
-VLC_EXPORT( decoder_t *, input_DecoderNew, ( input_thread_t *, es_format_t *, bool b_force_decoder ) );
+VLC_EXPORT( decoder_t *, input_DecoderNew, ( input_thread_t *, es_format_t *, sout_instance_t * ) );
 VLC_EXPORT( void, input_DecoderDelete, ( decoder_t * ) );
 VLC_EXPORT( void, input_DecoderDecode,( decoder_t *, block_t * ) );
 
diff --git a/modules/stream_out/display.c b/modules/stream_out/display.c
index d9dc33a..c5cf9c9 100644
--- a/modules/stream_out/display.c
+++ b/modules/stream_out/display.c
@@ -168,7 +168,7 @@ static sout_stream_id_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
         }
     }
 
-    id->p_dec = input_DecoderNew( p_sys->p_input, p_fmt, true );
+    id->p_dec = input_DecoderNew( p_sys->p_input, p_fmt, NULL );
     if( id->p_dec == NULL )
     {
         msg_Err( p_stream, "cannot create decoder for fcc=`%4.4s'",
diff --git a/src/input/decoder.c b/src/input/decoder.c
index ff75d76..fafb439 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -45,7 +45,7 @@
 #include "stream_output/stream_output.h"
 #include "input_internal.h"
 
-static decoder_t * CreateDecoder( input_thread_t *, es_format_t *, int );
+static decoder_t * CreateDecoder( input_thread_t *, es_format_t *, int, sout_instance_t *p_sout );
 static void        DeleteDecoder( decoder_t * );
 
 static void*        DecoderThread( vlc_object_t * );
@@ -148,7 +148,7 @@ mtime_t decoder_GetDisplayDate( decoder_t *p_dec, mtime_t i_ts )
  * \return the spawned decoder object
  */
 decoder_t *input_DecoderNew( input_thread_t *p_input,
-                             es_format_t *fmt, bool b_force_decoder )
+                             es_format_t *fmt, sout_instance_t *p_sout  )
 {
     decoder_t   *p_dec = NULL;
     vlc_value_t val;
@@ -157,10 +157,10 @@ decoder_t *input_DecoderNew( input_thread_t *p_input,
     (void)b_force_decoder;
 #else
     /* If we are in sout mode, search for packetizer module */
-    if( p_input->p->p_sout && !b_force_decoder )
+    if( p_sout )
     {
         /* Create the decoder configuration structure */
-        p_dec = CreateDecoder( p_input, fmt, VLC_OBJECT_PACKETIZER );
+        p_dec = CreateDecoder( p_input, fmt, VLC_OBJECT_PACKETIZER, p_sout );
         if( p_dec == NULL )
         {
             msg_Err( p_input, "could not create packetizer" );
@@ -173,7 +173,7 @@ decoder_t *input_DecoderNew( input_thread_t *p_input,
 #endif
     {
         /* Create the decoder configuration structure */
-        p_dec = CreateDecoder( p_input, fmt, VLC_OBJECT_DECODER );
+        p_dec = CreateDecoder( p_input, fmt, VLC_OBJECT_DECODER, p_sout );
         if( p_dec == NULL )
         {
             msg_Err( p_input, "could not create decoder" );
@@ -192,8 +192,7 @@ decoder_t *input_DecoderNew( input_thread_t *p_input,
         return NULL;
     }
 
-    if( p_input->p->p_sout && p_input->p->input.b_can_pace_control &&
-        !b_force_decoder )
+    if( p_sout && p_sout == p_input->p->p_sout && p_input->p->input.b_can_pace_control )
     {
         msg_Dbg( p_input, "stream out mode -> no decoder thread" );
         p_dec->p_owner->b_own_thread = false;
@@ -375,7 +374,7 @@ int input_DecoderSetCcState( decoder_t *p_dec, bool b_decode, int i_channel )
         es_format_t fmt;
 
         es_format_Init( &fmt, SPU_ES, fcc[i_channel] );
-        p_cc = CreateDecoder( p_owner->p_input, &fmt, VLC_OBJECT_DECODER );
+        p_cc = CreateDecoder( p_owner->p_input, &fmt, VLC_OBJECT_DECODER, p_dec->p_owner->p_sout );
         if( !p_cc )
         {
             msg_Err( p_dec, "could not create decoder" );
@@ -437,7 +436,7 @@ int input_DecoderGetCcState( decoder_t *p_dec, bool *pb_decode, int i_channel )
  * \return the decoder object
  */
 static decoder_t * CreateDecoder( input_thread_t *p_input,
-                                  es_format_t *fmt, int i_object_type )
+                                  es_format_t *fmt, int i_object_type, sout_instance_t *p_sout )
 {
     decoder_t *p_dec;
     decoder_owner_sys_t *p_owner;
@@ -475,7 +474,7 @@ static decoder_t * CreateDecoder( input_thread_t *p_input,
     p_dec->p_owner->p_vout = NULL;
     p_dec->p_owner->p_spu_vout = NULL;
     p_dec->p_owner->i_spu_channel = 0;
-    p_dec->p_owner->p_sout = p_input->p->p_sout;
+    p_dec->p_owner->p_sout = p_sout;
     p_dec->p_owner->p_sout_input = NULL;
     p_dec->p_owner->p_packetizer = NULL;
 




More information about the vlc-devel mailing list