[vlc-commits] demux: avi: handle fastseek
Francois Cartegnie
git at videolan.org
Fri Oct 6 11:00:32 CEST 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Oct 6 10:24:38 2017 +0200| [341d50ffa447a4718395e921efd33980994bb46e] | committer: Francois Cartegnie
demux: avi: handle fastseek
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=341d50ffa447a4718395e921efd33980994bb46e
---
modules/demux/avi/avi.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index dd5c03c98e..722b5a45c0 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -91,7 +91,7 @@ vlc_module_end ()
* Local prototypes
*****************************************************************************/
static int Control ( demux_t *, int, va_list );
-static int Seek ( demux_t *, mtime_t, int );
+static int Seek ( demux_t *, mtime_t, int, bool );
static int Demux_Seekable ( demux_t * );
static int Demux_UnSeekable( demux_t * );
@@ -1493,7 +1493,7 @@ static int Demux_UnSeekable( demux_t *p_demux )
/*****************************************************************************
* Seek: goto to i_date or i_percent
*****************************************************************************/
-static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
+static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent, bool b_accurate )
{
demux_sys_t *p_sys = p_demux->p_sys;
msg_Dbg( p_demux, "seek requested: %"PRId64" seconds %d%%",
@@ -1622,7 +1622,8 @@ static int Seek( demux_t *p_demux, mtime_t i_date, int i_percent )
}
p_sys->i_time = i_start;
es_out_SetPCR( p_demux->out, VLC_TS_0 + p_sys->i_time );
- es_out_Control( p_demux->out, ES_OUT_SET_NEXT_DISPLAY_TIME, VLC_TS_0 + i_date );
+ if( b_accurate )
+ es_out_Control( p_demux->out, ES_OUT_SET_NEXT_DISPLAY_TIME, VLC_TS_0 + i_date );
msg_Dbg( p_demux, "seek: %"PRId64" seconds", p_sys->i_time /CLOCK_FREQ );
return VLC_SUCCESS;
@@ -1664,6 +1665,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
demux_sys_t *p_sys = p_demux->p_sys;
double f, *pf;
int64_t i64, *pi64;
+ bool b;
vlc_meta_t *p_meta;
switch( i_query )
@@ -1678,6 +1680,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
return VLC_SUCCESS;
case DEMUX_SET_POSITION:
f = va_arg( args, double );
+ b = va_arg( args, int );
if ( !p_sys->b_seekable )
{
return VLC_EGENERIC;
@@ -1685,7 +1688,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
else
{
i64 = (mtime_t)(f * CLOCK_FREQ * p_sys->i_length);
- return Seek( p_demux, i64, (int)(f * 100) );
+ return Seek( p_demux, i64, (int)(f * 100), b );
}
case DEMUX_GET_TIME:
@@ -1698,6 +1701,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
int i_percent = 0;
i64 = va_arg( args, int64_t );
+ b = va_arg( args, int );
if( !p_sys->b_seekable )
{
return VLC_EGENERIC;
@@ -1711,7 +1715,7 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
i_percent = (int)( 100.0 * ControlGetPosition( p_demux ) *
(double)i64 / (double)p_sys->i_time );
}
- return Seek( p_demux, i64, i_percent );
+ return Seek( p_demux, i64, i_percent, b );
}
case DEMUX_GET_LENGTH:
pi64 = va_arg( args, int64_t * );
More information about the vlc-commits
mailing list