[vlc-commits] filter_chain: no need to reset the fmt_out each time a filter is added

Steve Lhomme git at videolan.org
Thu Nov 14 08:29:35 CET 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Aug  2 08:20:59 2019 +0200| [7ebacd17ab039886711089c8e1c461d8be76c071] | committer: Steve Lhomme

filter_chain: no need to reset the fmt_out each time a filter is added

The last output format is always the format of the last filter. It doesn't
matter if it was allowed to change the format or not. It's either the filter
added or the "chain" filter added to compensate for the format change (should
be adjusted in push mode)

This is how filter_chain_GetFmtOut() is documented "last output format of the
last element in the filter chain" and how it's used.

If there's no filter yet, the output format is the one used to initialize the
filter chain (via filter_chain_Reset).

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

 src/misc/filter_chain.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 3739a45720..6e6674586c 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -51,7 +51,7 @@ struct filter_chain_t
     chained_filter_t *first, *last; /**< List of filters */
 
     es_format_t fmt_in; /**< Chain input format (constant) */
-    es_format_t fmt_out; /**< Chain current output format */
+    es_format_t fmt_out; /**< Chain output format (constant) */
     bool b_allow_fmt_out_change; /**< Each filter can change the output */
     const char *filter_cap; /**< Filter modules capability */
     const char *conv_cap; /**< Converter modules capability */
@@ -236,12 +236,6 @@ static filter_t *filter_chain_AppendInner( filter_chain_t *chain,
     if( filter->p_module == NULL )
         goto error;
 
-    if( chain->b_allow_fmt_out_change )
-    {
-        es_format_Clean( &chain->fmt_out );
-        es_format_Copy( &chain->fmt_out, &filter->fmt_out );
-    }
-
     if( chain->last == NULL )
     {
         assert( chain->first == NULL );
@@ -389,9 +383,6 @@ bool filter_chain_IsEmpty(const filter_chain_t *chain)
 
 const es_format_t *filter_chain_GetFmtOut( const filter_chain_t *p_chain )
 {
-    if( p_chain->b_allow_fmt_out_change )
-        return &p_chain->fmt_out;
-
     if( p_chain->last != NULL )
         return &p_chain->last->filter.fmt_out;
 



More information about the vlc-commits mailing list