[vlc-commits] demux:mkv: read the block duration in vlc_tick_t rather than nanoseconds
Steve Lhomme
git at videolan.org
Tue Sep 18 13:52:54 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Sep 18 11:39:30 2018 +0200| [b0bf599d3e04b535806f4b9fd25c82f944b864e7] | committer: Steve Lhomme
demux:mkv: read the block duration in vlc_tick_t rather than nanoseconds
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b0bf599d3e04b535806f4b9fd25c82f944b864e7
---
modules/demux/mkv/matroska_segment.cpp | 4 ++--
modules/demux/mkv/matroska_segment_parse.cpp | 11 ++++++-----
modules/demux/mkv/virtual_segment.cpp | 4 ++--
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/modules/demux/mkv/matroska_segment.cpp b/modules/demux/mkv/matroska_segment.cpp
index ef894574ac..4789722d7d 100644
--- a/modules/demux/mkv/matroska_segment.cpp
+++ b/modules/demux/mkv/matroska_segment.cpp
@@ -1094,8 +1094,8 @@ void matroska_segment_c::EnsureDuration()
}
}
- i_duration = ( i_last_timecode - cluster->GlobalTimecode() ) / CLOCK_FREQ;
- msg_Dbg( &sys.demuxer, " extracted Duration=%" PRId64, i_duration );
+ i_duration = VLC_TICK_FROM_NS( i_last_timecode - cluster->GlobalTimecode() );
+ msg_Dbg( &sys.demuxer, " extracted Duration=%" PRId64, SEC_FROM_VLC_TICK(i_duration) );
}
// get back to the reading position we were at before looking for a duration
diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 493f175cd3..373296a0e1 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -988,9 +988,10 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
matroska_segment_c * obj;
EbmlElement *& el;
EbmlMaster *& m;
+ double f_duration;
int& i_upper_level;
- } captures = { &sys.demuxer, this, el, m, i_upper_level };
+ } captures = { &sys.demuxer, this, el, m, -1., i_upper_level };
MKV_SWITCH_CREATE(EbmlTypeDispatcher, InfoHandlers, InfoHandlerPayload)
{
@@ -1035,8 +1036,8 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
}
E_CASE( KaxDuration, dur )
{
- vars.obj->i_duration = vlc_tick_t( static_cast<double>( dur ) );
- debug( vars, "Duration=%" PRId64, vars.obj->i_duration );
+ vars.f_duration = static_cast<double>( dur );
+ debug( vars, "Duration=%.0f", vars.f_duration );
}
E_CASE( KaxMuxingApp, mapp )
{
@@ -1131,8 +1132,8 @@ void matroska_segment_c::ParseInfo( KaxInfo *info )
InfoHandlers::Dispatcher().iterate( m->begin(), m->end(), &captures );
- if( i_duration != -1 )
- i_duration = vlc_tick_t( static_cast<double>( i_duration * i_timescale ) / 10e5 );
+ if( captures.f_duration != -1. )
+ i_duration = VLC_TICK_FROM_NS( captures.f_duration * i_timescale );
}
diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp
index dc888ea2e0..080248d933 100644
--- a/modules/demux/mkv/virtual_segment.cpp
+++ b/modules/demux/mkv/virtual_segment.cpp
@@ -50,7 +50,7 @@ virtual_chapter_c * virtual_chapter_c::CreateVirtualChapter( chapter_item_c * p_
if( !p_chap )
{
/* Dummy chapter use the whole segment */
- return new (std::nothrow) virtual_chapter_c( main_segment, NULL, 0, main_segment.i_duration * 1000, sub_chapters );
+ return new (std::nothrow) virtual_chapter_c( main_segment, NULL, 0, main_segment.i_duration, sub_chapters );
}
matroska_segment_c * p_segment = &main_segment;
@@ -252,7 +252,7 @@ void virtual_edition_c::retimeChapters()
virtual_chapter_c * p_vchap = vchapters[i];
p_vchap->i_mk_virtual_start_time = i_duration;
- i_duration += p_vchap->segment.i_duration * 1000;
+ i_duration += p_vchap->segment.i_duration;
p_vchap->i_mk_virtual_stop_time = i_duration;
retimeSubChapters( p_vchap );
More information about the vlc-commits
mailing list