1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-29 10:32:15 +00:00

stats.lua: add scaled resolution

Calculate the actual scaled size of the video from osd-dimensions and
display it on the stats page.
This commit is contained in:
Dudemanguy 2021-06-24 10:09:05 -05:00
parent 5f76744c61
commit 76a53f9de3

View File

@ -517,6 +517,10 @@ local function add_video(s)
return
end
local osd_dims = mp.get_property_native("osd-dimensions")
local scaled_width = osd_dims["w"] - osd_dims["ml"] - osd_dims["mr"]
local scaled_height = osd_dims["h"] - osd_dims["mt"] - osd_dims["mb"]
append(s, "", {prefix=o.nl .. o.nl .. "Video:", nl="", indent=""})
if append_property(s, "video-codec", {prefix_sep="", nl="", indent=""}) then
append_property(s, "hwdec-current", {prefix="(hwdec:", nl="", indent=" ",
@ -548,6 +552,9 @@ local function add_video(s)
if append(s, r["w"], {prefix="Native Resolution:"}) then
append(s, r["h"], {prefix="x", nl="", indent=" ", prefix_sep=" ", no_prefix_markup=true})
end
if append(s, scaled_width, {prefix="Scaled Resolution:"}) then
append(s, scaled_height, {prefix="x", nl="", indent=" ", prefix_sep=" ", no_prefix_markup=true})
end
append_property(s, "current-window-scale", {prefix="Window Scale:"})
if r["aspect"] ~= nil then
append(s, format("%.2f", r["aspect"]), {prefix="Aspect Ratio:"})