[vlc-devel] [PATCH 17/34] filter_chain: removing always NULL parameters in internal calls

Steve Lhomme robux4 at ycbcr.xyz
Fri Nov 8 15:40:21 CET 2019


---
 src/misc/filter_chain.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 55af4afd54d..619641ad958 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -186,7 +186,7 @@ void filter_chain_Reset( filter_chain_t *p_chain, const es_format_t *p_fmt_in,
 
 static filter_t *filter_chain_AppendInner( filter_chain_t *chain,
     const char *name, const char *capability, config_chain_t *cfg,
-    const es_format_t *fmt_in, const es_format_t *fmt_out )
+    const es_format_t *fmt_out )
 {
     chained_filter_t *chained =
         vlc_custom_create( chain->obj, sizeof(*chained), "filter" );
@@ -195,12 +195,14 @@ static filter_t *filter_chain_AppendInner( filter_chain_t *chain,
 
     filter_t *filter = &chained->filter;
 
-    if( fmt_in == NULL )
+    const es_format_t *fmt_in;
+    if( chain->last != NULL )
+    {
+        fmt_in = &chain->last->filter.fmt_out;
+    }
+    else
     {
-        if( chain->last != NULL )
-            fmt_in = &chain->last->filter.fmt_out;
-        else
-            fmt_in = &chain->fmt_in;
+        fmt_in = &chain->fmt_in;
     }
 
     if( fmt_out == NULL )
@@ -274,14 +276,14 @@ filter_t *filter_chain_AppendFilter( filter_chain_t *chain,
     const es_format_t *fmt_out )
 {
     return filter_chain_AppendInner( chain, name, chain->filter_cap, cfg,
-                                     NULL, fmt_out );
+                                     fmt_out );
 }
 
 int filter_chain_AppendConverter( filter_chain_t *chain,
     const es_format_t *fmt_out )
 {
     return filter_chain_AppendInner( chain, NULL, chain->conv_cap, NULL,
-                                     NULL, fmt_out ) != NULL ? 0 : -1;
+                                     fmt_out ) != NULL ? 0 : -1;
 }
 
 void filter_chain_DeleteFilter( filter_chain_t *chain, filter_t *filter )
-- 
2.17.1



More information about the vlc-devel mailing list