[vlc-devel] [PATCH 10/16] mux: mp4: use sout_mux_operations table

Alexandre Janniaux ajanni at videolabs.io
Mon Mar 15 17:03:03 UTC 2021


---
 modules/mux/mp4/mp4.c | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/modules/mux/mp4/mp4.c b/modules/mux/mp4/mp4.c
index b58a999dbe..eebcbfda7a 100644
--- a/modules/mux/mp4/mp4.c
+++ b/modules/mux/mp4/mp4.c
@@ -294,10 +294,23 @@ static int Open(vlc_object_t *p_this)
     p_sys->i_mfhd_sequence = 1;
 
     p_mux->p_sys        = p_sys;
-    p_mux->pf_control   = Control;
-    p_mux->pf_addstream = AddStream;
-    p_mux->pf_delstream = DelStream;
-    p_mux->pf_mux       = (options & FRAGMENTED) ? MuxFrag : Mux;
+
+    static const struct sout_mux_operations mux_ops =
+    {
+        .control = Control,
+        .add_stream = AddStream,
+        .del_stream = DelStream,
+        .mux = Mux,
+    };
+
+    static const struct sout_mux_operations mux_frag_ops =
+    {
+        .control = Control,
+        .add_stream = AddStream,
+        .del_stream = DelStream,
+        .mux = MuxFrag,
+    };
+    p_mux->ops = (options & FRAGMENTED) ? &mux_frag_ops : &mux_ops;
 
     if(p_sys->b_3gp)
     {
-- 
2.30.2



More information about the vlc-devel mailing list