[vlc-devel] [PATCH] MKV: divide i_default_duration by 1000 once and for all

Steve Lhomme robUx4 at videolabs.io
Fri Mar 13 14:37:50 CET 2015


---
 modules/demux/mkv/matroska_segment_parse.cpp | 5 +++--
 modules/demux/mkv/mkv.cpp                    | 6 +++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index ad88a81..9b82d4c 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -337,7 +337,8 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
             KaxTrackDefaultDuration &defd = *(KaxTrackDefaultDuration*)l;
 
             tk->i_default_duration = uint64(defd);
-            msg_Dbg( &sys.demuxer, "|   |   |   + Track Default Duration=%" PRId64, uint64(defd) );
+            msg_Dbg( &sys.demuxer, "|   |   |   + Track Default Duration=%" PRId64, tk->i_default_duration );
+            tk->i_default_duration /= 1000;
         }
         else  if( MKV_IS_ID( l, KaxTrackTimecodeScale ) )
         {
@@ -532,7 +533,7 @@ void matroska_segment_c::ParseTrackEntry( KaxTrackEntry *m )
             msg_Dbg( &sys.demuxer, "|   |   |   + Track Video" );
             tk->f_fps = 0.0;
 
-            tk->fmt.video.i_frame_rate_base = (unsigned int)(tk->i_default_duration / 1000);
+            tk->fmt.video.i_frame_rate_base = (unsigned int)tk->i_default_duration;
             tk->fmt.video.i_frame_rate = 1000000;
 
             for( unsigned int j = 0; j < tkv->ListSize(); j++ )
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index a7c267b..212082e 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -603,7 +603,7 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
             handle_real_audio(p_demux, tk, p_block, i_pts);
             block_Release(p_block);
             i_pts = ( tk->i_default_duration )?
-                i_pts + ( mtime_t )( tk->i_default_duration / 1000 ):
+                i_pts + ( mtime_t )tk->i_default_duration:
                 VLC_TS_INVALID;
             continue;
          }
@@ -672,7 +672,7 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
                 if ( b_key_picture || b_discardable_picture )
                     p_block->i_dts = p_block->i_pts;
                 else
-                    p_block->i_dts = min( i_pts, tk->i_last_dts + ( mtime_t )( tk->i_default_duration / 1000 ) );
+                    p_block->i_dts = min( i_pts, tk->i_last_dts + ( mtime_t )tk->i_default_duration );
             }
         }
         if( p_block->i_dts > VLC_TS_INVALID &&
@@ -700,7 +700,7 @@ msg_Dbg( p_demux, "block (track=%d) i_dts: %"PRId64" / i_pts: %"PRId64, tk->i_nu
 
         /* use time stamp only for first block */
         i_pts = ( tk->i_default_duration )?
-                 i_pts + ( mtime_t )( tk->i_default_duration / 1000 ):
+                 i_pts + ( mtime_t )tk->i_default_duration:
                  VLC_TS_INVALID;
     }
 }
-- 
2.3.2




More information about the vlc-devel mailing list