|
297 | 297 | -- exclude: Optional table containing keys which are considered invalid values |
298 | 298 | -- for this property. Specifying this will replace empty string as |
299 | 299 | -- default invalid value (nil is always invalid). |
300 | | -local function append_property(s, prop, attr, excluded) |
| 300 | +-- cached : If true, use get_property_cached instead of get_property_osd |
| 301 | +local function append_property(s, prop, attr, excluded, cached) |
301 | 302 | excluded = excluded or {[""] = true} |
302 | | - local ret = mp.get_property_osd(prop) |
| 303 | + local ret |
| 304 | + if cached then |
| 305 | + ret = get_property_cached(prop) |
| 306 | + else |
| 307 | + ret = mp.get_property_osd(prop) |
| 308 | + end |
303 | 309 | if not ret or excluded[ret] then |
304 | 310 | if o.debug then |
305 | 311 | print("No value for property: " .. prop) |
@@ -919,8 +925,8 @@ local function add_video_out(s) |
919 | 925 | append(s, "", {prefix="Display:", nl=o.nl .. o.nl, indent=""}) |
920 | 926 | append(s, vo, {prefix_sep="", nl="", indent=""}) |
921 | 927 |
|
922 | | - append(s, get_property_cached("display-names"), {prefix_sep="", prefix="(", suffix=")", |
923 | | - no_prefix_markup=true, nl="", indent=" "}) |
| 928 | + append_property(s, "display-names", {prefix_sep="", prefix="(", suffix=")", |
| 929 | + no_prefix_markup=true, nl="", indent=" "}, nil, true) |
924 | 930 | append(s, mp.get_property_native("current-gpu-context"), |
925 | 931 | {prefix="Context:", nl="", indent=o.prefix_sep .. o.prefix_sep}) |
926 | 932 | append_property(s, "avsync", {prefix="A-V:"}) |
@@ -985,9 +991,9 @@ local function add_video(s) |
985 | 991 | append(s, track["decoder"], {prefix="[", nl="", indent=" ", prefix_sep="", |
986 | 992 | no_prefix_markup=true, suffix="]"}) |
987 | 993 | end |
988 | | - append(s, get_property_cached("hwdec-current"), {prefix="HW:", nl="", |
989 | | - indent=o.prefix_sep .. o.prefix_sep, |
990 | | - no_prefix_markup=false, suffix=""}, {no=true, [""]=true}) |
| 994 | + append_property(s, "hwdec-current", {prefix="HW:", nl="", |
| 995 | + indent=o.prefix_sep .. o.prefix_sep, |
| 996 | + no_prefix_markup=false, suffix=""}, {no=true, [""]=true}, true) |
991 | 997 | end |
992 | 998 | local has_prefix = false |
993 | 999 | if o.show_frame_info then |
|
0 commit comments