[vlc-devel] commit: Give input_DecoderNew the clock used. (Laurent Aimar )

git version control git at videolan.org
Sun Sep 28 13:36:03 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Sat Sep 27 21:32:57 2008 +0200| [4c247f8af062ef162a79832095c5595ecf924763] | committer: Laurent Aimar 

Give input_DecoderNew the clock used.

No functionnal changes yet.

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

 include/vlc_input.h          |    4 +++-
 modules/stream_out/display.c |    2 +-
 src/input/decoder.c          |   21 +++++++++++++--------
 src/input/es_out.c           |    6 +++---
 src/input/input_clock.h      |    3 +--
 5 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/include/vlc_input.h b/include/vlc_input.h
index cf8b4b9..bb2a263 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -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 * ) );
 
diff --git a/modules/stream_out/display.c b/modules/stream_out/display.c
index c5cf9c9..997b49f 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, 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'",
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 9545b6a..1d6e0a7 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -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;
 }
 
diff --git a/src/input/es_out.c b/src/input/es_out.c
index c32bf64..0916bed 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -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 )
 {
diff --git a/src/input/input_clock.h b/src/input/input_clock.h
index 7b1fe70..cfb11fe 100644
--- a/src/input/input_clock.h
+++ b/src/input/input_clock.h
@@ -31,13 +31,12 @@
 
 #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.




More information about the vlc-devel mailing list