[vlc-devel] [PATCH 2/4] add spu text scaling actions

Francois Cartegnie fcvlcdev at free.fr
Fri Aug 28 20:01:29 CEST 2015


---
 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..7c4ee7f 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 )
+            {
+                int i_scale;
+                if( i_action == ACTIONID_SUBTITLE_TEXT_SCALE_NORMAL )
+                {
+                    i_scale = 100;
+                }
+                else
+                {
+                    i_scale = var_GetInteger( p_vout, "sub-text-scale" );
+                    i_scale += ((i_action == ACTIONID_SUBTITLE_TEXT_SCALE_UP) ? 1 : -1) * 25;
+                    i_scale = VLC_CLIP( i_scale, 10, 500 );
+                }
+                var_SetInteger( p_vout, "sub-text-scale", i_scale );
+                DisplayMessage( p_vout, _( "Subtitle text scale %d%%" ), i_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, },
-- 
2.4.3



More information about the vlc-devel mailing list