mirror of
https://github.com/mpv-player/mpv
synced 2025-03-30 15:29:56 +00:00
options: Expose --colormatrix-primaries to the user
Signed-off-by: wm4 <wm4@nowhere>
This commit is contained in:
parent
70f50ddc5e
commit
ef6db24366
@ -872,6 +872,9 @@ Property list
|
|||||||
``colormatrix-output-range`` (RW)
|
``colormatrix-output-range`` (RW)
|
||||||
See ``--colormatrix-output-range``.
|
See ``--colormatrix-output-range``.
|
||||||
|
|
||||||
|
``colormatrix-primaries`` (RW)
|
||||||
|
See ``--colormatrix-primaries``.
|
||||||
|
|
||||||
``ontop`` (RW)
|
``ontop`` (RW)
|
||||||
See ``--ontop``.
|
See ``--ontop``.
|
||||||
|
|
||||||
@ -949,6 +952,9 @@ Property list
|
|||||||
``video-params/colorlevels``
|
``video-params/colorlevels``
|
||||||
The colorlevels as string. (Exact values subject to change.)
|
The colorlevels as string. (Exact values subject to change.)
|
||||||
|
|
||||||
|
``video-params/primaries``
|
||||||
|
The primaries in use as string. (Exact values subject to change.)
|
||||||
|
|
||||||
``video-params/chroma-location``
|
``video-params/chroma-location``
|
||||||
Chroma location as string. (Exact values subject to change.)
|
Chroma location as string. (Exact values subject to change.)
|
||||||
|
|
||||||
|
@ -574,6 +574,24 @@ OPTIONS
|
|||||||
It is advisable to use your graphics driver's color range option
|
It is advisable to use your graphics driver's color range option
|
||||||
instead, if available.
|
instead, if available.
|
||||||
|
|
||||||
|
``--colormatrix-primaries=<primaries>``
|
||||||
|
RGB primaries the source file was encoded with. Normally this should be set
|
||||||
|
in the file header, but when playing broken or mistagged files this can be
|
||||||
|
used to override the setting. By default, when unset, BT.709 is used for
|
||||||
|
all files except those tagged with a BT.2020 color matrix.
|
||||||
|
|
||||||
|
This option only affects video output drivers that perform color
|
||||||
|
management, for example ``opengl`` with the ``srgb`` or ``icc-profile``
|
||||||
|
suboptions set.
|
||||||
|
|
||||||
|
Available primaries are:
|
||||||
|
|
||||||
|
:auto: automatic selection (default)
|
||||||
|
:BT.601-525: ITU-R BT.601 (SD) 525-line systems (NTSC)
|
||||||
|
:BT.601-625: ITU-R BT.601 (SD) 625-line systems (PAL, SECAM)
|
||||||
|
:BT.709: ITU-R BT.709 (HD)
|
||||||
|
:BT.2020: ITU-R BT.2020 (UHD)
|
||||||
|
|
||||||
``--config-dir=<path>``
|
``--config-dir=<path>``
|
||||||
Force a different configuration directory. If this is set, the given
|
Force a different configuration directory. If this is set, the given
|
||||||
directory is used to load configuration files, and all other configuration
|
directory is used to load configuration files, and all other configuration
|
||||||
|
@ -399,6 +399,12 @@ const m_option_t mp_opts[] = {
|
|||||||
({"auto", MP_CSP_LEVELS_AUTO},
|
({"auto", MP_CSP_LEVELS_AUTO},
|
||||||
{"limited", MP_CSP_LEVELS_TV},
|
{"limited", MP_CSP_LEVELS_TV},
|
||||||
{"full", MP_CSP_LEVELS_PC})),
|
{"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,
|
OPT_CHOICE_OR_INT("video-rotate", video_rotate, 0, 0, 359,
|
||||||
({"no", -1})),
|
({"no", -1})),
|
||||||
|
|
||||||
|
@ -97,6 +97,7 @@ typedef struct MPOpts {
|
|||||||
int requested_colorspace;
|
int requested_colorspace;
|
||||||
int requested_input_range;
|
int requested_input_range;
|
||||||
int requested_output_range;
|
int requested_output_range;
|
||||||
|
int requested_primaries;
|
||||||
|
|
||||||
int video_rotate;
|
int video_rotate;
|
||||||
|
|
||||||
|
@ -1839,6 +1839,31 @@ static int mp_property_colormatrix_output_range(void *ctx, struct m_property *pr
|
|||||||
return M_PROPERTY_OK;
|
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.
|
// Update options which are managed through VOCTRL_GET/SET_PANSCAN.
|
||||||
static int panscan_property_helper(void *ctx, struct m_property *prop,
|
static int panscan_property_helper(void *ctx, struct m_property *prop,
|
||||||
int action, void *arg)
|
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)},
|
{"par", SUB_PROP_FLOAT(dar / sar)},
|
||||||
{"colormatrix", SUB_PROP_STR(mp_csp_names[p.colorspace])},
|
{"colormatrix", SUB_PROP_STR(mp_csp_names[p.colorspace])},
|
||||||
{"colorlevels", SUB_PROP_STR(mp_csp_levels_names[p.colorlevels])},
|
{"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])},
|
{"chroma-location", SUB_PROP_STR(mp_chroma_names[p.chroma_location])},
|
||||||
{"rotate", SUB_PROP_INT(p.rotate)},
|
{"rotate", SUB_PROP_INT(p.rotate)},
|
||||||
{0}
|
{0}
|
||||||
@ -2615,6 +2641,7 @@ static const struct m_property mp_properties[] = {
|
|||||||
{"colormatrix", mp_property_colormatrix},
|
{"colormatrix", mp_property_colormatrix},
|
||||||
{"colormatrix-input-range", mp_property_colormatrix_input_range},
|
{"colormatrix-input-range", mp_property_colormatrix_input_range},
|
||||||
{"colormatrix-output-range", mp_property_colormatrix_output_range},
|
{"colormatrix-output-range", mp_property_colormatrix_output_range},
|
||||||
|
{"colormatrix-primaries", mp_property_primaries},
|
||||||
{"ontop", mp_property_ontop},
|
{"ontop", mp_property_ontop},
|
||||||
{"border", mp_property_border},
|
{"border", mp_property_border},
|
||||||
{"framedrop", mp_property_framedrop},
|
{"framedrop", mp_property_framedrop},
|
||||||
@ -2825,6 +2852,8 @@ static const struct property_osd_display {
|
|||||||
.msg = "YUV input range:\n${colormatrix-input-range}" },
|
.msg = "YUV input range:\n${colormatrix-input-range}" },
|
||||||
{ "colormatrix-output-range",
|
{ "colormatrix-output-range",
|
||||||
.msg = "RGB output range:\n${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 },
|
{ "gamma", "Gamma", .osd_progbar = OSD_BRIGHTNESS },
|
||||||
{ "brightness", "Brightness", .osd_progbar = OSD_BRIGHTNESS },
|
{ "brightness", "Brightness", .osd_progbar = OSD_BRIGHTNESS },
|
||||||
{ "contrast", "Contrast", .osd_progbar = OSD_CONTRAST },
|
{ "contrast", "Contrast", .osd_progbar = OSD_CONTRAST },
|
||||||
|
@ -428,6 +428,8 @@ int video_reconfig_filters(struct dec_video *d_video,
|
|||||||
if (opts->requested_input_range != MP_CSP_LEVELS_AUTO)
|
if (opts->requested_input_range != MP_CSP_LEVELS_AUTO)
|
||||||
p.colorlevels = opts->requested_input_range;
|
p.colorlevels = opts->requested_input_range;
|
||||||
p.outputlevels = opts->requested_output_range;
|
p.outputlevels = opts->requested_output_range;
|
||||||
|
if (opts->requested_primaries != MP_CSP_PRIM_AUTO)
|
||||||
|
p.primaries = opts->requested_primaries;
|
||||||
|
|
||||||
// Detect colorspace from resolution.
|
// Detect colorspace from resolution.
|
||||||
// Make sure the user-overrides are consistent (no RGB csp for YUV, etc.).
|
// Make sure the user-overrides are consistent (no RGB csp for YUV, etc.).
|
||||||
|
Loading…
Reference in New Issue
Block a user