]> git.sesse.net Git - vlc/commitdiff
At input EOF, wait for all pictures to be displayed.
authorLaurent Aimar <fenrir@videolan.org>
Fri, 30 Apr 2010 17:41:24 +0000 (19:41 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Sat, 1 May 2010 11:39:54 +0000 (13:39 +0200)
src/input/decoder.c
src/video_output/video_output.c
src/video_output/vout_control.h

index 088c1fd6caba1d4a1b5279695cc89a02ae7c946b..f8c774883f1b8764cc82fff10f28e061ebce01e7 100644 (file)
@@ -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] )
index 26b78e38241551d2a9f96b35a88db4aeecbfa59b..a0e8eb5228bf9ca9d95a223b8be85c94d10521ed 100644 (file)
@@ -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);
index ffb194ed93c125350b053f22f7b385cd721b082a..f2d5c12902d58a4b6e7dd3c378d8b7afd589393f 100644 (file)
@@ -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