vlc | branch: master | Steve Lhomme <[email protected]> | Fri Jun 8 08:53:37 2018 +0200| [cfbf0e9ccf414858aa43813d89c1f1738f8bbd4d] | committer: Steve Lhomme
demux:mkv: store the segment duration in vlc_tick_t not float Also the chapter/edition is in vlc_tick_t so doesn't need extra conversion. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cfbf0e9ccf414858aa43813d89c1f1738f8bbd4d --- modules/demux/mkv/demux.cpp | 2 +- modules/demux/mkv/demux.hpp | 4 ++-- modules/demux/mkv/mkv.cpp | 16 ++++++++-------- modules/demux/mkv/virtual_segment.hpp | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/modules/demux/mkv/demux.cpp b/modules/demux/mkv/demux.cpp index 7909973ba2..8108ac528e 100644 --- a/modules/demux/mkv/demux.cpp +++ b/modules/demux/mkv/demux.cpp @@ -302,7 +302,7 @@ bool demux_sys_t::PreparePlayback( virtual_segment_c & new_vsegment, vlc_tick_t if( !p_current_vsegment->CurrentSegment()->b_cues ) msg_Warn( &p_current_vsegment->CurrentSegment()->sys.demuxer, "no cues/empty cues found->seek won't be precise" ); - f_duration = p_current_vsegment->Duration(); + i_duration = p_current_vsegment->Duration(); /* add information */ p_current_vsegment->CurrentSegment()->InformationCreate( ); diff --git a/modules/demux/mkv/demux.hpp b/modules/demux/mkv/demux.hpp index 0f4e4df571..81e9ad0928 100644 --- a/modules/demux/mkv/demux.hpp +++ b/modules/demux/mkv/demux.hpp @@ -54,7 +54,7 @@ public: ,i_updates(0) ,p_current_vsegment(NULL) ,dvd_interpretor( *this ) - ,f_duration(-1.0) + ,i_duration(-1) ,p_input(NULL) ,ev(&demux) { @@ -89,7 +89,7 @@ public: dvd_command_interpretor_c dvd_interpretor; /* duration of the stream */ - float f_duration; + vlc_tick_t i_duration; matroska_segment_c *FindSegment( const EbmlBinary & uid ) const; virtual_chapter_c *BrowseCodecPrivate( unsigned int codec_id, diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp index 78ba0bc41b..1cdf9d5a8e 100644 --- a/modules/demux/mkv/mkv.cpp +++ b/modules/demux/mkv/mkv.cpp @@ -331,22 +331,22 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) case DEMUX_GET_LENGTH: pi64 = va_arg( args, int64_t * ); - if( p_sys->f_duration > 0.0 ) - *pi64 = static_cast<int64_t>( p_sys->f_duration * 1000 ); + if( p_sys->i_duration > 0 ) + *pi64 = static_cast<int64_t>( p_sys->i_duration ); else *pi64 = VLC_TICK_INVALID; return VLC_SUCCESS; case DEMUX_GET_POSITION: pf = va_arg( args, double * ); - if ( p_sys->f_duration > 0.0 ) + if ( p_sys->i_duration > 0 ) *pf = static_cast<double> (p_sys->i_pcr >= (p_sys->i_start_pts + p_sys->i_mk_chapter_time) ? p_sys->i_pcr : - (p_sys->i_start_pts + p_sys->i_mk_chapter_time) ) / (1000.0 * p_sys->f_duration); + (p_sys->i_start_pts + p_sys->i_mk_chapter_time) ) / p_sys->i_duration; return VLC_SUCCESS; case DEMUX_SET_POSITION: - if( p_sys->f_duration > 0.0 ) + if( p_sys->i_duration > 0) { f = va_arg( args, double ); b = va_arg( args, int ); /* precise? */ @@ -388,7 +388,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) { p_sys->i_updates |= INPUT_UPDATE_SEEKPOINT|INPUT_UPDATE_TITLE; p_sys->i_current_seekpoint = 0; - p_sys->f_duration = (float) p_sys->titles[i_idx]->i_length / 1000.f; + p_sys->i_duration = p_sys->titles[i_idx]->i_length; return VLC_SUCCESS; } else @@ -489,7 +489,7 @@ static int Seek( demux_t *p_demux, vlc_tick_t i_mk_date, double f_percent, virtu msg_Warn( p_demux, "cannot seek so far!" ); return VLC_EGENERIC; } - if( p_sys->f_duration < 0 ) + if( p_sys->i_duration < 0 ) { msg_Warn( p_demux, "cannot seek without duration!"); return VLC_EGENERIC; @@ -503,7 +503,7 @@ static int Seek( demux_t *p_demux, vlc_tick_t i_mk_date, double f_percent, virtu /* seek without index or without date */ if( f_percent >= 0 && (var_InheritBool( p_demux, "mkv-seek-percent" ) || i_mk_date < 0 )) { - i_mk_date = int64_t( f_percent * p_sys->f_duration * 1000.0 ); + i_mk_date = vlc_tick_t( f_percent * p_sys->i_duration ); } return p_vsegment->Seek( *p_demux, i_mk_date, p_vchapter, b_precise ) ? VLC_SUCCESS : VLC_EGENERIC; } diff --git a/modules/demux/mkv/virtual_segment.hpp b/modules/demux/mkv/virtual_segment.hpp index 4c420ef623..e5ac74977a 100644 --- a/modules/demux/mkv/virtual_segment.hpp +++ b/modules/demux/mkv/virtual_segment.hpp @@ -145,9 +145,9 @@ public: return &p_current_vchapter->segment; } - inline int64_t Duration() + inline vlc_tick_t Duration() { - return veditions[i_current_edition]->i_duration / 1000; + return veditions[i_current_edition]->i_duration; } inline std::vector<virtual_edition_c*>* Editions() { return &veditions; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
