Mercurial > mplayer.hg
changeset 23725:a0432f65040e
Add the sub_scale property and command.
Patch from Anatoli Marinov (anatoli [dot] marinov [at] gmail [dot] com).
author | albeu |
---|---|
date | Mon, 09 Jul 2007 11:19:21 +0000 |
parents | 72cff1657307 |
children | 11abe5f3dcaa |
files | DOCS/tech/slave.txt command.c etc/input.conf etc/menu.conf help/help_mp-en.h input/input.c input/input.h |
diffstat | 7 files changed, 40 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/DOCS/tech/slave.txt Sun Jul 08 13:30:33 2007 +0000 +++ b/DOCS/tech/slave.txt Mon Jul 09 11:19:21 2007 +0000 @@ -288,6 +288,10 @@ 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_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
--- a/command.c Sun Jul 08 13:30:33 2007 +0000 +++ b/command.c Mon Jul 09 11:19:21 2007 +0000 @@ -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 @@ } +/// 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 @@ 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 @@ { "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 },
--- a/etc/input.conf Sun Jul 08 13:30:33 2007 +0000 +++ b/etc/input.conf Mon Jul 09 11:19:21 2007 +0000 @@ -58,6 +58,8 @@ 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
--- a/etc/menu.conf Sun Jul 08 13:30:33 2007 +0000 +++ b/etc/menu.conf Mon Jul 09 11:19:21 2007 +0000 @@ -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">
--- a/help/help_mp-en.h Sun Jul 08 13:30:33 2007 +0000 +++ b/help/help_mp-en.h Mon Jul 09 11:19:21 2007 +0000 @@ -245,6 +245,7 @@ #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"
--- a/input/input.c Sun Jul 08 13:30:33 2007 +0000 +++ b/input/input.c Mon Jul 09 11:19:21 2007 +0000 @@ -88,6 +88,7 @@ { 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}} } },
--- a/input/input.h Sun Jul 08 13:30:33 2007 +0000 +++ b/input/input.h Mon Jul 09 11:19:21 2007 +0000 @@ -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