diff options
author | Martin Herkt <lachs0r@srsfckn.biz> | 2016-02-28 23:31:51 +0100 |
---|---|---|
committer | Martin Herkt <lachs0r@srsfckn.biz> | 2016-02-28 23:31:51 +0100 |
commit | 21cd4ff05bb46b375a9ad38c9f0b7f8e71a5d979 (patch) | |
tree | b9679cc1d2c7c3cab0f88c370015f34f6d0b27ca /TOOLS | |
parent | d1d6257731866934717353fce484f5f472f845d1 (diff) | |
parent | 1f436f65f2ee4df6419ca68bd6426b8283db6d22 (diff) | |
download | mpv-21cd4ff05bb46b375a9ad38c9f0b7f8e71a5d979.tar.bz2 mpv-21cd4ff05bb46b375a9ad38c9f0b7f8e71a5d979.tar.xz |
Merge branch 'master' into release/current
Diffstat (limited to 'TOOLS')
-rw-r--r-- | TOOLS/lua/ao-null-reload.lua | 20 | ||||
-rw-r--r-- | TOOLS/lua/autoload.lua | 5 |
2 files changed, 25 insertions, 0 deletions
diff --git a/TOOLS/lua/ao-null-reload.lua b/TOOLS/lua/ao-null-reload.lua new file mode 100644 index 0000000000..5b2330b517 --- /dev/null +++ b/TOOLS/lua/ao-null-reload.lua @@ -0,0 +1,20 @@ +-- Handles the edge case where previous attempts to init audio have failed, but +-- might start working due to a newly added device. This is required in +-- particular for ao=wasapi, since the internal IMMNotificationClient code that +-- normally triggers ao-reload will not be running in this case. + +function do_reload() + mp.command("ao-reload") + reloading = nil +end + +function on_audio_device_list_change() + if mp.get_property("current-ao") == "null" and not reloading then + mp.msg.verbose("audio-device-list changed: reloading audio") + -- avoid calling ao-reload too often + reloading = mp.add_timeout(0.5, do_reload) + end +end + +mp.set_property("options/audio-fallback-to-null", "yes") +mp.observe_property("audio-device-list", "native", on_audio_device_list_change) diff --git a/TOOLS/lua/autoload.lua b/TOOLS/lua/autoload.lua index 0c8c9a5381..1f22bb40e2 100644 --- a/TOOLS/lua/autoload.lua +++ b/TOOLS/lua/autoload.lua @@ -72,6 +72,11 @@ function find_and_add_entries() return EXTENSIONS[string.lower(ext)] end) table.sort(files, function (a, b) + local len = string.len(a) - string.len(b) + if len ~= 0 then -- case for ordering filename ending with such as X.Y.Z + local ext = string.len(get_extension(a)) + 1 + return string.sub(a, 1, -ext) < string.sub(b, 1, -ext) + end return string.lower(a) < string.lower(b) end) |