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.
This commit is contained in:
Rudolf Polzer 2014-09-17 14:11:56 +02:00
parent 396756e58a
commit a173d3a2fb
1 changed files with 23 additions and 14 deletions

View File

@ -25,24 +25,33 @@ testfun()
--o= --vo=null --no-audio --untimed \ --o= --vo=null --no-audio --untimed \
$ILDETECT_MPVFLAGS \ $ILDETECT_MPVFLAGS \
| { if [ -n "$ILDETECT_QUIET" ]; then cat; else tee /dev/stderr; fi } \ | { 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() judge()
{ {
out="$(testfun "$@")" tff=0
bff=0
tff=${out##* TFF:}; tff=${tff%% *} progressive=0
bff=${out##* BFF:}; bff=${bff%% *} undetermined=0
progressive=${out##* Progressive:}; progressive=${progressive%% *} while IFS= read -r out; do
undetermined=${out##* Undetermined:}; undetermined=${undetermined%% *} tff1=${out##* TFF:}; tff1=${tff1%% *}
bff1=${out##* BFF:}; bff1=${bff1%% *}
case "$tff$bff$progressive$undetermined" in progressive1=${out##* Progressive:}; progressive1=${progressive1%% *}
undetermined1=${out##* Undetermined:}; undetermined1=${undetermined1%% *}
case "$tff1$bff1$progressive1$undetermined1" in
*[!0-9]*) *[!0-9]*)
printf >&2 'ERROR: Unrecognized idet output: %s\n' "$out" printf >&2 'ERROR: Unrecognized idet output: %s\n' "$out"
exit 16 exit 16
;; ;;
esac esac
tff=$(($tff + $tff1))
bff=$(($bff + $bff1))
progressive=$(($progressive + $progressive1))
undetermined=$(($undetermined + $undetermined1))
done <<EOF
$(testfun "$@")
EOF
interlaced=$((bff + tff)) interlaced=$((bff + tff))
determined=$((interlaced + progressive)) determined=$((interlaced + progressive))