[vlc-devel] [PATCH] demux: avformat: handle fast seeking
Rémi Denis-Courmont
remi at remlab.net
Tue Jun 26 10:29:29 CEST 2018
Le mardi 26 juin 2018, 05:07:51 EEST Zhao Zhili a écrit :
> ---
> modules/demux/avformat/demux.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
Please use scoped variables in new code.
>
> diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
> index 4a66706..8d3602b 100644
> --- a/modules/demux/avformat/demux.c
> +++ b/modules/demux/avformat/demux.c
> @@ -1005,6 +1005,7 @@ static int Control( demux_t *p_demux, int i_query,
> va_list args ) const int64_t i_start_time = p_sys->ic->start_time !=
> (int64_t)AV_NOPTS_VALUE ? p_sys->ic->start_time : 0; double f, *pf;
> int64_t i64, *pi64;
> + bool b;
>
> switch( i_query )
> {
> @@ -1030,6 +1031,7 @@ static int Control( demux_t *p_demux, int i_query,
> va_list args )
>
> case DEMUX_SET_POSITION:
> f = va_arg( args, double );
> + b = va_arg( args, int );
> i64 = p_sys->ic->duration * f + i_start_time;
>
> msg_Warn( p_demux, "DEMUX_SET_POSITION: %"PRId64, i64 );
> @@ -1050,7 +1052,10 @@ static int Control( demux_t *p_demux, int i_query,
> va_list args ) }
> else
> {
> - ResetTime( p_demux, i64 - i_start_time );
> + if( b )
> + ResetTime( p_demux, i64 - i_start_time );
> + else
> + ResetTime( p_demux, -1 );
> }
> return VLC_SUCCESS;
>
> @@ -1070,6 +1075,7 @@ 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 );
> i64 = i64 * AV_TIME_BASE / CLOCK_FREQ + i_start_time;
>
> msg_Warn( p_demux, "DEMUX_SET_TIME: %"PRId64, i64 );
> @@ -1078,7 +1084,10 @@ static int Control( demux_t *p_demux, int i_query,
> va_list args ) {
> return VLC_EGENERIC;
> }
> - ResetTime( p_demux, i64 - i_start_time );
> + if( b )
> + ResetTime( p_demux, i64 - i_start_time );
> + else
> + ResetTime( p_demux, -1 );
> return VLC_SUCCESS;
> }
--
Rémi Denis-Courmont
More information about the vlc-devel
mailing list