summaryrefslogtreecommitdiffstats
path: root/player/lua/stats.lua
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-08-13 17:20:03 +0200
committerNiklas Haas <github-daiK1o@haasn.dev>2023-08-18 16:39:35 +0200
commitcc3c2ad8fb5c12a22f220a9191e4d9b563532e9b (patch)
tree0aa8c35ae81285d46872c9737712e9c417f4af98 /player/lua/stats.lua
parent540a5eb5ab452e290f4fd40447eeeb1b8aee180f (diff)
downloadmpv-cc3c2ad8fb5c12a22f220a9191e4d9b563532e9b.tar.bz2
mpv-cc3c2ad8fb5c12a22f220a9191e4d9b563532e9b.tar.xz
stats.lua: display output resolution if it differs to native one
Useful when filters are applied that alters the video resolution, like crop. Also display aspect ratio per each resolution.
Diffstat (limited to 'player/lua/stats.lua')
-rw-r--r--player/lua/stats.lua34
1 files changed, 23 insertions, 11 deletions
diff --git a/player/lua/stats.lua b/player/lua/stats.lua
index 46cf81e434..bcfd29e9dd 100644
--- a/player/lua/stats.lua
+++ b/player/lua/stats.lua
@@ -670,11 +670,29 @@ local function add_file(s)
end
+local function append_resolution(s, r, prefix)
+ if not r then
+ return
+ end
+ if append(s, r["w"], {prefix=prefix}) then
+ append(s, r["h"], {prefix="x", nl="", indent=" ", prefix_sep=" ",
+ no_prefix_markup=true})
+ if r["aspect"] ~= nil then
+ append(s, format("%.2f:1", r["aspect"]), {prefix=", ", nl="", indent="",
+ no_prefix_markup=true})
+ append(s, r["aspect-name"], {prefix="(", suffix=")", nl="", indent=" ",
+ prefix_sep="", no_prefix_markup=true})
+ end
+ end
+end
+
+
local function add_video(s)
local r = mp.get_property_native("video-params")
+ local ro = mp.get_property_native("video-out-params")
-- in case of e.g. lavfi-complex there can be no input video, only output
if not r then
- r = mp.get_property_native("video-out-params")
+ r = ro
end
if not r then
return
@@ -712,20 +730,14 @@ local function add_video(s)
append_display_sync(s)
append_perfdata(s, o.print_perfdata_passes)
- 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})
+ append_resolution(s, r, "Native Resolution:")
+ if ro and (r["w"] ~= ro["w"] or r["h"] ~= ro["h"]) then
+ append_resolution(s, ro, "Output Resolution:")
end
+ append_resolution(s, {w=scaled_width, h=scaled_height}, "Scaled Resolution:")
if not mp.get_property_native("fullscreen") then
append_property(s, "current-window-scale", {prefix="Window Scale:"})
end
- if r["aspect"] ~= nil then
- append(s, format("%.2f:1", r["aspect"]), {prefix="Aspect Ratio:"})
- append(s, r["aspect-name"], {prefix="(", suffix=")", nl="", indent=" ",
- prefix_sep="", no_prefix_markup=true})
- end
append(s, r["pixelformat"], {prefix="Pixel Format:"})
if r["hw-pixelformat"] ~= nil then
append(s, r["hw-pixelformat"], {prefix_sep="[", nl="", indent=" ",