mpv: sane-cast: fix crash due to missing table.concat function

This commit is contained in:
2024-04-21 00:24:46 +00:00
parent 4dfee58d09
commit 0625bfdd10
3 changed files with 61 additions and 50 deletions

View File

@@ -137,43 +137,50 @@ let
in in
{ {
sane.programs.mpv = { sane.programs.mpv = {
packageUnwrapped = pkgs.wrapMpv (mpv-unwrapped.override { lua = pkgs.luajit; }) { packageUnwrapped = pkgs.wrapMpv
scripts = [ (mpv-unwrapped.override rec {
pkgs.mpvScripts.mpris # N.B.: populating `self` to `luajit` is necessary for the resulting `lua.withPackages` function to preserve my override.
pkgs.mpvScripts.mpv-playlistmanager # i use enable52Compat in order to get `table.unpack`.
uosc # i think using `luajit` here instead of `lua` is optional, just i get better perf with it :)
# pkgs.mpv-uosc-latest lua = pkgs.luajit.override { enable52Compat = true; self = lua; };
]; })
# extraMakeWrapperArgs = lib.optionals (cfg.config.vo != null) [ {
# # 2023/08/29: fixes an error where mpv on moby launches with the message scripts = [
# # "DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory" pkgs.mpvScripts.mpris
# # audio still works, and controls, screenshotting, etc -- just not the actual rendering pkgs.mpvScripts.mpv-playlistmanager
# # uosc
# # this is likely a regression for mpv 0.36.0. # pkgs.mpv-uosc-latest
# # the actual error message *appears* to come from the mesa library, but it's tough to trace. ];
# # # extraMakeWrapperArgs = lib.optionals (cfg.config.vo != null) [
# # 2024/03/02: no longer necessary, with mesa 23.3.1: <https://github.com/NixOS/nixpkgs/pull/265740> # # 2023/08/29: fixes an error where mpv on moby launches with the message
# # # # "DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory"
# # backend compatibility (2023/10/22): # # audio still works, and controls, screenshotting, etc -- just not the actual rendering
# # run with `--vo=help` to see a list of all output options. # #
# # non-exhaustive (W=works, F=fails, A=audio-only, U=audio+ui only (no video)) # # this is likely a regression for mpv 0.36.0.
# # ? null Null video output # # the actual error message *appears* to come from the mesa library, but it's tough to trace.
# # A (default) # #
# # A dmabuf-wayland Wayland dmabuf video output # # 2024/03/02: no longer necessary, with mesa 23.3.1: <https://github.com/NixOS/nixpkgs/pull/265740>
# # A libmpv render API for libmpv (mpv plays the audio, but doesn't even render a window) # #
# # A vdpau VDPAU with X11 # # backend compatibility (2023/10/22):
# # F drm Direct Rendering Manager (software scaling) # # run with `--vo=help` to see a list of all output options.
# # F gpu-next Video output based on libplacebo # # non-exhaustive (W=works, F=fails, A=audio-only, U=audio+ui only (no video))
# # F vaapi VA API with X11 # # ? null Null video output
# # F x11 X11 (software scaling) # # A (default)
# # F xv X11/Xv # # A dmabuf-wayland Wayland dmabuf video output
# # U gpu Shader-based GPU Renderer # # A libmpv render API for libmpv (mpv plays the audio, but doesn't even render a window)
# # W caca libcaca (terminal rendering) # # A vdpau VDPAU with X11
# # W sdl SDL 2.0 Renderer # # F drm Direct Rendering Manager (software scaling)
# # W wlshm Wayland SHM video output (software scaling) # # F gpu-next Video output based on libplacebo
# "--add-flags" "--vo=${cfg.config.vo}" # # F vaapi VA API with X11
# ]; # # F x11 X11 (software scaling)
}; # # F xv X11/Xv
# # U gpu Shader-based GPU Renderer
# # W caca libcaca (terminal rendering)
# # W sdl SDL 2.0 Renderer
# # W wlshm Wayland SHM video output (software scaling)
# "--add-flags" "--vo=${cfg.config.vo}"
# ];
};
suggestedPrograms = [ suggestedPrograms = [
"blast-to-default" "blast-to-default"
@@ -205,7 +212,7 @@ in
# for `watch_later` # for `watch_later`
".local/state/mpv" ".local/state/mpv"
]; ];
fs.".config/mpv/scripts/sane-cast/main.lua".symlink.target = ./sane-cast-main.lua; fs.".config/mpv/scripts/sane-cast/main.lua".symlink.target = ./sane-cast/main.lua;
fs.".config/mpv/scripts/sane-sysvol/main.lua".symlink.target = ./sane-sysvol/main.lua; fs.".config/mpv/scripts/sane-sysvol/main.lua".symlink.target = ./sane-sysvol/main.lua;
fs.".config/mpv/scripts/sane-sysvol/non_blocking_popen.lua".symlink.target = ./sane-sysvol/non_blocking_popen.lua; fs.".config/mpv/scripts/sane-sysvol/non_blocking_popen.lua".symlink.target = ./sane-sysvol/non_blocking_popen.lua;
fs.".config/mpv/input.conf".symlink.target = ./input.conf; fs.".config/mpv/input.conf".symlink.target = ./input.conf;

View File

@@ -33,7 +33,7 @@ ctrl+s async screenshot #! Utils > Screenshot
alt+i script-binding uosc/keybinds #! Utils > Key bindings alt+i script-binding uosc/keybinds #! Utils > Key bindings
O script-binding uosc/show-in-directory #! Utils > Show in directory O script-binding uosc/show-in-directory #! Utils > Show in directory
# script-binding uosc/open-config-directory #! Utils > Open config directory # script-binding uosc/open-config-directory #! Utils > Open config directory
ctrl+r script-binding sane-cast/blast #! Audiocast ctrl+r script-binding sane_cast/blast #! Audiocast
ctrl+t script-binding sane-cast/go2tv-video #! Cast ctrl+t script-binding sane_cast/go2tv-video #! Cast
# script-binding sane-cast/go2tv-stream #! Cast (...) > Stream # script-binding sane_cast/go2tv-stream #! Cast (...) > Stream
# script-binding sane-cast/go2tv-gui #! Cast (...) > GUI # script-binding sane_cast/go2tv-gui #! Cast (...) > GUI

View File

@@ -1,7 +1,11 @@
msg = require("mp.msg")
msg.trace("load: begin")
function subprocess(in_terminal, args) function subprocess(in_terminal, args)
if in_terminal then if in_terminal then
args = { "xdg-terminal-exec", table.unpack(args) } args = { "xdg-terminal-exec", table.unpack(args) }
end end
msg.info(table.concat(args, " "))
mp.command_native({ mp.command_native({
name = "subprocess", name = "subprocess",
args = args, args = args,
@@ -20,15 +24,15 @@ function invoke_go2tv(in_terminal, args)
end end
function invoke_go2tv_on_open_file(mode) function invoke_go2tv_on_open_file(mode)
local path = mp.get_property("stream-open-filename"); msg.trace("invoke_go2tv_on_open_file")
return invoke_go2tv(true, { mode, path }) local path = mp.get_property("stream-open-filename")
msg.trace("path:", path)
invoke_go2tv(true, { mode, path })
end end
mp.add_key_binding(nil, "blast", function() subprocess(false, { "blast-to-default" }) end) mp.add_key_binding(nil, "blast", function() subprocess(false, { "blast-to-default" }) end)
mp.add_key_binding(nil, 'go2tv-gui', function() invoke_go2tv(false, {}) end) mp.add_key_binding(nil, "go2tv-gui", function() invoke_go2tv(false, {}) end)
mp.add_key_binding(nil, 'go2tv-video', function() invoke_go2tv_on_open_file("-v") end) mp.add_key_binding(nil, "go2tv-video", function() invoke_go2tv_on_open_file("-v") end)
mp.add_key_binding(nil, 'go2tv-stream', function() invoke_go2tv_on_open_file("-s") end) mp.add_key_binding(nil, "go2tv-stream", function() invoke_go2tv_on_open_file("-s") end)
-- uncomment for debugging: msg.trace("load: complete")
-- if mpv fails to eval this script (e.g. syntax error), then it will fail to quit on launch
-- mp.command('quit')