⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_flac.sh

📁 wince下著名的视频播放器源码
💻 SH
📖 第 1 页 / 共 3 页
字号:
cuesheet=cuetest.cuecat > $cuesheet << EOFCATALOG 1234567890123FILE "blah" WAVE  TRACK 01 AUDIO    INDEX 01 0    INDEX 02 10    INDEX 03 20  TRACK 02 AUDIO    INDEX 01 30  TRACK 04 AUDIO    INDEX 01 40EOFtest_cue (){	in_fmt=$1	out_fmt=$2	[ "$in_fmt" = wav ] || [ "$in_fmt" = aiff ] || [ "$in_fmt" = raw ] || die "ERROR: internal error, bad 'in' format '$in_fmt'"	[ "$out_fmt" = flac ] || [ "$out_fmt" = ogg ] || die "ERROR: internal error, bad 'out' format '$out_fmt'"	if [ $in_fmt = raw ] ; then		eopt="$raw_eopt"		dopt="$raw_dopt"	else		eopt="$wav_eopt"		dopt="$wav_dopt"	fi	if [ $out_fmt = ogg ] ; then		eopt="--ogg $eopt"	fi	desc="($in_fmt<->$out_fmt)"	#	# for this we need just need just one FLAC file; --cue only works while decoding	#	run_flac $eopt --cuesheet=$cuesheet -o z50c.cue.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc"	# To make it easy to translate from cue point to sample numbers, the	# file has a sample rate of 10 Hz and a cuesheet like so:	#	# TRACK 01, INDEX 01 : 0:00.00 -> sample 0	# TRACK 01, INDEX 02 : 0:01.00 -> sample 10	# TRACK 01, INDEX 03 : 0:02.00 -> sample 20	# TRACK 02, INDEX 01 : 0:03.00 -> sample 30	# TRACK 04, INDEX 01 : 0:04.00 -> sample 40	#	echo -n "testing --cue=- $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=- z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=- $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=1.0 $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=1.0 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.0 $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=1.0- $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=1.0- z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.0- $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=1.1 $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=1.1 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.1 $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=1.1- $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=1.1- z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.1- $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=1.2 $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=1.2 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.skip10.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.2 $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=1.2- $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=1.2- z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.skip10.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.2- $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=1.4 $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=1.4 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.skip20.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.4 $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=1.4- $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=1.4- z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.skip20.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.4- $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=-5.0 $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=-5.0 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=-5.0 $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=-4.1 $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=-4.1 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.until40.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=-4.1 $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=-3.1 $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=-3.1 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.until40.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=-3.1 $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=-1.4 $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=-1.4 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.until30.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=-1.4 $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=1.0-5.0 $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=1.0-5.0 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.0-5.0 $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=1.1-5.0 $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=1.1-5.0 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.1-5.0 $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=1.2-4.1 $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=1.2-4.1 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.skip10.until40.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.2-4.1 $desc"	rm -f z50c.cue.$in_fmt	echo OK	echo -n "testing --cue=1.4-2.0 $desc... "	run_flac $dopt -o z50c.cue.$in_fmt --cue=1.4-2.0 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc"	cmp 50c.skip20.until30.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.4-2.0 $desc"	rm -f z50c.cue.$in_fmt	echo OK	rm -f z50c.cue.$out_fmt}test_cue raw flactest_cue wav flactest_cue aiff flacif [ $has_ogg = "yes" ] ; then	test_cue raw ogg	test_cue wav ogg	test_cue aiff oggfi############################################################################# test 'fixup' code that happens when a FLAC file with total_samples == 0# in the STREAMINFO block is converted to WAVE or AIFF, requiring the# decoder go back and fix up the chunk headers############################################################################echo -n "WAVE fixup test... "echo -n "prepare... "convert_to_wav noise || die "ERROR creating reference WAVE"echo -n "encode... "# the pipe from 'cat' to 'flac' does not work on cygwin because of the EOF/# binary-mode stdin problem, so we use an undocumented option to metaflac to# set the total sample count to 0if [ $is_win = yes ] ; then	run_flac $raw_eopt noise.raw -o fixup.flac || die "ERROR generating FLAC file"	run_metaflac --set-total-samples=0 fixup.flac 2> /dev/nullelse	cat noise.raw | run_flac $raw_eopt - -c > fixup.flac || die "ERROR generating FLAC file"fiecho -n "decode... "run_flac $wav_dopt fixup.flac -o fixup.wav || die "ERROR decoding FLAC file"echo -n "compare... "cmp noise.wav fixup.wav || die "ERROR: file mismatch"echo OKrm -f noise.wav fixup.wav fixup.flacecho -n "AIFF fixup test... "echo -n "prepare... "convert_to_aiff noise || die "ERROR creating reference AIFF"echo -n "encode... "# the pipe from 'cat' to 'flac' does not work on cygwin because of the EOF/# binary-mode stdin problem, so we use an undocumented option to metaflac to# set the total sample count to 0if [ $is_win = yes ] ; then	run_flac $raw_eopt noise.raw -o fixup.flac || die "ERROR generating FLAC file"	run_metaflac --set-total-samples=0 fixup.flac 2> /dev/nullelse	cat noise.raw | run_flac $raw_eopt - -c > fixup.flac || die "ERROR generating FLAC file"fiecho -n "decode... "run_flac $wav_dopt fixup.flac -o fixup.aiff || die "ERROR decoding FLAC file"echo -n "compare... "cmp noise.aiff fixup.aiff || die "ERROR: file mismatch"echo OKrm -f noise.aiff fixup.aiff fixup.flac############################################################################# multi-file tests############################################################################echo "Generating multiple input files from noise..."run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 noise.raw || die "ERROR generating FLAC file"run_flac --decode --force --silent noise.flac || die "ERROR generating WAVE file"rm -f noise.flacmv noise.wav file0.wavcp file0.wav file1.wavcp file1.wav file2.wavtest_multifile (){	streamtype=$1	sector_align=$2	encode_options="$3"	if [ $streamtype = ogg ] ; then		suffix=ogg		encode_options="$encode_options --ogg"	else		suffix=flac	fi	if [ $sector_align = sector_align ] ; then		encode_options="$encode_options --sector-align"	fi	run_flac --force $encode_options file0.wav file1.wav file2.wav || die "ERROR"	for n in 0 1 2 ; do		mv file$n.$suffix file${n}x.$suffix	done	run_flac --force --decode file0x.$suffix file1x.$suffix file2x.$suffix || die "ERROR"	if [ $sector_align != sector_align ] ; then		for n in 0 1 2 ; do			cmp file$n.wav file${n}x.wav || die "ERROR: file mismatch on file #$n"		done	fi	for n in 0 1 2 ; do		rm -f file${n}x.$suffix file${n}x.wav	done}echo "Testing multiple files without verify..."test_multifile flac no_sector_align ""echo "Testing multiple files with verify..."test_multifile flac no_sector_align "--verify"echo "Testing multiple files with --sector-align, without verify..."test_multifile flac sector_align ""echo "Testing multiple files with --sector-align, with verify..."test_multifile flac sector_align "--verify"if [ $has_ogg = "yes" ] ; then	echo "Testing multiple files with --ogg, without verify..."	test_multifile ogg no_sector_align ""	echo "Testing multiple files with --ogg, with verify..."	test_multifile ogg no_sector_align "--verify"	echo "Testing multiple files with --ogg and --sector-align, without verify..."	test_multifile ogg sector_align ""	echo "Testing multiple files with --ogg and --sector-align, with verify..."	test_multifile sector_align ogg "--verify"	echo "Testing multiple files with --ogg and --serial-number, with verify..."	test_multifile ogg no_sector_align "--serial-number=321 --verify"fi

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -