mirror of
https://github.com/mpv-player/mpv
synced 2025-04-11 04:01:31 +00:00
command: add hdr-metadata property
This commit is contained in:
parent
38ac67308b
commit
3cf71fd7c7
@ -51,6 +51,7 @@ Interface changes
|
|||||||
- remove `auto-forced-only` property
|
- remove `auto-forced-only` property
|
||||||
- rename `--sub-forced-only` to `--sub-forced-events-only`
|
- rename `--sub-forced-only` to `--sub-forced-events-only`
|
||||||
- remove `sub-forced-only-cur` property (`--sub-forced-events-only` is a replacement)
|
- remove `sub-forced-only-cur` property (`--sub-forced-events-only` is a replacement)
|
||||||
|
- add `hdr-metadata` property
|
||||||
--- mpv 0.36.0 ---
|
--- mpv 0.36.0 ---
|
||||||
- add `--target-contrast`
|
- add `--target-contrast`
|
||||||
- Target luminance value is now also applied when ICC profile is used.
|
- Target luminance value is now also applied when ICC profile is used.
|
||||||
|
@ -2480,6 +2480,54 @@ Property list
|
|||||||
"average-bpp" MPV_FORMAT_INT64
|
"average-bpp" MPV_FORMAT_INT64
|
||||||
"alpha" MPV_FORMAT_STRING
|
"alpha" MPV_FORMAT_STRING
|
||||||
|
|
||||||
|
``hdr-metadata``
|
||||||
|
Video HDR metadata per frame, including peak detection result.
|
||||||
|
This has a number of sub-properties:
|
||||||
|
|
||||||
|
``hdr-metadata/min-luma``
|
||||||
|
Minimum luminance, as reported by HDR10 metadata (in cd/m²)
|
||||||
|
|
||||||
|
``hdr-metadata/max-luma``
|
||||||
|
Maximum luminance, as reported by HDR10 metadata (in cd/m²)
|
||||||
|
|
||||||
|
``hdr-metadata/max-cll``
|
||||||
|
Maximum content light level, as reported by HDR10 metadata (in cd/m²)
|
||||||
|
|
||||||
|
``hdr-metadata/max-fall``
|
||||||
|
Maximum frame average light level, as reported by HDR10 metadata (in cd/m²)
|
||||||
|
|
||||||
|
``hdr-metadata/scene-max-r``
|
||||||
|
MaxRGB of a scene for R component, as reported by HDR10+ metadata (in cd/m²)
|
||||||
|
|
||||||
|
``hdr-metadata/scene-max-g``
|
||||||
|
MaxRGB of a scene for G component, as reported by HDR10+ metadata (in cd/m²)
|
||||||
|
|
||||||
|
``hdr-metadata/scene-max-b``
|
||||||
|
MaxRGB of a scene for B component, as reported by HDR10+ metadata (in cd/m²)
|
||||||
|
|
||||||
|
``hdr-metadata/max-pq-y``
|
||||||
|
Maximum PQ luminance of a frame, as reported by peak detection (in PQ, 0-1)
|
||||||
|
|
||||||
|
``hdr-metadata/avg-pq-y``
|
||||||
|
Average PQ luminance of a frame, as reported by peak detection (in PQ, 0-1)
|
||||||
|
|
||||||
|
When querying the property with the client API using ``MPV_FORMAT_NODE``,
|
||||||
|
or with Lua ``mp.get_property_native``, this will return a mpv_node with
|
||||||
|
the following contents:
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
MPV_FORMAT_NODE_MAP
|
||||||
|
"min-luma" MPV_FORMAT_DOUBLE
|
||||||
|
"max-luma" MPV_FORMAT_DOUBLE
|
||||||
|
"max-cll" MPV_FORMAT_DOUBLE
|
||||||
|
"max-fall" MPV_FORMAT_DOUBLE
|
||||||
|
"scene-max-r" MPV_FORMAT_DOUBLE
|
||||||
|
"scene-max-g" MPV_FORMAT_DOUBLE
|
||||||
|
"scene-max-b" MPV_FORMAT_DOUBLE
|
||||||
|
"max-pq-y" MPV_FORMAT_DOUBLE
|
||||||
|
"avg-pq-y" MPV_FORMAT_DOUBLE
|
||||||
|
|
||||||
``dwidth``, ``dheight``
|
``dwidth``, ``dheight``
|
||||||
Video display size. This is the video size after filters and aspect scaling
|
Video display size. This is the video size after filters and aspect scaling
|
||||||
have been applied. The actual video window size can still be different
|
have been applied. The actual video window size can still be different
|
||||||
|
@ -2664,6 +2664,40 @@ out:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int mp_property_hdr_metadata(void *ctx, struct m_property *prop,
|
||||||
|
int action, void *arg)
|
||||||
|
{
|
||||||
|
MPContext *mpctx = ctx;
|
||||||
|
if (!mpctx->video_out)
|
||||||
|
return M_PROPERTY_UNAVAILABLE;
|
||||||
|
|
||||||
|
struct mp_hdr_metadata data;
|
||||||
|
if (vo_control(mpctx->video_out, VOCTRL_HDR_METADATA, &data) != VO_TRUE)
|
||||||
|
return M_PROPERTY_UNAVAILABLE;
|
||||||
|
|
||||||
|
bool has_hdr10 = data.max_luma;
|
||||||
|
bool has_hdr10plus = data.scene_avg && (data.scene_max[0] ||
|
||||||
|
data.scene_max[1] ||
|
||||||
|
data.scene_max[2]);
|
||||||
|
bool has_cie_y = data.max_pq_y && data.avg_pq_y;
|
||||||
|
|
||||||
|
struct m_sub_property props[] = {
|
||||||
|
{"min-luma", SUB_PROP_FLOAT(data.min_luma), .unavailable = !has_hdr10},
|
||||||
|
{"max-luma", SUB_PROP_FLOAT(data.max_luma), .unavailable = !has_hdr10},
|
||||||
|
{"max-cll", SUB_PROP_FLOAT(data.max_cll), .unavailable = !has_hdr10},
|
||||||
|
{"max-fall", SUB_PROP_FLOAT(data.max_fall), .unavailable = !has_hdr10},
|
||||||
|
{"scene-max-r", SUB_PROP_FLOAT(data.scene_max[0]), .unavailable = !has_hdr10plus},
|
||||||
|
{"scene-max-g", SUB_PROP_FLOAT(data.scene_max[1]), .unavailable = !has_hdr10plus},
|
||||||
|
{"scene-max-b", SUB_PROP_FLOAT(data.scene_max[2]), .unavailable = !has_hdr10plus},
|
||||||
|
{"scene-avg", SUB_PROP_FLOAT(data.scene_avg), .unavailable = !has_hdr10plus},
|
||||||
|
{"max-pq-y", SUB_PROP_FLOAT(data.max_pq_y), .unavailable = !has_cie_y},
|
||||||
|
{"avg-pq-y", SUB_PROP_FLOAT(data.avg_pq_y), .unavailable = !has_cie_y},
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
return m_property_read_sub(props, action, arg);
|
||||||
|
}
|
||||||
|
|
||||||
static int mp_property_perf_info(void *ctx, struct m_property *p, int action,
|
static int mp_property_perf_info(void *ctx, struct m_property *p, int action,
|
||||||
void *arg)
|
void *arg)
|
||||||
{
|
{
|
||||||
@ -3934,6 +3968,7 @@ static const struct m_property mp_properties_base[] = {
|
|||||||
{"current-window-scale", mp_property_current_window_scale},
|
{"current-window-scale", mp_property_current_window_scale},
|
||||||
{"vo-configured", mp_property_vo_configured},
|
{"vo-configured", mp_property_vo_configured},
|
||||||
{"vo-passes", mp_property_vo_passes},
|
{"vo-passes", mp_property_vo_passes},
|
||||||
|
{"hdr-metadata", mp_property_hdr_metadata},
|
||||||
{"perf-info", mp_property_perf_info},
|
{"perf-info", mp_property_perf_info},
|
||||||
{"current-vo", mp_property_vo},
|
{"current-vo", mp_property_vo},
|
||||||
{"container-fps", mp_property_fps},
|
{"container-fps", mp_property_fps},
|
||||||
|
Loading…
Reference in New Issue
Block a user