blob: 47594256f14399338cf1a23d569a6b85306424ae (
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
#!/bin/bash
############################
ROOT_D="$1"
TAG="$2"
NUM="$3"
SYDRA_RTP="sydra-rtp"
SYDRA_LAUNCH="sydra-launch"
MAIN_STAT_FILE="sydra-receiver.main"
############################
printUsage() {
echo "Usage: $0 <basedir> (overview|main <id>)"
}
if [ -z "$ROOT_D" ] || [ -z "$TAG" ]; 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_overview() {
ID="$1"
TITLE="$2"
PORT_BASE="$3"
REF_PORT_BASE=$((PORT_BASE + 1000))
RECORD_D="$ROOT_D/recordings/$ID"
mkdir -p "$RECORD_D"
herbstclient rule once title="overview-$ID" tag="overview"
exec $SYDRA_RTP -n "overview-$ID" -D --log stdout:3 --mode receiver -O $PORT_BASE --rtp-host-reflector localhost --rtp-port-base-reflector $REF_PORT_BASE \
--sink "videoconvert name=videosink ! textoverlay text=\"$TITLE\" shaded-background=true font-desc=\"Sans 18\" ! videoscale add-borders=true ! xvimagesink fakesink name=audiosink" \
--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_overview() {
ID="$1"
TITLE="$2"
herbstclient rule once title="overview-$ID" tag="overview"
exec $SYDRA_LAUNCH -n "overview-$ID" -D --log stdout:3 -p "videotestsrc ! video/x-raw,width=864,height=480,framerate=25/1 ! textoverlay text=\"$TITLE\" shaded-background=true font-desc=\"Sans 18\" ! videoscale add-borders=true ! xvimagesink"
}
start_rtp_main() {
ID="$1"
TITLE="$2"
PORT_BASE="$3"
herbstclient rule once title="main-$ID" tag="main"
exec $SYDRA_RTP -n "main-$ID" -D --log stdout:3 --mode receiver -A localhost -O $PORT_BASE \
--sink "videoconvert name=videosink ! videoscale add-borders=true ! xvimagesink audioconvert name=audiosink ! audioresample ! autoaudiosink"
}
start_test_main() {
ID="$1"
TITLE="$2"
herbstclient rule once title="main-$ID" tag="main"
exec $SYDRA_LAUNCH -n "main-$ID" -D --log stdout:3 -p "videotestsrc ! video/x-raw,width=864,height=480,framerate=25/1 ! textoverlay text=\"$TITLE\" shaded-background=true font-desc=\"Sans 18\" ! videoscale add-borders=true ! xvimagesink"
}
cd $ROOT_D
case "$TAG" in
overview)
if [ -z "$NUM" ]; then
printUsage
exit 1
fi
get_id_title_and_port "$NUM"
if [ -z "$ID" ]; then
echo "invalid process number: $NUM"
exit 3
fi
[ -n "$SYDRA_TEST" ] || start_rtp_overview "$ID" "$TITLE" $PORT_BASE
[ -n "$SYDRA_TEST" ] && start_test_overview "$ID" "$TITLE" $PORT_BASE
;;
main)
read NUM < "$MAIN_STAT_FILE"
get_id_title_and_port "$NUM"
if [ -z "$ID" ]; then
echo "$ROOT_D/show-stream.current contains an invalid process number: $NUM"
exit 3
fi
[ -n "$SYDRA_TEST" ] || start_rtp_main "$ID" "$TITLE" $((PORT_BASE + 1000))
[ -n "$SYDRA_TEST" ] && start_test_main "$ID" "$TITLE" $((PORT_BASE + 1000))
;;
*)
printUsage
exit 1
;;
esac
############################
exit 3
|