Replace arrays with variable substitutions for POSIX compliance

Co-Authored-By: Rien <rien.maertens@posteo.be>
This commit is contained in:
Mattéo Delabre 2020-04-07 10:48:51 +02:00 committed by GitHub
parent 4344903438
commit d0323daef5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -78,14 +78,14 @@ fi
output_args=() output_args=""
video_filters=() video_filters=""
# calculate how much bytes the window is # calculate how much bytes the window is
window_bytes="$(($width*$height*$bytes_per_pixel))" window_bytes="$(($width*$height*$bytes_per_pixel))"
# rotate 90 degrees if landscape=true # 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 # read the first $window_bytes of the framebuffer
head_fb0="dd if=/dev/fb0 count=1 bs=$window_bytes 2>/dev/null" head_fb0="dd if=/dev/fb0 count=1 bs=$window_bytes 2>/dev/null"
@ -99,17 +99,16 @@ else
output_command=ffmpeg output_command=ffmpeg
if [ "$format" != - ]; then if [ "$format" != - ]; then
output_args+=('-f' "$format") output_args="$output_args -f '$format' "
fi fi
output_args+=("$output_path") output_args="$output_args '$output_path'"
fi fi
# set frame presentation time to the time it was received # 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="$output_args -vf '${video_filters#,}'"
output_args+=('-vf' "$joined_filters")
set -e # stop if an error occurs set -e # stop if an error occurs