[vlc-devel] [PATCH 1/2] demux: pass the input_thread_t to the demux filters

Steve Lhomme robux4 at videolabs.io
Wed Jun 22 13:46:03 CEST 2016


So the filter doesn't need to iterate through other filters' p_next.
---
 modules/stream_out/chromecast/chromecast_demux.cpp | 10 ++--------
 src/input/demux.c                                  |  2 +-
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/modules/stream_out/chromecast/chromecast_demux.cpp b/modules/stream_out/chromecast/chromecast_demux.cpp
index e671043..8648905 100644
--- a/modules/stream_out/chromecast/chromecast_demux.cpp
+++ b/modules/stream_out/chromecast/chromecast_demux.cpp
@@ -46,10 +46,7 @@ struct demux_sys_t
         ,canSeek(false)
         ,m_seektime( VLC_TS_INVALID )
     {
-        demux_t *p_last_demux = demux->p_next;
-        while (p_last_demux->p_next)
-            p_last_demux = p_last_demux->p_next;
-        input_thread_t *p_input = p_last_demux->p_input;
+        input_thread_t *p_input = demux->p_input;
         input_item_t *p_item = input_GetItem( p_input );
         if ( p_item )
         {
@@ -69,10 +66,7 @@ struct demux_sys_t
 
     ~demux_sys_t()
     {
-        demux_t *p_last_demux = p_demux->p_next;
-        while (p_last_demux->p_next)
-            p_last_demux = p_last_demux->p_next;
-        input_thread_t *p_input = p_last_demux->p_input;
+        input_thread_t *p_input = p_demux->p_input;
         var_DelCallback( p_input, "intf-event", InputEvent, this );
 
         p_renderer->pf_set_title( p_renderer->p_opaque, NULL );
diff --git a/src/input/demux.c b/src/input/demux.c
index 6ee1e69..60c4350 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -712,7 +712,7 @@ static demux_t *demux_FilterNew( demux_t *p_next, const char *p_name )
 
     p_demux->p_next       = p_next;
     p_demux->s            = NULL;
-    p_demux->p_input      = NULL;
+    p_demux->p_input      = p_next->p_input;
     p_demux->p_sys        = NULL;
     p_demux->psz_access   = NULL;
     p_demux->psz_demux    = NULL;
-- 
2.8.2



More information about the vlc-devel mailing list