Commit daa556bc authored by Laurent Aimar's avatar Laurent Aimar

At input EOF, wait for all pictures to be displayed.

parent 7d55fdfc
......@@ -388,10 +388,19 @@ void input_DecoderDecode( decoder_t *p_dec, block_t *p_block, bool b_do_pace )
bool input_DecoderIsEmpty( decoder_t * p_dec )
{
assert( !p_dec->p_owner->b_buffering );
decoder_owner_sys_t *p_owner = p_dec->p_owner;
assert( !p_owner->b_buffering );
/* FIXME that's not really true */
return block_FifoCount( p_dec->p_owner->p_fifo ) <= 0;
bool b_empty = block_FifoCount( p_dec->p_owner->p_fifo ) <= 0;
if( b_empty )
{
vlc_mutex_lock( &p_owner->lock );
/* TODO audio support */
if( p_dec->fmt_out.i_cat == VIDEO_ES && p_owner->p_vout )
b_empty = vout_IsEmpty( p_owner->p_vout );
vlc_mutex_unlock( &p_owner->lock );
}
return b_empty;
}
void input_DecoderIsCcPresent( decoder_t *p_dec, bool pb_present[4] )
......
......@@ -513,6 +513,19 @@ void vout_Reset(vout_thread_t *vout)
vout_control_WaitEmpty(&vout->p->control);
}
bool vout_IsEmpty(vout_thread_t *vout)
{
vlc_mutex_lock(&vout->p->picture_lock);
picture_t *picture = picture_fifo_Peek(vout->p->decoder_fifo);
if (picture)
picture_Release(picture);
vlc_mutex_unlock(&vout->p->picture_lock);
return !picture;
}
void vout_FixLeaks( vout_thread_t *vout )
{
vlc_mutex_lock(&vout->p->picture_lock);
......
......@@ -75,5 +75,10 @@ void vout_NextPicture( vout_thread_t *p_vout, mtime_t *pi_duration );
*/
void vout_DisplayTitle( vout_thread_t *p_vout, const char *psz_title );
/**
* This function will return true if no more pictures are to be displayed.
*/
bool vout_IsEmpty( vout_thread_t *p_vout );
#endif
Markdown is supported
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