Skip to content

Commit 2db3e3a

Browse files
committed
splashscreen - switch to vlc instead of omxiv / omxplayer
omxiv / omxplayer only works on the Raspberry Pi legacy and fkms drivers. This change switches to vlc for both utilities, as it supports mmal output on the Raspberry Pi legacy drivers, and drm output on KMS on Raspberry Pi OS (bullseye). Remove dependencies for omxplayer / omxiv / insserv Switch code to use vlc. Run asplashscreen as $user (not root). Remove wait for dbus (no longer needed) Save vlc pid and Exit vlc before launching emulationstation on KMS Pin vlc version on Buster to version from archive.raspberrypi.org to stop it being overwritten with the vanilla Debian security release. Enable on 64bit Raspberry Pi OS
1 parent 49731df commit 2db3e3a

File tree

4 files changed

+68
-41
lines changed

4 files changed

+68
-41
lines changed

scriptmodules/supplementary/splashscreen.sh

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ rp_module_id="splashscreen"
1313
rp_module_desc="Configure Splashscreen"
1414
rp_module_section="main"
1515
rp_module_repo="git https://github.com/RetroPie/retropie-splashscreens.git master"
16-
rp_module_flags="noinstclean !all rpi !osmc !xbian !aarch64"
16+
rp_module_flags="noinstclean !all rpi !osmc !xbian"
1717

1818
function _update_hook_splashscreen() {
1919
# make sure splashscreen is always up to date if updating just RetroPie-Setup
@@ -32,9 +32,14 @@ function _video_exts_splashscreen() {
3232
}
3333

3434
function depends_splashscreen() {
35-
local params=(insserv)
36-
isPlatform "32bit" && params+=(omxplayer)
37-
getDepends "${params[@]}"
35+
# pin archive.raspberrypi.org version of VLC on buster as updated "security" vanilla version doesn't have mmal output
36+
if [[ "$__os_debian_ver" -lt 11 ]]; then
37+
cp "$md_data/rp-vlc" /etc/apt/preferences.d/
38+
# try and install vlc to force downgrade
39+
aptInstall --allow-downgrades vlc
40+
else
41+
getDepends vlc
42+
fi
3843
}
3944

4045
function install_bin_splashscreen() {
@@ -48,20 +53,28 @@ ConditionPathExists=$md_inst/asplashscreen.sh
4853
4954
[Service]
5055
Type=oneshot
56+
User=$__user
5157
ExecStart=$md_inst/asplashscreen.sh
5258
RemainAfterExit=yes
5359
5460
[Install]
5561
WantedBy=sysinit.target
5662
_EOF_
5763

58-
rp_installModule "omxiv" "_autoupdate_"
59-
6064
gitPullOrClone "$md_inst"
6165

6266
cp "$md_data/asplashscreen.sh" "$md_inst"
6367

6468
iniConfig "=" '"' "$md_inst/asplashscreen.sh"
69+
70+
if isPlatform "videocore"; then
71+
# set vlc mmal layer for videocore
72+
iniSet "CMD_OPTS" " --mmal-layer 10001"
73+
else
74+
# install script to kill splashscreen before running autostart scripts when using kms
75+
cp "$md_data/05-splash.sh" /etc/profile.d/
76+
fi
77+
6578
iniSet "ROOTDIR" "$rootdir"
6679
iniSet "DATADIR" "$datadir"
6780
iniSet "REGEX_IMAGE" "$(_image_exts_splashscreen)"
@@ -107,9 +120,6 @@ function disable_splashscreen() {
107120
function configure_splashscreen() {
108121
[[ "$md_mode" == "remove" ]] && return
109122

110-
# remove legacy service
111-
[[ -f "/etc/init.d/asplashscreen" ]] && insserv -r asplashscreen && rm -f /etc/init.d/asplashscreen
112-
113123
disable_plymouth_splashscreen
114124
enable_splashscreen
115125
[[ ! -f /etc/splashscreen.list ]] && default_splashscreen
@@ -118,8 +128,9 @@ function configure_splashscreen() {
118128
function remove_splashscreen() {
119129
enable_plymouth_splashscreen
120130
disable_splashscreen
121-
rp_callModule "omxiv" remove
122131
rm -f /etc/splashscreen.list /etc/systemd/system/asplashscreen.service
132+
rm -f /etc/apt/preferences.d/rp-vlc
133+
rm -f /etc/profile.d/05-splash.sh
123134
systemctl daemon-reload
124135
}
125136

@@ -229,7 +240,7 @@ function preview_splashscreen() {
229240

230241
local path
231242
local file
232-
local omxiv="/opt/retropie/supplementary/omxiv/omxiv"
243+
local splash_cmd="sudo -u $__user XDG_RUNTIME_DIR=/run/user/$SUDO_UID vlc --intf dummy --quiet --play-and-exit --image-duration 6"
233244
while true; do
234245
local cmd=(dialog --backtitle "$__backtitle" --menu "Choose an option." 22 86 16)
235246
local choice=$("${cmd[@]}" "${options[@]}" 2>&1 >/dev/tty)
@@ -241,13 +252,13 @@ function preview_splashscreen() {
241252
1)
242253
file=$(choose_splashscreen "$path" "image")
243254
[[ -z "$file" ]] && break
244-
$omxiv -b "$file"
255+
$splash_cmd "$file"
245256
;;
246257
2)
247258
file=$(mktemp)
248259
find "$path" -type f ! -regex ".*/\..*" ! -regex ".*LICENSE" ! -regex ".*README.*" ! -regex ".*\.sh" | sort > "$file"
249260
if [[ -s "$file" ]]; then
250-
$omxiv -t 6 -T blend -b --once -f "$file"
261+
tr "\n" "\0" <"$file" | xargs -0 $splash_cmd
251262
else
252263
printMsgs "dialog" "There are no splashscreens installed in $path"
253264
fi
@@ -257,7 +268,7 @@ function preview_splashscreen() {
257268
3)
258269
file=$(choose_splashscreen "$path" "video")
259270
[[ -z "$file" ]] && break
260-
omxplayer --no-osd -b --layer 10000 "$file"
271+
$splash_cmd "$file"
261272
;;
262273
esac
263274
done
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
PID_FILE=/dev/shm/rp-splashscreen.pid
2+
if [ "`tty`" = "/dev/tty1" ] && [ -z "$DISPLAY" ] && [ -f "$PID_FILE" ]; then
3+
PID=`cat $PID_FILE`
4+
if ps -p $PID >/dev/null; then
5+
kill $PID >/dev/null 2>&1
6+
fi
7+
rm $PID_FILE
8+
fi

scriptmodules/supplementary/splashscreen/asplashscreen.sh

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ ROOTDIR=""
44
DATADIR=""
55
REGEX_VIDEO=""
66
REGEX_IMAGE=""
7+
CMD="vlc --intf dummy --quiet --no-video-title-show --play-and-exit"
8+
CMD_OPTS=""
79

810
# Load user settings
911
. /opt/retropie/configs/all/splashscreen.cfg
@@ -20,11 +22,8 @@ do_start () {
2022
local config="/etc/splashscreen.list"
2123
local line
2224
local re="$REGEX_VIDEO\|$REGEX_IMAGE"
23-
local omxiv="/opt/retropie/supplementary/omxiv/omxiv"
25+
local cmd="$CMD $CMD_OPTS"
2426
case "$RANDOMIZE" in
25-
disabled)
26-
line="$(head -1 "$config")"
27-
;;
2827
retropie)
2928
line="$(find "$ROOTDIR/supplementary/splashscreen" -type f | grep "$re" | shuf -n1)"
3029
;;
@@ -38,36 +37,38 @@ do_start () {
3837
line="$(cat "$config" | shuf -n1)"
3938
;;
4039
esac
41-
if $(echo "$line" | grep -q "$REGEX_VIDEO"); then
42-
# wait for dbus
43-
while ! pgrep "dbus" >/dev/null; do
44-
sleep 1
45-
done
46-
omxplayer --no-osd -o both -b --layer 10001 "$line"
47-
elif $(echo "$line" | grep -q "$REGEX_IMAGE"); then
48-
if [ "$RANDOMIZE" = "disabled" ]; then
49-
local count=$(wc -l <"$config")
50-
else
51-
local count=1
52-
fi
53-
[ $count -eq 0 ] && count=1
54-
[ $count -gt 12 ] && count=12
5540

56-
# Default duration is 12 seconds, check if configured otherwise
57-
[ -z "$DURATION" ] && DURATION=12
58-
local delay=$((DURATION/count))
59-
if [ "$RANDOMIZE" = "disabled" ]; then
60-
"$omxiv" --once -t $delay -b --layer 10001 -f "$config" >/dev/null 2>&1
61-
else
62-
"$omxiv" --once -t $delay -b --layer 10001 -r "$line" >/dev/null 2>&1
63-
fi
41+
if [ "$RANDOMIZE" = "disabled" ]; then
42+
local count=$(wc -l <"$config")
43+
else
44+
local count=1
45+
fi
46+
47+
[ $count -eq 0 ] && count=1
48+
[ $count -gt 12 ] && count=12
49+
50+
# Default duration is 12 seconds, check if configured otherwise
51+
[ -z "$DURATION" ] && DURATION=12
52+
local delay=$((DURATION/count))
53+
54+
cmd="$cmd --image-duration $delay"
55+
local pid
56+
if [ "$RANDOMIZE" = "disabled" ]; then
57+
tr "\n" "\0" <"$config" | xargs -0 $cmd & 2>/dev/null
58+
# get cmd pid (child of xargs)
59+
pid=`pgrep -P $!`
60+
else
61+
$cmd "$line" & 2>/dev/null
62+
pid=$!
6463
fi
64+
echo "$pid" >/dev/shm/rp-splashscreen.pid
65+
6566
exit 0
6667
}
6768

6869
case "$1" in
6970
start|"")
70-
do_start &
71+
do_start
7172
;;
7273
restart|reload|force-reload)
7374
echo "Error: argument '$1' not supported" >&2
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Package: vlc*
2+
Pin: origin archive.raspberrypi.org
3+
Pin-Priority: 1001
4+
5+
Package: libvlc*
6+
Pin: origin archive.raspberrypi.org
7+
Pin-Priority: 1001

0 commit comments

Comments
 (0)