From 10285d31fd2ffb84063bc2103c247e52f9169e4e Mon Sep 17 00:00:00 2001
From: Janne Mareike Koschinski <mail@justjanne.de>
Date: Thu, 23 Jan 2025 22:17:26 +0100
Subject: [PATCH] Use weston for playout

---
 configs/weston.ini                   |  4 ++++
 install.sh                           |  3 +++
 services/voctomix2-voctocore.service |  6 ++++--
 services/weston.service              | 21 +++++++++++++++++++++
 4 files changed, 32 insertions(+), 2 deletions(-)
 create mode 100644 services/weston.service

diff --git a/configs/weston.ini b/configs/weston.ini
index 8d968c3..88f0726 100644
--- a/configs/weston.ini
+++ b/configs/weston.ini
@@ -6,6 +6,10 @@ renderer=gl
 require-input=false
 xwayland=false
 
+[shell]
+background-type=scale
+background-image=/opt/voc/assets/bg1080.png
+
 [output]
 name=HDMI-A-5
 transform=normal
diff --git a/install.sh b/install.sh
index f3dad3e..44569ae 100644
--- a/install.sh
+++ b/install.sh
@@ -27,12 +27,15 @@ apt install -y \
 usermod -aG audio voc
 usermod -aG render voc
 usermod -aG video voc
+usermod -aG weston-launch voc
 
 ln -s /opt/voc/configs/udev.rules /etc/udev/rules.d/v4l2-voc.rules
 ln -s /opt/voc/services/voctomix2-recording-sink.service /etc/systemd/system/voctomix2-recording-sink.service
 ln -s /opt/voc/services/voctomix2-streaming-sink.service /etc/systemd/system/voctomix2-streaming-sink.service
 ln -s /opt/voc/services/voctomix2-voctocore.service /etc/systemd/system/voctomix2-voctocore.service
+ln -s /opt/voc/services/weston.service /etc/systemd/system/weston.service
 
 systemctl enable voctomix2-recording-sink.service
 systemctl enable voctomix2-streaming-sink.service
 systemctl enable voctomix2-voctocore.service
+systemctl enable weston.service
\ No newline at end of file
diff --git a/services/voctomix2-voctocore.service b/services/voctomix2-voctocore.service
index eb49c75..c9a54cf 100644
--- a/services/voctomix2-voctocore.service
+++ b/services/voctomix2-voctocore.service
@@ -1,13 +1,15 @@
 [Unit]
 Description=voctomix2 core
-After=network.target
+After=weston.service network.target
 
 [Service]
 User=voc
 Group=voc
 Type=notify
 WorkingDirectory=/opt/voc/voctomix
-ExecStart=/opt/voc/voctomix/voctocore/voctocore.py --ini-file /opt/voc/configs/voctocore-cam2.ini -vv
+Environment=WAYLAND_DISPLAY=/run/user/1000/wayland-1
+Environment=XDG_RUNTIME_DIR=/run/user/1000
+ExecStart=/opt/voc/voctomix/voctocore/voctocore.py --ini-file /opt/voc/configs/voctocore-cam2.ini --pipeline -vv
 Restart=always
 RestartSec=1s
 StartLimitInterval=0
diff --git a/services/weston.service b/services/weston.service
new file mode 100644
index 0000000..e4d3b6c
--- /dev/null
+++ b/services/weston.service
@@ -0,0 +1,21 @@
+[Unit]
+Description=Weston Wayland compositor startup
+After=systemd-user-sessions.service
+
+[Service]
+Type=simple
+Environment=XDG_SESSION_TYPE=wayland
+User=voc
+PAMName=login
+TTYPath=/dev/tty7
+TTYReset=yes
+TTYVHangup=yes
+TTYVTDisallocate=yes
+StandardInput=tty-fail
+StandardError=journal
+UtmpIdentifier=tty7
+UtmpMode=user
+ExecStart=/usr/bin/weston --config /opt/voc/configs/weston.ini
+
+[Install]
+WantedBy=multi-user.target
-- 
GitLab