[vlc-commits] MKV: the Block duration is for the whole Block, not each frame

Steve Lhomme git at videolan.org
Tue Feb 24 13:19:00 CET 2015


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Tue Feb 24 12:51:08 2015 +0100| [12e068cfe5c0af2e1a29b8087cd46f7d2b69c7ae] | committer: Jean-Baptiste Kempf

MKV: the Block duration is for the whole Block, not each frame

unlike the Default Duration in the Info header which is per frame.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/demux/mkv/mkv.cpp |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index b99b898..588255b 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -545,9 +545,9 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
     else
         block_size = block->GetSize();
  
-    for( unsigned int i = 0;
-         ( block != NULL && i < block->NumberFrames()) || ( simpleblock != NULL && i < simpleblock->NumberFrames() );
-         i++ )
+    const unsigned int i_number_frames = block != NULL ? block->NumberFrames() :
+            ( simpleblock != NULL ? simpleblock->NumberFrames() : 0 );
+    for( unsigned int i = 0; i < i_number_frames; i++ )
     {
         block_t *p_block;
         DataBuffer *data;
@@ -687,7 +687,7 @@ msg_Dbg( p_demux, "block i_dts: %"PRId64" / i_pts: %"PRId64, p_block->i_dts, p_b
         if( !tk->b_no_duration )
         {
             p_block->i_length = i_duration * tk-> f_timecodescale *
-                (double) p_segment->i_timescale / 1000.0;
+                (double) p_segment->i_timescale / ( 1000.0 * i_number_frames );
         }
 
         /* FIXME remove when VLC_TS_INVALID work is done */



More information about the vlc-commits mailing list