summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRudolf Polzer <divverent@xonotic.org>2013-06-20 09:07:42 +0200
committerRudolf Polzer <divverent@xonotic.org>2013-06-20 09:14:27 +0200
commit6b808ef8da4299e6d744a3774b1f424b4e5de88f (patch)
treef0805de138f6169d6fcdd6072cad0fdcb3659de5
parent0407869ae3aeea0d015b18bd8a901034ed45e76f (diff)
downloadmpv-6b808ef8da4299e6d744a3774b1f424b4e5de88f.tar.bz2
mpv-6b808ef8da4299e6d744a3774b1f424b4e5de88f.tar.xz
ildetect.sh: env vars support
-rwxr-xr-xTOOLS/vf_dlopen/ildetect.sh43
1 files changed, 35 insertions, 8 deletions
diff --git a/TOOLS/vf_dlopen/ildetect.sh b/TOOLS/vf_dlopen/ildetect.sh
index d5c7549e10..042756e644 100755
--- a/TOOLS/vf_dlopen/ildetect.sh
+++ b/TOOLS/vf_dlopen/ildetect.sh
@@ -9,30 +9,57 @@ case "$0" in
;;
esac
-set -e
+: ${MPV:=mpv}
+: ${ILDETECT_MPV:=$MPV}
+: ${ILDETECT_MPV:=$MPV}
+: ${ILDETECT_MPVFLAGS:=-start 40 -end 60}
+: ${ILDETECT_DRY_RUN:=}
+: ${MAKE:=make}
-make -C "$MYDIR"
+# exit status:
+# 0 progressive
+# 1 telecine
+# 2 interlaced
+# 8 unknown
+# 15 compile fail
+# 16 detect fail
+# 17+ mpv's status | 16
+
+$MAKE -C "$MYDIR" ildetect.so || exit 15
testfun()
{
- ${MPV:-mpv} "$@" \
+ $ILDETECT_MPV "$@" \
-vf dlopen="$MYDIR/ildetect.so" \
-o /dev/null -of rawvideo -ofopts-clr -ovc rawvideo -ovcopts-clr -no-audio \
+ $ILDETECT_MPVFLAGS \
| tee /dev/stderr | grep "^ildetect:"
}
out=`testfun "$@"`
case "$out" in
*"probably: PROGRESSIVE"*)
- ${MPV:-mpv} "$@"
+ [ -n "$ILDETECT_DRY_RUN" ] || $ILDETECT_MPV "$@"
+ r=$?
+ [ $r -eq 0 ] || exit $(($r | 16))
+ exit 0
+ ;;
+ *"probably: TELECINED"*)
+ [ -n "$ILDETECT_DRY_RUN" ] || $ILDETECT_MPV "$@" -vf-pre pullup
+ r=$?
+ [ $r -eq 0 ] || exit $(($r | 16))
+ exit 1
;;
*"probably: INTERLACED"*)
- ${MPV:-mpv} "$@" -vf-pre yadif
+ [ -n "$ILDETECT_DRY_RUN" ] || $ILDETECT_MPV "$@" -vf-pre yadif
+ r=$?
+ [ $r -eq 0 ] || exit $(($r | 16))
+ exit 2
;;
- *"probably: TELECINED"*)
- ${MPV:-mpv} "$@" -vf-pre pullup
+ *"probably: "*)
+ exit 8
;;
*)
- false
+ exit 16
;;
esac