[MPlayer-cvslog] r23745 - in trunk: DOCS/tech/slave.txt command.c etc/input.conf etc/menu.conf help/help_mp-en.h input/input.c input/input.h

albeu subversion at mplayerhq.hu
Mon Jul 9 13:19:21 CEST 2007


Author: albeu
Date: Mon Jul  9 13:19:21 2007
New Revision: 23745

Log:
Add the sub_scale property and command.
Patch from Anatoli Marinov (anatoli [dot] marinov [at] gmail [dot] com).


Modified:
   trunk/DOCS/tech/slave.txt
   trunk/command.c
   trunk/etc/input.conf
   trunk/etc/menu.conf
   trunk/input/input.c
   trunk/input/input.h

Changes in other areas also in this revision:
Modified:
   trunk/help/help_mp-en.h

Modified: trunk/DOCS/tech/slave.txt
==============================================================================
--- trunk/DOCS/tech/slave.txt	(original)
+++ trunk/DOCS/tech/slave.txt	Mon Jul  9 13:19:21 2007
@@ -288,6 +288,10 @@ sub_select [value]
     than -1. Supported subtitle sources are -sub options on the command
     line, VOBsubs, DVD subtitles, and Ogg and Matroska text streams.
 
+sub_scale <value> [abs]
+    Adjust the subtitle size by +/- <value> or set it to <value> when [abs]
+    is nonzero.
+
 vobsub_lang
     This is a stub linked to sub_select for backwards compatibility.
 
@@ -443,6 +447,7 @@ sub_pos            int       0       100
 sub_alignment      int       0       2       X   X   X    subtitle alignment
 sub_visibility     flag      0       1       X   X   X    show/hide subtitles
 sub_forced_only    flag      0       1       X   X   X
+sub_scale          float     0       100     X   X   X    subtitles font size
 tv_brightness      int       -100    100     X   X   X
 tv_contrast        int       -100    100     X   X   X
 tv_saturation      int       -100    100     X   X   X

Modified: trunk/command.c
==============================================================================
--- trunk/command.c	(original)
+++ trunk/command.c	Mon Jul  9 13:19:21 2007
@@ -19,6 +19,7 @@
 #include "libmpcodecs/vf.h"
 #include "libmpcodecs/vd.h"
 #include "libvo/video_out.h"
+#include "libvo/font_load.h"
 #include "playtree.h"
 #include "libao2/audio_out.h"
 #include "mpcommon.h"
@@ -1411,6 +1412,31 @@ static int mp_property_sub_forced_only(m
 
 }
 
+/// Subtitle scale (RW)
+static int mp_property_sub_scale(m_option_t * prop, int action, void *arg,
+			      MPContext * mpctx)
+{
+
+    switch (action) {
+        case M_PROPERTY_SET:
+            if (!arg)
+                return M_PROPERTY_ERROR;
+            M_PROPERTY_CLAMP(prop, *(float *) arg);
+            text_font_scale_factor = *(float *) arg;
+            force_load_font = 1;
+            return M_PROPERTY_OK;
+        case M_PROPERTY_STEP_UP:
+        case M_PROPERTY_STEP_DOWN:
+            text_font_scale_factor += (arg ? *(float *) arg : 0.1)*
+                (action == M_PROPERTY_STEP_UP ? 1.0 : -1.0);
+            M_PROPERTY_CLAMP(prop, text_font_scale_factor);
+            force_load_font = 1;
+            return M_PROPERTY_OK;
+        default:
+            return m_property_float_ro(prop, action, arg, text_font_scale_factor);
+    }
+}
+
 ///@}
 
 /// \defgroup TVProperties TV properties
@@ -1568,6 +1594,8 @@ static m_option_t mp_properties[] = {
      M_OPT_RANGE, 0, 1, NULL },
     { "sub_forced_only", mp_property_sub_forced_only, CONF_TYPE_FLAG,
      M_OPT_RANGE, 0, 1, NULL },
+    { "sub_scale", mp_property_sub_scale, CONF_TYPE_FLOAT,
+     M_OPT_RANGE, 0, 100, NULL },
 
 #ifdef USE_TV
     { "tv_brightness", mp_property_tv_color, CONF_TYPE_INT,
@@ -1672,6 +1700,7 @@ static struct {
     { "sub_delay", MP_CMD_SUB_DELAY, 0, 0, OSD_MSG_SUB_DELAY, MSGTR_SubDelayStatus },
     { "sub_visibility", MP_CMD_SUB_VISIBILITY, 1, 0, -1, MSGTR_SubVisibleStatus },
     { "sub_forced_only", MP_CMD_SUB_FORCED_ONLY, 1, 0, -1, MSGTR_SubForcedOnlyStatus },
+    { "sub_scale", MP_CMD_SUB_SCALE, 0, 0, -1, MSGTR_SubScale},
 #ifdef USE_TV
     { "tv_brightness", MP_CMD_TV_SET_BRIGHTNESS, 0, OSD_BRIGHTNESS, -1, MSGTR_Brightness },
     { "tv_hue", MP_CMD_TV_SET_HUE, 0, OSD_HUE, -1, MSGTR_Hue },

Modified: trunk/etc/input.conf
==============================================================================
--- trunk/etc/input.conf	(original)
+++ trunk/etc/input.conf	Mon Jul  9 13:19:21 2007
@@ -58,6 +58,8 @@ r sub_pos -1            # move subtitles
 t sub_pos +1            #                down
 #? sub_step +1		# immediately display next subtitle
 #? sub_step -1		#                     previous
+#? sub_scale +0.1	# increase subtitle font size 
+#? sub_scale -0.1	# decrease subtitle font size                  
 f vo_fullscreen
 T vo_ontop              # toggle video window ontop of other windows
 w panscan -0.1          # zoom out with -panscan 0 -fs

Modified: trunk/etc/menu.conf
==============================================================================
--- trunk/etc/menu.conf	(original)
+++ trunk/etc/menu.conf	Mon Jul  9 13:19:21 2007
@@ -29,6 +29,7 @@
       <e property="sub_alignment" name="Alignment"/>   
       <e property="sub_pos" name="Position"/>
       <e property="sub_delay" name="Delay"/>
+      <e property="sub_scale" name="Scale"/>
 </pref>
 
 <pref name="audio_pref" title="Audio">

Modified: trunk/input/input.c
==============================================================================
--- trunk/input/input.c	(original)
+++ trunk/input/input.c	Mon Jul  9 13:19:21 2007
@@ -88,6 +88,7 @@ static mp_cmd_t mp_cmds[] = {
   { MP_CMD_SUB_SELECT, "vobsub_lang", 0, { { MP_CMD_ARG_INT,{-2} }, {-1,{0}} } }, // for compatibility
   { MP_CMD_SUB_SELECT, "sub_select", 0, { { MP_CMD_ARG_INT,{-2} }, {-1,{0}} } },
   { MP_CMD_SUB_LOG, "sub_log", 0, { {-1,{0}} } },
+  { MP_CMD_SUB_SCALE, "sub_scale",1, { {MP_CMD_ARG_FLOAT,{0}}, {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
   { MP_CMD_GET_PERCENT_POS, "get_percent_pos", 0, { {-1,{0}} } },
   { MP_CMD_GET_TIME_POS, "get_time_pos", 0, { {-1,{0}} } },
   { MP_CMD_GET_TIME_LENGTH, "get_time_length", 0, { {-1,{0}} } },

Modified: trunk/input/input.h
==============================================================================
--- trunk/input/input.h	(original)
+++ trunk/input/input.h	Mon Jul  9 13:19:21 2007
@@ -94,6 +94,7 @@
 #define MP_CMD_RADIO_STEP_FREQ 92
 #define MP_CMD_TV_STEP_FREQ 93
 #define MP_CMD_BALANCE 96
+#define MP_CMD_SUB_SCALE 97
 
 #define MP_CMD_GUI_EVENTS       5000
 #define MP_CMD_GUI_LOADFILE     5001



More information about the MPlayer-cvslog mailing list