Do not access to internal p_input sout in input_DecoderNew.
authorLaurent Aimar <fenrir@videolan.org>
Tue, 26 Aug 2008 13:56:57 +0000 (15:56 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Tue, 26 Aug 2008 21:27:57 +0000 (23:27 +0200)
include/vlc_input.h
modules/stream_out/display.c
src/input/decoder.c

index 70f56c6..f9f5678 100644 (file)
@@ -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 * ) );
 
index d9dc33a..c5cf9c9 100644 (file)
@@ -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'",
index ff75d76..fafb439 100644 (file)
@@ -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;