[vlc-devel] [PATCH 16/21] input/demux: always associate stream_t with created demuxer

Filip Roséen filip at atch.se
Sun Jul 31 22:42:25 CEST 2016


---
 src/input/demux.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/input/demux.c b/src/input/demux.c
index 90007565..09e4b75 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -99,12 +99,6 @@ static void demux_DestroyDemux(demux_t *demux)
     vlc_stream_Delete(demux->s);
 }
 
-static void demux_DestroyAccessDemux(demux_t *demux)
-{
-    assert(demux->s == NULL);
-    (void) demux;
-}
-
 static void demux_DestroyDemuxFilter(demux_t *demux)
 {
     assert(demux->p_next != NULL);
@@ -164,7 +158,7 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_parent_input,
     p_demux->info.i_update = 0;
     p_demux->info.i_title  = 0;
     p_demux->info.i_seekpoint = 0;
-    priv->destroy = s ? demux_DestroyDemux : demux_DestroyAccessDemux;
+    priv->destroy = demux_DestroyDemux;
 
     /* NOTE: Add only file without any problems here and with strong detection:
      * - no .mp3, .a52, ...
@@ -253,9 +247,20 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_parent_input,
     {
         p_demux->p_module =
             module_need( p_demux, "access_demux", p_demux->psz_access, true );
+
+        if( p_demux->p_module )
+        {
+            char* mrl;
+
+            if( asprintf( &mrl, "%s://%s", psz_access, psz_location ) != -1 )
+            {
+                p_demux->s = stream_AccessDummyNew( p_obj, p_parent_input, mrl );
+                free( mrl );
+            }
+        }
     }
 
-    if( p_demux->p_module == NULL )
+    if( p_demux->p_module == NULL || p_demux->s == NULL )
         goto error;
 
     return p_demux;
-- 
2.9.2



More information about the vlc-devel mailing list