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
1 changed files with 12 additions and 3 deletions

View File

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