1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-01 20:32:13 +00:00

commands: rename "osdlevel" option and property, make it a choice

Rename both the option and property to "osd-level", which fits a bit
better with the general naming scheme. Make it a choice instead of an
integer range. I failed to come up with good names for the various
levels, so leave them as-is.

Remove the useless property handler for the "loop" property too.
This commit is contained in:
wm4 2012-09-17 08:45:35 +02:00
parent 6f1486b397
commit 10437c35df
7 changed files with 9 additions and 36 deletions

View File

@ -96,6 +96,7 @@ Command line switches
-use-filename-title --title="${filename}"
-loop 0 --loop=inf
-hardframedrop --framedrop=hard
-osdlevel --osd-level
=================================== ===================================
input.conf and slave commands

View File

@ -1294,7 +1294,7 @@
--osd-fractions
Show OSD times with fractions of seconds.
--osdlevel=<0-3>
--osd-level=<0-3>
Specifies which mode the OSD should start in.
:0: subtitles only

View File

@ -411,7 +411,7 @@ gl
(no-)osd
Enable or disable support for OSD rendering via OpenGL (default:
enabled). This option is for testing; to disable the OSD use
``--osdlevel=0`` instead.
``--osd-level=0`` instead.
backend=<sys>
auto

View File

@ -670,6 +670,8 @@ const m_option_t mplayer_opts[]={
{"use-filedir-conf", &use_filedir_conf, CONF_TYPE_FLAG, CONF_GLOBAL, 0, 1, NULL},
OPT_INTRANGE("osdlevel", osd_level, 0, 0, 3),
OPT_CHOICE("osd-level", osd_level, 0,
({"0", 0}, {"1", 1}, {"2", 2}, {"3", 3})),
OPT_INTRANGE("osd-duration", osd_duration, 0, 0, 3600000),
OPT_MAKE_FLAGS("osd-fractions", osd_fractions, 0),

View File

@ -194,20 +194,6 @@ static int mp_property_generic_option(struct m_option *prop, int action,
return M_PROPERTY_NOT_IMPLEMENTED;
}
/// OSD level (RW)
static int mp_property_osdlevel(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
return m_property_choice(prop, action, arg, &mpctx->opts.osd_level);
}
/// Loop (RW)
static int mp_property_loop(m_option_t *prop, int action, void *arg,
MPContext *mpctx)
{
return mp_property_generic_option(prop, action, arg, mpctx);
}
/// Playback speed (RW)
static int mp_property_playback_speed(m_option_t *prop, int action,
void *arg, MPContext *mpctx)
@ -1652,9 +1638,9 @@ static int mp_property_tv_color(m_option_t *prop, int action, void *arg,
*/
static const m_option_t mp_properties[] = {
// General
{ "osdlevel", mp_property_osdlevel, CONF_TYPE_INT,
M_OPT_RANGE, 0, 3, NULL },
{ "loop", mp_property_loop, &m_option_type_choice,
{ "osd-level", mp_property_generic_option, &m_option_type_choice,
0, 0, 0, "osd-level" },
{ "loop", mp_property_generic_option, &m_option_type_choice,
0, 0, 0, "loop" },
{ "speed", mp_property_playback_speed, CONF_TYPE_FLOAT,
M_OPT_RANGE, 0.01, 100.0, NULL },
@ -1816,6 +1802,7 @@ static const struct legacy_prop legacy_props[] = {
{"switch_audio", "audio"},
{"switch_program", "program"},
{"framedropping", "framedrop"},
{"osdlevel", "osd-level"},
{0}
};

View File

@ -274,19 +274,6 @@ int m_property_int_range(const m_option_t *prop, int action,
return m_property_int_ro(prop, action, arg, *var);
}
int m_property_choice(const m_option_t *prop, int action,
void *arg, int *var)
{
switch (action) {
case M_PROPERTY_STEP_UP:
case M_PROPERTY_STEP_DOWN:
*var += action == M_PROPERTY_STEP_UP ? 1 : prop->max;
*var %= (int)prop->max + 1;
return 1;
}
return m_property_int_range(prop, action, arg, var);
}
int m_property_flag_ro(const m_option_t *prop, int action,
void *arg, int var)
{

View File

@ -183,10 +183,6 @@ int m_property_int_ro(const m_option_t* prop,int action,
int m_property_int_range(const m_option_t* prop,int action,
void* arg,int* var);
/// Same as m_property_int_range but cycle.
int m_property_choice(const m_option_t* prop,int action,
void* arg,int* var);
int m_property_flag_ro(const m_option_t* prop,int action,
void* arg,int var);