[vlc-devel] [PATCH v1 14/33] filter_chain: use a local video sink to implement filter_chain_VideoFilter
Steve Lhomme
robux4 at ycbcr.xyz
Fri Sep 25 16:46:50 CEST 2020
We assert that only one picture can be received by this picture chain.
Otherwise the caller should have used filter_chain_VideoFilterInto.
The difference of filter usage/expectations could be enforced by using two
different types.
---
src/misc/filter_chain.c | 34 ++++++++++++++++------------------
1 file changed, 16 insertions(+), 18 deletions(-)
diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index 3019d67e749..083ed165f62 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -449,26 +449,24 @@ static picture_t *FilterChainVideoFilter( chained_filter_t *f, picture_t *p_pic
return p_pic;
}
+static int FilterChainLastPush(struct vlc_video_sink *sink, picture_t *p_pic)
+{
+ picture_t **outpic = sink->sys;
+ assert(*outpic == NULL);
+ *outpic = p_pic;
+ return VLC_SUCCESS;
+}
+
picture_t *filter_chain_VideoFilter( filter_chain_t *p_chain, picture_t *p_pic )
{
- if( p_pic )
- {
- p_pic = FilterChainVideoFilter( p_chain->first, p_pic );
- if( p_pic )
- return p_pic;
- }
- for( chained_filter_t *b = p_chain->last; b != NULL; b = b->prev )
- {
- if( vlc_picture_chain_IsEmpty( &b->pending ) )
- continue;
- p_pic = b->pending.front;
- b->pending = picture_GetAndResetChain( p_pic );
-
- p_pic = FilterChainVideoFilter( b->next, p_pic );
- if( p_pic )
- return p_pic;
- }
- return NULL;
+ picture_t *result = NULL;
+ struct vlc_video_sink output = { &result, FilterChainLastPush };
+ int res;
+ assert( p_pic );
+ res = filter_chain_VideoFilterInto( p_chain, p_pic, &output );
+ // use filter_chain_VideoFilterInto to get all output at once
+ assert(!picture_HasChainedPics(result));
+ return result;
}
int filter_chain_VideoFilterInto(filter_chain_t *p_chain, picture_t *p_pic,
--
2.26.2
More information about the vlc-devel
mailing list