3 # FLAC - Free Lossless Audio Codec
4 # Copyright (C) 2002,2003 Josh Coalson
6 # This file is part the FLAC project. FLAC is comprised of several
7 # components distributed under difference licenses. The codec libraries
8 # are distributed under Xiph.Org's BSD-like license (see the file
9 # COPYING.Xiph in this distribution). All other programs, libraries, and
10 # plugins are distributed under the GPL (see COPYING.GPL). The documentation
11 # is distributed under the Gnu FDL (see COPYING.FDL). Each file in the
12 # FLAC distribution contains at the top the terms under which it may be
15 # Since this particular file is relevant to all components of FLAC,
16 # it may be distributed under the Xiph.Org license, which is the least
17 # restrictive of those mentioned above. See the file COPYING.Xiph in this
26 LD_LIBRARY_PATH=../src/libFLAC/.libs:../obj/release/lib:../obj/debug/lib:$LD_LIBRARY_PATH
27 export LD_LIBRARY_PATH
28 PATH=../src/flac:../src/metaflac:../obj/release/bin:../obj/debug/bin:$PATH
30 flacfile=metaflac.flac
32 flac --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable"
33 metaflac --help 1>/dev/null 2>/dev/null || die "ERROR can't find metaflac executable"
37 if [ x"$FLAC__VALGRIND" = xyes ] ; then
38 valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 flac $* 4>>test_metaflac.valgrind.log
46 if [ x"$FLAC__VALGRIND" = xyes ] ; then
47 valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 metaflac $* 4>>test_metaflac.valgrind.log
53 echo "Generating stream..."
54 if [ -f /bin/sh.exe ] ; then
59 if run_flac --verify -0 --output-name=$flacfile --force-raw-format --endian=big --sign=signed --channels=1 --bps=8 --sample-rate=44100 $inputfile ; then
62 die "ERROR during generation"
68 [ $exit_code = 0 ] || die "ERROR, exit code = $exit_code"
73 run_flac --silent --test $flacfile || die "ERROR in $flacfile" 1>&2
78 (set -x && run_metaflac --list $flacfile)
84 --show-min-blocksize \
85 --show-max-blocksize \
86 --show-min-framesize \
87 --show-max-framesize \
91 --show-total-samples \
96 (set -x && run_metaflac --preserve-modtime --add-padding=12345 $flacfile)
100 # some flavors of /bin/sh (e.g. Darwin's) won't even handle quoted spaces, so we underscore:
101 (set -x && run_metaflac --set-vc-field="ARTIST=The_artist_formerly_known_as_the_artist..." $flacfile)
105 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
108 (set -x && run_metaflac --set-vc-field="ARTIST=Chuck_Woolery" $flacfile)
112 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
115 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
118 (set -x && run_metaflac --set-vc-field="ARTIST=Vern" $flacfile)
122 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
125 (set -x && run_metaflac --set-vc-field="TITLE=He_who_smelt_it_dealt_it" $flacfile)
129 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
132 (set -x && run_metaflac --show-vc-vendor --show-vc-field=ARTIST $flacfile)
135 (set -x && run_metaflac --remove-vc-firstfield=ARTIST $flacfile)
139 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
142 (set -x && run_metaflac --remove-vc-field=ARTIST $flacfile)
146 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
149 (set -x && run_metaflac --list --block-number=0 $flacfile)
152 (set -x && run_metaflac --list --block-number=1,2,999 $flacfile)
155 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT,PADDING $flacfile)
158 (set -x && run_metaflac --list --except-block-type=SEEKTABLE,VORBIS_COMMENT $flacfile)
161 (set -x && run_metaflac --add-padding=4321 $flacfile $flacfile)
165 (set -x && run_metaflac --merge-padding $flacfile)
169 (set -x && run_metaflac --add-padding=0 $flacfile)
173 (set -x && run_metaflac --sort-padding $flacfile)
177 (set -x && run_metaflac --add-padding=0 $flacfile)
181 (set -x && run_metaflac --remove-vc-all $flacfile)
185 (set -x && run_metaflac --remove --block-number=1,99 --dont-use-padding $flacfile)
189 (set -x && run_metaflac --remove --block-number=99 --dont-use-padding $flacfile)
193 (set -x && run_metaflac --remove --block-type=PADDING $flacfile)
197 (set -x && run_metaflac --remove --block-type=PADDING --dont-use-padding $flacfile)
201 (set -x && run_metaflac --add-padding=0 $flacfile $flacfile)
205 (set -x && run_metaflac --remove --except-block-type=PADDING $flacfile)
209 (set -x && run_metaflac --remove-all $flacfile)
213 (set -x && run_metaflac --remove-all --dont-use-padding $flacfile)
217 (set -x && run_metaflac --remove-all --dont-use-padding $flacfile)
221 (set -x && run_metaflac --set-vc-field="f=0123456789abcdefghij" $flacfile)
224 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
227 (set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcdefghi" $flacfile)
230 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
233 (set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcde" $flacfile)
236 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
239 (set -x && run_metaflac --remove-vc-all --set-vc-field="f=0" $flacfile)
242 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
245 (set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789" $flacfile)
248 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
251 (set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcdefghi" $flacfile)
254 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
257 (set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789" $flacfile)
260 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
263 (set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcdefghij" $flacfile)
266 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
269 (set -x && echo "TITLE=Tittle" | run_metaflac --import-vc-from=- $flacfile)
272 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
279 (set -x && run_metaflac --import-vc-from=vc.txt $flacfile)
282 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
287 cs_in=cuesheets/good.000.cue
289 cs_out2=metaflac2.cue
290 (set -x && run_metaflac --import-cuesheet-from="$cs_in" $flacfile)
293 (set -x && run_metaflac --export-cuesheet-to=$cs_out $flacfile)
295 (set -x && run_metaflac --remove --block-type=CUESHEET $flacfile)
298 (set -x && run_metaflac --import-cuesheet-from=$cs_out $flacfile)
301 (set -x && run_metaflac --export-cuesheet-to=$cs_out2 $flacfile)
303 echo "comparing cuesheets:"
304 diff $cs_out $cs_out2 || die "ERROR, cuesheets should be identical"
307 rm -f $cs_out $cs_out2
309 (set -x && run_metaflac --add-replay-gain $flacfile)
313 echo -n "Testing FLAC file with unknown metadata... "
314 cp -p metaflac.flac.in $flacfile
315 # remove the VORBIS_COMMENT block so vendor string changes don't interfere with the comparison:
316 run_metaflac --remove --block-type=VORBIS_COMMENT --dont-use-padding $flacfile
317 cmp $flacfile metaflac.flac.ok || die "ERROR, $flacfile and metaflac.flac.ok differ"