From ef6db24366da2974cdee1d9578cf91910b5faa9c Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Wed, 26 Mar 2014 14:03:24 +0100 Subject: options: Expose --colormatrix-primaries to the user Signed-off-by: wm4 --- player/command.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'player/command.c') 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 }, -- cgit v1.2.3