Adds ability to run multiple instanses.

This commit is contained in:
Llewellyn van der Merwe 2023-05-03 22:57:27 +02:00
parent 5268492184
commit 1d640d4158
Signed by: Llewellyn
GPG Key ID: A9201372263741E7

View File

@ -27,6 +27,9 @@ DEVICE=''
# the screen number # the screen number
SCREEN_NUMBER='' SCREEN_NUMBER=''
# the mplayer PID ID
MPLAYER_PID
# main function # main function
function main() { function main() {
# select the video to use # select the video to use
@ -155,6 +158,7 @@ function getDevices() {
function previewDevice() { function previewDevice() {
device=$1 device=$1
mplayer tv:// -tv driver=v4l2:device="/dev/$device" -geometry "300x300" -quiet -nolirc -ontop -noborder -nosound -vo xv & mplayer tv:// -tv driver=v4l2:device="/dev/$device" -geometry "300x300" -quiet -nolirc -ontop -noborder -nosound -vo xv &
MPLAYER_PID=$!
disown disown
} }
@ -208,6 +212,7 @@ function mainMenu() {
function showLarge() { function showLarge() {
mplayer -zoom -ontop -noborder -nosound -vo gl:nomanyfmts \ mplayer -zoom -ontop -noborder -nosound -vo gl:nomanyfmts \
-vf mirror -xy 2 tv:// -tv driver=v4l2:device="/dev/${DEVICE}" -screen "${SCREEN_NUMBER}" & -vf mirror -xy 2 tv:// -tv driver=v4l2:device="/dev/${DEVICE}" -screen "${SCREEN_NUMBER}" &
MPLAYER_PID=$!
disown disown
} }
@ -259,13 +264,17 @@ function showVideo() {
mplayer -zoom -ontop -noborder -nosound -vo gl:nomanyfmts \ mplayer -zoom -ontop -noborder -nosound -vo gl:nomanyfmts \
-geometry 320x240+"${x}"+"${y}" -vf mirror tv:// -tv driver=v4l2:device="/dev/${DEVICE}" -screen "${SCREEN_NUMBER}" & -geometry 320x240+"${x}"+"${y}" -vf mirror tv:// -tv driver=v4l2:device="/dev/${DEVICE}" -screen "${SCREEN_NUMBER}" &
MPLAYER_PID=$!
disown disown
} }
# stop videos playing # stop videos playing
function stopVideo() { function stopVideo() {
pkill mplayer if [ -n "${MPLAYER_PID}" ]; then
kill "${MPLAYER_PID}"
unset MPLAYER_PID
sleep 1 sleep 1
fi
} }
# start program # start program