summaryrefslogtreecommitdiff
path: root/scripts/ctrlroom/sydra-sender.sh
blob: e626ddd9b462bc5cc976669102df334037662e95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
############################

ROOT_D="$1"

SYDRA_RTP="sydra-rtp"
SYDRA_LAUNCH="sydra-launch"

############################

printUsage() {
  echo "Usage: $0 <basedir>"
}

if [ -z "$ROOT_D" ]; then
  printUsage
  exit 1
fi
if [ ! -d "$ROOT_D" ]; then
  echo "ERROR: can't change to non-existent directory: $ROOT_D"
  exit 2
fi

. ./include.sh

start_rtp() {
  PORT_BASE=8000
  RECORD_D="$ROOT_D/recordings/sender"
  mkdir -p "$RECORD_D"

  herbstclient rule once title="sender" tag="control"
  exec $SYDRA_RTP -n "sender" -D --log stdout:3 --mode sender -t 10 -O $PORT_BASE \
    --previewsink "textoverlay text=\"local\" shaded-background=true font-desc=\"Sans 18\" ! videoscale add-borders=true ! xvimagesink" \
    --rec-mux matroskamux --rec-name-format "$RECORD_D/%Y-%m-%d_%H-%M-%S.mkv" --rec-video-encoder jpegenc \
                          --rec-audio-encoder "audioconvert ! vorbisenc"
}

start_test() {
  herbstclient rule once title="sender" tag="control"
  exec $SYDRA_LAUNCH -n "sender" -D --log stdout:3 -p "videotestsrc ! video/x-raw,width=864,height=480,framerate=25/1 ! textoverlay text=\"local\" shaded-background=true font-desc=\"Sans 18\" ! videoscale add-borders=true ! xvimagesink"
}

cd $ROOT_D
[ -n "$SYDRA_TEST" ] || start_rtp
[ -n "$SYDRA_TEST" ] && start_test