[vlc-devel] [PATCH 04/15] Add function to toggle multiple SPU ES selection enabled
Thomas Guillem
thomas at gllm.fr
Wed May 15 11:09:08 CEST 2019
On Tue, May 14, 2019, at 11:41, Roland Bewick wrote:
> ---
> include/vlc_player.h | 24 +++++++++++++++++++++++
> modules/gui/macosx/playlist/VLCPlayerController.m | 1 +
> modules/gui/qt/components/player_controller.cpp | 1 +
> src/input/es_out.c | 3 ++-
> src/input/player.c | 11 +++++++++++
> src/input/var.c | 1 +
> src/libvlccore.sym | 1 +
> 7 files changed, 41 insertions(+), 1 deletion(-)
>
> diff --git a/include/vlc_player.h b/include/vlc_player.h
> index 077b3883ad..370accb78d 100644
> --- a/include/vlc_player.h
> +++ b/include/vlc_player.h
> @@ -697,6 +697,18 @@ struct vlc_player_cbs
> float subs_fps, void *data);
>
> /**
> + * Called when dual subtitles enabled has changed
> + *
> + * @see vlc_player_SetDualSubtitlesEnabled()
> + *
> + * @param player locked player instance
> + * @param enabled true if dual subtitle selection is enabled
> + * @param data opaque pointer set by vlc_player_AddListener()
> + */
> + void (*on_dual_subtitles_enabled_changed)(vlc_player_t *player,
> + bool enabled, void *data);
> +
> + /**
> * Called when a new renderer item is set
> *
> * @see vlc_player_SetRenderer()
> @@ -2260,6 +2272,18 @@ VLC_API float
> vlc_player_GetAssociatedSubsFPS(vlc_player_t *player);
>
> /**
> + * Enable or disable the abiltity to select multiple sub tracks.
> + *
> + * @note A successful call will trigger the
> + * vlc_player_cbs.on_dual_subtitles_enabled_changed event.
> + *
> + * @param player locked player instance
> + * @param enabled Enable dual subtitle track selection
> + */
> +VLC_API void
> +vlc_player_SetDualSubtitlesEnabled(vlc_player_t *player, bool enabled);
I don't understand why you would need 2 functions:
vlc_player_SetDualSubtitlesEnabled and vlc_player_SetSubtitleMultipleSelection
> +
> +/**
> * Set the renderer
> *
> * Valid for the current media and all future ones.
> diff --git a/modules/gui/macosx/playlist/VLCPlayerController.m
> b/modules/gui/macosx/playlist/VLCPlayerController.m
> index 463bee5946..d23770995f 100644
> --- a/modules/gui/macosx/playlist/VLCPlayerController.m
> +++ b/modules/gui/macosx/playlist/VLCPlayerController.m
> @@ -462,6 +462,7 @@ static const struct vlc_player_cbs player_callbacks
> = {
> cb_player_audio_delay_changed,
> cb_player_subtitle_delay_changed,
> cb_player_associated_subs_fps_changed,
> + NULL, //cb_player_dual_subtitles_enabled_changed
> cb_player_renderer_changed,
> cb_player_record_changed,
> NULL, //cb_player_signal_changed,
> diff --git a/modules/gui/qt/components/player_controller.cpp
> b/modules/gui/qt/components/player_controller.cpp
> index e42f7b5b9d..994ba6dae4 100644
> --- a/modules/gui/qt/components/player_controller.cpp
> +++ b/modules/gui/qt/components/player_controller.cpp
> @@ -818,6 +818,7 @@ static const struct vlc_player_cbs player_cbs = {
> on_player_audio_delay_changed,
> on_player_subtitle_delay_changed,
> on_player_associated_subs_fps_changed,
> + NULL, //on_player_dual_subtitles_enabled_changed,
> on_player_renderer_changed,
> on_player_record_changed,
> on_player_signal_changed,
> diff --git a/src/input/es_out.c b/src/input/es_out.c
> index dc14a970b6..7395d69353 100644
> --- a/src/input/es_out.c
> +++ b/src/input/es_out.c
> @@ -2081,7 +2081,8 @@ static void EsOutSelect( es_out_t *out,
> es_out_id_t *es, bool b_force )
> bool b_select_secondary_subtitle = es->fmt.i_cat == SPU_ES &&
> p_sys->b_multiple_subtitle_selection &&
> p_esprops->p_main_es != NULL &&
> - EsIsSelected(p_esprops->p_main_es);
> + EsIsSelected(p_esprops->p_main_es) &&
> + var_GetBool( p_sys->p_input,
> "multiple-spus" );
>
> if ( b_select_secondary_subtitle &&
> EsOutCountSelected( p_sys, es->fmt.i_cat ) > 1 )
> diff --git a/src/input/player.c b/src/input/player.c
> index 843f86000c..620af48bc6 100644
> --- a/src/input/player.c
> +++ b/src/input/player.c
> @@ -2156,6 +2156,17 @@ vlc_player_GetAssociatedSubsFPS(vlc_player_t *player)
> }
>
> void
> +vlc_player_SetDualSubtitlesEnabled(vlc_player_t *player, bool enabled)
> +{
> + struct vlc_player_input *input =
> vlc_player_get_input_locked(player);
> + if (input)
> + {
> + var_SetBool(input->thread, "multiple-spus", enabled);
> + vlc_player_SendEvent(player,
> on_dual_subtitles_enabled_changed, enabled);
> + }
> +}
> +
> +void
> vlc_player_InvalidateNextMedia(vlc_player_t *player)
> {
> vlc_player_assert_locked(player);
> diff --git a/src/input/var.c b/src/input/var.c
> index 7822d66003..9110624eab 100644
> --- a/src/input/var.c
> +++ b/src/input/var.c
> @@ -726,6 +726,7 @@ void input_ConfigVarInit ( input_thread_t *p_input )
> var_Create( p_input, "video", VLC_VAR_BOOL | VLC_VAR_DOINHERIT
> );
> var_Create( p_input, "audio", VLC_VAR_BOOL | VLC_VAR_DOINHERIT
> );
> var_Create( p_input, "spu", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
> + var_Create( p_input, "multiple-spus", VLC_VAR_BOOL);
>
> var_Create( p_input, "video-track",
> VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
> var_Create( p_input, "audio-track",
> VLC_VAR_INTEGER|VLC_VAR_DOINHERIT );
> diff --git a/src/libvlccore.sym b/src/libvlccore.sym
> index d0070d42b8..175d9a9639 100644
> --- a/src/libvlccore.sym
> +++ b/src/libvlccore.sym
> @@ -869,6 +869,7 @@ vlc_player_SetSubtitleDelay
> vlc_player_SetSubtitleSync
> vlc_player_SetSubtitleTextScale
> vlc_player_SetSubtitleMultipleSelection
> +vlc_player_SetDualSubtitlesEnabled
> vlc_player_SetTeletextEnabled
> vlc_player_SetTeletextTransparency
> vlc_player_SetTrackCategoryEnabled
> --
> 2.11.0
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list