[vlc-commits] sout: pass instance to sout_Input*() functions

Rémi Denis-Courmont git at videolan.org
Sun Oct 11 21:23:24 CEST 2020


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Oct 10 21:51:51 2020 +0300| [dbed81f7290fcab29ec4f468a793b78f8a61c80b] | committer: Rémi Denis-Courmont

sout: pass instance to sout_Input*() functions

The caller has to have the instance, so let it provide it.
This follows the same pattern as the es_out_*() functions: taking both
the es_out_t and the es_out_id_t pointers.

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

 src/input/decoder.c               | 14 ++++++++------
 src/stream_output/stream_output.c | 23 ++++++++++++-----------
 src/stream_output/stream_output.h | 10 ++++++----
 3 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 19b17dda0e..793c7e687f 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -828,7 +828,8 @@ static int DecoderThread_PlaySout( vlc_input_decoder_t *p_owner, block_t *p_sout
     vlc_mutex_unlock( &p_owner->lock );
 
     /* FIXME --VLC_TICK_INVALID inspect stream_output*/
-    return sout_InputSendBuffer( p_owner->p_sout_input, p_sout_block );
+    return sout_InputSendBuffer( p_owner->p_sout, p_owner->p_sout_input,
+                                 p_sout_block );
 }
 
 /* This function process a block for sout
@@ -901,7 +902,7 @@ static void DecoderThread_ProcessSout( vlc_input_decoder_t *p_owner, block_t *p_
                         }
 
                         if( !p_owner->cc.p_sout_input ||
-                            sout_InputSendBuffer( p_owner->cc.p_sout_input, p_cc ) )
+                            sout_InputSendBuffer( p_owner->p_sout, p_owner->cc.p_sout_input, p_cc ) )
                         {
                             block_Release( p_cc );
                         }
@@ -1453,7 +1454,7 @@ static void DecoderThread_Flush( vlc_input_decoder_t *p_owner )
 #ifdef ENABLE_SOUT
     if ( p_owner->p_sout_input != NULL )
     {
-        sout_InputFlush( p_owner->p_sout_input );
+        sout_InputFlush( p_owner->p_sout, p_owner->p_sout_input );
     }
 #endif
     if( p_dec->fmt_out.i_cat == AUDIO_ES )
@@ -1928,9 +1929,9 @@ static void DeleteDecoder( vlc_input_decoder_t *p_owner )
 #ifdef ENABLE_SOUT
     if( p_owner->p_sout_input )
     {
-        sout_InputDelete( p_owner->p_sout_input );
+        sout_InputDelete( p_owner->p_sout, p_owner->p_sout_input );
         if( p_owner->cc.p_sout_input )
-            sout_InputDelete( p_owner->cc.p_sout_input );
+            sout_InputDelete( p_owner->p_sout, p_owner->cc.p_sout_input );
     }
 #endif
 
@@ -2625,7 +2626,8 @@ int vlc_input_decoder_SetSpuHighlight( vlc_input_decoder_t *p_owner,
 
 #ifdef ENABLE_SOUT
     if( p_owner->p_sout_input )
-        sout_InputControl( p_owner->p_sout_input, SOUT_INPUT_SET_SPU_HIGHLIGHT, spu_hl );
+        sout_InputControl( p_owner->p_sout, p_owner->p_sout_input,
+                           SOUT_INPUT_SET_SPU_HIGHLIGHT, spu_hl );
 #endif
 
     vlc_mutex_lock( &p_owner->lock );
diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index 5dcc327c0f..a5af737eac 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -194,9 +194,9 @@ sout_packetizer_input_t *sout_InputNew( sout_instance_t *p_sout,
 /*****************************************************************************
  *
  *****************************************************************************/
-int sout_InputDelete( sout_packetizer_input_t *p_input )
+int sout_InputDelete( sout_instance_t *p_sout,
+                      sout_packetizer_input_t *p_input )
 {
-    sout_instance_t     *p_sout = p_input->p_sout;
 
     msg_Dbg(p_sout->p_stream, "removing an output ES (%p)", (void *)p_input);
 
@@ -209,9 +209,10 @@ int sout_InputDelete( sout_packetizer_input_t *p_input )
     return( VLC_SUCCESS);
 }
 
-static int sout_InputControlVa( sout_packetizer_input_t *p_input, int i_query, va_list args )
+static int sout_InputControlVa( sout_instance_t *p_sout,
+                                sout_packetizer_input_t *p_input,
+                                int i_query, va_list args )
 {
-    sout_instance_t *p_sout = p_input->p_sout;
     if( i_query == SOUT_INPUT_SET_SPU_HIGHLIGHT )
     {
         vlc_mutex_lock( &p_sout->lock );
@@ -224,21 +225,21 @@ static int sout_InputControlVa( sout_packetizer_input_t *p_input, int i_query, v
     return VLC_EGENERIC;
 }
 
-int sout_InputControl( sout_packetizer_input_t *p_input, int i_query, ... )
+int sout_InputControl( sout_instance_t *p_sout,
+                       sout_packetizer_input_t *p_input, int i_query, ... )
 {
     va_list args;
     int     i_result;
 
     va_start( args, i_query );
-    i_result = sout_InputControlVa( p_input, i_query, args );
+    i_result = sout_InputControlVa( p_sout, p_input, i_query, args );
     va_end( args );
     return i_result;
 }
 
-void sout_InputFlush( sout_packetizer_input_t *p_input )
+void sout_InputFlush( sout_instance_t *p_sout,
+                      sout_packetizer_input_t *p_input )
 {
-    sout_instance_t     *p_sout = p_input->p_sout;
-
     vlc_mutex_lock( &p_sout->lock );
     sout_StreamFlush( p_sout->p_stream, p_input->id );
     vlc_mutex_unlock( &p_sout->lock );
@@ -248,10 +249,10 @@ void sout_InputFlush( sout_packetizer_input_t *p_input )
 /*****************************************************************************
  *
  *****************************************************************************/
-int sout_InputSendBuffer( sout_packetizer_input_t *p_input,
+int sout_InputSendBuffer( sout_instance_t *p_sout,
+                          sout_packetizer_input_t *p_input,
                           block_t *p_buffer )
 {
-    sout_instance_t     *p_sout = p_input->p_sout;
     int                 i_ret;
 
     if( p_input->b_flushed )
diff --git a/src/stream_output/stream_output.h b/src/stream_output/stream_output.h
index 0260165ba4..9bee89824d 100644
--- a/src/stream_output/stream_output.h
+++ b/src/stream_output/stream_output.h
@@ -58,14 +58,16 @@ void sout_DeleteInstance( sout_instance_t * );
 bool sout_instance_ControlsPace( sout_instance_t *sout );
 
 sout_packetizer_input_t *sout_InputNew( sout_instance_t *, const es_format_t * );
-int sout_InputDelete( sout_packetizer_input_t * );
-int sout_InputSendBuffer( sout_packetizer_input_t *, block_t* );
+int sout_InputDelete( sout_instance_t *, sout_packetizer_input_t * );
+int sout_InputSendBuffer( sout_instance_t *, sout_packetizer_input_t *,
+                          block_t * );
 
 enum sout_input_query_e
 {
     SOUT_INPUT_SET_SPU_HIGHLIGHT, /* arg1=const vlc_spu_highlight_t *, can fail */
 };
-int  sout_InputControl( sout_packetizer_input_t *, int i_query, ... );
-void sout_InputFlush( sout_packetizer_input_t * );
+int  sout_InputControl( sout_instance_t *, sout_packetizer_input_t *,
+                        int i_query, ... );
+void sout_InputFlush( sout_instance_t *, sout_packetizer_input_t * );
 
 #endif



More information about the vlc-commits mailing list