[vlc-devel] [PATCH] [RFC] input: set "input-current" early so control interfaces can control earlier

Steve Lhomme robux4 at videolabs.io
Mon Oct 26 08:59:29 CET 2015


For Chromecast we want to be able to set a custom sout for the selected input
to play but the control interface get the event too late and the input thread
has already created its sout/vout.
---
 src/playlist/thread.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/src/playlist/thread.c b/src/playlist/thread.c
index a348479..abdbc12 100644
--- a/src/playlist/thread.c
+++ b/src/playlist/thread.c
@@ -207,6 +207,12 @@ static bool PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
 
     input_thread_t *p_input_thread = input_Create( p_playlist, p_input, NULL,
                                                    p_sys->p_input_resource );
+
+    PL_LOCK;
+    p_sys->p_input = p_input_thread;
+    PL_UNLOCK;
+    var_SetAddress( p_playlist, "input-current", p_input_thread );
+
     if( likely(p_input_thread != NULL) )
     {
         var_AddCallback( p_input_thread, "intf-event",
@@ -218,6 +224,11 @@ static bool PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
                              InputEvent, p_playlist );
             vlc_object_release( p_input_thread );
             p_input_thread = NULL;
+
+            PL_LOCK;
+            p_sys->p_input = p_input_thread;
+            PL_UNLOCK;
+            var_SetAddress( p_playlist, "input-current", p_input_thread );
         }
     }
 
@@ -234,12 +245,6 @@ static bool PlayItem( playlist_t *p_playlist, playlist_item_t *p_item )
     free( psz_arturl );
 
     PL_LOCK;
-    p_sys->p_input = p_input_thread;
-    PL_UNLOCK;
-
-    var_SetAddress( p_playlist, "input-current", p_input_thread );
-
-    PL_LOCK;
     return p_input_thread != NULL;
 }
 
-- 
2.6.2



More information about the vlc-devel mailing list