]> git.sesse.net Git - vlc/commitdiff
Give input_DecoderNew the clock used.
authorLaurent Aimar <fenrir@videolan.org>
Sat, 27 Sep 2008 19:32:57 +0000 (21:32 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 28 Sep 2008 01:08:38 +0000 (03:08 +0200)
No functionnal changes yet.

include/vlc_input.h
modules/stream_out/display.c
src/input/decoder.c
src/input/es_out.c
src/input/input_clock.h

index cf8b4b90f0e4d7d999052e5e4f6c6c4faee3928c..bb2a2639a18e2b79895e9de3cd4a279f8cf6d36e 100644 (file)
@@ -542,7 +542,9 @@ 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 *, sout_instance_t * ) );
+
+typedef struct input_clock_t input_clock_t;
+VLC_EXPORT( decoder_t *, input_DecoderNew, ( input_thread_t *, es_format_t *, input_clock_t *, sout_instance_t * ) );
 VLC_EXPORT( void, input_DecoderDelete, ( decoder_t * ) );
 VLC_EXPORT( void, input_DecoderDecode,( decoder_t *, block_t * ) );
 
index c5cf9c9632dd75be5e259a7cb8ffbe63285334f9..997b49f707c6f851a186ffc2fb89be9ac9e4ca50 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, NULL );
+    id->p_dec = input_DecoderNew( p_sys->p_input, p_fmt, NULL, NULL );
     if( id->p_dec == NULL )
     {
         msg_Err( p_stream, "cannot create decoder for fcc=`%4.4s'",
index 9545b6ad19a290a5e3c0321410bf648fbbf34d8a..1d6e0a7d1185092d6c4252d7254eb9afe648e312 100644 (file)
@@ -72,6 +72,7 @@ struct decoder_owner_sys_t
     int64_t         i_preroll_end;
 
     input_thread_t  *p_input;
+    input_clock_t   *p_clock;
 
     aout_instance_t *p_aout;
     aout_input_t    *p_aout_input;
@@ -149,7 +150,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, sout_instance_t *p_sout  )
+                             es_format_t *fmt, input_clock_t *p_clock, sout_instance_t *p_sout  )
 {
     decoder_t   *p_dec = NULL;
     vlc_value_t val;
@@ -193,6 +194,8 @@ decoder_t *input_DecoderNew( input_thread_t *p_input,
         return NULL;
     }
 
+    p_dec->p_owner->p_clock = p_clock;
+
     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" );
@@ -305,9 +308,10 @@ void input_DecoderDecode( decoder_t * p_dec, block_t *p_block )
     }
     else
     {
-        if( p_dec->b_error || (p_block && p_block->i_buffer <= 0) )
+        if( p_dec->b_error || ( p_block && p_block->i_buffer <= 0 ) )
         {
-            if( p_block ) block_Release( p_block );
+            if( p_block )
+                block_Release( p_block );
         }
         else
         {
@@ -339,8 +343,8 @@ void input_DecoderDiscontinuity( decoder_t * p_dec, bool b_flush )
 
 bool input_DecoderEmpty( decoder_t * p_dec )
 {
-    if( p_dec->p_owner->b_own_thread
-     && block_FifoCount( p_dec->p_owner->p_fifo ) > 0 )
+    if( p_dec->p_owner->b_own_thread &&
+        block_FifoCount( p_dec->p_owner->p_fifo ) > 0 )
     {
         return false;
     }
@@ -582,7 +586,7 @@ static void* DecoderThread( vlc_object_t *p_this )
 {
     decoder_t * p_dec = (decoder_t *)p_this;
     block_t *p_block;
-    int canc = vlc_savecancel ();
+    int canc = vlc_savecancel();
 
     /* The decoder's main loop */
     while( !p_dec->b_die && !p_dec->b_error )
@@ -602,13 +606,14 @@ static void* DecoderThread( vlc_object_t *p_this )
     {
         /* Trash all received PES packets */
         p_block = block_FifoGet( p_dec->p_owner->p_fifo );
-        if( p_block ) block_Release( p_block );
+        if( p_block )
+            block_Release( p_block );
     }
 
     /* We do it here because of the dll loader that wants close() in the
      * same thread than open()/decode() */
     module_unneed( p_dec, p_dec->p_module );
-    vlc_restorecancel (canc);
+    vlc_restorecancel( canc );
     return NULL;
 }
 
index c32bf64a10791ad2d28899afe7663b08d533874d..0916bed6b6e521deaa99f84350ea2c1e497a0700 100644 (file)
@@ -444,7 +444,7 @@ int input_EsOutSetRecord(  es_out_t *out, bool b_record )
             if( !p_es->p_dec || p_es->p_master )
                 continue;
 
-            p_es->p_dec_record = input_DecoderNew( p_input, &p_es->fmt, p_sys->p_sout_record );
+            p_es->p_dec_record = input_DecoderNew( p_input, &p_es->fmt, p_es->p_pgrm->p_clock, p_sys->p_sout_record );
         }
     }
     else
@@ -1159,9 +1159,9 @@ static void EsCreateDecoder( es_out_t *out, es_out_id_t *p_es )
     es_out_sys_t   *p_sys = out->p_sys;
     input_thread_t *p_input = p_sys->p_input;
 
-    p_es->p_dec = input_DecoderNew( p_input, &p_es->fmt, p_input->p->p_sout );
+    p_es->p_dec = input_DecoderNew( p_input, &p_es->fmt, p_es->p_pgrm->p_clock, p_input->p->p_sout );
     if( p_es->p_dec && !p_es->p_master && p_sys->p_sout_record )
-        p_es->p_dec_record = input_DecoderNew( p_input, &p_es->fmt, p_sys->p_sout_record );
+        p_es->p_dec_record = input_DecoderNew( p_input, &p_es->fmt, p_es->p_pgrm->p_clock, p_sys->p_sout_record );
 }
 static void EsDestroyDecoder( es_out_t *out, es_out_id_t *p_es )
 {
index 7b1fe703edacb48645c15c7a31ed46c3ea367a3e..cfb11fea3e48238429eec103c85d5b17fa644bf0 100644 (file)
 
 #include <vlc_common.h>
 
-/**
+/** @struct input_clock_t
  * This structure is used to manage clock drift and reception jitters
  *
  * XXX input_clock_GetTS can be called from any threads. All others functions
  * MUST be called from one and only one thread.
  */
-typedef struct input_clock_t input_clock_t;
 
 /**
  * This function creates a new input_clock_t.