]> git.sesse.net Git - vlc/commitdiff
MKV: the Block duration is for the whole Block, not each frame
authorSteve Lhomme <robUx4@videolabs.io>
Tue, 24 Feb 2015 11:51:08 +0000 (12:51 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 24 Feb 2015 12:18:10 +0000 (13:18 +0100)
unlike the Default Duration in the Info header which is per frame.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/demux/mkv/mkv.cpp

index b99b898367833151b0699aa1fd3517fd828e9594..588255b7bb65392f5bdc9eb8c79ff27c0206fa4c 100644 (file)
@@ -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 */