[vlc-commits] input: spread normal_time via input events
Thomas Guillem
git at videolan.org
Mon Sep 23 13:36:21 CEST 2019
vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Sep 10 18:28:04 2019 +0200| [27b689c0ac5741400da1230f0e5ad30c8f422004] | committer: Thomas Guillem
input: spread normal_time via input events
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=27b689c0ac5741400da1230f0e5ad30c8f422004
---
src/input/es_out.c | 7 +++++--
src/input/es_out.h | 9 ++++++---
src/input/es_out_timeshift.c | 4 ++++
src/input/event.h | 3 ++-
src/input/input.c | 11 +++++++++--
src/input/input_internal.h | 2 ++
6 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/src/input/es_out.c b/src/input/es_out.c
index 6e30fbfe43..8b8200285d 100644
--- a/src/input/es_out.c
+++ b/src/input/es_out.c
@@ -3309,6 +3309,7 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
{
double f_position = va_arg( args, double );
vlc_tick_t i_time = va_arg( args, vlc_tick_t );
+ vlc_tick_t i_normal_time = va_arg( args, vlc_tick_t );
vlc_tick_t i_length = va_arg( args, vlc_tick_t );
if( !p_sys->b_buffering )
@@ -3334,12 +3335,14 @@ static int EsOutVaControlLocked( es_out_t *out, int i_query, va_list args )
if( f_position < 0 )
f_position = 0;
+ assert( i_normal_time >= VLC_TICK_0 );
+
input_SendEventTimes( p_sys->p_input, f_position, i_time,
- i_length );
+ i_normal_time, i_length );
}
else
input_SendEventTimes( p_sys->p_input, 0.0, VLC_TICK_INVALID,
- i_length );
+ i_normal_time, i_length );
return VLC_SUCCESS;
}
case ES_OUT_SET_JITTER:
diff --git a/src/input/es_out.h b/src/input/es_out.h
index 30e199579e..e6cde26366 100644
--- a/src/input/es_out.h
+++ b/src/input/es_out.h
@@ -76,7 +76,7 @@ enum es_out_query_private_e
ES_OUT_SET_FRAME_NEXT, /* res=can fail */
/* Set position/time/length */
- ES_OUT_SET_TIMES, /* arg1=double f_position arg2=vlc_tick_t i_time arg3=vlc_tick_t i_length res=cannot fail */
+ ES_OUT_SET_TIMES, /* arg1=double f_position arg2=vlc_tick_t i_time arg3=vlc_tick_t i_normal_time arg4=vlc_tick_t i_length res=cannot fail */
/* Set jitter */
ES_OUT_SET_JITTER, /* arg1=vlc_tick_t i_pts_delay arg2= vlc_tick_t i_pts_jitter, arg2=int i_cr_average res=cannot fail */
@@ -149,9 +149,12 @@ static inline int es_out_SetFrameNext( es_out_t *p_out )
{
return es_out_Control( p_out, ES_OUT_SET_FRAME_NEXT );
}
-static inline void es_out_SetTimes( es_out_t *p_out, double f_position, vlc_tick_t i_time, vlc_tick_t i_length )
+static inline void es_out_SetTimes( es_out_t *p_out, double f_position,
+ vlc_tick_t i_time, vlc_tick_t i_normal_time,
+ vlc_tick_t i_length )
{
- int i_ret = es_out_Control( p_out, ES_OUT_SET_TIMES, f_position, i_time, i_length );
+ int i_ret = es_out_Control( p_out, ES_OUT_SET_TIMES, f_position, i_time,
+ i_normal_time, i_length );
assert( !i_ret );
}
static inline void es_out_SetJitter( es_out_t *p_out,
diff --git a/src/input/es_out_timeshift.c b/src/input/es_out_timeshift.c
index 2fd8855251..ed79000f65 100644
--- a/src/input/es_out_timeshift.c
+++ b/src/input/es_out_timeshift.c
@@ -135,6 +135,7 @@ typedef struct attribute_packed
/* FIXME Really too big (double make the whole thing too big) */
double f_position;
vlc_tick_t i_time;
+ vlc_tick_t i_normal_time;
vlc_tick_t i_length;
} times;
struct
@@ -1517,10 +1518,12 @@ static int CmdInitControl( ts_cmd_t *p_cmd, int i_query, va_list args, bool b_co
{
double f_position = va_arg( args, double );
vlc_tick_t i_time = va_arg( args, vlc_tick_t );
+ vlc_tick_t i_normal_time = va_arg( args, vlc_tick_t );
vlc_tick_t i_length = va_arg( args, vlc_tick_t );
p_cmd->u.control.u.times.f_position = f_position;
p_cmd->u.control.u.times.i_time = i_time;
+ p_cmd->u.control.u.times.i_normal_time = i_normal_time;
p_cmd->u.control.u.times.i_length = i_length;
break;
}
@@ -1612,6 +1615,7 @@ static int CmdExecuteControl( es_out_t *p_out, ts_cmd_t *p_cmd )
case ES_OUT_SET_TIMES:
return es_out_Control( p_out, i_query, p_cmd->u.control.u.times.f_position,
p_cmd->u.control.u.times.i_time,
+ p_cmd->u.control.u.times.i_normal_time,
p_cmd->u.control.u.times.i_length );
case ES_OUT_SET_JITTER:
return es_out_Control( p_out, i_query, p_cmd->u.control.u.jitter.i_pts_delay,
diff --git a/src/input/event.h b/src/input/event.h
index 3899563889..dd9aec4a87 100644
--- a/src/input/event.h
+++ b/src/input/event.h
@@ -56,11 +56,12 @@ static inline void input_SendEventCapabilities(input_thread_t *p_input,
static inline void input_SendEventTimes(input_thread_t *p_input,
double f_position, vlc_tick_t i_time,
+ vlc_tick_t i_normal_time,
vlc_tick_t i_length)
{
input_SendEvent(p_input, &(struct vlc_input_event) {
.type = INPUT_EVENT_TIMES,
- .times = { f_position, i_time, i_length }
+ .times = { f_position, i_time, i_normal_time, i_length }
});
}
diff --git a/src/input/input.c b/src/input/input.c
index ebb1af8817..d403d8d346 100644
--- a/src/input/input.c
+++ b/src/input/input.c
@@ -305,6 +305,7 @@ static input_thread_t *Create( vlc_object_t *p_parent,
priv->is_stopped = false;
priv->b_recording = false;
priv->rate = 1.f;
+ priv->normal_time = VLC_TICK_0;
TAB_INIT( priv->i_attachment, priv->attachment );
priv->attachment_demux = NULL;
priv->p_sout = NULL;
@@ -625,7 +626,12 @@ static void MainLoopStatistics( input_thread_t *p_input )
if( demux_Control( priv->master->p_demux, DEMUX_GET_LENGTH, &i_length ) )
i_length = VLC_TICK_INVALID;
- es_out_SetTimes( priv->p_es_out, f_position, i_time, i_length );
+ /* In case of failure (not implemented or in case of seek), use the last
+ * normal_time value (that is VLC_TICK_0 by default). */
+ demux_Control( priv->master->p_demux, DEMUX_GET_NORMAL_TIME, &priv->normal_time );
+
+ es_out_SetTimes( priv->p_es_out, f_position, i_time, priv->normal_time,
+ i_length );
struct input_stats_t new_stats;
if( priv->stats != NULL )
@@ -1272,7 +1278,8 @@ static int Init( input_thread_t * p_input )
if( i_length == VLC_TICK_INVALID )
i_length = input_item_GetDuration( priv->p_item );
- input_SendEventTimes( p_input, 0.0, VLC_TICK_INVALID, i_length );
+ input_SendEventTimes( p_input, 0.0, VLC_TICK_INVALID, priv->normal_time,
+ i_length );
if( !priv->b_preparsing )
{
diff --git a/src/input/input_internal.h b/src/input/input_internal.h
index 12613bafc6..916a8e9e0f 100644
--- a/src/input/input_internal.h
+++ b/src/input/input_internal.h
@@ -161,6 +161,7 @@ struct vlc_input_event_times
{
float percentage;
vlc_tick_t ms;
+ vlc_tick_t normal_time;
vlc_tick_t length;
};
@@ -463,6 +464,7 @@ typedef struct input_thread_private_t
bool b_recording;
bool b_thumbnailing;
float rate;
+ vlc_tick_t normal_time;
/* Playtime configuration and state */
vlc_tick_t i_start; /* :start-time,0 by default */
More information about the vlc-commits
mailing list