vlc | branch: master | Filip Roséen <[email protected]> | Mon May 9 14:53:15 2016 +0200| [550c8daeea7852f3f94778ce694981cff7fa3c86] | committer: Jean-Baptiste Kempf
mkv: support "inprecise seeking" (ie. "Fast Seek") We should use a less-precise but faster seeking algorithm if this has been requested when receiving DEMUX_SET_POSITION or DEMUX_SET_TIME from the core. This patch makes the relevant changes so that this information propagates down to the relevant sections of the demuxer. Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=550c8daeea7852f3f94778ce694981cff7fa3c86 --- modules/demux/mkv/mkv.cpp | 13 ++++++++----- modules/demux/mkv/virtual_segment.cpp | 3 ++- modules/demux/mkv/virtual_segment.hpp | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp index 9b94474..c064376 100644 --- a/modules/demux/mkv/mkv.cpp +++ b/modules/demux/mkv/mkv.cpp @@ -87,7 +87,7 @@ struct demux_sys_t; static int Demux ( demux_t * ); static int Control( demux_t *, int, va_list ); -static void Seek ( demux_t *, mtime_t i_mk_date, double f_percent, virtual_chapter_c *p_vchapter ); +static void Seek ( demux_t *, mtime_t i_mk_date, double f_percent, virtual_chapter_c *p_vchapter, bool b_precise = true ); /***************************************************************************** * Open: initializes matroska demux structures @@ -298,6 +298,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) double *pf, f; int i_skp; size_t i_idx; + bool b; vlc_meta_t *p_meta; input_attachment_t ***ppp_attach; @@ -357,7 +358,8 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) if( p_sys->f_duration > 0.0 ) { f = va_arg( args, double ); - Seek( p_demux, -1, f, NULL ); + b = va_arg( args, int ); /* precise? */ + Seek( p_demux, -1, f, NULL, b ); return VLC_SUCCESS; } return VLC_EGENERIC; @@ -436,8 +438,9 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) case DEMUX_SET_TIME: i64 = va_arg( args, int64_t ); + b = va_arg( args, int ); /* precise? */ msg_Dbg(p_demux,"SET_TIME to %" PRId64, i64 ); - Seek( p_demux, i64, -1, NULL ); + Seek( p_demux, i64, -1, NULL, b ); return VLC_SUCCESS; default: return VLC_EGENERIC; @@ -445,7 +448,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args ) } /* Seek */ -static void Seek( demux_t *p_demux, mtime_t i_mk_date, double f_percent, virtual_chapter_c *p_vchapter ) +static void Seek( demux_t *p_demux, mtime_t i_mk_date, double f_percent, virtual_chapter_c *p_vchapter, bool b_precise ) { demux_sys_t *p_sys = p_demux->p_sys; virtual_segment_c *p_vsegment = p_sys->p_current_vsegment; @@ -480,7 +483,7 @@ static void Seek( demux_t *p_demux, mtime_t i_mk_date, double f_percent, virtual { i_mk_date = int64_t( f_percent * p_sys->f_duration * 1000.0 ); } - p_vsegment->Seek( *p_demux, i_mk_date, p_vchapter ); + p_vsegment->Seek( *p_demux, i_mk_date, p_vchapter, b_precise ); } /* Needed by matroska_segment::Seek() and Seek */ diff --git a/modules/demux/mkv/virtual_segment.cpp b/modules/demux/mkv/virtual_segment.cpp index e41e16a..3cbfe1d 100644 --- a/modules/demux/mkv/virtual_segment.cpp +++ b/modules/demux/mkv/virtual_segment.cpp @@ -508,7 +508,8 @@ bool virtual_chapter_c::EnterAndLeave( virtual_chapter_c *p_leaving_vchapter, bo return p_chapter->EnterAndLeave( p_leaving_vchapter->p_chapter, b_enter ); } -void virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_mk_date, virtual_chapter_c *p_vchapter ) +void virtual_segment_c::Seek( demux_t & demuxer, mtime_t i_mk_date, + virtual_chapter_c *p_vchapter, bool b_precise ) { demux_sys_t *p_sys = demuxer.p_sys; diff --git a/modules/demux/mkv/virtual_segment.hpp b/modules/demux/mkv/virtual_segment.hpp index 45648d6..d4e3510 100644 --- a/modules/demux/mkv/virtual_segment.hpp +++ b/modules/demux/mkv/virtual_segment.hpp @@ -160,7 +160,7 @@ public: virtual_chapter_c * FindChapter( int64_t i_find_uid ); bool UpdateCurrentToChapter( demux_t & demux ); - void Seek( demux_t & demuxer, mtime_t i_mk_date, virtual_chapter_c *p_vchapter ); + void Seek( demux_t & demuxer, mtime_t i_mk_date, virtual_chapter_c *p_vchapter, bool b_precise = true ); private: void KeepTrackSelection( matroska_segment_c & old, matroska_segment_c & next ); }; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
