From a173d3a2fba7c2c3d89af20077dec89ed0424030 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Wed, 17 Sep 2014 14:11:56 +0200 Subject: TOOLS/idet.sh: Handle the case of multiple Parsed_idet_0: output lines. This seems to happen frequently now. It is handled by adding their values. --- TOOLS/idet.sh | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'TOOLS') diff --git a/TOOLS/idet.sh b/TOOLS/idet.sh index c3b30080a6..f6d67f96dc 100755 --- a/TOOLS/idet.sh +++ b/TOOLS/idet.sh @@ -25,24 +25,33 @@ testfun() --o= --vo=null --no-audio --untimed \ $ILDETECT_MPVFLAGS \ | { if [ -n "$ILDETECT_QUIET" ]; then cat; else tee /dev/stderr; fi } \ - | grep "Parsed_idet_0: Multi frame detection: " | tail -n 1 + | grep "Parsed_idet_0: Multi frame detection: " } judge() { - out="$(testfun "$@")" - - tff=${out##* TFF:}; tff=${tff%% *} - bff=${out##* BFF:}; bff=${bff%% *} - progressive=${out##* Progressive:}; progressive=${progressive%% *} - undetermined=${out##* Undetermined:}; undetermined=${undetermined%% *} - - case "$tff$bff$progressive$undetermined" in - *[!0-9]*) - printf >&2 'ERROR: Unrecognized idet output: %s\n' "$out" - exit 16 - ;; - esac + tff=0 + bff=0 + progressive=0 + undetermined=0 + while IFS= read -r out; do + tff1=${out##* TFF:}; tff1=${tff1%% *} + bff1=${out##* BFF:}; bff1=${bff1%% *} + progressive1=${out##* Progressive:}; progressive1=${progressive1%% *} + undetermined1=${out##* Undetermined:}; undetermined1=${undetermined1%% *} + case "$tff1$bff1$progressive1$undetermined1" in + *[!0-9]*) + printf >&2 'ERROR: Unrecognized idet output: %s\n' "$out" + exit 16 + ;; + esac + tff=$(($tff + $tff1)) + bff=$(($bff + $bff1)) + progressive=$(($progressive + $progressive1)) + undetermined=$(($undetermined + $undetermined1)) + done <