summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-04-02 23:54:08 +0200
committerwm4 <wm4@nowhere>2015-04-02 23:54:08 +0200
commit5a2825ec35446ae2127c0fb204203cd09738c4ed (patch)
tree90e24f12b16912e1ce2894f28839e716653066d2 /options
parent19f56e20979d1dbbb4b9956c955d4d0fa27516aa (diff)
downloadmpv-5a2825ec35446ae2127c0fb204203cd09738c4ed.tar.bz2
mpv-5a2825ec35446ae2127c0fb204203cd09738c4ed.tar.xz
video: cleanup stereo mode parsing
Use OPT_CHOICE_C() instead of the custom parser. The functionality is pretty much equivalent. (On a side note, it seems --video-stereo-mode can't be removed, because it controls whether to "reduce" stereo video to mono, which is also the default. In fact I'm not sure how this should be handled at all.)
Diffstat (limited to 'options')
-rw-r--r--options/m_option.c53
-rw-r--r--options/m_option.h4
-rw-r--r--options/options.c2
3 files changed, 1 insertions, 58 deletions
diff --git a/options/m_option.c b/options/m_option.c
index 26ed7a2457..337193a28d 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -2162,59 +2162,6 @@ const m_option_type_t m_option_type_imgfmt = {
.copy = copy_opt,
};
-#include "video/csputils.h"
-
-static int parse_stereo_mode(struct mp_log *log, const m_option_t *opt,
- struct bstr name, struct bstr param, void *dst)
-{
- if (param.len == 0)
- return M_OPT_MISSING_PARAM;
-
- if (!bstrcmp0(param, "help")) {
- mp_info(log, "Available modes:");
- for (int n = 0; n < MP_STEREO3D_COUNT; n++) {
- if (mp_stereo3d_names[n])
- mp_info(log, " %s\n", mp_stereo3d_names[n]);
- }
- mp_info(log, " none\n");
- return M_OPT_EXIT - 1;
- }
-
- int mode = -1;
-
- for (int n = 0; n < MP_STEREO3D_COUNT; n++) {
- if (bstr_equals(param, bstr0(mp_stereo3d_names[n]))) {
- mode = n;
- break;
- }
- }
-
- if (mode < 0 && !bstr_equals0(param, "none")) {
- mp_err(log, "Option %.*s: unknown parameter: '%.*s'\n",
- BSTR_P(name), BSTR_P(param));
- return M_OPT_INVALID;
- }
-
- if (dst)
- *((int *)dst) = mode;
-
- return 1;
-}
-
-static char *print_stereo_mode(const m_option_t *opt, const void *val)
-{
- int mode = *(int *)val;
- const char *name = mode >= 0 ? MP_STEREO3D_NAME(mode) : "none";
- return talloc_strdup(NULL, name);
-}
-
-const m_option_type_t m_option_vid_stereo_mode = {
- .name = "Stereo 3D mode",
- .size = sizeof(int),
- .parse = parse_stereo_mode,
- .print = print_stereo_mode,
-};
-
static int parse_fourcc(struct mp_log *log, const m_option_t *opt,
struct bstr name, struct bstr param, void *dst)
{
diff --git a/options/m_option.h b/options/m_option.h
index a07c5a1082..eb6121d8a0 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -57,7 +57,6 @@ extern const m_option_type_t m_option_type_msglevels;
extern const m_option_type_t m_option_type_print_fn;
extern const m_option_type_t m_option_type_subconfig;
extern const m_option_type_t m_option_type_imgfmt;
-extern const m_option_type_t m_option_vid_stereo_mode;
extern const m_option_type_t m_option_type_fourcc;
extern const m_option_type_t m_option_type_afmt;
extern const m_option_type_t m_option_type_color;
@@ -665,9 +664,6 @@ extern const char m_option_path_separator;
#define OPT_TRACKCHOICE(name, var) \
OPT_CHOICE_OR_INT(name, var, 0, 0, 8190, ({"no", -2}, {"auto", -1}))
-#define OPT_VID_STEREO_MODE(...) \
- OPT_GENERAL(int, __VA_ARGS__, .type = &m_option_vid_stereo_mode)
-
#define OPT_STRING_VALIDATE_(optname, varname, flags, validate_fn, ...) \
OPT_GENERAL(char*, optname, varname, flags, __VA_ARGS__, \
.priv = MP_EXPECT_TYPE(m_opt_string_validate_fn, validate_fn))
diff --git a/options/options.c b/options/options.c
index e2a17382d9..e58fb89580 100644
--- a/options/options.c
+++ b/options/options.c
@@ -426,7 +426,7 @@ const m_option_t mp_opts[] = {
OPT_FLAG("force-rgba-osd-rendering", force_rgba_osd, 0),
OPT_CHOICE_OR_INT("video-rotate", video_rotate, 0, 0, 360,
({"no", -1})),
- OPT_VID_STEREO_MODE("video-stereo-mode", video_stereo_mode, 0),
+ OPT_CHOICE_C("video-stereo-mode", video_stereo_mode, 0, mp_stereo3d_names),
OPT_CHOICE_OR_INT("cursor-autohide", cursor_autohide_delay, 0,
0, 30000, ({"no", -1}, {"always", -2})),