History

command: add hdr-metadata property

Kacper Michajłow committed 3 years ago

Commit 3cf71fd1 parent 38ac6733 files · +84 −0Browse files

Unified · Split

3 files
  1. DOCS/interface-changes.rst +1 −0
  2. DOCS/man/input.rst +48 −0
  3. player/command.c +35 −0
DOCS/interface-changes.rst+1−0
@@ -51,6 +51,7 @@ Interface changes · 50 unmodified lines
51 - remove `auto-forced-only` property51 - remove `auto-forced-only` property
52 - rename `--sub-forced-only` to `--sub-forced-events-only`52 - rename `--sub-forced-only` to `--sub-forced-events-only`
53 - remove `sub-forced-only-cur` property (`--sub-forced-events-only` is a replacement)53 - remove `sub-forced-only-cur` property (`--sub-forced-events-only` is a replacement)
54 - add `hdr-metadata` property
54 --- mpv 0.36.0 ---55 --- mpv 0.36.0 ---
55 - add `--target-contrast`56 - add `--target-contrast`
56 - Target luminance value is now also applied when ICC profile is used.57 - Target luminance value is now also applied when ICC profile is used.
DOCS/man/input.rst+48−0
@@ -2480,6 +2480,54 @@ Property list · 2479 unmodified lines
2480 "average-bpp" MPV_FORMAT_INT642480 "average-bpp" MPV_FORMAT_INT64
2481 "alpha" MPV_FORMAT_STRING2481 "alpha" MPV_FORMAT_STRING
2482 2482
2483``hdr-metadata``
2484 Video HDR metadata per frame, including peak detection result.
2485 This has a number of sub-properties:
2486
2487 ``hdr-metadata/min-luma``
2488 Minimum luminance, as reported by HDR10 metadata (in cd/m²)
2489
2490 ``hdr-metadata/max-luma``
2491 Maximum luminance, as reported by HDR10 metadata (in cd/m²)
2492
2493 ``hdr-metadata/max-cll``
2494 Maximum content light level, as reported by HDR10 metadata (in cd/m²)
2495
2496 ``hdr-metadata/max-fall``
2497 Maximum frame average light level, as reported by HDR10 metadata (in cd/m²)
2498
2499 ``hdr-metadata/scene-max-r``
2500 MaxRGB of a scene for R component, as reported by HDR10+ metadata (in cd/m²)
2501
2502 ``hdr-metadata/scene-max-g``
2503 MaxRGB of a scene for G component, as reported by HDR10+ metadata (in cd/m²)
2504
2505 ``hdr-metadata/scene-max-b``
2506 MaxRGB of a scene for B component, as reported by HDR10+ metadata (in cd/m²)
2507
2508 ``hdr-metadata/max-pq-y``
2509 Maximum PQ luminance of a frame, as reported by peak detection (in PQ, 0-1)
2510
2511 ``hdr-metadata/avg-pq-y``
2512 Average PQ luminance of a frame, as reported by peak detection (in PQ, 0-1)
2513
2514 When querying the property with the client API using ``MPV_FORMAT_NODE``,
2515 or with Lua ``mp.get_property_native``, this will return a mpv_node with
2516 the following contents:
2517
2518 ::
2519
2520 MPV_FORMAT_NODE_MAP
2521 "min-luma" MPV_FORMAT_DOUBLE
2522 "max-luma" MPV_FORMAT_DOUBLE
2523 "max-cll" MPV_FORMAT_DOUBLE
2524 "max-fall" MPV_FORMAT_DOUBLE
2525 "scene-max-r" MPV_FORMAT_DOUBLE
2526 "scene-max-g" MPV_FORMAT_DOUBLE
2527 "scene-max-b" MPV_FORMAT_DOUBLE
2528 "max-pq-y" MPV_FORMAT_DOUBLE
2529 "avg-pq-y" MPV_FORMAT_DOUBLE
2530
2483``dwidth``, ``dheight``2531``dwidth``, ``dheight``
2484 Video display size. This is the video size after filters and aspect scaling2532 Video display size. This is the video size after filters and aspect scaling
2485 have been applied. The actual video window size can still be different2533 have been applied. The actual video window size can still be different
player/command.c+35−0
@@ -2664,6 +2664,40 @@ out: · 2663 unmodified lines
2664 return ret;2664 return ret;
2665}2665}
2666 2666
2667static int mp_property_hdr_metadata(void *ctx, struct m_property *prop,
2668 int action, void *arg)
2669{
2670 MPContext *mpctx = ctx;
2671 if (!mpctx->video_out)
2672 return M_PROPERTY_UNAVAILABLE;
2673
2674 struct mp_hdr_metadata data;
2675 if (vo_control(mpctx->video_out, VOCTRL_HDR_METADATA, &data) != VO_TRUE)
2676 return M_PROPERTY_UNAVAILABLE;
2677
2678 bool has_hdr10 = data.max_luma;
2679 bool has_hdr10plus = data.scene_avg && (data.scene_max[0] ||
2680 data.scene_max[1] ||
2681 data.scene_max[2]);
2682 bool has_cie_y = data.max_pq_y && data.avg_pq_y;
2683
2684 struct m_sub_property props[] = {
2685 {"min-luma", SUB_PROP_FLOAT(data.min_luma), .unavailable = !has_hdr10},
2686 {"max-luma", SUB_PROP_FLOAT(data.max_luma), .unavailable = !has_hdr10},
2687 {"max-cll", SUB_PROP_FLOAT(data.max_cll), .unavailable = !has_hdr10},
2688 {"max-fall", SUB_PROP_FLOAT(data.max_fall), .unavailable = !has_hdr10},
2689 {"scene-max-r", SUB_PROP_FLOAT(data.scene_max[0]), .unavailable = !has_hdr10plus},
2690 {"scene-max-g", SUB_PROP_FLOAT(data.scene_max[1]), .unavailable = !has_hdr10plus},
2691 {"scene-max-b", SUB_PROP_FLOAT(data.scene_max[2]), .unavailable = !has_hdr10plus},
2692 {"scene-avg", SUB_PROP_FLOAT(data.scene_avg), .unavailable = !has_hdr10plus},
2693 {"max-pq-y", SUB_PROP_FLOAT(data.max_pq_y), .unavailable = !has_cie_y},
2694 {"avg-pq-y", SUB_PROP_FLOAT(data.avg_pq_y), .unavailable = !has_cie_y},
2695 {0}
2696 };
2697
2698 return m_property_read_sub(props, action, arg);
2699}
2700
2667static int mp_property_perf_info(void *ctx, struct m_property *p, int action,2701static int mp_property_perf_info(void *ctx, struct m_property *p, int action,
2668 void *arg)2702 void *arg)
2669{2703{
@@ -3934,6 +3968,7 @@ static const struct m_property mp_properties_base[] = { · 1264 unmodified lines
3934 {"current-window-scale", mp_property_current_window_scale},3968 {"current-window-scale", mp_property_current_window_scale},
3935 {"vo-configured", mp_property_vo_configured},3969 {"vo-configured", mp_property_vo_configured},
3936 {"vo-passes", mp_property_vo_passes},3970 {"vo-passes", mp_property_vo_passes},
3971 {"hdr-metadata", mp_property_hdr_metadata},
3937 {"perf-info", mp_property_perf_info},3972 {"perf-info", mp_property_perf_info},
3938 {"current-vo", mp_property_vo},3973 {"current-vo", mp_property_vo},
3939 {"container-fps", mp_property_fps},3974 {"container-fps", mp_property_fps},

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t