Skip to content

Commit

Permalink
stats.lua: add scaled resolution
Browse files Browse the repository at this point in the history
Calculate the actual scaled size of the video from osd-dimensions and
display it on the stats page.
  • Loading branch information
Dudemanguy committed Jun 25, 2021
1 parent 5f76744 commit 76a53f9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions player/lua/stats.lua
Expand Up @@ -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=" ",
Expand Down Expand Up @@ -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:"})
Expand Down

0 comments on commit 76a53f9

Please sign in to comment.