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
This commit is contained in:
albeu committed 2007-07-09 11:19:21 +00:00
1 parent 128ff990e9
commit 1544e64717
7 files changed
+40

No files matched your search

+5
View File
@@ -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
+29
View File
@@ -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 },
+2
View File
@@ -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
+1
View File
@@ -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">
+1
View File
@@ -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"
+1
View File
@@ -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}} } },
+1
View File
@@ -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