summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRudolf Polzer <divverent@xonotic.org>2014-09-17 14:11:56 +0200
committerRudolf Polzer <divverent@xonotic.org>2014-09-17 14:11:56 +0200
commita173d3a2fba7c2c3d89af20077dec89ed0424030 (patch)
tree9be4726967865ee7928ce7a0b4f66c4d36a8812d
parent396756e58ab37d262ca31fece673329d224eca0a (diff)
downloadmpv-a173d3a2fba7c2c3d89af20077dec89ed0424030.tar.bz2
mpv-a173d3a2fba7c2c3d89af20077dec89ed0424030.tar.xz
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.
-rwxr-xr-xTOOLS/idet.sh37
1 files changed, 23 insertions, 14 deletions
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 <<EOF
+$(testfun "$@")
+EOF
interlaced=$((bff + tff))
determined=$((interlaced + progressive))