diff options
author | wm4 <wm4@nowhere> | 2015-03-30 23:52:28 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-03-31 00:09:03 +0200 |
commit | 27715b7dd18c4a393b8483b8048cb957172e776b (patch) | |
tree | 1a0c9fbcab9591fd451f1525f5fe6613d15a7b7e /video/filter | |
parent | 273afdc3a4dc775e427b282f0e30c9a6ae167e06 (diff) | |
download | mpv-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 'video/filter')
-rw-r--r-- | video/filter/vf_format.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/video/filter/vf_format.c b/video/filter/vf_format.c index a638cb37a1..8b86c35489 100644 --- a/video/filter/vf_format.c +++ b/video/filter/vf_format.c @@ -33,6 +33,11 @@ struct vf_priv_s { int fmt; int outfmt; + int colormatrix; + int colorlevels; + int outputlevels; + int primaries; + int chroma_location; }; static bool is_compatible(int fmt1, int fmt2) @@ -69,9 +74,26 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) static int reconfig(struct vf_instance *vf, struct mp_image_params *in, struct mp_image_params *out) { + struct vf_priv_s *p = vf->priv; + *out = *in; - if (vf->priv->outfmt) - out->imgfmt = vf->priv->outfmt; + + if (p->outfmt) + out->imgfmt = p->outfmt; + if (p->colormatrix) + out->colorspace = p->colormatrix; + if (p->colorlevels) + out->colorlevels = p->colorlevels; + if (p->outputlevels) + out->outputlevels = p->outputlevels; + if (p->primaries) + out->primaries = p->primaries; + if (p->chroma_location) + out->chroma_location = p->chroma_location; + + // Make sure the user-overrides are consistent (no RGB csp for YUV, etc.). + mp_image_params_guess_csp(out); + return 0; } @@ -94,6 +116,11 @@ static int vf_open(vf_instance_t *vf) static const m_option_t vf_opts_fields[] = { OPT_IMAGEFORMAT("fmt", fmt, 0), OPT_IMAGEFORMAT("outfmt", outfmt, 0), + OPT_CHOICE_C("colormatrix", colormatrix, 0, mp_csp_names), + OPT_CHOICE_C("colorlevels", colorlevels, 0, mp_csp_levels_names), + OPT_CHOICE_C("outputlevels", outputlevels, 0, mp_csp_levels_names), + OPT_CHOICE_C("primaries", primaries, 0, mp_csp_prim_names), + OPT_CHOICE_C("chroma-location", chroma_location, 0, mp_chroma_names), {0} }; |