summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-07-09 11:19:21 +0000
committeralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-07-09 11:19:21 +0000
commit1544e6471755ec91d954ab604abdcedfac082acc (patch)
tree0af175ab9afea75e2d58a786fd30df07aebc9c34
parent128ff990e990be2ec70bc2bfc27e874d3793ea8f (diff)
downloadmpv-1544e6471755ec91d954ab604abdcedfac082acc.tar.bz2
mpv-1544e6471755ec91d954ab604abdcedfac082acc.tar.xz
Add the sub_scale property and command.
Patch from Anatoli Marinov (anatoli [dot] marinov [at] gmail [dot] com). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23745 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--DOCS/tech/slave.txt5
-rw-r--r--command.c29
-rw-r--r--etc/input.conf2
-rw-r--r--etc/menu.conf1
-rw-r--r--help/help_mp-en.h1
-rw-r--r--input/input.c1
-rw-r--r--input/input.h1
7 files changed, 40 insertions, 0 deletions
diff --git a/DOCS/tech/slave.txt b/DOCS/tech/slave.txt
index 7a44426d8d..a74ba2fe38 100644
--- a/DOCS/tech/slave.txt
+++ b/DOCS/tech/slave.txt
@@ -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 X X X subtitle position
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
diff --git a/command.c b/command.c
index b2bd9f89b2..f438effe43 100644
--- a/command.c
+++ b/command.c
@@ -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_option_t * prop, int action,
}
+/// 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 },
diff --git a/etc/input.conf b/etc/input.conf
index 733cb18b08..c34eb7e1f6 100644
--- a/etc/input.conf
+++ b/etc/input.conf
@@ -58,6 +58,8 @@ r sub_pos -1 # move subtitles up
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
diff --git a/etc/menu.conf b/etc/menu.conf
index 51c329b849..5cc8625e5e 100644
--- a/etc/menu.conf
+++ b/etc/menu.conf
@@ -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">
diff --git a/help/help_mp-en.h b/help/help_mp-en.h
index e5ac9cb0bc..592bf0642f 100644
--- a/help/help_mp-en.h
+++ b/help/help_mp-en.h
@@ -245,6 +245,7 @@ static char help_text[]=
#define MSGTR_SubPosStatus "Sub position: %s/100"
#define MSGTR_SubAlignStatus "Sub alignment: %s"
#define MSGTR_SubDelayStatus "Sub delay: %s"
+#define MSGTR_SubScale "Sub Scale: %s"
#define MSGTR_SubVisibleStatus "Subtitles: %s"
#define MSGTR_SubForcedOnlyStatus "Forced sub only: %s"
diff --git a/input/input.c b/input/input.c
index c6f3461b9a..3b9312a916 100644
--- a/input/input.c
+++ b/input/input.c
@@ -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}} } },
diff --git a/input/input.h b/input/input.h
index cee0597fa0..264bd2269f 100644
--- a/input/input.h
+++ b/input/input.h
@@ -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