forked from jgreco/mpv-youtube-quality
-
Notifications
You must be signed in to change notification settings - Fork 4
/
osc.patch
78 lines (68 loc) · 2.42 KB
/
osc.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
diff --git a/osc.lua b/osc.lua
index 0a9965b..afd6047 100644
--- a/osc.lua
+++ b/osc.lua
@@ -1615,6 +1615,13 @@ function bar_layout(direction)
lo.geometry = geo
lo.style = osc_styles.smallButtonsBar
+ -- START quality-menu
+ geo = { x = geo.x - geo.w - padX, y = geo.y, an = geo.an, w = geo.w, h = geo.h }
+ lo = add_layout("quality-menu")
+ lo.geometry = geo
+ lo.style = osc_styles.smallButtonsBar
+ -- END quality-menu
+
-- Volume
geo = { x = geo.x - geo.w - padX, y = geo.y, an = geo.an, w = geo.w, h = geo.h }
lo = add_layout("volume")
@@ -2124,6 +2131,17 @@ function osc_init()
string.format("%3.0fs", sec))
end
+ -- START quality-menu
+ ne = new_element("quality-menu", "button")
+ ne.content = function()
+ return ("≚")
+ end
+ ne.eventresponder["mbtn_left_up"] =
+ function () mp.commandv("script-message", "video_formats_toggle") end
+ ne.eventresponder["mbtn_right_up"] =
+ function () mp.commandv("script-message", "audio_formats_toggle") end
+ -- END quality-menu
+
-- volume
ne = new_element("volume", "button")
@@ -2206,15 +2224,21 @@ function update_margins()
reset_margins()
end
+ if utils.shared_script_property_set then
utils.shared_script_property_set("osc-margins",
string.format("%f,%f,%f,%f", margins.l, margins.r, margins.t, margins.b))
+ end
mp.set_property_native("user-data/osc/margins", margins)
end
function shutdown()
reset_margins()
+ if utils.shared_script_property_set then
utils.shared_script_property_set("osc-margins", nil)
+ end
+ if mp.del_property then
mp.del_property("user-data/osc")
+ end
end
--
@@ -2870,7 +2894,9 @@ function visibility_mode(mode, no_osd)
end
user_opts.visibility = mode
+ if utils.shared_script_property_set then
utils.shared_script_property_set("osc-visibility", mode)
+ end
mp.set_property_native("user-data/osc/visibility", mode)
if not no_osd and tonumber(mp.get_property("osd-level")) >= 1 then
@@ -2903,7 +2929,9 @@ function idlescreen_visibility(mode, no_osd)
user_opts.idlescreen = false
end
+ if utils.shared_script_property_set then
utils.shared_script_property_set("osc-idlescreen", mode)
+ end
mp.set_property_native("user-data/osc/idlescreen", user_opts.idlescreen)
if not no_osd and tonumber(mp.get_property("osd-level")) >= 1 then