vlc | branch: master | Thomas Guillem <[email protected]> | Thu Jul 11 16:27:57 2019 +0200| [5e2e94b64413baabb1ca3ac57e699f5276a88ca2] | committer: Thomas Guillem
input: always call es_out functions from input thread Locking the es_out can be blocking since it can wait for the decoder. Therefore, we must always go through an input control to call es_out functions. This is a partial revert of 1f51e1d214771f7d609d518178c0e4c173dff8dd When this partially reverted commit said: "Maybe, it would be better to completely hide all input controls and let the input implementation decide if a control need to be handled from the MainLoop thread or can be handled directly." => This can only be done when all es_out control are non blocking (maybe with the 5.0 input buffering rewrite ?) > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5e2e94b64413baabb1ca3ac57e699f5276a88ca2 --- src/input/input.c | 28 +++++++++++++--------------- src/input/input_internal.h | 23 +++++++++++++---------- src/input/player.c | 12 +++++++++--- 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/src/input/input.c b/src/input/input.c index d4639de45c..9d0bc94e78 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -237,21 +237,6 @@ void input_SetPosition( input_thread_t *p_input, float f_position, bool b_fast ) input_ControlPush( p_input, INPUT_CONTROL_SET_POSITION, ¶m ); } -void input_SetCategoryDelay(input_thread_t *input, enum es_format_category_e cat, - vlc_tick_t delay) -{ - assert(cat == AUDIO_ES || cat == SPU_ES); - es_out_SetDelay(input_priv(input)->p_es_out_display, cat, delay); -} - -void input_SetEsIdDelay(input_thread_t *input, vlc_es_id_t *es_id, - vlc_tick_t delay) -{ - assert(es_id); - es_out_SetEsDelay(input_priv(input)->p_es_out_display, - vlc_es_id_get_out(es_id), delay); -} - /** * Get the item from an input thread * FIXME it does not increase ref count of the item. @@ -2090,6 +2075,19 @@ static bool Control( input_thread_t *p_input, ViewpointApply( p_input ); break; + case INPUT_CONTROL_SET_CATEGORY_DELAY: + assert(param.cat_delay.cat == AUDIO_ES + || param.cat_delay.cat == SPU_ES); + es_out_SetDelay(priv->p_es_out_display, + param.cat_delay.cat, param.cat_delay.delay); + break; + case INPUT_CONTROL_SET_ES_DELAY: + assert(param.es_delay.id); + es_out_SetEsDelay(priv->p_es_out_display, + vlc_es_id_get_out(param.es_delay.id), + param.es_delay.delay); + break; + case INPUT_CONTROL_SET_TITLE: case INPUT_CONTROL_SET_TITLE_NEXT: case INPUT_CONTROL_SET_TITLE_PREV: diff --git a/src/input/input_internal.h b/src/input/input_internal.h index b9e27810fc..b0bc7b6d16 100644 --- a/src/input/input_internal.h +++ b/src/input/input_internal.h @@ -324,16 +324,6 @@ void input_SetTime( input_thread_t *, vlc_tick_t i_time, bool b_fast ); void input_SetPosition( input_thread_t *, float f_position, bool b_fast ); /** - * Set the delay of an ES category - * - * If called before input_Start(), the delay will be applied for next ES - * tracks. If called after input_Start(), the delay will be applied for all - * tracks of the category (and all future tracks). - */ -void input_SetCategoryDelay(input_thread_t *input, enum es_format_category_e cat, - vlc_tick_t delay); - -/** * Set the delay of an ES identifier */ void input_SetEsIdDelay(input_thread_t *input, vlc_es_id_t *es_id, @@ -407,6 +397,16 @@ typedef union bool b_fast_seek; float f_val; } pos; + struct + { + enum es_format_category_e cat; + vlc_tick_t delay; + } cat_delay; + struct + { + vlc_es_id_t *id; + vlc_tick_t delay; + } es_delay; struct { vlc_es_id_t *id; unsigned page; @@ -552,6 +552,9 @@ enum input_control_e INPUT_CONTROL_SET_INITIAL_VIEWPOINT, // set initial viewpoint (generally from video) INPUT_CONTROL_UPDATE_VIEWPOINT, // update viewpoint relative to current + INPUT_CONTROL_SET_CATEGORY_DELAY, + INPUT_CONTROL_SET_ES_DELAY, + INPUT_CONTROL_ADD_SLAVE, INPUT_CONTROL_SET_SUBS_FPS, diff --git a/src/input/player.c b/src/input/player.c index 44d22b640b..3d51666b5b 100644 --- a/src/input/player.c +++ b/src/input/player.c @@ -708,7 +708,11 @@ vlc_player_input_New(vlc_player_t *player, input_item_t *item) input->cat_delays[i] = cat_delays[i]; if (cat_delays[i] != 0) { - input_SetCategoryDelay(input->thread, i, cat_delays[i]); + const input_control_param_t param = { + .cat_delay = { i, cat_delays[i] } + }; + input_ControlPush(input->thread, INPUT_CONTROL_SET_CATEGORY_DELAY, + ¶m); vlc_player_SendEvent(player, on_category_delay_changed, i, cat_delays[i]); } @@ -3025,7 +3029,8 @@ vlc_player_SetCategoryDelay(vlc_player_t *player, enum es_format_category_e cat, delay = *cat_delay; } - input_SetCategoryDelay(input->thread, cat, delay); + const input_control_param_t param = { .cat_delay = { cat, delay } }; + input_ControlPush(input->thread, INPUT_CONTROL_SET_CATEGORY_DELAY, ¶m); vlc_player_vout_OSDMessage(player, _("%s delay: %i ms"), es_format_category_to_string(cat), (int)MS_FROM_VLC_TICK(delay)); @@ -3071,7 +3076,8 @@ vlc_player_SetEsIdDelay(vlc_player_t *player, vlc_es_id_t *es_id, delay = trackpriv->delay; } - input_SetEsIdDelay(input->thread, es_id, delay); + const input_control_param_t param = { .es_delay = { es_id, delay } }; + input_ControlPush(input->thread, INPUT_CONTROL_SET_ES_DELAY, ¶m); if (delay != INT64_MAX) vlc_player_vout_OSDMessage(player, _("%s delay: %i ms"), trackpriv->t.name, _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
