summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2017-05-11 11:45:15 +0200
committerJonas Smedegaard <dr@jones.dk>2017-05-11 11:55:47 +0200
commit61ba220b60087b62410b6709005f8ddfbdd711d6 (patch)
treea79e80b4aaa4351cb8888bca401efe2e02604b61
parente15ed7596332db8d84422342d318d26d0f6e7dda (diff)
Normalize device loop.
-rwxr-xr-xbin/recv-gst-rtp-v-a10
-rwxr-xr-xbin/send-gst-rtp-v-a7
2 files changed, 10 insertions, 7 deletions
diff --git a/bin/recv-gst-rtp-v-a b/bin/recv-gst-rtp-v-a
index 2289d04..1da2106 100755
--- a/bin/recv-gst-rtp-v-a
+++ b/bin/recv-gst-rtp-v-a
@@ -4,8 +4,8 @@
set -e
CAMIP=${CAMIP:-$1} # origin host - default: use multicast group
-VCOUNT=${VCOUNT:-$2} # number of video stream(s) to display - default: 1
-ACOUNT=${ACOUNT:-$3} # number of audio stream(s) to play - default: 0
+VCOUNT=${VCOUNT:-${2:-1}} # number of video stream(s) to display - default: 1
+ACOUNT=${ACOUNT:-${3:-0}} # number of audio stream(s) to play - default: 0
VFORMAT=${VFORMAT:-$4} # H264 VP8 RAW - default: RAW
AFORMAT=${AFORMAT:-$5} # AMR OPUS RAW - default: RAW
VSINK=${VSINK:-autovideosink}
@@ -76,5 +76,7 @@ stream() {
gst-launch-1.0 -v \
rtpbin name=rtpbin latency=$NETLATENCY drop-on-latency=true \
- $(for i in $(seq "${VCOUNT:-1}"); do stream "$i" "$VCAPS" "$VDEC ! $VSINK"; done) \
- $(for j in $(seq "${ACOUNT:-0}"); do stream $((VCOUNT+j)) "$ACAPS" "$ADEC ! $ASINK buffer-time=$ABUFFERS"; done)
+ $(n=0;\
+ for i in $(seq "$VCOUNT"); do n=$((n+1)); stream "$n" "$VCAPS" "$VDEC ! $VSINK"; done;\
+ for i in $(seq "$ACOUNT"); do n=$((n+1)); stream "$n" "$ACAPS" "$ADEC ! $ASINK buffer-time=$ABUFFERS"; done;\
+ )
diff --git a/bin/send-gst-rtp-v-a b/bin/send-gst-rtp-v-a
index f79da8b..f8b548b 100755
--- a/bin/send-gst-rtp-v-a
+++ b/bin/send-gst-rtp-v-a
@@ -79,10 +79,11 @@ stream() {
! rtpbin."recv_rtcp_sink_$ID"
}
-n=0
gst-launch-1.0 -v \
rtpbin name=rtpbin \
- $(for dev in $VDEVICES; do n=$((n+1)); stream "$n" "v4l2src device=$dev ! $QUEUE ! videoconvert ! $VCAPS ! $QUEUE ! $VENC ! $QUEUE"; done; \
- for dev in $ADEVICES; do n=$((n+1)); stream "$n" "alsasrc device=$dev buffer-time=$ABUFFERS ! $QUEUE ! audioconvert ! $QUEUE ! $AENC ! $QUEUE"; done)
+ $(n=0;\
+ for dev in $VDEVICES; do n=$((n+1)); stream "$n" "v4l2src device=$dev ! $QUEUE ! videoconvert ! $VCAPS ! $QUEUE ! $VENC ! $QUEUE"; done;\
+ for dev in $ADEVICES; do n=$((n+1)); stream "$n" "alsasrc device=$dev buffer-time=$ABUFFERS ! $QUEUE ! audioconvert ! $QUEUE ! $AENC ! $QUEUE"; done;\
+ )
set -e