From c56868be49dc64d215cee8f01825b8dddd7108b6 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Mon, 22 May 2017 14:33:29 +0200 Subject: Generalize and rename function mux_webm() → mux(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/stream | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/stream b/bin/stream index 502fff5..6981a28 100755 --- a/bin/stream +++ b/bin/stream @@ -238,21 +238,21 @@ encode_x264() { bitrate=$1; speed=$2; # * routing based on http://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs#Teepseudo-muxer # * Use same RTP payload types as GStreamer -mux_webm() { - targetcount=$(echo "$TARGETS_WEBM" | wc --words) +mux() { targets="$1"; + targetcount=$(echo "$targets" | wc --words) if [ $targetcount -lt 2 ]; then - case "$TARGETS_WEBM" in + case "$targets" in rtp_opus) echo_n "-f rtp -payload_type 111 rtp://$IP:$FIRSTPORT?pkt_size=1440";; rtp_vp8) echo_n "-f rtp -payload_type 100 rtp://$IP:$((FIRSTPORT+2))?pkt_size=1440";; - *) exit1 "Unsupported muxing $TARGETS_WEBM";; + *) exit1 "Unknown target $targets";; esac else echo_n "-f tee " - for muxing in $TARGETS_WEBM; do + for muxing in $targets; do case "$muxing" in rtp_opus) echo_n "[select=\'a\':f=rtp:payload_type=111]rtp://$IP:$FIRSTPORT?pkt_size=1440";; rtp_vp8) echo_n "[select=\'v\':f=rtp:payload_type=100]rtp://$IP:$((FIRSTPORT+2))?pkt_size=1440";; - *) exit1 "Unsupported muxing $muxing";; + *) exit1 "Unknown target $muxing";; esac targetcount=$((targetcount-1)) [ $targetcount -lt 1 ] || echo_n '|' @@ -281,7 +281,7 @@ ffmpeg -hide_banner -threads auto \ $(encode_opus) } \ ${HASVIDEO:+\ $(encode_vp8 "$VBITRATE" "$SPEED_VP8") } \ - $(mux_webm) } \ + $(mux "$TARGETS_WEBM") } \ ${ENCODINGS_MPEG:+\ ${HASAUDIO:+-map '0:a' }${HASVIDEO:+$(printf_each ' -map [v%smpeg]' "$ENCODINGS_MPEG") } -shortest \ ${HASAUDIO:+\ -- cgit v1.2.3