[vlc-devel] [PATCH 2/4] add spu text scaling actions
Rémi Denis-Courmont
remi at remlab.net
Fri Aug 28 13:30:39 CEST 2015
Le 2015-08-28 14:05, Francois Cartegnie a écrit :
> ---
> include/vlc_keys.h | 3 +++
> modules/control/hotkeys.c | 22 ++++++++++++++++++++++
> src/config/keys.c | 5 ++++-
> 3 files changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/include/vlc_keys.h b/include/vlc_keys.h
> index 49edab3..ea54950 100644
> --- a/include/vlc_keys.h
> +++ b/include/vlc_keys.h
> @@ -173,6 +173,9 @@ typedef enum vlc_action {
> ACTIONID_AUDIO_TRACK,
> ACTIONID_SUBTITLE_TRACK,
> ACTIONID_SUBTITLE_TOGGLE,
> + ACTIONID_SUBTITLE_TEXT_SCALE_NORMAL,
> + ACTIONID_SUBTITLE_TEXT_SCALE_UP,
> + ACTIONID_SUBTITLE_TEXT_SCALE_DOWN,
> ACTIONID_INTF_TOGGLE_FSC,
> ACTIONID_INTF_HIDE,
> ACTIONID_INTF_BOSS,
> diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
> index f5d0638..0eee78c 100644
> --- a/modules/control/hotkeys.c
> +++ b/modules/control/hotkeys.c
> @@ -1092,6 +1092,28 @@ static int PutAction( intf_thread_t *p_intf,
> int i_action )
> break;
> }
>
> + case ACTIONID_SUBTITLE_TEXT_SCALE_DOWN:
> + case ACTIONID_SUBTITLE_TEXT_SCALE_UP:
> + case ACTIONID_SUBTITLE_TEXT_SCALE_NORMAL:
> + {
> + if( p_vout )
> + {
> + float f_scale;
> + if( i_action == ACTIONID_SUBTITLE_TEXT_SCALE_NORMAL
> )
> + {
> + f_scale = 1.0;
> + }
> + else
> + {
> + f_scale = var_GetFloat( p_vout, "sub-text-scale"
> );
> + f_scale += ((i_action ==
> ACTIONID_SUBTITLE_TEXT_SCALE_UP) ? 1 : -1) * 0.25;
> + f_scale = VLC_CLIP( f_scale, 0.10, 5.0 );
Why do you use double precision?
> + }
> + var_SetFloat( p_vout, "sub-text-scale", f_scale );
> + DisplayMessage( p_vout, _( "Subtitle text scale
> %2.fx" ), f_scale );
> + }
> + }
> +
> /* Input + video output */
> case ACTIONID_POSITION:
> if( p_vout && vout_OSDEpg( p_vout, input_GetItem(
> p_input ) ) )
> diff --git a/src/config/keys.c b/src/config/keys.c
> index b247a57..94e5cf5 100644
> --- a/src/config/keys.c
> +++ b/src/config/keys.c
> @@ -260,7 +260,7 @@ found:
>
> /*** VLC key map ***/
>
> -#define MAXACTION 20
> +#define MAXACTION 26
> struct action
> {
> char name[MAXACTION];
> @@ -353,6 +353,9 @@ static const struct action actions[] =
> { "subsync-markaudio", ACTIONID_SUBSYNC_MARKAUDIO, },
> { "subsync-marksub", ACTIONID_SUBSYNC_MARKSUB, },
> { "subsync-reset", ACTIONID_SUBSYNC_RESET, },
> + { "subtitle-text-scale-down", ACTIONID_SUBTITLE_TEXT_SCALE_DOWN,
> },
> + { "subtitle-text-scale-normal",
> ACTIONID_SUBTITLE_TEXT_SCALE_NORMAL, },
> + { "subtitle-text-scale-up", ACTIONID_SUBTITLE_TEXT_SCALE_UP, },
> { "subtitle-toggle", ACTIONID_SUBTITLE_TOGGLE, },
> { "subtitle-track", ACTIONID_SUBTITLE_TRACK, },
> { "title-next", ACTIONID_TITLE_NEXT, },
You need config items first.
--
Rémi Denis-Courmont
http://www.remlab.net/
More information about the vlc-devel
mailing list