Commit bd9c8829 authored by Steve Lhomme's avatar Steve Lhomme
Browse files

filter_chain: separate the picture filtering from filter draining

The draining is done after the picture filtering. This is equivalent to how
a picture was returned with all the chained pictures.

filter_chain_VideoFilter does the same part as filter_chain_VideoFilter() when
called with a NULL picture.

For now filter_chain_VideoFilter() still handles the case where a NULL picture
is used.
parent 204064ae
......@@ -606,7 +606,16 @@ VLC_API vlc_video_context *filter_chain_GetVideoCtxOut(const filter_chain_t *cha
* \return modified picture after applying all video filters
*/
VLC_API picture_t *filter_chain_VideoFilter(filter_chain_t *chain,
picture_t *pic);
picture_t *pic) VLC_USED;
/**
* Drain the filter chain of remaining processed pictures.
*
* \param chain pointer to filter chain
* \return modified picture after applying all video filters or NULL if there is
* nothing left to drain
*/
VLC_API picture_t *filter_chain_VideoDrain(filter_chain_t *chain) VLC_USED;
/**
* Flush a video filter chain.
......
......@@ -577,7 +577,12 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
{
/* Run filter chain */
if( id->p_f_chain )
p_in = filter_chain_VideoFilter( id->p_f_chain, p_in );
{
if ( p_in )
p_in = filter_chain_VideoFilter( id->p_f_chain, p_in );
else
p_in = filter_chain_VideoDrain( id->p_f_chain );
}
if( !p_in )
break;
......
......@@ -121,6 +121,7 @@ filter_chain_Reset
filter_chain_Clear
filter_chain_SubFilter
filter_chain_VideoFilter
filter_chain_VideoDrain
filter_chain_VideoFlush
filter_chain_ForEach
filter_ConfigureBlend
......
......@@ -452,6 +452,12 @@ picture_t *filter_chain_VideoFilter( filter_chain_t *p_chain, picture_t *p_pic )
if( p_pic )
return p_pic;
}
return filter_chain_VideoDrain( 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; b = b->prev )
{
if( vlc_picture_chain_IsEmpty( &b->pending ) )
......
......@@ -1108,7 +1108,7 @@ static picture_t *ThreadGetPrerenderedLocked(vout_thread_sys_t *vout, bool reuse
picture_t *picture = NULL;
while (!picture) {
picture = filter_chain_VideoFilter(sys->filter.chain_static, NULL);
picture = filter_chain_VideoDrain(sys->filter.chain_static);
if (picture && DropLate(vout, picture, can_drop_late, paused))
{
picture = NULL;
......@@ -1230,7 +1230,7 @@ static int ThreadDisplayRenderPicture(vout_thread_sys_t *vout, bool render_now)
vout_chrono_Start(&sys->render);
vlc_mutex_lock(&sys->filter.lock);
picture_t *filtered = filter_chain_VideoFilter(sys->filter.chain_interactive, NULL);
picture_t *filtered = filter_chain_VideoDrain(sys->filter.chain_interactive);
vlc_mutex_unlock(&sys->filter.lock);
if (filtered == 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