Unified · Split
| @@ -51,6 +51,7 @@ Interface changes · 50 unmodified lines | ||
| 51 | 51 | - remove `auto-forced-only` property |
| 52 | 52 | - rename `--sub-forced-only` to `--sub-forced-events-only` |
| 53 | 53 | - remove `sub-forced-only-cur` property (`--sub-forced-events-only` is a replacement) |
| 54 | + - add `hdr-metadata` property | |
| 54 | 55 | --- mpv 0.36.0 --- |
| 55 | 56 | - add `--target-contrast` |
| 56 | 57 | - Target luminance value is now also applied when ICC profile is used. |
| @@ -2480,6 +2480,54 @@ Property list · 2479 unmodified lines | ||
| 2480 | 2480 | "average-bpp" MPV_FORMAT_INT64 |
| 2481 | 2481 | "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 | 2531 | ``dwidth``, ``dheight`` |
| 2484 | 2532 | Video display size. This is the video size after filters and aspect scaling |
| 2485 | 2533 | have been applied. The actual video window size can still be different |
| @@ -2664,6 +2664,40 @@ out: · 2663 unmodified lines | ||
| 2664 | 2664 | return ret; |
| 2665 | 2665 | } |
| 2666 | 2666 | |
| 2667 | +static 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 | + | |
| 2667 | 2701 | static int mp_property_perf_info(void *ctx, struct m_property *p, int action, |
| 2668 | 2702 | void *arg) |
| 2669 | 2703 | { |
| @@ -3934,6 +3968,7 @@ static const struct m_property mp_properties_base[] = { · 1264 unmodified lines | ||
| 3934 | 3968 | {"current-window-scale", mp_property_current_window_scale}, |
| 3935 | 3969 | {"vo-configured", mp_property_vo_configured}, |
| 3936 | 3970 | {"vo-passes", mp_property_vo_passes}, |
| 3971 | + {"hdr-metadata", mp_property_hdr_metadata}, | |
| 3937 | 3972 | {"perf-info", mp_property_perf_info}, |
| 3938 | 3973 | {"current-vo", mp_property_vo}, |
| 3939 | 3974 | {"container-fps", mp_property_fps}, |