summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
Diffstat (limited to 'options')
-rw-r--r--options/m_option.c10
-rw-r--r--options/m_option.h8
-rw-r--r--options/options.c22
-rw-r--r--options/options.h5
4 files changed, 18 insertions, 27 deletions
diff --git a/options/m_option.c b/options/m_option.c
index 2b34c4e918..49d78a06d2 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -522,6 +522,16 @@ const struct m_option_type m_option_type_intpair = {
.copy = copy_opt,
};
+const char *m_opt_choice_str(const struct m_opt_choice_alternatives *choices,
+ int value)
+{
+ for (const struct m_opt_choice_alternatives *c = choices; c->name; c++) {
+ if (c->value == value)
+ return c->name;
+ }
+ return NULL;
+}
+
static int clamp_choice(const m_option_t *opt, void *val)
{
int v = *(int *)val;
diff --git a/options/m_option.h b/options/m_option.h
index 401d98473d..a07c5a1082 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -165,6 +165,9 @@ struct m_opt_choice_alternatives {
int value;
};
+const char *m_opt_choice_str(const struct m_opt_choice_alternatives *choices,
+ int value);
+
// For OPT_STRING_VALIDATE(). Behaves like m_option_type.parse().
typedef int (*m_opt_string_validate_fn)(struct mp_log *log, const m_option_t *opt,
struct bstr name, struct bstr param);
@@ -626,6 +629,11 @@ extern const char m_option_path_separator;
OPT_CHOICE_(__VA_ARGS__, .type = &m_option_type_choice)
#define OPT_CHOICE_(optname, varname, flags, choices, ...) \
OPT_GENERAL(int, optname, varname, flags, M_CHOICES(choices), __VA_ARGS__)
+// Variant which takes a pointer to struct m_opt_choice_alternatives directly
+#define OPT_CHOICE_C(optname, varname, flags, choices) \
+ OPT_GENERAL(int, optname, varname, flags, .priv = (void *) \
+ MP_EXPECT_TYPE(const struct m_opt_choice_alternatives*, choices), \
+ .type = &m_option_type_choice)
#define OPT_FLAGS(...) \
OPT_CHOICE_(__VA_ARGS__, .type = &m_option_type_flags)
diff --git a/options/options.c b/options/options.c
index 8c33e4560a..4e01ae27cf 100644
--- a/options/options.c
+++ b/options/options.c
@@ -424,28 +424,6 @@ const m_option_t mp_opts[] = {
OPT_FLOATRANGE("video-align-y", vo.align_y, 0, -1.0, 1.0),
OPT_FLAG("video-unscaled", vo.unscaled, 0),
OPT_FLAG("force-rgba-osd-rendering", force_rgba_osd, 0),
- OPT_CHOICE("colormatrix", requested_colorspace, 0,
- ({"auto", MP_CSP_AUTO},
- {"bt.601", MP_CSP_BT_601},
- {"bt.709", MP_CSP_BT_709},
- {"smpte-240m", MP_CSP_SMPTE_240M},
- {"bt.2020-ncl", MP_CSP_BT_2020_NC},
- {"bt.2020-cl", MP_CSP_BT_2020_C},
- {"YCgCo", MP_CSP_YCGCO})),
- OPT_CHOICE("colormatrix-input-range", requested_input_range, 0,
- ({"auto", MP_CSP_LEVELS_AUTO},
- {"limited", MP_CSP_LEVELS_TV},
- {"full", MP_CSP_LEVELS_PC})),
- OPT_CHOICE("colormatrix-output-range", requested_output_range, 0,
- ({"auto", MP_CSP_LEVELS_AUTO},
- {"limited", MP_CSP_LEVELS_TV},
- {"full", MP_CSP_LEVELS_PC})),
- OPT_CHOICE("colormatrix-primaries", requested_primaries, 0,
- ({"auto", MP_CSP_PRIM_AUTO},
- {"bt.601-525", MP_CSP_PRIM_BT_601_525},
- {"bt.601-625", MP_CSP_PRIM_BT_601_625},
- {"bt.709", MP_CSP_PRIM_BT_709},
- {"bt.2020", MP_CSP_PRIM_BT_2020})),
OPT_CHOICE_OR_INT("video-rotate", video_rotate, 0, 0, 359,
({"no", -1})),
OPT_VID_STEREO_MODE("video-stereo-mode", video_stereo_mode, 0),
diff --git a/options/options.h b/options/options.h
index 15ff9cb8ca..24173168e6 100644
--- a/options/options.h
+++ b/options/options.h
@@ -102,11 +102,6 @@ typedef struct MPOpts {
int cursor_autohide_delay;
int cursor_autohide_fs;
- int requested_colorspace;
- int requested_input_range;
- int requested_output_range;
- int requested_primaries;
-
int video_rotate;
int video_stereo_mode;