[vlc-devel] [PATCH 1/4] input: pass vlc_es_id_t to decoder

Thomas Guillem thomas at gllm.fr
Wed May 29 15:32:55 CEST 2019


This will just be used as an identifier for input events. In order to link an
output to an ES track (from the player).
---
 src/input/decoder.c | 18 ++++++++++--------
 src/input/decoder.h |  4 ++--
 src/input/es_out.c  |  8 +++++---
 3 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index e5bc84d091..99d7ef134e 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -66,6 +66,7 @@ struct decoder_owner
 {
     decoder_t        dec;
     input_thread_t  *p_input;
+    vlc_es_id_t     *id;
     input_resource_t*p_resource;
     vlc_clock_t     *p_clock;
 
@@ -1759,7 +1760,7 @@ static const struct decoder_owner_callbacks dec_spu_cbs =
  * \return the decoder object
  */
 static decoder_t * CreateDecoder( vlc_object_t *p_parent,
-                                  input_thread_t *p_input,
+                                  input_thread_t *p_input, vlc_es_id_t *id,
                                   const es_format_t *fmt, vlc_clock_t *p_clock,
                                   input_resource_t *p_resource,
                                   sout_instance_t *p_sout )
@@ -1772,6 +1773,7 @@ static decoder_t * CreateDecoder( vlc_object_t *p_parent,
         return NULL;
     p_dec = &p_owner->dec;
 
+    p_owner->id = id;
     p_owner->p_clock = p_clock;
     p_owner->i_preroll_end = (vlc_tick_t)INT64_MIN;
     p_owner->p_input = p_input;
@@ -2013,8 +2015,8 @@ static void DecoderUnsupportedCodec( decoder_t *p_dec, const es_format_t *fmt, b
 
 /* TODO: pass p_sout through p_resource? -- Courmisch */
 static decoder_t *decoder_New( vlc_object_t *p_parent, input_thread_t *p_input,
-                               const es_format_t *fmt, vlc_clock_t *p_clock,
-                               input_resource_t *p_resource,
+                               vlc_es_id_t *id, const es_format_t *fmt,
+                               vlc_clock_t *p_clock, input_resource_t *p_resource,
                                sout_instance_t *p_sout  )
 {
     decoder_t *p_dec = NULL;
@@ -2022,7 +2024,7 @@ static decoder_t *decoder_New( vlc_object_t *p_parent, input_thread_t *p_input,
     int i_priority;
 
     /* Create the decoder configuration structure */
-    p_dec = CreateDecoder( p_parent, p_input, fmt, p_clock, p_resource, p_sout );
+    p_dec = CreateDecoder( p_parent, p_input, id, fmt, p_clock, p_resource, p_sout );
     if( p_dec == NULL )
     {
         msg_Err( p_parent, "could not create %s", psz_type );
@@ -2081,11 +2083,11 @@ static decoder_t *decoder_New( vlc_object_t *p_parent, input_thread_t *p_input,
  * \param p_es the es descriptor
  * \return the spawned decoder object
  */
-decoder_t *input_DecoderNew( input_thread_t *p_input,
+decoder_t *input_DecoderNew( input_thread_t *p_input, vlc_es_id_t *id,
                              es_format_t *fmt, vlc_clock_t *p_clock,
                              sout_instance_t *p_sout  )
 {
-    return decoder_New( VLC_OBJECT(p_input), p_input, fmt, p_clock,
+    return decoder_New( VLC_OBJECT(p_input), p_input, id, fmt, p_clock,
                         input_priv(p_input)->p_resource, p_sout );
 }
 
@@ -2095,7 +2097,7 @@ decoder_t *input_DecoderNew( input_thread_t *p_input,
 decoder_t *input_DecoderCreate( vlc_object_t *p_parent, const es_format_t *fmt,
                                 input_resource_t *p_resource )
 {
-    return decoder_New( p_parent, NULL, fmt, NULL, p_resource, NULL );
+    return decoder_New( p_parent, NULL, NULL, fmt, NULL, p_resource, NULL );
 }
 
 
@@ -2315,7 +2317,7 @@ int input_DecoderSetCcState( decoder_t *p_dec, vlc_fourcc_t codec,
         es_format_Init( &fmt, SPU_ES, codec );
         fmt.subs.cc.i_channel = i_channel;
         fmt.subs.cc.i_reorder_depth = p_owner->cc.desc.i_reorder_depth;
-        p_cc = input_DecoderNew( p_owner->p_input, &fmt,
+        p_cc = input_DecoderNew( p_owner->p_input, p_owner->id, &fmt,
                                  p_owner->p_clock, p_owner->p_sout );
         if( !p_cc )
         {
diff --git a/src/input/decoder.h b/src/input/decoder.h
index f9928edb45..0ac021e9b2 100644
--- a/src/input/decoder.h
+++ b/src/input/decoder.h
@@ -28,8 +28,8 @@
 #include <vlc_codec.h>
 #include <vlc_mouse.h>
 
-decoder_t *input_DecoderNew( input_thread_t *, es_format_t *, vlc_clock_t *,
-                             sout_instance_t * ) VLC_USED;
+decoder_t *input_DecoderNew( input_thread_t *, vlc_es_id_t *, es_format_t *,
+                             vlc_clock_t *, sout_instance_t * ) VLC_USED;
 
 /**
  * This function changes the pause state.
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 289117f22d..3c22fdbbe9 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -633,7 +633,8 @@ static int EsOutSetRecord(  es_out_t *out, bool b_record )
             if( !p_es->p_dec )
                 continue;
 
-            p_es->p_dec_record = input_DecoderNew( p_input, &p_es->fmt, NULL, p_sys->p_sout_record );
+            p_es->p_dec_record = input_DecoderNew( p_input, &p_es->id, &p_es->fmt,
+                                                   NULL, p_sys->p_sout_record );
             if( p_es->p_dec_record && p_sys->b_buffering )
                 input_DecoderStartWait( p_es->p_dec_record );
         }
@@ -1828,7 +1829,7 @@ static void EsOutCreateDecoder( es_out_t *out, es_out_id_t *p_es )
     if( !p_es->p_clock )
         return;
 
-    dec = input_DecoderNew( p_input, &p_es->fmt, p_es->p_clock,
+    dec = input_DecoderNew( p_input, &p_es->id, &p_es->fmt, p_es->p_clock,
                             input_priv(p_input)->p_sout );
     if( dec != NULL )
     {
@@ -1839,7 +1840,8 @@ static void EsOutCreateDecoder( es_out_t *out, es_out_id_t *p_es )
 
         if( !p_es->p_master && p_sys->p_sout_record )
         {
-            p_es->p_dec_record = input_DecoderNew( p_input, &p_es->fmt, NULL, p_sys->p_sout_record );
+            p_es->p_dec_record = input_DecoderNew( p_input, &p_es->id, &p_es->fmt,
+                                                   NULL, p_sys->p_sout_record );
             if( p_es->p_dec_record && p_sys->b_buffering )
                 input_DecoderStartWait( p_es->p_dec_record );
         }
-- 
2.20.1



More information about the vlc-devel mailing list