Commit dd2c2fc9 authored by Stefan Westerfeld's avatar Stefan Westerfeld

videowmark: verify correct number of arguments for add/get/probe

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent 560960c4
...@@ -86,7 +86,7 @@ while true; do ...@@ -86,7 +86,7 @@ while true; do
esac esac
done done
if [ "$1" == "add" ]; then if [ "$1" == "add" ] && [ "$#" == 4 ]; then
# create tmpfiles # create tmpfiles
create_temp_files 3 4 create_temp_files 3 4
orig_wav=/dev/fd/3 orig_wav=/dev/fd/3
...@@ -100,7 +100,7 @@ if [ "$1" == "add" ]; then ...@@ -100,7 +100,7 @@ if [ "$1" == "add" ]; then
# rejoin # rejoin
ffmpeg $FFMPEG_VERBOSE -y -i "$2" -i "$wm_wav" -c:v copy $(audio_encode_options "$2") -map 0:v:0 -map 1:a:0 "$3" || \ ffmpeg $FFMPEG_VERBOSE -y -i "$2" -i "$wm_wav" -c:v copy $(audio_encode_options "$2") -map 0:v:0 -map 1:a:0 "$3" || \
die "merging video and watermarked audio failed (ffmpeg)" die "merging video and watermarked audio failed (ffmpeg)"
elif [ "$1" == "get" ]; then elif [ "$1" == "get" ] && [ "$#" == 2 ]; then
# create tmpfiles # create tmpfiles
create_temp_files 3 create_temp_files 3
wav=/dev/fd/3 wav=/dev/fd/3
...@@ -109,7 +109,7 @@ elif [ "$1" == "get" ]; then ...@@ -109,7 +109,7 @@ elif [ "$1" == "get" ]; then
ffmpeg $FFMPEG_VERBOSE -y -i "$2" -f wav "$wav" || die "extracting audio from video failed (ffmpeg)" ffmpeg $FFMPEG_VERBOSE -y -i "$2" -f wav "$wav" || die "extracting audio from video failed (ffmpeg)"
# get watermark # get watermark
audiowmark "${AUDIOWMARK_ARGS[@]}" get "$wav" || die "retrieving watermark from audio failed (audiowmark)" audiowmark "${AUDIOWMARK_ARGS[@]}" get "$wav" || die "retrieving watermark from audio failed (audiowmark)"
elif [ "$1" == "probe" ]; then elif [ "$1" == "probe" ] && [ "$#" == 2 ]; then
echo $2 $(audio_encode_options "$2") echo $2 $(audio_encode_options "$2")
else else
echo "videowmark: error parsing command line arguments (use videowmark -h)" echo "videowmark: error parsing command line arguments (use videowmark -h)"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment