From 76a53f9de3592c435def1d020fab4a05f88a14e0 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Thu, 24 Jun 2021 10:09:05 -0500 Subject: stats.lua: add scaled resolution Calculate the actual scaled size of the video from osd-dimensions and display it on the stats page. --- player/lua/stats.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/player/lua/stats.lua b/player/lua/stats.lua index 6aaf7eef5e..bfdf68aba6 100644 --- a/player/lua/stats.lua +++ b/player/lua/stats.lua @@ -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:"}) -- cgit v1.2.3