[vlc-devel] [PATCH 14/34] filter_chain: remove always NULL parameter from AppendConverter

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


---
 include/vlc_filter.h                 |  3 +--
 modules/stream_out/sdi/SDIStream.cpp |  2 +-
 modules/stream_out/transcode/video.c |  4 ++--
 modules/video_chroma/chain.c         | 17 ++++++-----------
 modules/video_filter/canvas.c        |  2 +-
 src/misc/filter_chain.c              |  4 ++--
 src/video_output/display.c           |  2 +-
 src/video_output/video_output.c      |  4 ++--
 8 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index f5d5a151cbf..fc09f8654ab 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -381,13 +381,12 @@ VLC_API filter_t *filter_chain_AppendFilter(filter_chain_t *chain,
  * Append a conversion to the chain.
  *
  * \param chain filter chain to append a filter to
- * \param fmt_in filter input format
  * \param fmt_out filter output format
  * \retval 0 on success
  * \retval -1 on failure
  */
 VLC_API int filter_chain_AppendConverter(filter_chain_t *chain,
-    const es_format_t *fmt_in, const es_format_t *fmt_out);
+    const es_format_t *fmt_out);
 
 /**
  * Append new filter to filter chain from string.
diff --git a/modules/stream_out/sdi/SDIStream.cpp b/modules/stream_out/sdi/SDIStream.cpp
index a87c9106434..252a88f318d 100644
--- a/modules/stream_out/sdi/SDIStream.cpp
+++ b/modules/stream_out/sdi/SDIStream.cpp
@@ -545,7 +545,7 @@ filter_chain_t * VideoDecodedStream::VideoFilterCreate(const es_format_t *p_srcf
 
     if(p_srcfmt->video.i_chroma != requestedoutput.video.i_chroma)
     {
-        if(filter_chain_AppendConverter(p_chain, NULL, &requestedoutput) != VLC_SUCCESS)
+        if(filter_chain_AppendConverter(p_chain, &requestedoutput) != VLC_SUCCESS)
         {
             filter_chain_Delete(p_chain);
             return NULL;
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index 27da7764c18..08a1a71e080 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -111,7 +111,7 @@ static int video_update_format_decoder( decoder_t *p_dec, vlc_video_context *vct
     test_chain = filter_chain_NewVideo( p_obj, false, NULL );
     filter_chain_Reset( test_chain, &p_dec->fmt_out, &p_dec->fmt_out );
 
-    int chain_works = filter_chain_AppendConverter( test_chain, NULL, p_enc_in );
+    int chain_works = filter_chain_AppendConverter( test_chain, p_enc_in );
     filter_chain_Delete( test_chain );
 
     msg_Dbg( p_obj, "Filter chain testing done, input chroma %4.4s seems to be %s for transcode",
@@ -300,7 +300,7 @@ static int transcode_video_set_conversions( sout_stream_t *p_stream,
             return VLC_EGENERIC;
         filter_chain_Reset( *pp_chain, *pp_src, p_tmpdst );
 
-        if( filter_chain_AppendConverter( *pp_chain, NULL, p_tmpdst ) != VLC_SUCCESS )
+        if( filter_chain_AppendConverter( *pp_chain, p_tmpdst ) != VLC_SUCCESS )
             return VLC_EGENERIC;
 
         *pp_src = filter_chain_GetFmtOut( *pp_chain );
diff --git a/modules/video_chroma/chain.c b/modules/video_chroma/chain.c
index 1f396ffa4b3..1ae85a02131 100644
--- a/modules/video_chroma/chain.c
+++ b/modules/video_chroma/chain.c
@@ -390,7 +390,7 @@ static int BuildFilterChain( filter_t *p_filter )
         video_format_FixRgb(&fmt_mid.video);
 
         if( filter_chain_AppendConverter( p_sys->p_chain,
-                                          NULL, &fmt_mid ) == VLC_SUCCESS )
+                                          &fmt_mid ) == VLC_SUCCESS )
         {
             p_sys->p_video_filter =
                 filter_chain_AppendFilter( p_sys->p_chain,
@@ -435,8 +435,7 @@ static int CreateChain( filter_t *p_filter, const es_format_t *p_fmt_mid )
     }
     else
     {
-        if( filter_chain_AppendConverter( p_sys->p_chain,
-                                          NULL, p_fmt_mid ) )
+        if( filter_chain_AppendConverter( p_sys->p_chain, p_fmt_mid ) )
             return VLC_EGENERIC;
     }
 
@@ -448,8 +447,7 @@ static int CreateChain( filter_t *p_filter, const es_format_t *p_fmt_mid )
     }
     else
     {
-        if( filter_chain_AppendConverter( p_sys->p_chain,
-                                          NULL, &p_filter->fmt_out ) )
+        if( filter_chain_AppendConverter( p_sys->p_chain, &p_filter->fmt_out ) )
             goto error;
     }
     return VLC_SUCCESS;
@@ -464,8 +462,7 @@ static int CreateResizeChromaChain( filter_t *p_filter, const es_format_t *p_fmt
     filter_sys_t *p_sys = p_filter->p_sys;
     filter_chain_Reset( p_sys->p_chain, &p_filter->fmt_in, &p_filter->fmt_out );
 
-    int i_ret = filter_chain_AppendConverter( p_sys->p_chain,
-                                              NULL, p_fmt_mid );
+    int i_ret = filter_chain_AppendConverter( p_sys->p_chain, p_fmt_mid );
     if( i_ret != VLC_SUCCESS )
         return i_ret;
 
@@ -480,13 +477,11 @@ static int CreateResizeChromaChain( filter_t *p_filter, const es_format_t *p_fmt
                         filter_chain_GetFmtOut( p_sys->p_chain ) );
         fmt_out.video.i_chroma = p_filter->fmt_out.video.i_chroma;
 
-        i_ret = filter_chain_AppendConverter( p_sys->p_chain,
-                                              NULL, &fmt_out );
+        i_ret = filter_chain_AppendConverter( p_sys->p_chain, &fmt_out );
         es_format_Clean( &fmt_out );
     }
     else
-        i_ret = filter_chain_AppendConverter( p_sys->p_chain,
-                                              NULL, &p_filter->fmt_out );
+        i_ret = filter_chain_AppendConverter( p_sys->p_chain, &p_filter->fmt_out );
 
     if( i_ret != VLC_SUCCESS )
         filter_chain_Clear( p_sys->p_chain );
diff --git a/modules/video_filter/canvas.c b/modules/video_filter/canvas.c
index 3e834c017c6..5fcf9b43b2d 100644
--- a/modules/video_filter/canvas.c
+++ b/modules/video_filter/canvas.c
@@ -335,7 +335,7 @@ static int Activate( vlc_object_t *p_this )
 
     filter_chain_Reset( p_sys->p_chain, &p_filter->fmt_in, &fmt );
     /* Append scaling module */
-    if ( filter_chain_AppendConverter( p_sys->p_chain, NULL, NULL ) )
+    if ( filter_chain_AppendConverter( p_sys->p_chain, NULL ) )
     {
         msg_Err( p_filter, "Could not append scaling filter" );
         free( p_sys );
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 6e6674586c1..927a0ba8524 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -278,10 +278,10 @@ filter_t *filter_chain_AppendFilter( filter_chain_t *chain,
 }
 
 int filter_chain_AppendConverter( filter_chain_t *chain,
-    const es_format_t *fmt_in, const es_format_t *fmt_out )
+    const es_format_t *fmt_out )
 {
     return filter_chain_AppendInner( chain, NULL, chain->conv_cap, NULL,
-                                     fmt_in, fmt_out ) != NULL ? 0 : -1;
+                                     NULL, fmt_out ) != NULL ? 0 : -1;
 }
 
 void filter_chain_DeleteFilter( filter_chain_t *chain, filter_t *filter )
diff --git a/src/video_output/display.c b/src/video_output/display.c
index de55c48348c..f284cf61a10 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -338,7 +338,7 @@ static int VoutDisplayCreateRender(vout_display_t *vd)
         es_format_InitFromVideo(&dst, i == 0 ? &v_dst : &v_dst_cmp);
 
         filter_chain_Reset(osys->converters, &src, &dst);
-        ret = filter_chain_AppendConverter(osys->converters, NULL, &dst);
+        ret = filter_chain_AppendConverter(osys->converters, &dst);
         es_format_Clean(&dst);
         if (ret == 0)
             break;
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index e4e8eb5220a..6cb46d010a1 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -850,7 +850,7 @@ static void ThreadChangeFilters(vout_thread_t *vout,
     if (!es_format_IsSimilar(p_fmt_current, &fmt_target)) {
         msg_Dbg(vout, "Adding a filter to compensate for format changes");
         if (filter_chain_AppendConverter(vout->p->filter.chain_interactive,
-                                         NULL, &fmt_target) != 0) {
+                                         &fmt_target) != 0) {
             msg_Err(vout, "Failed to compensate for the format changes, removing all filters");
             ThreadDelAllFilterCallbacks(vout);
             filter_chain_Reset(vout->p->filter.chain_static,      &fmt_target, &fmt_target);
@@ -983,7 +983,7 @@ static picture_t *ConvertRGB32AndBlend(vout_thread_t *vout, picture_t *pic,
 
     filter_chain_Reset(filterc, &src, &dst);
 
-    if (filter_chain_AppendConverter(filterc, NULL, &dst) != 0)
+    if (filter_chain_AppendConverter(filterc, &dst) != 0)
     {
         filter_chain_Delete(filterc);
         return NULL;
-- 
2.17.1



More information about the vlc-devel mailing list