+ test -z $ffprobe_opts || \
+ run ffprobe${PROGSUF}${EXECSUF} $ffprobe_opts $tencfile || return
+}
+
+# FIXME: There is a certain duplication between the avconv-related helper
+# functions above and below that should be refactored.
+ffmpeg2="$target_exec ${target_path}/ffmpeg${PROGSUF}${EXECSUF}"
+raw_src="${target_path}/tests/vsynth1/%02d.pgm"
+pcm_src="${target_path}/tests/data/asynth1.sw"
+crcfile="tests/data/$test.lavf.crc"
+target_crcfile="${target_path}/$crcfile"
+
+[ "${V-0}" -gt 0 ] && echov=echov || echov=:
+
+echov(){
+ echo "$@" >&3
+}
+
+AVCONV_OPTS="-nostdin -nostats -noauto_conversion_filters -y -cpuflags $cpuflags"
+COMMON_OPTS="-flags +bitexact -idct simple -sws_flags +accurate_rnd+bitexact -fflags +bitexact"
+DEC_OPTS="$COMMON_OPTS -threads $threads"
+ENC_OPTS="$COMMON_OPTS -threads 1 -dct fastint"
+
+run_avconv(){
+ $echov $ffmpeg2 $AVCONV_OPTS $*
+ $ffmpeg2 $AVCONV_OPTS $*
+}
+
+do_avconv(){
+ f="$1"
+ shift
+ set -- $* ${target_path}/$f
+ run_avconv $*
+ do_md5sum $f
+ echo $(wc -c $f)
+}
+
+do_avconv_crc(){
+ f="$1"
+ shift
+ run_avconv $* -f crc "$target_crcfile"
+ echo "$f $(cat $crcfile)"
+}
+
+lavf_audio(){
+ t="${test#lavf-}"
+ outdir="tests/data/lavf"
+ file=${outdir}/lavf.$t
+ do_avconv $file -auto_conversion_filters $DEC_OPTS $1 -ar 44100 -f s16le -i $pcm_src "$ENC_OPTS -metadata title=lavftest" -t 1 -qscale 10 $2
+ do_avconv_crc $file -auto_conversion_filters $DEC_OPTS $3 -i $target_path/$file
+}
+
+lavf_container(){
+ t="${test#lavf-}"
+ outdir="tests/data/lavf"
+ file=${outdir}/lavf.$t
+ do_avconv $file -auto_conversion_filters $DEC_OPTS -f image2 -c:v pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le $1 -i $pcm_src "$ENC_OPTS -metadata title=lavftest" -b:a 64k -t 1 -qscale:v 10 $2
+ test "$3" = "disable_crc" ||
+ do_avconv_crc $file -auto_conversion_filters $DEC_OPTS -i $target_path/$file $3