[vlc-devel] [PATCH 1/5] decoder: send aout/vout events via the input thread

Thomas Guillem thomas at gllm.fr
Fri Jul 13 11:34:37 CEST 2018


This is not specified anywhere, but I would prefer having all input events
coming from the same thread (the input one).
---
 src/input/decoder.c        | 13 ++++++++-----
 src/input/input.c          |  7 +++++++
 src/input/input_internal.h |  3 +++
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 1cba292d14..69b7d2c19c 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -293,7 +293,7 @@ static vout_thread_t *aout_request_vout( void *p_private,
     p_vout = input_resource_RequestVout( p_owner->p_resource, p_vout, p_fmt, 1,
                                          b_recyle );
     if( p_input != NULL )
-        input_SendEventVout( p_input );
+        input_ControlPush( p_input, INPUT_CONTROL_VOUT_CHANGED, NULL );
 
     return p_vout;
 }
@@ -392,7 +392,8 @@ static int aout_update_format( decoder_t *p_dec )
         vlc_mutex_unlock( &p_owner->lock );
 
         if( p_owner->p_input != NULL )
-            input_SendEventAout( p_owner->p_input );
+            input_ControlPush( p_owner->p_input, INPUT_CONTROL_AOUT_CHANGED,
+                               NULL );
 
         if( p_aout == NULL )
         {
@@ -530,7 +531,7 @@ static int vout_update_format( decoder_t *p_dec )
         vlc_mutex_unlock( &p_owner->lock );
 
         if( p_owner->p_input != NULL )
-            input_SendEventVout( p_owner->p_input );
+            input_ControlPush( p_owner->p_input, INPUT_CONTROL_VOUT_CHANGED, NULL );
         if( p_vout == NULL )
         {
             msg_Err( p_dec, "failed to create video output" );
@@ -1858,7 +1859,8 @@ static void DeleteDecoder( decoder_t * p_dec )
                 aout_DecDelete( p_owner->p_aout );
                 input_resource_PutAout( p_owner->p_resource, p_owner->p_aout );
                 if( p_owner->p_input != NULL )
-                    input_SendEventAout( p_owner->p_input );
+                    input_ControlPush( p_owner->p_input,
+                                       INPUT_CONTROL_AOUT_CHANGED, NULL );
             }
             break;
         case VIDEO_ES:
@@ -1871,7 +1873,8 @@ static void DeleteDecoder( decoder_t * p_dec )
                 input_resource_RequestVout( p_owner->p_resource, p_owner->p_vout, NULL,
                                             0, true );
                 if( p_owner->p_input != NULL )
-                    input_SendEventVout( p_owner->p_input );
+                    input_ControlPush( p_owner->p_input,
+                                       INPUT_CONTROL_VOUT_CHANGED, NULL );
             }
             break;
         case SPU_ES:
diff --git a/src/input/input.c b/src/input/input.c
index 76abd780a3..c07689bcf9 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -2298,6 +2298,13 @@ static bool Control( input_thread_t *p_input,
             ControlNav( p_input, i_type );
             break;
 
+        case INPUT_CONTROL_VOUT_CHANGED:
+            input_SendEventVout( p_input );
+            break;
+        case INPUT_CONTROL_AOUT_CHANGED:
+            input_SendEventAout( p_input );
+            break;
+
         default:
             msg_Err( p_input, "not yet implemented" );
             break;
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index cd34546976..c27a856c6a 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -233,6 +233,9 @@ enum input_control_e
     INPUT_CONTROL_SET_FRAME_NEXT,
 
     INPUT_CONTROL_SET_RENDERER,
+
+    INPUT_CONTROL_VOUT_CHANGED,
+    INPUT_CONTROL_AOUT_CHANGED,
 };
 
 /* Internal helpers */
-- 
2.18.0



More information about the vlc-devel mailing list