From d0323daef57b3a0313169d360b652aff05058f5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delabre?= <1370040+matteodelabre@users.noreply.github.com> Date: Tue, 7 Apr 2020 10:48:51 +0200 Subject: [PATCH] Replace arrays with variable substitutions for POSIX compliance Co-Authored-By: Rien --- reStream.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/reStream.sh b/reStream.sh index 8cdbf2a..9bd30c1 100755 --- a/reStream.sh +++ b/reStream.sh @@ -78,14 +78,14 @@ fi -output_args=() -video_filters=() +output_args="" +video_filters="" # calculate how much bytes the window is window_bytes="$(($width*$height*$bytes_per_pixel))" # rotate 90 degrees if landscape=true -$landscape && video_filters+=('transpose=1') +$landscape && video_filters="$video_filters,transpose=1" # read the first $window_bytes of the framebuffer head_fb0="dd if=/dev/fb0 count=1 bs=$window_bytes 2>/dev/null" @@ -99,17 +99,16 @@ else output_command=ffmpeg if [ "$format" != - ]; then - output_args+=('-f' "$format") + output_args="$output_args -f '$format' " fi - output_args+=("$output_path") + output_args="$output_args '$output_path'" fi # set frame presentation time to the time it was received -video_filters+=('setpts=(RTCTIME - RTCSTART) / (TB * 1000000)') +video_filters="$video_filters,setpts=(RTCTIME - RTCSTART) / (TB * 1000000)" -joined_filters=$(IFS=,; echo "${video_filters[*]}") -output_args+=('-vf' "$joined_filters") +output_args="$output_args -vf '${video_filters#,}'" set -e # stop if an error occurs