Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function round(num, idp)
- local mult = 10^(idp or 0)
- return math.floor(num * mult + 0.5) / mult
- end
- local function append_number(s, num, attr, excluded)
- excluded = excluded or {[""] = true}
- local ret = num
- attr.prefix_sep = attr.prefix_sep or o.prefix_sep
- attr.indent = attr.indent or o.indent
- attr.nl = attr.nl or o.nl
- attr.suffix = attr.suffix or ""
- attr.prefix = attr.prefix or ""
- attr.no_prefix_markup = attr.no_prefix_markup or false
- attr.prefix = attr.no_prefix_markup and attr.prefix or b(attr.prefix)
- ret = attr.no_value and "" or ret
- s[#s+1] = format("%s%s%s%s%s%s", attr.nl, attr.indent,
- attr.prefix, attr.prefix_sep, no_ASS(ret), attr.suffix)
- return true
- end
- local function add_video(s)
- local scaledh = 0
- local scaledw = 0
- local anamorphic = 0
- local real_window_scale = 0
- -- Anamorphic videos are a thing and osd-width/osd-height don't update on Windows for them correctly
- if not (mp.get_property_osd("video-params/dw") == mp.get_property_osd("video-params/w") and mp.get_property_osd("video-params/dh") == mp.get_property_osd("video-params/h")) then
- anamorphic = 1
- append_property(s, "video-params/w", {prefix="Native Resolution:"})
- append_property(s, "video-params/h",
- {prefix="x", nl="", indent=" ", prefix_sep=" ", no_prefix_markup=true})
- append_property(s, "video-params/dw", {prefix="Anamorphic Resolution: ", prefix_sep=""})
- append_property(s, "video-params/dh", {prefix="x", nl = "", indent=" ", prefix_sep=" ", no_prefix_markup=true})
- if mp.get_property_bool("fullscreen") then
- scaledh = round(1440 * mp.get_property_number("video-params/aspect"))
- scaledw = 1440
- else
- scaledh = round(mp.get_property_number("video-params/dw") * mp.get_property_number("window-scale"))
- scaledw = round(mp.get_property_number("video-params/dh") * mp.get_property_number("window-scale"))
- end
- append_number(s, scaledh, {prefix="→", nl = "", indent=" ", prefix_sep=" ", no_prefix_markup=true})
- append_number(s, scaledw, {prefix="x", nl = "", indent=" ", prefix_sep=" ", no_prefix_markup=true})
- else
- append_property(s, "video-params/w", {prefix="Native Resolution:"})
- append_property(s, "video-params/h",
- {prefix="x", nl="", indent=" ", prefix_sep=" ", no_prefix_markup=true})
- append_number(s, mp.get_property_number("osd-width"), {prefix="→", nl = "", indent=" ", prefix_sep=" ", no_prefix_markup=true})
- append_number(s, mp.get_property_number("osd-height"), {prefix="x", nl = "", indent=" ", prefix_sep=" ", no_prefix_markup=true})
- end
- -- window-scale is not updated when resizing from smaller than full screen to full screen on Windows
- if not mp.get_property_bool("fullscreen") then
- append_property(s, "window-scale", {prefix="Window Scale:"})
- else
- if anamorphic == 1 then
- real_window_scale = round(1440 / mp.get_property_number("video-params/dh"), 3)
- else
- real_window_scale = round(1440 / mp.get_property_number("video-params/h"), 3)
- end
- append_number(s, real_window_scale, {prefix="Window Scale:"})
- end
Add Comment
Please, Sign In to add comment