[vlc-devel] [PATCH 2/2] demux: p_next and s are mutually exclusive and private to the demuxer

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


---
 include/vlc_demux.h                                | 9 +++++----
 modules/stream_out/chromecast/chromecast_demux.cpp | 2 ++
 src/input/demux.c                                  | 2 --
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/include/vlc_demux.h b/include/vlc_demux.h
index 2a4b08f..3c121d2 100644
--- a/include/vlc_demux.h
+++ b/include/vlc_demux.h
@@ -54,7 +54,11 @@ struct demux_t
     char        *psz_file;
 
     /* input stream */
-    stream_t    *s;     /* NULL in case of a access+demux in one */
+    union
+    {
+        stream_t    *s;     /* NULL in case of a access+demux in one */
+        demux_t     *p_next;/* demux_t filter chaining */
+    };
 
     /* es output */
     es_out_t    *out;   /* our p_es_out */
@@ -79,9 +83,6 @@ struct demux_t
 
     /* Weak link to parent input */
     input_thread_t *p_input;
-
-    /* demux_t filter chaining */
-    demux_t        *p_next;
 };
 
 /* pf_demux return values */
diff --git a/modules/stream_out/chromecast/chromecast_demux.cpp b/modules/stream_out/chromecast/chromecast_demux.cpp
index 8648905..ac19940 100644
--- a/modules/stream_out/chromecast/chromecast_demux.cpp
+++ b/modules/stream_out/chromecast/chromecast_demux.cpp
@@ -71,6 +71,8 @@ struct demux_sys_t
 
         p_renderer->pf_set_title( p_renderer->p_opaque, NULL );
         p_renderer->pf_set_artwork( p_renderer->p_opaque, NULL );
+
+        demux_Delete(p_demux->p_next);
     }
 
     /**
diff --git a/src/input/demux.c b/src/input/demux.c
index 60c4350..83ce7c4 100644
--- a/src/input/demux.c
+++ b/src/input/demux.c
@@ -154,7 +154,6 @@ demux_t *demux_NewAdvanced( vlc_object_t *p_obj, input_thread_t *p_parent_input,
 
     p_demux->pf_demux   = NULL;
     p_demux->pf_control = NULL;
-    p_demux->p_next     = NULL;
     p_demux->p_sys      = NULL;
     p_demux->info.i_update = 0;
     p_demux->info.i_title  = 0;
@@ -711,7 +710,6 @@ static demux_t *demux_FilterNew( demux_t *p_next, const char *p_name )
         return NULL;
 
     p_demux->p_next       = p_next;
-    p_demux->s            = NULL;
     p_demux->p_input      = p_next->p_input;
     p_demux->p_sys        = NULL;
     p_demux->psz_access   = NULL;
-- 
2.8.2



More information about the vlc-devel mailing list