2013-06-14 12:32:18 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
case "$0" in
|
|
|
|
*/*)
|
|
|
|
MYDIR=${0%/*}
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
MYDIR=.
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2013-06-20 07:07:42 +00:00
|
|
|
: ${MPV:=mpv}
|
|
|
|
: ${ILDETECT_MPV:=$MPV}
|
|
|
|
: ${ILDETECT_MPV:=$MPV}
|
2013-06-20 08:13:12 +00:00
|
|
|
: ${ILDETECT_MPVFLAGS:=--start=35% --length=35}
|
2013-06-20 07:07:42 +00:00
|
|
|
: ${ILDETECT_DRY_RUN:=}
|
2013-06-20 17:21:49 +00:00
|
|
|
: ${ILDETECT_QUIET:=}
|
2013-06-21 04:22:13 +00:00
|
|
|
: ${ILDETECT_RUN_INTERLACED_ONLY:=}
|
2013-12-18 09:56:33 +00:00
|
|
|
: ${ILDETECT_FORCE_RUN:=}
|
2013-06-20 07:07:42 +00:00
|
|
|
: ${MAKE:=make}
|
2013-06-14 12:32:18 +00:00
|
|
|
|
2013-06-20 07:07:42 +00:00
|
|
|
# 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
|
2013-06-14 12:32:18 +00:00
|
|
|
|
|
|
|
testfun()
|
|
|
|
{
|
2013-06-20 07:07:42 +00:00
|
|
|
$ILDETECT_MPV "$@" \
|
2013-06-20 10:25:55 +00:00
|
|
|
--vf=dlopen="$MYDIR/ildetect.so" \
|
|
|
|
--o= --vo=null --no-audio --untimed \
|
2013-06-20 07:07:42 +00:00
|
|
|
$ILDETECT_MPVFLAGS \
|
2013-06-20 17:21:49 +00:00
|
|
|
| { if [ -n "$ILDETECT_QUIET" ]; then cat; else tee /dev/stderr; fi } \
|
|
|
|
| grep "^ildetect:"
|
2013-06-14 12:32:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
out=`testfun "$@"`
|
|
|
|
case "$out" in
|
|
|
|
*"probably: PROGRESSIVE"*)
|
2013-06-21 04:22:13 +00:00
|
|
|
[ -n "$ILDETECT_DRY_RUN" ] || \
|
|
|
|
[ -n "$ILDETECT_RUN_INTERLACED_ONLY" ] || \
|
|
|
|
$ILDETECT_MPV "$@"
|
2013-06-20 07:07:42 +00:00
|
|
|
r=$?
|
|
|
|
[ $r -eq 0 ] || exit $(($r | 16))
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*"probably: TELECINED"*)
|
2013-06-20 17:21:49 +00:00
|
|
|
out2=`ILDETECT_MPVFLAGS="$ILDETECT_MPVFLAGS --vf-pre=pullup,scale" testfun "$@"`
|
|
|
|
case "$out2" in
|
|
|
|
*"probably: TELECINED"*|*"probably: INTERLACED"*)
|
2013-06-21 04:22:13 +00:00
|
|
|
[ -n "$ILDETECT_DRY_RUN" ] || \
|
|
|
|
$ILDETECT_MPV "$@" -vf-pre yadif
|
2013-06-20 17:21:49 +00:00
|
|
|
r=$?
|
|
|
|
[ $r -eq 0 ] || exit $(($r | 16))
|
|
|
|
exit 2
|
|
|
|
;;
|
|
|
|
*)
|
2013-06-21 04:22:13 +00:00
|
|
|
[ -n "$ILDETECT_DRY_RUN" ] || \
|
|
|
|
$ILDETECT_MPV "$@" -vf-pre pullup
|
2013-06-20 17:21:49 +00:00
|
|
|
r=$?
|
|
|
|
[ $r -eq 0 ] || exit $(($r | 16))
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2013-06-14 12:32:18 +00:00
|
|
|
;;
|
|
|
|
*"probably: INTERLACED"*)
|
2013-06-21 04:22:13 +00:00
|
|
|
[ -n "$ILDETECT_DRY_RUN" ] || \
|
|
|
|
$ILDETECT_MPV "$@" -vf-pre yadif
|
2013-06-20 07:07:42 +00:00
|
|
|
r=$?
|
|
|
|
[ $r -eq 0 ] || exit $(($r | 16))
|
|
|
|
exit 2
|
2013-06-14 12:32:18 +00:00
|
|
|
;;
|
2013-06-20 07:07:42 +00:00
|
|
|
*"probably: "*)
|
2013-12-18 09:56:33 +00:00
|
|
|
[ -n "$ILDETECT_FORCE_RUN" ] || exit 8
|
|
|
|
[ -n "$ILDETECT_DRY_RUN" ] || \
|
|
|
|
$ILDETECT_MPV "$@" -vf-pre yadif
|
|
|
|
r=$?
|
|
|
|
[ $r -eq 0 ] || exit $(($r | 16))
|
|
|
|
exit 0
|
2013-06-14 12:32:18 +00:00
|
|
|
;;
|
|
|
|
*)
|
2013-06-20 07:07:42 +00:00
|
|
|
exit 16
|
2013-06-14 12:32:18 +00:00
|
|
|
;;
|
|
|
|
esac
|