diff options
Diffstat (limited to 'TOOLS/vf_dlopen')
-rwxr-xr-x | TOOLS/vf_dlopen/ildetect.sh | 43 |
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 |