summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-03-30 23:52:28 +0200
committerwm4 <wm4@nowhere>2015-03-31 00:09:03 +0200
commit27715b7dd18c4a393b8483b8048cb957172e776b (patch)
tree1a0c9fbcab9591fd451f1525f5fe6613d15a7b7e /options
parent273afdc3a4dc775e427b282f0e30c9a6ae167e06 (diff)
downloadmpv-27715b7dd18c4a393b8483b8048cb957172e776b.tar.bz2
mpv-27715b7dd18c4a393b8483b8048cb957172e776b.tar.xz
video: move colorspace overrides to vf_format, simplify
Remove the colorspace-related top-level options, add them to vf_format. They are rather obscure and not needed often, so it's better to get them out of the way. In particular, this gets rid of the semi-complicated logic in command.c (most of which was needed for OSD display and the direct feedback from the VO). It removes the duplicated color-related name mappings. This removes the ability to write the colormatrix and related properties. Since filters can be changed at runtime, there's no loss of functionality, except that you can't cycle automatically through the color constants anymore (but who needs to do this). This also changes the type of the mp_csp_names and related variables, so they can directly be used with OPT_CHOICE. This probably ended up a bit awkward, for the sake of not adding a new option type which would have used the previous format.
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;