[vlc-commits] Revert "filter_chain: uniform filter_chain_Append{Converter,Filter} return type"

Jean-Baptiste Kempf git at videolan.org
Sun Jul 2 14:07:54 CEST 2017


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Jul  2 14:04:14 2017 +0200| [11d731b1142b38e767bf9f1489e66d8599940a06] | committer: Jean-Baptiste Kempf

Revert "filter_chain: uniform filter_chain_Append{Converter,Filter} return type"

This reverts commit 40bd2515d996a4b9c47b2199fac61a9fdea310bb.

There is no need to access to the video filter converter since you can't do
anything with it.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=11d731b1142b38e767bf9f1489e66d8599940a06
---

 include/vlc_filter.h                 |  5 +++--
 modules/stream_out/transcode/video.c |  2 +-
 modules/video_chroma/chain.c         | 10 +++++-----
 src/misc/filter_chain.c              |  4 ++--
 src/video_output/display.c           |  3 +--
 src/video_output/video_output.c      |  4 ++--
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/include/vlc_filter.h b/include/vlc_filter.h
index 52b84ba655..a0b6bb2945 100644
--- a/include/vlc_filter.h
+++ b/include/vlc_filter.h
@@ -353,9 +353,10 @@ VLC_API filter_t *filter_chain_AppendFilter(filter_chain_t *chain,
  * \param chain filter chain to append a filter to
  * \param fmt_in filter input format
  * \param fmt_out filter output format
- * \return a pointer to the filter or NULL on error
+ * \retval 0 on success
+ * \retval -1 on failure
  */
-VLC_API filter_t *filter_chain_AppendConverter(filter_chain_t *chain,
+VLC_API int filter_chain_AppendConverter(filter_chain_t *chain,
     const es_format_t *fmt_in, const es_format_t *fmt_out);
 
 /**
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c
index b4bc000db3..50b21bc0ff 100644
--- a/modules/stream_out/transcode/video.c
+++ b/modules/stream_out/transcode/video.c
@@ -69,7 +69,7 @@ static int video_update_format_decoder( decoder_t *p_dec )
     filter_chain_Reset( test_chain, &p_dec->fmt_out, &p_dec->fmt_out );
 
     int chain_works = filter_chain_AppendConverter( test_chain, &p_dec->fmt_out,
-                                                    &id->p_encoder->fmt_in ) != NULL ? 0 : -1;
+                                  &id->p_encoder->fmt_in );
     filter_chain_Delete( test_chain );
     msg_Dbg( stream, "Filter chain testing done, input chroma %4.4s seems to be %s for transcode",
                      (char *)&p_dec->fmt_out.video.i_chroma,
diff --git a/modules/video_chroma/chain.c b/modules/video_chroma/chain.c
index bf4f426a8f..6071014657 100644
--- a/modules/video_chroma/chain.c
+++ b/modules/video_chroma/chain.c
@@ -330,7 +330,7 @@ static int BuildFilterChain( filter_t *p_filter )
         video_format_FixRgb(&fmt_mid.video);
 
         if( filter_chain_AppendConverter( p_filter->p_sys->p_chain,
-                                          NULL, &fmt_mid ) )
+                                          NULL, &fmt_mid ) == VLC_SUCCESS )
         {
             p_filter->p_sys->p_video_filter =
                 filter_chain_AppendFilter( p_filter->p_sys->p_chain,
@@ -380,8 +380,8 @@ static int CreateChain( filter_t *p_parent, es_format_t *p_fmt_mid )
     }
     else
     {
-        if( !filter_chain_AppendConverter( p_parent->p_sys->p_chain,
-                                           NULL, p_fmt_mid ) )
+        if( filter_chain_AppendConverter( p_parent->p_sys->p_chain,
+                                          NULL, p_fmt_mid ) )
             return VLC_EGENERIC;
     }
 
@@ -393,8 +393,8 @@ static int CreateChain( filter_t *p_parent, es_format_t *p_fmt_mid )
     }
     else
     {
-        if( !filter_chain_AppendConverter( p_parent->p_sys->p_chain,
-                                           p_fmt_mid, NULL ) )
+        if( filter_chain_AppendConverter( p_parent->p_sys->p_chain,
+                                          p_fmt_mid, NULL ) )
             goto error;
     }
     return VLC_SUCCESS;
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 7e038dbbb8..741a63c9ad 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -274,11 +274,11 @@ filter_t *filter_chain_AppendFilter( filter_chain_t *chain,
                                      fmt_in, fmt_out );
 }
 
-filter_t *filter_chain_AppendConverter( filter_chain_t *chain,
+int filter_chain_AppendConverter( filter_chain_t *chain,
     const es_format_t *fmt_in, const es_format_t *fmt_out )
 {
     return filter_chain_AppendInner( chain, NULL, chain->conv_cap, NULL,
-                                     fmt_in, fmt_out );
+                                     fmt_in, 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 57210df5fd..aaa24b053d 100644
--- a/src/video_output/display.c
+++ b/src/video_output/display.c
@@ -462,8 +462,7 @@ static int VoutDisplayCreateRender(vout_display_t *vd)
         es_format_InitFromVideo(&dst, i == 0 ? &v_dst : &v_dst_cmp);
 
         filter_chain_Reset(osys->filters, &src, &dst);
-        ret = filter_chain_AppendConverter(osys->filters, &src, &dst)
-            != NULL ? 0 : -1;
+        ret = filter_chain_AppendConverter(osys->filters, &src, &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 57385154f4..2f11ebeec3 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -815,8 +815,8 @@ static void ThreadChangeFilters(vout_thread_t *vout,
 
     if (!es_format_IsSimilar(&fmt_current, &fmt_target)) {
         msg_Dbg(vout, "Adding a filter to compensate for format changes");
-        if (!filter_chain_AppendConverter(vout->p->filter.chain_interactive,
-                                          &fmt_current, &fmt_target)) {
+        if (filter_chain_AppendConverter(vout->p->filter.chain_interactive,
+                                         &fmt_current, &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);



More information about the vlc-commits mailing list