[vlc-devel] [PATCH 5/5] sout: remove constantly NULL parameter

RĂ©mi Denis-Courmont remi at remlab.net
Sun Oct 11 15:22:59 CEST 2020


---
 include/vlc_sout.h                     |  2 +-
 modules/stream_out/chromecast/cast.cpp |  2 +-
 modules/stream_out/cycle.c             |  2 +-
 modules/stream_out/dlna/dlna.cpp       |  3 +--
 modules/stream_out/duplicate.c         |  2 +-
 modules/stream_out/record.c            |  2 +-
 modules/stream_out/renderer_common.cpp |  2 +-
 src/missing.c                          |  5 ++---
 src/stream_output/stream_output.c      | 12 ++----------
 9 files changed, 11 insertions(+), 21 deletions(-)

diff --git a/include/vlc_sout.h b/include/vlc_sout.h
index 6f4d557cea..eb5ff0f83c 100644
--- a/include/vlc_sout.h
+++ b/include/vlc_sout.h
@@ -195,7 +195,7 @@ struct sout_stream_t
 
 VLC_API void sout_StreamChainDelete(sout_stream_t *first, sout_stream_t *end);
 VLC_API sout_stream_t *sout_StreamChainNew(vlc_object_t *parent,
-        const char *psz_chain, sout_stream_t *p_next, sout_stream_t **p_last) VLC_USED;
+        const char *psz_chain, sout_stream_t *p_next) VLC_USED;
 
 static inline void *sout_StreamIdAdd( sout_stream_t *s,
                                       const es_format_t *fmt )
diff --git a/modules/stream_out/chromecast/cast.cpp b/modules/stream_out/chromecast/cast.cpp
index cfbd874edf..08defbd5a1 100644
--- a/modules/stream_out/chromecast/cast.cpp
+++ b/modules/stream_out/chromecast/cast.cpp
@@ -822,7 +822,7 @@ bool sout_stream_sys_t::startSoutChain(sout_stream_t *p_stream,
 
     access_out_live.prepare( p_stream, mime );
 
-    p_out = sout_StreamChainNew(VLC_OBJECT(p_stream), sout.c_str(), NULL, NULL);
+    p_out = sout_StreamChainNew(VLC_OBJECT(p_stream), sout.c_str(), NULL);
     if (p_out == NULL) {
         msg_Dbg(p_stream, "could not create sout chain:%s", sout.c_str());
         out_streams.clear();
diff --git a/modules/stream_out/cycle.c b/modules/stream_out/cycle.c
index eb615f3b0b..7559c1205f 100644
--- a/modules/stream_out/cycle.c
+++ b/modules/stream_out/cycle.c
@@ -128,7 +128,7 @@ static int AddStream(sout_stream_t *stream, char *chain)
     msg_Dbg(stream, "starting new phase \"%s\"", chain);
     /* TODO format */
     sys->stream = sout_StreamChainNew(VLC_OBJECT(stream), chain,
-                                      stream->p_next, NULL);
+                                      stream->p_next);
     if (sys->stream == NULL)
         return -1;
 
diff --git a/modules/stream_out/dlna/dlna.cpp b/modules/stream_out/dlna/dlna.cpp
index b2aec305cb..3e13dddde8 100644
--- a/modules/stream_out/dlna/dlna.cpp
+++ b/modules/stream_out/dlna/dlna.cpp
@@ -226,8 +226,7 @@ bool sout_stream_sys_t::startSoutChain(sout_stream_t *p_stream,
     msg_Dbg( p_stream, "Creating chain %s", sout.c_str() );
     out_streams = new_streams;
 
-    p_out = sout_StreamChainNew(VLC_OBJECT(p_stream), sout.c_str(), nullptr,
-                                nullptr);
+    p_out = sout_StreamChainNew(VLC_OBJECT(p_stream), sout.c_str(), nullptr);
     if (p_out == nullptr) {
         msg_Err(p_stream, "could not create sout chain:%s", sout.c_str());
         out_streams.clear();
diff --git a/modules/stream_out/duplicate.c b/modules/stream_out/duplicate.c
index 1b3236a00e..b4716cf0b8 100644
--- a/modules/stream_out/duplicate.c
+++ b/modules/stream_out/duplicate.c
@@ -130,7 +130,7 @@ static int Open( vlc_object_t *p_this )
 
             msg_Dbg( p_stream, " * adding `%s'", p_cfg->psz_value );
             s = sout_StreamChainNew( VLC_OBJECT(p_stream), p_cfg->psz_value,
-                p_stream->p_next, NULL );
+                p_stream->p_next );
 
             if( s )
             {
diff --git a/modules/stream_out/record.c b/modules/stream_out/record.c
index 2d8e557f9c..f7a24fba3d 100644
--- a/modules/stream_out/record.c
+++ b/modules/stream_out/record.c
@@ -347,7 +347,7 @@ static int OutputNew( sout_stream_t *p_stream,
     /* Create the output */
     msg_Dbg( p_stream, "Using record output `%s'", psz_output );
 
-    p_sys->p_out = sout_StreamChainNew( VLC_OBJECT(p_stream), psz_output, NULL,
+    p_sys->p_out = sout_StreamChainNew( VLC_OBJECT(p_stream), psz_output,
                                         NULL );
 
     if( !p_sys->p_out )
diff --git a/modules/stream_out/renderer_common.cpp b/modules/stream_out/renderer_common.cpp
index 2d84d1a7a3..ecb327bf7a 100644
--- a/modules/stream_out/renderer_common.cpp
+++ b/modules/stream_out/renderer_common.cpp
@@ -103,7 +103,7 @@ GetVencOption( sout_stream_t *p_stream, std::vector<vlc_fourcc_t> codecs,
             ssout << "transcode{" << ssvenc.str() << "}:dummy";
 
             sout_stream_t *p_sout_test =
-                sout_StreamChainNew( VLC_OBJECT(p_stream), ssout.str().c_str(), NULL, NULL );
+                sout_StreamChainNew( VLC_OBJECT(p_stream), ssout.str().c_str(), NULL );
 
             if( p_sout_test != NULL )
             {
diff --git a/src/missing.c b/src/missing.c
index 0053f5816e..926ca6efd5 100644
--- a/src/missing.c
+++ b/src/missing.c
@@ -159,10 +159,9 @@ noreturn void sout_StreamChainDelete(sout_stream_t *first,
 
 noreturn sout_stream_t *sout_StreamChainNew(sout_instance_t *sout,
                                             const char *chain,
-                                            sout_stream_t *next,
-                                            sout_stream_t **last)
+                                            sout_stream_t *next)
 {
-    (void) sout; (void) chain; (void) next; (void) last;
+    (void) sout; (void) chain; (void) next;
     vlc_assert_unreachable ();
 }
 
diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index d66223ed61..dc9f979927 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -113,7 +113,7 @@ sout_instance_t *sout_NewInstance( vlc_object_t *p_parent, const char *psz_dest
     vlc_mutex_init( &p_sout->lock );
     p_sout->p_stream = NULL;
 
-    p_sout->p_stream = sout_StreamChainNew(p_parent, psz_chain, NULL, NULL);
+    p_sout->p_stream = sout_StreamChainNew(p_parent, psz_chain, NULL);
     if( p_sout->p_stream )
     {
         free( psz_chain );
@@ -812,19 +812,14 @@ static sout_stream_t *sout_StreamNew( vlc_object_t *parent, char *psz_name,
  *  chain format: module1{option=*:option=*}[:module2{option=*:...}]
  *
  *  The modules are created starting from the last one and linked together
- *  A pointer to the last module created is stored if pp_last isn't NULL, to
- *  make sure sout_StreamChainDelete doesn't delete modules created in another
- *  place.
  *
  *  Returns a pointer to the first module.
  */
 sout_stream_t *sout_StreamChainNew(vlc_object_t *parent, const char *psz_chain,
-                                   sout_stream_t *sink,
-                                   sout_stream_t **restrict pp_last)
+                                   sout_stream_t *sink)
 {
     if(!psz_chain || !*psz_chain)
     {
-        if(pp_last) *pp_last = NULL;
         return sink;
     }
 
@@ -862,9 +857,6 @@ sout_stream_t *sout_StreamChainNew(vlc_object_t *parent, const char *psz_chain,
         if (prev == NULL)
             goto error;
 
-        if (front == sink && pp_last != NULL)
-            *pp_last = prev; /* last module created in the chain */
-
         front = prev;
     }
 
-- 
2.28.0



More information about the vlc-devel mailing list