[vlc-commits] commit: At input EOF, wait for all pictures to be displayed. ( Laurent Aimar )

git at videolan.org git at videolan.org
Sat May 1 13:42:28 CEST 2010


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri Apr 30 19:41:24 2010 +0200| [daa556bc3b195e09017685044c4c953f3da5fb56] | committer: Laurent Aimar 

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

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=daa556bc3b195e09017685044c4c953f3da5fb56
---

 src/input/decoder.c             |   15 ++++++++++++---
 src/video_output/video_output.c |   13 +++++++++++++
 src/video_output/vout_control.h |    5 +++++
 3 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 088c1fd..f8c7748 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -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] )
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 26b78e3..a0e8eb5 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -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);
diff --git a/src/video_output/vout_control.h b/src/video_output/vout_control.h
index ffb194e..f2d5c12 100644
--- a/src/video_output/vout_control.h
+++ b/src/video_output/vout_control.h
@@ -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
 



More information about the vlc-commits mailing list