Commit 06d04158 authored by Steve Lhomme's avatar Steve Lhomme
Browse files

filter_chain: rework filter_chain_VideoDrain()

From the last filter in the chain to the first we:

- drain to get a picture
- if there is a picture we use it to filter it
- if we have a picture from running all the filters, we return it
- otherwise we try again to drain the filter that produced a picture
- if that filter doesn't produce a picture anymore, we try the previous filter
  in the chain
parent 3b29ef4c
...@@ -468,16 +468,26 @@ picture_t *filter_chain_VideoFilter( filter_chain_t *p_chain, picture_t *p_pic ) ...@@ -468,16 +468,26 @@ picture_t *filter_chain_VideoFilter( filter_chain_t *p_chain, picture_t *p_pic )
picture_t *filter_chain_VideoDrain( filter_chain_t *p_chain ) picture_t *filter_chain_VideoDrain( filter_chain_t *p_chain )
{ {
picture_t *p_pic; for( chained_filter_t *b = p_chain->last; b != NULL; )
for( chained_filter_t *b = p_chain->last; b != NULL; b = b->prev )
{ {
if( vlc_picture_chain_IsEmpty( &b->pending ) ) picture_t *p_pic = filter_DrainVideo( &b->filter );
if ( p_pic )
// we have a picture, feed it down the chain
p_pic = filter_chained( b->next, p_pic );
if ( p_pic )
// all filters produced a picture, we can return it
return p_pic;
// b drains picture, keep draining pictures until it's dry
// we assume the next filters won't produce a picture since
// they didn't produce one with a regular picture
continue; continue;
p_pic = vlc_picture_chain_PopFront( &b->pending ); }
p_pic = FilterChainVideoFilter( b->next, p_pic ); // we don't have a picture from b, drain from further up in the chain
if( p_pic ) b = b->prev;
return p_pic;
} }
return NULL; return NULL;
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment