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

Steve Lhomme git at videolan.org
Fri Mar 13 15:29:46 CET 2015


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Fri Mar 13 14:37:50 2015 +0100| [a0ee7281d365c1b1132069e5e9628b7156e5922e] | committer: Jean-Baptiste Kempf

MKV: divide i_default_duration by 1000 once and for all

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

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

 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 7b8abb1..ce64952 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -604,7 +604,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;
          }
@@ -673,7 +673,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 &&
@@ -701,7 +701,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;
     }
 }



More information about the vlc-commits mailing list