summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2024-04-09 00:50:51 +0200
committerChristian Pointner <equinox@spreadspace.org>2024-04-09 00:50:51 +0200
commit01f60c5d3e1dabfe14ad1405e61255788b4a8a28 (patch)
treef4d384f1e210a1517bbb7d27a584a1f4197511e4
parentglt-c3voc: use c3voc router as DNS (diff)
streaming/mpv-headless: start mpv with --idle and use json IPC to control it - this way the output resolution is automatically maintained by mpv (aka no video= kernel command line option needed)
-rw-r--r--inventory/host_vars/ele-tarvos.yml1
-rw-r--r--roles/streaming/mpv-headless/defaults/main.yml4
-rw-r--r--roles/streaming/mpv-headless/tasks/main.yml11
-rw-r--r--roles/streaming/mpv-headless/templates/ssh-forced.sh.j24
4 files changed, 4 insertions, 16 deletions
diff --git a/inventory/host_vars/ele-tarvos.yml b/inventory/host_vars/ele-tarvos.yml
index 06cf9711..b0a3423c 100644
--- a/inventory/host_vars/ele-tarvos.yml
+++ b/inventory/host_vars/ele-tarvos.yml
@@ -23,7 +23,6 @@ install:
mountpoint: /home
kernel_cmdline:
- "consoleblank=0"
- - "video=1920x1080@50"
network:
nameservers: "{{ network_zones.lan.dns }}"
diff --git a/roles/streaming/mpv-headless/defaults/main.yml b/roles/streaming/mpv-headless/defaults/main.yml
index 0ef41a75..847dc2aa 100644
--- a/roles/streaming/mpv-headless/defaults/main.yml
+++ b/roles/streaming/mpv-headless/defaults/main.yml
@@ -5,9 +5,5 @@
mpv_headless_audio_device: "alsa/hdmi"
mpv_headless_video_mode: "1920x1080@50"
-mpv_headless_play_script: |
- #!/bin/sh
- exec mpv --osd-level=0 --audio-device='{{ mpv_headless_audio_device }}' --vo=gpu --hwdec=vaapi --gpu-context=drm --drm-mode='{{ mpv_headless_video_mode }}' $@
-
# mpv_headless_ssh_keys:
# - ssh-ed25519 ...
diff --git a/roles/streaming/mpv-headless/tasks/main.yml b/roles/streaming/mpv-headless/tasks/main.yml
index f3a1e684..027c1c69 100644
--- a/roles/streaming/mpv-headless/tasks/main.yml
+++ b/roles/streaming/mpv-headless/tasks/main.yml
@@ -9,6 +9,7 @@
- firmware-linux
- ffmpeg
- mpv
+ - socat
state: present
- name: install non-free vaapi drivers
@@ -54,7 +55,7 @@
case $(tty) in
/dev/tty1)
setterm --clear=all --cursor off --background black
- sleep inf
+ exec mpv --osd-level=0 --no-osc --audio-device='{{ mpv_headless_audio_device }}' --vo=gpu --hwdec=vaapi --gpu-context=drm --drm-mode='{{ mpv_headless_video_mode }}' --force-window=immediate --input-ipc-server=/var/lib/player/ctl.sock --idle
;;
esac
fi
@@ -62,14 +63,6 @@
owner: player
group: player
-- name: install play script
- copy:
- content: "{{ mpv_headless_play_script }}"
- dest: /var/lib/player/play
- owner: player
- group: player
- mode: 0755
-
- name: install ssh forced command
template:
src: ssh-forced.sh.j2
diff --git a/roles/streaming/mpv-headless/templates/ssh-forced.sh.j2 b/roles/streaming/mpv-headless/templates/ssh-forced.sh.j2
index 777f0b32..35e9571e 100644
--- a/roles/streaming/mpv-headless/templates/ssh-forced.sh.j2
+++ b/roles/streaming/mpv-headless/templates/ssh-forced.sh.j2
@@ -15,14 +15,14 @@ case "$command" in
play)
media_file="/srv/media/$(basename "$arg")"
if [ -e "$media_file" ]; then
- exec ./play "$media_file"
+ echo '{"command": ["loadfile", "'"$media_file"'"]}' | socat - /var/lib/player/ctl.sock
else
echo "file '$media_file' not found!"
exit 1
fi
;;
stop)
- killall mpv
+ echo '{"command": ["playlist-remove", "current"]}' | socat - /var/lib/player/ctl.sock
;;
*)
echo "invalid command: '$command'"