[vlc-devel] [RFC PATCH 07/10] input: Query a potential stream output for its time/pos
Rémi Denis-Courmont
remi at remlab.net
Thu Sep 7 16:58:01 CEST 2017
Le torstaina 7. syyskuuta 2017, 15.46.03 EEST Hugo Beauzée-Luyssen a écrit :
> Also forward pause request
> ---
> src/input/input.c | 13 +++++++++++--
This seems out of place. The ES output, not the input thread, normally
controls the sout instance.
> src/input/var.c | 2 ++
> 2 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/src/input/input.c b/src/input/input.c
> index 956d441982..924fcf6e45 100644
> --- a/src/input/input.c
> +++ b/src/input/input.c
> @@ -43,6 +43,7 @@
> #include "item.h"
> #include "resource.h"
> #include "stream.h"
> +#include "stream_output/stream_output.h"
>
> #include <vlc_aout.h>
> #include <vlc_sout.h>
> @@ -652,13 +653,16 @@ static void MainLoopStatistics( input_thread_t
> *p_input ) double f_position = 0.0;
> mtime_t i_time = 0;
> mtime_t i_length = 0;
> + sout_instance_t *p_sout = input_priv(p_input)->p_sout;
>
> /* update input status variables */
> - if( demux_Control( input_priv(p_input)->master->p_demux,
> + if( sout_InstanceGetPosition( p_sout, &f_position ) &&
> + demux_Control( input_priv(p_input)->master->p_demux,
> DEMUX_GET_POSITION, &f_position ) )
> f_position = 0.0;
>
> - if( demux_Control( input_priv(p_input)->master->p_demux,
> + if( sout_InstanceGetTime( p_sout, &i_time ) &&
> + demux_Control( input_priv(p_input)->master->p_demux,
> DEMUX_GET_TIME, &i_time ) )
> i_time = 0;
> input_priv(p_input)->i_time = i_time;
> @@ -1732,6 +1736,8 @@ static void ControlPause( input_thread_t *p_input,
> mtime_t i_control_date ) return;
> }
>
> + sout_InstanceSetPauseState( input_priv(p_input)->p_sout, true );
> +
> /* Switch to new state */
> input_ChangeState( p_input, i_state );
> }
> @@ -1753,6 +1759,7 @@ static void ControlUnpause( input_thread_t *p_input,
> mtime_t i_control_date ) /* Switch to play */
> input_ChangeState( p_input, PLAYING_S );
> es_out_SetPauseState( input_priv(p_input)->p_es_out, false, false,
> i_control_date ); + sout_InstanceSetPauseState(
> input_priv(p_input)->p_sout, false ); }
>
> static void ViewpointApply( input_thread_t *p_input )
> @@ -1950,6 +1957,8 @@ static bool Control( input_thread_t *p_input,
> /* Reset the decoders states and clock sync (before calling the
> demuxer */ es_out_SetTime( input_priv(p_input)->p_es_out, -1 );
>
> + sout_InstanceSetTime( input_priv(p_input)->p_sout, i_time );
> +
> i_ret = demux_Control( input_priv(p_input)->master->p_demux,
> DEMUX_SET_TIME, i_time,
> !input_priv(p_input)->b_fast_seek );
> diff --git a/src/input/var.c b/src/input/var.c
> index f41dac5e9e..cecc756cbe 100644
> --- a/src/input/var.c
> +++ b/src/input/var.c
> @@ -29,6 +29,7 @@
> #endif
>
> #include <vlc_common.h>
> +#include "stream_output/stream_output.h"
> #include <assert.h>
> #include <math.h>
> #include <stdio.h>
> @@ -609,6 +610,7 @@ static int PositionCallback( vlc_object_t *p_this, char
> const *psz_cmd, val.i_int = i_length * newval.f_float;
> var_Change( p_input, "time", VLC_VAR_SETVALUE, &val, NULL );
> }
> + sout_InstanceSetPosition( input_priv(p_input)->p_sout, newval.f_float
> );
>
> input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION, &newval );
> return VLC_SUCCESS;
--
雷米‧德尼-库尔蒙
https://www.remlab.net/
More information about the vlc-devel
mailing list