|
1 | 1 | --[[ |
2 | 2 | SOURCE_ https://github.com/mpv-player/mpv/blob/master/player/lua/stats.lua |
3 | | -COMMIT_ 5b1df3c5d900298e433539c99e8e5ea60acfa068 |
| 3 | +COMMIT_ 0fb40b654d969b2447ae0f71bcb695d7cf597f9c |
4 | 4 | 文档_ stats.conf |
5 | 5 |
|
6 | 6 | mpv.conf的前置条件 --load-stats-overlay=no |
@@ -889,30 +889,33 @@ local function append_hdr(s, hdr, video_out) |
889 | 889 | return |
890 | 890 | end |
891 | 891 |
|
892 | | - local function should_show(val) |
893 | | - return val and val ~= 203 and val > 0 |
| 892 | + local function has(val, target) |
| 893 | + return val and math.abs(val - target) > 1e-4 |
894 | 894 | end |
895 | 895 |
|
896 | 896 | -- If we are printing video out parameters it is just display, not mastering |
897 | 897 | local display_prefix = video_out and "显示:" or "母版显示:" |
898 | 898 |
|
899 | 899 | local indent = "" |
| 900 | + local has_dml = has(hdr["min-luma"], 0.203) or has(hdr["max-luma"], 203) |
| 901 | + local has_cll = hdr["max-cll"] and hdr["max-cll"] > 0 |
| 902 | + local has_fall = hdr["max-fall"] and hdr["max-fall"] > 0 |
900 | 903 |
|
901 | | - if should_show(hdr["max-cll"]) or should_show(hdr["max-luma"]) then |
| 904 | + if has_dml or has_cll or has_fall then |
902 | 905 | append(s, "", {prefix="HDR10:"}) |
903 | | - if hdr["min-luma"] and should_show(hdr["max-luma"]) then |
| 906 | + if has_dml then |
904 | 907 | -- libplacebo uses close to zero values as "defined zero" |
905 | 908 | hdr["min-luma"] = hdr["min-luma"] <= 1e-6 and 0 or hdr["min-luma"] |
906 | 909 | append(s, format("%.2g / %.0f", hdr["min-luma"], hdr["max-luma"]), |
907 | 910 | {prefix=display_prefix, suffix=" cd/m²", nl="", indent=indent}) |
908 | 911 | indent = o.prefix_sep .. o.prefix_sep |
909 | 912 | end |
910 | | - if should_show(hdr["max-cll"]) then |
911 | | - append(s, hdr["max-cll"], {prefix="MaxCLL:", suffix=" cd/m²", nl="", |
912 | | - indent=indent}) |
| 913 | + if has_cll then |
| 914 | + append(s, string.format("%.0f", hdr["max-cll"]), {prefix="MaxCLL:", |
| 915 | + suffix=" cd/m²", nl="", indent=indent}) |
913 | 916 | indent = o.prefix_sep .. o.prefix_sep |
914 | 917 | end |
915 | | - if hdr["max-fall"] and hdr["max-fall"] > 0 then |
| 918 | + if has_fall then |
916 | 919 | append(s, hdr["max-fall"], {prefix="MaxFALL:", suffix=" cd/m²", nl="", |
917 | 920 | indent=indent}) |
918 | 921 | end |
@@ -1076,9 +1079,9 @@ local function add_video(s) |
1076 | 1079 | end |
1077 | 1080 |
|
1078 | 1081 | local track = mp.get_property_native("current-tracks/video") |
1079 | | - if track then |
1080 | | - append(s, "", {prefix=track.image and "图片:" or "视频轨:", nl=o.nl .. o.nl, indent=""}) |
1081 | | - append(s, track["codec-desc"], {prefix_sep="", nl="", indent=""}) |
| 1082 | + local track_type = (track and track.image) and "图片:" or "视频轨:" |
| 1083 | + append(s, "", {prefix=track_type, nl=o.nl .. o.nl, indent=""}) |
| 1084 | + if track and append(s, track["codec-desc"], {prefix_sep="", nl="", indent=""}) then |
1082 | 1085 | append(s, track["codec-profile"], {prefix="[", nl="", indent=" ", prefix_sep="", |
1083 | 1086 | no_prefix_markup=true, suffix="]"}) |
1084 | 1087 | if track["codec"] ~= track["decoder"] then |
|
0 commit comments