<html><head></head><body>Does the setting even make sense and is anybody using it? To me, this feels really like a per-call parameter, not a setting.<br><br><div class="gmail_quote">Le 19 juin 2018 10:14:42 GMT+03:00, Thomas Guillem <thomas@gllm.fr> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">I think this patches goes to the right direction (getting ride of variable callback to control the input).<br>One question, should the "input-fast-seek" var should be fetched only one time when the input is created ?<br><br>On Fri, Jun 15, 2018, at 14:57, Zhao Zhili wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"> ---<br> include/vlc_input.h | 4 +++<br> src/input/input.c | 83 +++++++++++++++++++++++++++++++++++++---------<br> src/input/input_internal.h | 1 -<br> src/input/var.c | 8 ++---<br> src/libvlccore.sym | 2 ++<br> 5 files changed, 77 insertions(+), 21 deletions(-)<br> <br> diff --git a/include/vlc_input.h b/include/vlc_input.h<br> index 16c566a..7e04713 100644<br> --- a/include/vlc_input.h<br> +++ b/include/vlc_input.h<br> @@ -512,6 +512,10 @@ VLC_API int input_vaControl( input_thread_t *, int <br> i_query, va_list );<br> <br> VLC_API int input_Control( input_thread_t *, int i_query, ... );<br> <br> +VLC_API int input_SetTime( input_thread_t *, mtime_t i_time, bool <br> b_fast );<br> +<br> +VLC_API int input_SetPosition( input_thread_t *, float f_position, bool <br> b_fast );<br> +<br> VLC_API void input_Close( input_thread_t * );<br> <br> /**<br> diff --git a/src/input/input.c b/src/input/input.c<br> index a413683..9003d61 100644<br> --- a/src/input/input.c<br> +++ b/src/input/input.c<br> @@ -227,6 +227,46 @@ void input_Close( input_thread_t *p_input )<br> vlc_object_release( p_input );<br> }<br> <br> +typedef struct input_seek_params_t {<br> + bool b_fast;<br> + union {<br> + mtime_t i_time;<br> + float f_position;<br> + };<br> +} input_seek_params_t;<br> +<br> +int input_SetTime( input_thread_t *p_input, mtime_t i_time, bool b_fast )<br> +{<br> + vlc_value_t val;<br> + input_seek_params_t *param;<br> +<br> + param = malloc( sizeof(*param) );<br> + if( unlikely(param == NULL) )<br> + return VLC_ENOMEM;<br> +<br> + param->b_fast = b_fast;<br> + param->i_time = i_time;<br> + val.p_address = param;<br> + input_ControlPush( p_input, INPUT_CONTROL_SET_TIME, &val );<br> + return VLC_SUCCESS;<br> +}<br> +<br> +int input_SetPosition( input_thread_t *p_input, float f_position, bool b_fast )<br> +{<br> + vlc_value_t val;<br> + input_seek_params_t *param;<br> +<br> + param = malloc( sizeof(*param) );<br> + if( unlikely(param == NULL) )<br> + return VLC_ENOMEM;<br> +<br> + param->b_fast = b_fast;<br> + param->f_position = f_position;<br> + val.p_address = param;<br> + input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION, &val );<br> + return VLC_SUCCESS;<br> +}<br> +<br> /**<br> * Input destructor (called when the object's refcount reaches 0).<br> */<br> @@ -630,16 +670,15 @@ static int MainLoopTryRepeat( input_thread_t *p_input )<br> input_ControlPush( p_input,<br> INPUT_CONTROL_SET_SEEKPOINT, &val );<br> <br> + bool b_fast_seek = var_GetBool( p_input, "input-fast-seek" );<br> /* Seek to start position */<br> if( input_priv(p_input)->i_start > 0 )<br> {<br> - val.i_int = input_priv(p_input)->i_start;<br> - input_ControlPush( p_input, INPUT_CONTROL_SET_TIME, &val );<br> + input_SetTime( p_input, input_priv(p_input)->i_start, b_fast_seek );<br> }<br> else<br> {<br> - val.f_float = 0.f;<br> - input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION, &val );<br> + input_SetPosition( p_input, 0.0f, b_fast_seek );<br> }<br> <br> return VLC_SUCCESS;<br> @@ -916,20 +955,17 @@ static void StartTitle( input_thread_t * p_input )<br> <br> if( priv->i_start > 0 )<br> {<br> - vlc_value_t s;<br> -<br> msg_Dbg( p_input, "starting at time: %"PRId64"s",<br> priv->i_start / CLOCK_FREQ );<br> <br> - s.i_int = priv->i_start;<br> - input_ControlPush( p_input, INPUT_CONTROL_SET_TIME, &s );<br> + bool b_fast_seek = var_GetBool( p_input, "input-fast-seek" );<br> + input_SetTime( p_input, priv->i_start, b_fast_seek );<br> }<br> if( priv->i_stop > 0 && priv->i_stop <= priv->i_start )<br> {<br> msg_Warn( p_input, "invalid stop-time ignored" );<br> priv->i_stop = 0;<br> }<br> - priv->b_fast_seek = var_GetBool( p_input, "input-fast-seek" );<br> }<br> <br> static int SlaveCompare(const void *a, const void *b)<br> @@ -1627,6 +1663,8 @@ static void ControlRelease( int i_type, vlc_value_t val )<br> case INPUT_CONTROL_SET_VIEWPOINT:<br> case INPUT_CONTROL_SET_INITIAL_VIEWPOINT:<br> case INPUT_CONTROL_UPDATE_VIEWPOINT:<br> + case INPUT_CONTROL_SET_TIME:<br> + case INPUT_CONTROL_SET_POSITION:<br> free( val.p_address );<br> break;<br> case INPUT_CONTROL_SET_RENDERER:<br> @@ -1849,7 +1887,8 @@ static bool Control( input_thread_t *p_input,<br> break;<br> }<br> <br> - float f_pos = val.f_float;<br> + input_seek_params_t *param = val.p_address;<br> + float f_pos = param->f_position;<br> if( f_pos < 0.f )<br> f_pos = 0.f;<br> else if( f_pos > 1.f )<br> @@ -1857,7 +1896,7 @@ static bool Control( input_thread_t *p_input,<br> /* Reset the decoders states and clock sync (before calling <br> the demuxer */<br> es_out_Control( input_priv(p_input)->p_es_out, <br> ES_OUT_RESET_PCR );<br> if( demux_Control( input_priv(p_input)->master->p_demux, <br> DEMUX_SET_POSITION,<br> - (double) f_pos, !input_priv(p_input)-<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;">b_fast_seek ) )<br></blockquote> + (double) f_pos, !param->b_fast ) )<br> {<br> msg_Err( p_input, "INPUT_CONTROL_SET_POSITION "<br> "%2.1f%% failed", (double)(f_pos * 100.f) );<br> @@ -1877,6 +1916,7 @@ static bool Control( input_thread_t *p_input,<br> {<br> int64_t i_time;<br> int i_ret;<br> + input_seek_params_t *param;<br> <br> if( input_priv(p_input)->b_recording )<br> {<br> @@ -1884,7 +1924,8 @@ static bool Control( input_thread_t *p_input,<br> break;<br> }<br> <br> - i_time = val.i_int;<br> + param = val.p_address;<br> + i_time = param->i_time;<br> if( i_time < 0 )<br> i_time = 0;<br> <br> @@ -1893,7 +1934,7 @@ static bool Control( input_thread_t *p_input,<br> <br> i_ret = demux_Control( input_priv(p_input)->master-<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;">p_demux,<br></blockquote> DEMUX_SET_TIME, i_time,<br> - !input_priv(p_input)->b_fast_seek );<br> + !param->b_fast );<br> if( i_ret )<br> {<br> int64_t i_length;<br> @@ -1905,7 +1946,7 @@ static bool Control( input_thread_t *p_input,<br> double f_pos = (double)i_time / (double)i_length;<br> i_ret = demux_Control( input_priv(p_input)->master-<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;">p_demux,<br></blockquote> DEMUX_SET_POSITION, f_pos,<br> - !input_priv(p_input)-<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;">b_fast_seek );<br></blockquote> + !param->b_fast );<br> }<br> }<br> if( i_ret )<br> @@ -2236,8 +2277,18 @@ static bool Control( input_thread_t *p_input,<br> break;<br> }<br> <br> - val.i_int = time_offset;<br> - b_force_update = Control( p_input, INPUT_CONTROL_SET_TIME, <br> val );<br> + vlc_value_t seek_val;<br> + input_seek_params_t *param;<br> +<br> + param = malloc( sizeof(*param) );<br> + if( unlikely(param == NULL) )<br> + break;<br> +<br> + param->b_fast = var_GetBool( p_input, "input-fast-seek" );<br> + param->i_time = time_offset;<br> + seek_val.p_address = param;<br> +<br> + b_force_update = Control( p_input, INPUT_CONTROL_SET_TIME, <br> seek_val );<br> break;<br> }<br> case INPUT_CONTROL_SET_RENDERER:<br> diff --git a/src/input/input_internal.h b/src/input/input_internal.h<br> index c0b8ae4..bc38a09 100644<br> --- a/src/input/input_internal.h<br> +++ b/src/input/input_internal.h<br> @@ -106,7 +106,6 @@ typedef struct input_thread_private_t<br> mtime_t i_start; /* :start-time,0 by default */<br> mtime_t i_stop; /* :stop-time, 0 if none */<br> mtime_t i_time; /* Current time */<br> - bool b_fast_seek;/* :input-fast-seek */<br> <br> /* Output */<br> bool b_out_pace_control; /* XXX Move it ot es_sout ? */<br> diff --git a/src/input/var.c b/src/input/var.c<br> index 04c8cb0..717ae74 100644<br> --- a/src/input/var.c<br> +++ b/src/input/var.c<br> @@ -593,8 +593,8 @@ static int PositionCallback( vlc_object_t *p_this, <br> char const *psz_cmd,<br> var_Change( p_input, "time", VLC_VAR_SETVALUE, val );<br> }<br> <br> - input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION, &newval );<br> - return VLC_SUCCESS;<br> + return input_SetPosition( p_input, newval.f_float,<br> + var_GetBool( p_input, "input-fast-seek" ) );<br> }<br> <br> static int TimeCallback( vlc_object_t *p_this, char const *psz_cmd,<br> @@ -618,8 +618,8 @@ static int TimeCallback( vlc_object_t *p_this, char <br> const *psz_cmd,<br> var_SetInteger( p_input, "intf-event", INPUT_EVENT_POSITION );<br> }<br> <br> - input_ControlPush( p_input, INPUT_CONTROL_SET_TIME, &newval );<br> - return VLC_SUCCESS;<br> + return input_SetTime( p_input, newval.i_int,<br> + var_GetBool( p_input, "input-fast-seek" ) );<br> }<br> <br> static int TimeOffsetCallback( vlc_object_t *obj, char const *varname,<br> diff --git a/src/libvlccore.sym b/src/libvlccore.sym<br> index e32a686..f9418b1 100644<br> --- a/src/libvlccore.sym<br> +++ b/src/libvlccore.sym<br> @@ -202,6 +202,8 @@ input_resource_GetAout<br> input_resource_HoldAout<br> input_resource_PutAout<br> input_resource_ResetAout<br> +input_SetPosition<br> +input_SetTime<br> input_Start<br> input_Stop<br> input_vaControl<br> -- <br> 2.9.5<br> <br><hr><br> vlc-devel mailing list<br> To unsubscribe or modify your subscription options:<br> <a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a><br></blockquote><hr><br>vlc-devel mailing list<br>To unsubscribe or modify your subscription options:<br><a href="https://mailman.videolan.org/listinfo/vlc-devel">https://mailman.videolan.org/listinfo/vlc-devel</a></pre></blockquote></div><br>
-- <br>
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.</body></html>