mirror of https://github.com/mpv-player/mpv
stats.lua: show osd-dimensions property
This change displays the scaled position and size of the image before cropping to the target rectangle. In simple terms, it shows how much margin has been added to the image or how much of the image has been cropped. Note that target resolution is displayed after crop as in fact all other pixels are discarded anyway.
This commit is contained in:
parent
f55d19e846
commit
e3fd24496a
|
@ -895,18 +895,23 @@ local function add_video_out(s)
|
||||||
scale = mp.get_property_native("current-window-scale")
|
scale = mp.get_property_native("current-window-scale")
|
||||||
end
|
end
|
||||||
|
|
||||||
local r = mp.get_property_native("video-target-params")
|
local od = mp.get_property_native("osd-dimensions")
|
||||||
if not r then
|
local rt = mp.get_property_native("video-target-params")
|
||||||
local osd_dims = mp.get_property_native("osd-dimensions")
|
r = rt or {}
|
||||||
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_resolution(s, {w=scaled_width, h=scaled_height, s=scale},
|
|
||||||
"Resolution:")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Add window scale
|
-- Add window scale
|
||||||
r["s"] = scale
|
r["s"] = scale
|
||||||
|
r["crop-x"] = od["ml"]
|
||||||
|
r["crop-y"] = od["mt"]
|
||||||
|
r["crop-w"] = od["w"] - od["ml"] - od["mr"]
|
||||||
|
r["crop-h"] = od["h"] - od["mt"] - od["mb"]
|
||||||
|
|
||||||
|
if not rt then
|
||||||
|
r["w"] = r["crop-w"]
|
||||||
|
r["h"] = r["crop-h"]
|
||||||
|
append_resolution(s, r, "Resolution:", "w", "h", true)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
append_img_params(s, r)
|
append_img_params(s, r)
|
||||||
append_hdr(s, r, true)
|
append_hdr(s, r, true)
|
||||||
|
|
Loading…
Reference in New Issue