[vlc-devel] [PATCH 12/23] filter_chain: rename the chain output format
Steve Lhomme
robux4 at ycbcr.xyz
Thu Nov 7 10:31:25 CET 2019
It is only set when calling filter_chain_Reset() and no filter has been added yet.
We should not be using the filter chain unless filter_chain_Reset() has been called.
---
src/misc/filter_chain.c | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 42be5ac654b..e982c097668 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -51,7 +51,8 @@ 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 reset_fmt_out; /**< Chain output format after a reset */
+ bool is_reset;
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 */
@@ -77,7 +78,8 @@ static filter_chain_t *filter_chain_NewInner( vlc_object_t *obj,
chain->first = NULL;
chain->last = NULL;
es_format_Init( &chain->fmt_in, cat, 0 );
- es_format_Init( &chain->fmt_out, cat, 0 );
+ es_format_Init( &chain->reset_fmt_out, cat, 0 );
+ chain->is_reset = false;
chain->b_allow_fmt_out_change = fmt_out_change;
chain->filter_cap = cap;
chain->conv_cap = conv_cap;
@@ -163,7 +165,7 @@ void filter_chain_Delete( filter_chain_t *p_chain )
filter_chain_Clear( p_chain );
es_format_Clean( &p_chain->fmt_in );
- es_format_Clean( &p_chain->fmt_out );
+ es_format_Clean( &p_chain->reset_fmt_out );
free( p_chain );
}
@@ -180,8 +182,9 @@ void filter_chain_Reset( filter_chain_t *p_chain, const es_format_t *p_fmt_in,
es_format_Copy( &p_chain->fmt_in, p_fmt_in );
assert(p_fmt_out != NULL);
- es_format_Clean( &p_chain->fmt_out );
- es_format_Copy( &p_chain->fmt_out, p_fmt_out );
+ es_format_Clean( &p_chain->reset_fmt_out );
+ es_format_Copy( &p_chain->reset_fmt_out, p_fmt_out );
+ p_chain->is_reset = true;
}
static filter_t *filter_chain_AppendInner( filter_chain_t *chain,
@@ -204,7 +207,7 @@ static filter_t *filter_chain_AppendInner( filter_chain_t *chain,
}
if( fmt_out == NULL )
- fmt_out = &chain->fmt_out;
+ fmt_out = &chain->reset_fmt_out;
es_format_Copy( &filter->fmt_in, fmt_in );
es_format_Copy( &filter->fmt_out, fmt_out );
@@ -387,7 +390,8 @@ const es_format_t *filter_chain_GetFmtOut( const filter_chain_t *p_chain )
return &p_chain->last->filter.fmt_out;
/* Unless filter_chain_Reset has been called we are doomed */
- return &p_chain->fmt_out;
+ assert(p_chain->is_reset);
+ return &p_chain->reset_fmt_out;
}
static picture_t *FilterChainVideoFilter( chained_filter_t *f, picture_t *p_pic )
--
2.17.1
More information about the vlc-devel
mailing list