summaryrefslogtreecommitdiff
path: root/Script/launch_cam.sh
blob: c09dbb277ad5bd1dddfb4a4c30ae81a0300b20c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

#
#  Launch web cam 
#

touch $HOME/gst-pid
alreadyrunning=`cat $HOME/gst-pid`

cnt=$(echo $alreadyrunning | wc -w)
if [ $cnt -lt 2  ] ; then
    echo "create new $cnt"
    gst-launch-1.0 v4l2src device=/dev/video$cnt ! video/x-raw, width=640, height=480 ! videoconvert ! waylandsink &
    echo $!  >> $HOME/gst-pid
else echo "already running"
    for x in $alreadyrunning; do kill -9 $x; done
    rm -rf $HOME/gst-pid
fi