Commit 550c8dae authored by Filip Roséen's avatar Filip Roséen Committed by 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's avatarJean-Baptiste Kempf <jb@videolan.org>
parent f1bf530a
......@@ -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 */
......
......@@ -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;
......
......@@ -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 );
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment