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

transcode: video: drain all filter chains sequentially until they're dry

Loop while there are pictures to encode.

- Start by filtering the first picture through each filter chain, and encode
the result.
- Then drain the first (non-null) filter chain and pass the result through
the other filter chain, and encode the result.
- Then drain the second (non-null) filter chain and pass the result through
the other filter chain, and encode the result.
- And so on, until there is no more filtered pictures to encode.
parent 6983eaff
......@@ -573,35 +573,24 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
* and then with NULL as many times as we need until they
* stop outputting frames.
*/
for ( picture_t *p_in = p_pic; ; p_in = NULL /* drain second time */ )
for ( picture_t *p_in = p_pic; ; p_in = NULL /* keep draining */ )
{
/* Run filter chain */
if( id->p_f_chain )
filter_chain_t * chains[] = { id->p_f_chain,
id->p_uf_chain,
id->p_final_conv_static };
for( size_t i=0; i<ARRAY_SIZE(chains); i++ )
{
if( !chains[i] )
continue;
if ( p_in )
p_in = filter_chain_VideoFilter( id->p_f_chain, p_in );
p_in = filter_chain_VideoFilter( chains[i], p_in );
else
p_in = filter_chain_VideoDrain( id->p_f_chain );
p_in = filter_chain_VideoDrain( chains[i] );
}
if( !p_in )
break;
for ( ;; p_in = NULL /* drain second time */ )
{
/* Run user specified filter chain */
filter_chain_t * secondary_chains[] = { id->p_uf_chain,
id->p_final_conv_static };
for( size_t i=0; p_in && i<ARRAY_SIZE(secondary_chains); i++ )
{
if( !secondary_chains[i] )
continue;
p_in = filter_chain_VideoFilter( secondary_chains[i], p_in );
}
if( !p_in )
break;
/* Blend subpictures */
p_in = RenderSubpictures( id, p_in );
......@@ -612,7 +601,6 @@ int transcode_video_process( sout_stream_t *p_stream, sout_stream_id_sys_t *id,
block_ChainAppend( out, p_encoded );
picture_Release( p_in );
}
}
}
if( b_eos )
......
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