summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-09-17 08:45:35 +0200
committerwm4 <wm4@nowhere>2012-10-12 10:10:30 +0200
commit10437c35df5d3944625fa6cee05e565b0791fe15 (patch)
tree31dfa05575fdeac18121328ea4ffe9aea3fdafd8
parent6f1486b397d632feaa71f88b980491aea7b69256 (diff)
downloadmpv-10437c35df5d3944625fa6cee05e565b0791fe15.tar.bz2
mpv-10437c35df5d3944625fa6cee05e565b0791fe15.tar.xz
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.
-rw-r--r--DOCS/man/en/changes.rst1
-rw-r--r--DOCS/man/en/options.rst2
-rw-r--r--DOCS/man/en/vo.rst2
-rw-r--r--cfg-mplayer.h2
-rw-r--r--command.c21
-rw-r--r--m_property.c13
-rw-r--r--m_property.h4
7 files changed, 9 insertions, 36 deletions
diff --git a/DOCS/man/en/changes.rst b/DOCS/man/en/changes.rst
index ee66c5048a..ec08c7eac2 100644
--- a/DOCS/man/en/changes.rst
+++ b/DOCS/man/en/changes.rst
@@ -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
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst
index 59ce49a308..70b791c1ba 100644
--- a/DOCS/man/en/options.rst
+++ b/DOCS/man/en/options.rst
@@ -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
diff --git a/DOCS/man/en/vo.rst b/DOCS/man/en/vo.rst
index 0ba7fe8b9f..c6d80866a6 100644
--- a/DOCS/man/en/vo.rst
+++ b/DOCS/man/en/vo.rst
@@ -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
diff --git a/cfg-mplayer.h b/cfg-mplayer.h
index d9d78082ac..080b04bd63 100644
--- a/cfg-mplayer.h
+++ b/cfg-mplayer.h
@@ -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),
diff --git a/command.c b/command.c
index cdfeb835bf..a68b8f3228 100644
--- a/command.c
+++ b/command.c
@@ -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}
};
diff --git a/m_property.c b/m_property.c
index e75cbe43ac..fac3ec8285 100644
--- a/m_property.c
+++ b/m_property.c
@@ -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)
{
diff --git a/m_property.h b/m_property.h
index 0a94b26335..902f38c77e 100644
--- a/m_property.h
+++ b/m_property.h
@@ -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);