[vlc-commits] demux: flac: call packetizer at eos.

Francois Cartegnie git at videolan.org
Fri Jan 10 15:31:36 CET 2014


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Jan  9 16:37:43 2014 +0100| [f298d137bbc08c7b84892a868ab338bf25c8667e] | committer: Francois Cartegnie

demux: flac: call packetizer at eos.

refs #3178

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

 modules/demux/flac.c |   14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/modules/demux/flac.c b/modules/demux/flac.c
index 3a928f4..261eed9 100644
--- a/modules/demux/flac.c
+++ b/modules/demux/flac.c
@@ -199,14 +199,16 @@ static int Demux( demux_t *p_demux )
     demux_sys_t *p_sys = p_demux->p_sys;
     block_t     *p_block_in, *p_block_out;
 
-    if( !( p_block_in = stream_Block( p_demux->s, FLAC_PACKET_SIZE ) ) )
-        return 0;
+    bool b_eof = !( p_block_in = stream_Block( p_demux->s, FLAC_PACKET_SIZE ) );
 
-    p_block_in->i_pts = p_block_in->i_dts = p_sys->b_start ? VLC_TS_0 : VLC_TS_INVALID;
-    p_sys->b_start = false;
+    if ( p_block_in )
+    {
+        p_block_in->i_pts = p_block_in->i_dts = p_sys->b_start ? VLC_TS_0 : VLC_TS_INVALID;
+        p_sys->b_start = false;
+    }
 
     while( (p_block_out = p_sys->p_packetizer->pf_packetize(
-                p_sys->p_packetizer, &p_block_in )) )
+                p_sys->p_packetizer, (p_block_in) ? &p_block_in : NULL )) )
     {
         while( p_block_out )
         {
@@ -230,7 +232,7 @@ static int Demux( demux_t *p_demux )
             p_block_out = p_next;
         }
     }
-    return 1;
+    return !b_eof;
 }
 
 /*****************************************************************************



More information about the vlc-commits mailing list