summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorNiklas Haas <git@nand.wakku.to>2014-03-26 14:03:24 +0100
committerwm4 <wm4@nowhere>2014-06-22 19:01:25 +0200
commitef6db24366da2974cdee1d9578cf91910b5faa9c (patch)
treee06720ce263fc8c15630f49ebd8901139610ce21 /player/command.c
parent70f50ddc5e97020d64ea0702748a00eddebc2473 (diff)
downloadmpv-ef6db24366da2974cdee1d9578cf91910b5faa9c.tar.bz2
mpv-ef6db24366da2974cdee1d9578cf91910b5faa9c.tar.xz
options: Expose --colormatrix-primaries to the user
Signed-off-by: wm4 <wm4@nowhere>
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 85823371f3..af82a775da 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1839,6 +1839,31 @@ static int mp_property_colormatrix_output_range(void *ctx, struct m_property *pr
return M_PROPERTY_OK;
}
+static int mp_property_primaries(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ if (action != M_PROPERTY_PRINT)
+ return video_refresh_property_helper(prop, action, arg, mpctx);
+
+ struct MPOpts *opts = mpctx->opts;
+
+ struct mp_image_params vo_csp = {0};
+ if (mpctx->video_out)
+ vo_control(mpctx->video_out, VOCTRL_GET_COLORSPACE, &vo_csp);
+
+ struct mp_image_params vd_csp = {0};
+ if (mpctx->d_video)
+ vd_csp = mpctx->d_video->decoder_output;
+
+ char *res = talloc_strdup(NULL, "");
+ append_csp(&res, "*Requested", mp_csp_prim_names, opts->requested_primaries);
+ append_csp(&res, "Video decoder", mp_csp_prim_names, vd_csp.primaries);
+ append_csp(&res, "Video output", mp_csp_prim_names, vo_csp.primaries);
+ *(char **)arg = res;
+ return M_PROPERTY_OK;
+}
+
// Update options which are managed through VOCTRL_GET/SET_PANSCAN.
static int panscan_property_helper(void *ctx, struct m_property *prop,
int action, void *arg)
@@ -1978,6 +2003,7 @@ static int property_imgparams(struct mp_image_params p, int action, void *arg)
{"par", SUB_PROP_FLOAT(dar / sar)},
{"colormatrix", SUB_PROP_STR(mp_csp_names[p.colorspace])},
{"colorlevels", SUB_PROP_STR(mp_csp_levels_names[p.colorlevels])},
+ {"primaries", SUB_PROP_STR(mp_csp_prim_names[p.primaries])},
{"chroma-location", SUB_PROP_STR(mp_chroma_names[p.chroma_location])},
{"rotate", SUB_PROP_INT(p.rotate)},
{0}
@@ -2615,6 +2641,7 @@ static const struct m_property mp_properties[] = {
{"colormatrix", mp_property_colormatrix},
{"colormatrix-input-range", mp_property_colormatrix_input_range},
{"colormatrix-output-range", mp_property_colormatrix_output_range},
+ {"colormatrix-primaries", mp_property_primaries},
{"ontop", mp_property_ontop},
{"border", mp_property_border},
{"framedrop", mp_property_framedrop},
@@ -2825,6 +2852,8 @@ static const struct property_osd_display {
.msg = "YUV input range:\n${colormatrix-input-range}" },
{ "colormatrix-output-range",
.msg = "RGB output range:\n${colormatrix-output-range}" },
+ { "colormatrix-primaries",
+ .msg = "Colorspace primaries:\n${colormatrix-primaries}", },
{ "gamma", "Gamma", .osd_progbar = OSD_BRIGHTNESS },
{ "brightness", "Brightness", .osd_progbar = OSD_BRIGHTNESS },
{ "contrast", "Contrast", .osd_progbar = OSD_CONTRAST },