From 3668b3a871a97c2f805a88ffc9f5550f1c492c99 Mon Sep 17 00:00:00 2001 From: digitalLumberjack Date: Thu, 9 Jun 2022 18:56:36 +0200 Subject: [PATCH 1/2] fix(system): the creating share video will not cut other videos - it will be played if mpv is not running - and if the slides are not running --- board/recalbox/fsoverlay/etc/init.d/S11share | 3 +- .../fsoverlay/etc/init.d/S12populateshare | 51 ++++++++++++++----- .../fsoverlay/etc/init.d/S30waitsplash | 2 +- ...h => recalbox-play-first-install-media.sh} | 0 4 files changed, 40 insertions(+), 16 deletions(-) rename board/recalbox/fsoverlay/recalbox/scripts/{recalbox-create-share.sh => recalbox-play-first-install-media.sh} (100%) diff --git a/board/recalbox/fsoverlay/etc/init.d/S11share b/board/recalbox/fsoverlay/etc/init.d/S11share index 0f10c9c61d..171beba972 100755 --- a/board/recalbox/fsoverlay/etc/init.d/S11share +++ b/board/recalbox/fsoverlay/etc/init.d/S11share @@ -65,10 +65,11 @@ createMissingPartitions() { } # Display SHARE creation splash screen + touch /tmp/.first-install if [ -f /tmp/.install.sh ]; then ( /tmp/.install.sh createshare ) & else - /recalbox/scripts/recalbox-create-share.sh + /recalbox/scripts/recalbox-play-first-install-media.sh fi # Determine last free (available) space on device diff --git a/board/recalbox/fsoverlay/etc/init.d/S12populateshare b/board/recalbox/fsoverlay/etc/init.d/S12populateshare index 02837b9657..272f95c0d0 100755 --- a/board/recalbox/fsoverlay/etc/init.d/S12populateshare +++ b/board/recalbox/fsoverlay/etc/init.d/S12populateshare @@ -5,11 +5,6 @@ then exit 0 fi -# If the share partition is empty, try playing the "creating share" video -if [ ! -d /recalbox/share/roms ]; then - /recalbox/scripts/recalbox-create-share.sh -fi - # Installation image if [ -f /tmp/.install.sh ]; then ( /tmp/.install.sh installstuff ) & @@ -128,14 +123,47 @@ RECALBOX_VERSION_FILE="/recalbox/recalbox.version" RECALBOX_VERSION=$(cat "$RECALBOX_VERSION_FILE") SHARE_VERSION_FILE="/recalbox/share/system/.share.version" SHARE_VERSION=$(cat "$SHARE_VERSION_FILE" 2>/dev/null) + +function startMpvQueue { + touch /tmp/.mpvqueue + ( + while [ -f /tmp/.mpvqueue ];do + if ! pgrep mpv; then + if [ -f /tmp/.mpvqueuevideos ] && [ $(wc -l < /tmp/.mpvqueuevideos) -gt 0 ]; then + touch /tmp/.mpvqueuevideos.runned + video=$(head -n1 /tmp/.mpvqueuevideos) + cp /tmp/.mpvqueuevideos /tmp/.mpvqueuevideos.save + tail -n+2 /tmp/.mpvqueuevideos.save > /tmp/.mpvqueuevideos + mpv $video + fi + fi + sleep 1 + done + )& +} + +function stopMpvQueue { + if [ -f /tmp/.mpvqueuevideos.runned ];then + killall mpv + fi + rm -f /tmp/.mpvqueue /tmp/.mpvqueuevideos.save /tmp/.mpvqueuevideos /tmp/.mpvqueuevideos.runned +} + +function addMpvNextVideo { + newVideo="$@" + echo "${newVideo}" >> /tmp/.mpvqueuevideos +} + if [ "$RECALBOX_VERSION" != "$SHARE_VERSION" ] ; then recallog -s "${INIT_SCRIPT}" -t "POPULATE" "[7.0] - The system has been updated, copying share_init" # Starting the video source /recalbox/scripts/recalbox-utils.sh IMAGE_PATH=$(getInstallUpgradeImagePath) - killall mpv - mpv $(getMpvOptions) --loop "${IMAGE_PATH}/creating-share.mp4" & echo $! > /tmp/.mpv.pid - + # If it's first install, the slides are running + if [ ! -f /tmp/.first-install ];then + startMpvQueue + addMpvNextVideo $(getMpvOptions) --loop "${IMAGE_PATH}/creating-share.mp4" & echo $! > /tmp/.mpv.pid + fi # Copy all bios from share_upgrade to share recallog -s "${INIT_SCRIPT}" -t "POPULATE" "[7.1] - BIOS" rsync --size-only -r "${UPGRADE}/bios/." "${OUT}/bios" @@ -204,7 +232,7 @@ if [ "$RECALBOX_VERSION" != "$SHARE_VERSION" ] ; then # Update version recallog -s "${INIT_SCRIPT}" -t "POPULATE" "[7.7] - Copy version to share" cp "$RECALBOX_VERSION_FILE" "$SHARE_VERSION_FILE" - kill $(cat /tmp/.mpv.pid) + stopMpvQueue fi # directories to force directories exists @@ -278,8 +306,3 @@ recallog -s "${INIT_SCRIPT}" -t "POPULATE" "[14] - CORE LIST" [ ! -e /recalbox/share/system/configs/retroarch.corenames ] && upgradeRetroarchCoreNames -f /recalbox/share/system/configs/retroarch.corenames # END -if [ -e /tmp/newshare ]; then - recallog -s "${INIT_SCRIPT}" -t "POPULATE" "[15] - Create share" - /recalbox/scripts/recalbox-create-share.sh stop - #reboot -fi diff --git a/board/recalbox/fsoverlay/etc/init.d/S30waitsplash b/board/recalbox/fsoverlay/etc/init.d/S30waitsplash index fc37a6251f..67d9df7ece 100755 --- a/board/recalbox/fsoverlay/etc/init.d/S30waitsplash +++ b/board/recalbox/fsoverlay/etc/init.d/S30waitsplash @@ -21,7 +21,7 @@ wait_splash_end() { case "$1" in start) - /recalbox/scripts/recalbox-create-share.sh stop + /recalbox/scripts/recalbox-play-first-install-media.sh stop wait_splash_end ;; *) diff --git a/board/recalbox/fsoverlay/recalbox/scripts/recalbox-create-share.sh b/board/recalbox/fsoverlay/recalbox/scripts/recalbox-play-first-install-media.sh similarity index 100% rename from board/recalbox/fsoverlay/recalbox/scripts/recalbox-create-share.sh rename to board/recalbox/fsoverlay/recalbox/scripts/recalbox-play-first-install-media.sh -- GitLab From e52994a9090ca57a804d0301bf14669a1fdd42bd Mon Sep 17 00:00:00 2001 From: digitalLumberjack Date: Fri, 10 Jun 2022 08:32:56 +0200 Subject: [PATCH 2/2] feat(system): add a mediaplyaer service for boot process --- .../recalbox/fsoverlay/etc/init.d/S02hardware | 2 + .../fsoverlay/etc/init.d/S05mediaservice | 15 ++ board/recalbox/fsoverlay/etc/init.d/S06splash | 103 +--------- board/recalbox/fsoverlay/etc/init.d/S11share | 6 +- .../fsoverlay/etc/init.d/S12populateshare | 37 +--- .../fsoverlay/etc/init.d/S30waitsplash | 3 +- .../recalbox/scripts/recalbox-boot-media.sh | 189 ++++++++++++++++++ .../recalbox-play-first-install-media.sh | 91 --------- 8 files changed, 223 insertions(+), 223 deletions(-) create mode 100644 board/recalbox/fsoverlay/etc/init.d/S05mediaservice create mode 100644 board/recalbox/fsoverlay/recalbox/scripts/recalbox-boot-media.sh diff --git a/board/recalbox/fsoverlay/etc/init.d/S02hardware b/board/recalbox/fsoverlay/etc/init.d/S02hardware index 37defd4024..02905fe1ba 100755 --- a/board/recalbox/fsoverlay/etc/init.d/S02hardware +++ b/board/recalbox/fsoverlay/etc/init.d/S02hardware @@ -26,6 +26,8 @@ if [ "$1" == "start" ]; then # Installation image if [ -f /tmp/.install.sh ]; then + source /recalbox/scripts/recalbox-boot-media.sh + mediaIgnoreAll ( /tmp/.install.sh initialize ) & fi fi diff --git a/board/recalbox/fsoverlay/etc/init.d/S05mediaservice b/board/recalbox/fsoverlay/etc/init.d/S05mediaservice new file mode 100644 index 0000000000..5d1962d338 --- /dev/null +++ b/board/recalbox/fsoverlay/etc/init.d/S05mediaservice @@ -0,0 +1,15 @@ +#/bin/bash + +if test "$1" == "start"; then + start-stop-daemon -S -n mediaservice -- bash -c \ + "source /recalbox/scripts/recalbox-boot-media.sh && stopMpvQueue && startMpvQueue&" \ + --exit-idle-time=-1 --log-target=syslog --daemonize --use-pid-file --background +elif test "$1" == "stop"; then + start-stop-daemon -K -n mediaservice -- bash -c \ + "source /recalbox/scripts/recalbox-boot-media.sh && stopMpvQueue && stopAllMedia" \ + --exit-idle-time=-1 --log-target=syslog --daemonize --use-pid-file --background +else + exit 0 +fi + + diff --git a/board/recalbox/fsoverlay/etc/init.d/S06splash b/board/recalbox/fsoverlay/etc/init.d/S06splash index 4923d43860..8dab832e6c 100755 --- a/board/recalbox/fsoverlay/etc/init.d/S06splash +++ b/board/recalbox/fsoverlay/etc/init.d/S06splash @@ -6,16 +6,16 @@ if [ "$1" != "start" ]; then exit 0 fi -SKIPVIDEOSPLASHFLAG=/overlay/.configs/skipvideosplash + INTERNALDEVICE=$(/recalbox/scripts/recalbox-part.sh "share_internal") ARCH=$(cat /recalbox/recalbox.arch) INIT_SCRIPT=$(basename "$0") FIRSTTIMEFLAG=/overlay/.configs/firsttimevideo -source /recalbox/scripts/recalbox-utils.sh + +source /recalbox/scripts/recalbox-boot-media.sh # first boot or upgrade -if [ -f "$SKIPVIDEOSPLASHFLAG" ] || [ -f /tmp/.install.sh ] || [ ! -e "$INTERNALDEVICE" ] || ls /boot/update/recalbox-*.img.xz >/dev/null 2>&1 ; then - [[ -f "$SKIPVIDEOSPLASHFLAG" ]] && rm "$SKIPVIDEOSPLASHFLAG" +if mediaShouldIgnoreSplash || [ ! -e "$INTERNALDEVICE" ] || ls /boot/update/recalbox-*.img.xz >/dev/null 2>&1 ; then recallog -s "${INIT_SCRIPT}" -t "INSTALL" "Install in progress. Don't play boot video" exit 0 fi @@ -30,13 +30,6 @@ originalSmallVideoPath="${originalVideoPath}/240p" customVideoPath="/overlay/bootvideos" firstTimeVideo=introRecalboxElectron-1080-Normed-12dB.mp4 -# get output video size - -# Low definiton devices -if [ "$(cut -d, -f2 /sys/class/graphics/fb0/virtual_size)" -le 320 ] \ - && ! isRecalboxRGBDual; then - LOWDEF=1 -fi ## -1 : Video will be stopped when emulationstation is ready to start. ## 0 : All the video will be played before emulationstation start (default) @@ -49,16 +42,6 @@ else videoLength="$timeout" fi -## Functions ## - -# turnOffGPiCaseHDMI -# takes no argument, power off HDMI port to save energy when running in a GPi case -turnOffGPiCaseHDMI() { - if grep -q -E '^case=GPiV1:1' /boot/recalbox-boot.conf; then - recallog -s "${INIT_SCRIPT}" -t "GPI" "GPi case detected: turning HDMI off" - tvservice -o - fi -} # selectVideo # takes no argument and outputs a random video from those available @@ -69,7 +52,7 @@ selectVideo() { local videos local num_videos if isFirstTime; then - [ -n "${LOWDEF}" ] \ + mediaIsLowDef \ && echo "${originalSmallVideoPath}/${firstTimeVideo}" \ || echo "${originalVideoPath}/${firstTimeVideo}" return 0 @@ -108,79 +91,9 @@ isFirstTime() { return 0 } -# showIntroBackground -# displays our intro background via the framebuffer -showIntroBackground() { - if [ -n "${LOWDEF}" ] ; then - fbv2 -f -i /recalbox/system/resources/splash/240p/logo-version.png - else - fbv2 -f -i /recalbox/system/resources/splash/logo-version.png - fi - # launching ES just after fbv can cause some screen corruption - sleep 1 -} - - -# start mpv then show the background (aka pacman screen) -# $1 timeout -# $2 array of options for mpv -runInBackground() { - local timeout="$1"; shift - local options=("$@") - - if [ "$timeout" -gt 0 ]; then - timeout "$videoLength" mpv "${options[@]}" - else - mpv "${options[@]}" - fi - showIntroBackground -} - -# playVideoOnOneScreen -# play a video on a specific display -# intput: -# * filename to play -# * optins regarding output screen (--ao=alsa --vo=drm --drm-connector=1.DVI-I-1) -playVideoOnOneScreen() { - local options - # shellcheck disable=SC2206 - options+=($2) # get space delimited options as is - options+=(--ao=pulse) - options+=(--fs --sub-file=/recalbox/system/resources/splash/recalboxintro.srt --really-quiet) - options+=("$1") - runInBackground "$timeout" "${options[@]}" >/dev/null 2>&1 & -} - -# playVideo -# select all screen and run playVideoOnOneScreen for each connected screen -# intput: -# * filename to play -playVideo() { - local conn - local resolution - local drmmode="" - - if [[ "$machineArch" =~ x86 ]]; then - resolution="$($systemsetting -command load -key system.splash.resolution -source /boot/recalbox-backup.conf)" - if [ "$resolution" != "" ] ; then drmmode="--drm-mode=$resolution" ; fi - # on x86 and x86_64, find connected monitors and play video on all of them - findConnectedConnectors |while read -r conn; do - playVideoOnOneScreen "$1" "--vo=drm $drmmode --drm-connector=$conn" - done - elif isRecalboxRGBDual; then - # On recalbox RGB Dual we will try to get 640x480i for videos - playVideoOnOneScreen "$1" "$(getCrtMpvOptions)" - elif [[ "$ARCH" == "rpi1" ]]; then - # on rpi1 2 and 3 we need to force output - playVideoOnOneScreen "$1" "--hwdec=auto -vo=rpi" - else - # on other simply play - playVideoOnOneScreen "$1" - fi -} - ## Main ## -playVideo "$(selectVideo)" +startMpvQueue +mediaPlaySplash "$(selectVideo)" "${videoLength}" -exit 0 +exit 0 \ No newline at end of file diff --git a/board/recalbox/fsoverlay/etc/init.d/S11share b/board/recalbox/fsoverlay/etc/init.d/S11share index 171beba972..8b8113d53e 100755 --- a/board/recalbox/fsoverlay/etc/init.d/S11share +++ b/board/recalbox/fsoverlay/etc/init.d/S11share @@ -65,13 +65,13 @@ createMissingPartitions() { } # Display SHARE creation splash screen - touch /tmp/.first-install if [ -f /tmp/.install.sh ]; then ( /tmp/.install.sh createshare ) & - else - /recalbox/scripts/recalbox-play-first-install-media.sh fi + source /recalbox/scripts/recalbox-boot-media.sh + mediaPlayInstallMedia + # Determine last free (available) space on device freeSpaceStart=$(parted "${defaultPartedOptions[@]}" print free | grep ':free;$' | tail -1 | cut -d: -f2 | sed 's/B$//') freeSpaceEnd=$(parted "${defaultPartedOptions[@]}" print free | grep ':free;$' | tail -1 | cut -d: -f3 | sed 's/B$//') diff --git a/board/recalbox/fsoverlay/etc/init.d/S12populateshare b/board/recalbox/fsoverlay/etc/init.d/S12populateshare index 272f95c0d0..86aec8dd8b 100755 --- a/board/recalbox/fsoverlay/etc/init.d/S12populateshare +++ b/board/recalbox/fsoverlay/etc/init.d/S12populateshare @@ -124,46 +124,17 @@ RECALBOX_VERSION=$(cat "$RECALBOX_VERSION_FILE") SHARE_VERSION_FILE="/recalbox/share/system/.share.version" SHARE_VERSION=$(cat "$SHARE_VERSION_FILE" 2>/dev/null) -function startMpvQueue { - touch /tmp/.mpvqueue - ( - while [ -f /tmp/.mpvqueue ];do - if ! pgrep mpv; then - if [ -f /tmp/.mpvqueuevideos ] && [ $(wc -l < /tmp/.mpvqueuevideos) -gt 0 ]; then - touch /tmp/.mpvqueuevideos.runned - video=$(head -n1 /tmp/.mpvqueuevideos) - cp /tmp/.mpvqueuevideos /tmp/.mpvqueuevideos.save - tail -n+2 /tmp/.mpvqueuevideos.save > /tmp/.mpvqueuevideos - mpv $video - fi - fi - sleep 1 - done - )& -} - -function stopMpvQueue { - if [ -f /tmp/.mpvqueuevideos.runned ];then - killall mpv - fi - rm -f /tmp/.mpvqueue /tmp/.mpvqueuevideos.save /tmp/.mpvqueuevideos /tmp/.mpvqueuevideos.runned -} -function addMpvNextVideo { - newVideo="$@" - echo "${newVideo}" >> /tmp/.mpvqueuevideos -} if [ "$RECALBOX_VERSION" != "$SHARE_VERSION" ] ; then recallog -s "${INIT_SCRIPT}" -t "POPULATE" "[7.0] - The system has been updated, copying share_init" # Starting the video source /recalbox/scripts/recalbox-utils.sh + source /recalbox/scripts/recalbox-boot-media.sh + IMAGE_PATH=$(getInstallUpgradeImagePath) - # If it's first install, the slides are running - if [ ! -f /tmp/.first-install ];then - startMpvQueue - addMpvNextVideo $(getMpvOptions) --loop "${IMAGE_PATH}/creating-share.mp4" & echo $! > /tmp/.mpv.pid - fi + mediaPlayVideo "${IMAGE_PATH}/creating-share.mp4" + # Copy all bios from share_upgrade to share recallog -s "${INIT_SCRIPT}" -t "POPULATE" "[7.1] - BIOS" rsync --size-only -r "${UPGRADE}/bios/." "${OUT}/bios" diff --git a/board/recalbox/fsoverlay/etc/init.d/S30waitsplash b/board/recalbox/fsoverlay/etc/init.d/S30waitsplash index 67d9df7ece..be97cf2b2c 100755 --- a/board/recalbox/fsoverlay/etc/init.d/S30waitsplash +++ b/board/recalbox/fsoverlay/etc/init.d/S30waitsplash @@ -2,6 +2,7 @@ # in some situations (emmc, ssd...) emulationstation can load really fast, # so wait for splash to finish before launching ES +source /recalbox/scripts/recalbox-boot-media.sh wait_splash_end() { systemsetting="recalbox_settings" @@ -11,7 +12,7 @@ wait_splash_end() { ## -1 : All the video will be played before emulationstation start (default) ## >0 : Time the video will be played before emulationstation start (in seconds) if [ "${videoLength}" -eq 0 ]; then - pkill mpv + /etc/init.d/S05mediaservice stop fi # TODO: implement a failsafe timeout while pgrep mpv >/dev/null 2>&1 ; do diff --git a/board/recalbox/fsoverlay/recalbox/scripts/recalbox-boot-media.sh b/board/recalbox/fsoverlay/recalbox/scripts/recalbox-boot-media.sh new file mode 100644 index 0000000000..2bfc6066d7 --- /dev/null +++ b/board/recalbox/fsoverlay/recalbox/scripts/recalbox-boot-media.sh @@ -0,0 +1,189 @@ +#!/bin/bash +source /recalbox/scripts/recalbox-utils.sh + +SKIPVIDEOSPLASHFLAG=/overlay/.configs/skipvideosplash + +# Management functions + +function mediaIgnoreAll { + touch /tmp/.media.ignoreall +} + +function mediaShouldIgnoreAll { + test -f /tmp/.media.ignoreall + return $? +} + +function mediaShouldIgnoreSplash { + test -f "${SKIPVIDEOSPLASHFLAG}" || mediaShouldIgnoreAll + return $? +} + +function mediaIsLowDef { + # Low definiton devices + test [ "$(cut -d, -f2 /sys/class/graphics/fb0/virtual_size)" -le 320 ] \ + && ! isRecalboxRGBDual + return $? +} + +# Mpv Queue (used in S05mediaservice) +function startMpvQueue { + if [ ! -f /tmp/.mpvqueue ];then + touch /tmp/.mpvqueue + ( + while [ -f /tmp/.mpvqueue ];do + if ! pgrep mpv; then + if [ -f /tmp/.mpvqueuevideos ] && [ $(wc -l < /tmp/.mpvqueuevideos) -gt 0 ]; then + # mpv is not running and we have videos to play + touch /tmp/.mpvqueuevideos.runned + rm /tmp/.mpvqueuevideos.fbv + video=$(head -n1 /tmp/.mpvqueuevideos) + cp /tmp/.mpvqueuevideos /tmp/.mpvqueuevideos.save + tail -n+2 /tmp/.mpvqueuevideos.save > /tmp/.mpvqueuevideos + eval "$video" + else + # mpv is not running we should display the background + if [ ! -f /tmp/.mpvqueuevideos.fbv ];then + touch /tmp/.mpvqueuevideos.fbv + if mediaIsLowDef; then + fbv2 -f -i /recalbox/system/resources/splash/240p/logo-version.png + else + fbv2 -f -i /recalbox/system/resources/splash/logo-version.png + fi + fi + fi + fi + sleep 1 + done + ) + fi +} + +function stopMpvQueue { + if [ -f /tmp/.mpvqueuevideos.runned ];then + killall mpv + fi + rm -f /tmp/.mpvqueue /tmp/.mpvqueuevideos.save /tmp/.mpvqueuevideos /tmp/.mpvqueuevideos.runned +} + +function stopAllMedia { + kilall mpv +} + +function addNextVideo { + newVideo="$@" + echo "${newVideo}" >> /tmp/.mpvqueuevideos +} + + + + +# showIntroBackground +# displays our intro background via the framebuffer +showIntroBackground() { + if mediaIsLowDef ; then + fbv2 -f -i /recalbox/system/resources/splash/240p/logo-version.png + else + fbv2 -f -i /recalbox/system/resources/splash/logo-version.png + fi + # launching ES just after fbv can cause some screen corruption + sleep 1 +} + + +# start mpv then show the background (aka pacman screen) +# $1 timeout +# $2 array of options for mpv +runInBackground() { + local timeout="${1:-0}"; shift + local options=("$@") + + if [ "$timeout" -gt 0 ]; then + addNextVideo timeout "$timeout" mpv "${options[@]}" + else + addNextVideo mpv "${options[@]}" + fi +} + +# playVideoOnOneScreen +# play a video on a specific display +# intput: +# * filename to play +# * optins regarding output screen (--ao=alsa --vo=drm --drm-connector=1.DVI-I-1) +playVideoOnOneScreen() { + local options + # shellcheck disable=SC2206 + options+=($3) # get space delimited options as is + options+=(--ao=pulse) + options+=("${1}") + timeout="${2}" + runInBackground "${timeout}" "${options[@]}" #>/dev/null 2>&1 & +} + +# playVideo +# select all screen and run playVideoOnOneScreen for each connected screen +# intput: +# * filename to play +mediaPlayVideo() { + if mediaShouldIgnoreAll; then + return + fi + + local conn + local resolution + local drmmode="" + local video="${1}" + local timeout="${2}" + local options="${3}" + + if [[ "$machineArch" =~ x86 ]]; then + resolution="$($systemsetting -command load -key system.splash.resolution -source /boot/recalbox-backup.conf)" + if [ "$resolution" != "" ] ; then drmmode="--drm-mode=$resolution" ; fi + # on x86 and x86_64, find connected monitors and play video on all of them + findConnectedConnectors |while read -r conn; do + playVideoOnOneScreen "${video}" "${timeout}" "--vo=drm $drmmode --drm-connector=$conn $options" + done + elif isRecalboxRGBDual; then + # On recalbox RGB Dual we will try to get 640x480i for videos + playVideoOnOneScreen "${video}" "${timeout}" "$(getCrtMpvOptions) $options" + elif [[ "$ARCH" == "rpi1" ]]; then + # on rpi1 2 and 3 we need to force output + playVideoOnOneScreen "${video}" "${timeout}" "--hwdec=auto -vo=rpi $options" + else + # on other simply play + playVideoOnOneScreen "${video}" "${timeout}" "$options" + fi +} + + +# # # +# Splash functions +mediaPlaySplash() { + if mediaShouldIgnoreSplash; then + return + fi + video="${1}" + timeout="${2}" + mediaPlayVideo "${video}" "${timeout}" "--fs --sub-file=/recalbox/system/resources/splash/recalboxintro.srt --really-quiet" +} + +mediaPlayInstallMedia() { + source /recalbox/scripts/recalbox-utils.sh + IMAGE_PATH=$(getInstallUpgradeImagePath) + + # mpv has a bug having the second and last slide not displayed + if isRecalboxRGBDual; then + mediaPlayVideo /recalbox/system/resources/install/install-recalbox-rgb-dual.mp4 + else + mediaPlayVideo "$IMAGE_PATH/install-1.png" \ + "$IMAGE_PATH/install-2.png" \ + "$IMAGE_PATH/install-2.png" \ + "$IMAGE_PATH/install-3.png" \ + "$IMAGE_PATH/install-4.png" \ + "$IMAGE_PATH/install-5.png" \ + "$IMAGE_PATH/install-6.png" \ + "$IMAGE_PATH/install-7.png" \ + "$IMAGE_PATH/install-8.png" \ + "$IMAGE_PATH/install-8.png" "" "--really-quiet --image-display-duration=8" + fi +} \ No newline at end of file diff --git a/board/recalbox/fsoverlay/recalbox/scripts/recalbox-play-first-install-media.sh b/board/recalbox/fsoverlay/recalbox/scripts/recalbox-play-first-install-media.sh index 0a7726085e..e69de29bb2 100755 --- a/board/recalbox/fsoverlay/recalbox/scripts/recalbox-play-first-install-media.sh +++ b/board/recalbox/fsoverlay/recalbox/scripts/recalbox-play-first-install-media.sh @@ -1,91 +0,0 @@ -#!/bin/bash - -source /recalbox/scripts/recalbox-utils.sh -IMAGE_PATH=$(getInstallUpgradeImagePath) - -# Don't play animation when a special case is installing! -if [[ -f /tmp/.install.png ]] ; then - exit 0 -fi - -# Stop -if [ "$1" = "stop" ]; then - if [[ -f /tmp/first-boot-video ]] ; then - rm -f /tmp/first-boot-video - killall mpv - fi - if [[ -f /tmp/first-boot-slides ]] ; then - rm -f /tmp/first-boot-slides - while pkill --signal 0 fbv2; do sleep 1; done - fi - exit 0 -fi - -machineArch=$(arch) - - - -# playVideo -# select all screen and run playVideoOnOneScreen for each connected screen -playVideo() { - local conn - if [[ ! -f /tmp/first-boot-video ]] ; then - touch /tmp/first-boot-video - if [[ "$machineArch" =~ x86 ]]; then - # on x86 and x86_64, find connected monitors and play video on all of them - findConnectedConnectors | while read -r conn; do - mpv --loop --really-quiet --fps 5 --no-correct-pts -ao=alsa --vo=drm --drm-connector=$conn /recalbox/system/resources/creating-share.mp4 & - done - else - # on rpi, odroidxu4, simply play - mpv --loop --really-quiet --fps 5 --no-correct-pts /recalbox/system/resources/creating-share.mp4 & - fi - fi -} - -# playSlides -# play all the 8 slides -playSlides() { - if [[ ! -f /tmp/first-boot-slides ]] ; then - touch /tmp/first-boot-slides - if isRecalboxRGBDual; then - # mpv has a bug having the second and last slide not displayed - mpv $(getCrtMpvOptions) --really-quiet --image-display-duration=8 "$IMAGE_PATH/install-1.png" \ - "$IMAGE_PATH/install-2.png" \ - "$IMAGE_PATH/install-2.png" \ - "$IMAGE_PATH/install-3.png" \ - "$IMAGE_PATH/install-4.png" \ - "$IMAGE_PATH/install-5.png" \ - "$IMAGE_PATH/install-6.png" \ - "$IMAGE_PATH/install-7.png" \ - "$IMAGE_PATH/install-8.png" \ - "$IMAGE_PATH/install-8.png" & - else - fbv2 -i -k -e -s 150 \ - "$IMAGE_PATH/install-1.png" \ - "$IMAGE_PATH/install-2.png" \ - "$IMAGE_PATH/install-3.png" \ - "$IMAGE_PATH/install-4.png" \ - "$IMAGE_PATH/install-5.png" \ - "$IMAGE_PATH/install-6.png" \ - "$IMAGE_PATH/install-7.png" \ - "$IMAGE_PATH/install-8.png" & - fi - fi -} - -# Play Recalbox RGB Dual installation video -playRRGBDInstallVideo() { - mpv $(getCrtMpvOptions) --really-quiet /recalbox/system/resources/install/install-recalbox-rgb-dual.mp4 & -} - -# Start -fbdevHeight=$(cut -d, -f2 /sys/class/graphics/fb0/virtual_size) -if isRecalboxRGBDual; then - playRRGBDInstallVideo -elif [ "${fbdevHeight}" -le 320 ];then - playVideo -else - playSlides -fi -exit 0 -- GitLab