3 # FLAC - Free Lossless Audio Codec
4 # Copyright (C) 2002,2003,2004,2005,2006 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 if [ x = x"$1" ] ; then
32 LD_LIBRARY_PATH=../src/libFLAC/.libs:$LD_LIBRARY_PATH
33 LD_LIBRARY_PATH=../src/libOggFLAC/.libs:$LD_LIBRARY_PATH
34 LD_LIBRARY_PATH=../src/share/grabbag/.libs:$LD_LIBRARY_PATH
35 LD_LIBRARY_PATH=../src/share/getopt/.libs:$LD_LIBRARY_PATH
36 LD_LIBRARY_PATH=../src/share/replaygain_analysis/.libs:$LD_LIBRARY_PATH
37 LD_LIBRARY_PATH=../src/share/replaygain_synthesis/.libs:$LD_LIBRARY_PATH
38 LD_LIBRARY_PATH=../src/share/utf8/.libs:$LD_LIBRARY_PATH
39 LD_LIBRARY_PATH=../obj/$BUILD/lib:$LD_LIBRARY_PATH
40 export LD_LIBRARY_PATH
41 PATH=../src/flac:$PATH
42 PATH=../src/metaflac:$PATH
43 PATH=../obj/$BUILD/bin:$PATH
45 flacfile=metaflac.flac
47 flac --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable"
48 metaflac --help 1>/dev/null 2>/dev/null || die "ERROR can't find metaflac executable"
52 if [ x"$FLAC__VALGRIND" = xyes ] ; then
53 valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 flac $* 4>>test_metaflac.valgrind.log
61 if [ x"$FLAC__VALGRIND" = xyes ] ; then
62 valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 metaflac $* 4>>test_metaflac.valgrind.log
68 echo "Generating stream..."
69 if [ -f /bin/sh.exe ] ; then
71 elif [ -f /bin/sh ] ; then
76 if run_flac --force --verify -0 --output-name=$flacfile --force-raw-format --endian=big --sign=signed --channels=1 --bps=8 --sample-rate=44100 $inputfile ; then
79 die "ERROR during generation"
85 [ $exit_code = 0 ] || die "ERROR, exit code = $exit_code"
90 run_flac --silent --test $flacfile || die "ERROR in $flacfile" 1>&2
95 (set -x && run_metaflac --list $flacfile)
101 --show-min-blocksize \
102 --show-max-blocksize \
103 --show-min-framesize \
104 --show-max-framesize \
108 --show-total-samples \
113 (set -x && run_metaflac --preserve-modtime --add-padding=12345 $flacfile)
117 # some flavors of /bin/sh (e.g. Darwin's) won't even handle quoted spaces, so we underscore:
118 (set -x && run_metaflac --set-tag="ARTIST=The_artist_formerly_known_as_the_artist..." $flacfile)
122 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
125 (set -x && run_metaflac --set-tag="ARTIST=Chuck_Woolery" $flacfile)
129 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
132 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
135 (set -x && run_metaflac --set-tag="ARTIST=Vern" $flacfile)
139 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
142 (set -x && run_metaflac --set-tag="TITLE=He_who_smelt_it_dealt_it" $flacfile)
146 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
149 (set -x && run_metaflac --show-vendor-tag --show-tag=ARTIST $flacfile)
152 (set -x && run_metaflac --remove-first-tag=ARTIST $flacfile)
156 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
159 (set -x && run_metaflac --remove-tag=ARTIST $flacfile)
163 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
166 (set -x && run_metaflac --list --block-number=0 $flacfile)
169 (set -x && run_metaflac --list --block-number=1,2,999 $flacfile)
172 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT,PADDING $flacfile)
175 (set -x && run_metaflac --list --except-block-type=SEEKTABLE,VORBIS_COMMENT $flacfile)
178 (set -x && run_metaflac --add-padding=4321 $flacfile $flacfile)
182 (set -x && run_metaflac --merge-padding $flacfile)
186 (set -x && run_metaflac --add-padding=0 $flacfile)
190 (set -x && run_metaflac --sort-padding $flacfile)
194 (set -x && run_metaflac --add-padding=0 $flacfile)
198 (set -x && run_metaflac --remove-all-tags $flacfile)
202 (set -x && run_metaflac --remove --block-number=1,99 --dont-use-padding $flacfile)
206 (set -x && run_metaflac --remove --block-number=99 --dont-use-padding $flacfile)
210 (set -x && run_metaflac --remove --block-type=PADDING $flacfile)
214 (set -x && run_metaflac --remove --block-type=PADDING --dont-use-padding $flacfile)
218 (set -x && run_metaflac --add-padding=0 $flacfile $flacfile)
222 (set -x && run_metaflac --remove --except-block-type=PADDING $flacfile)
226 (set -x && run_metaflac --remove-all $flacfile)
230 (set -x && run_metaflac --remove-all --dont-use-padding $flacfile)
234 (set -x && run_metaflac --remove-all --dont-use-padding $flacfile)
238 (set -x && run_metaflac --set-tag="f=0123456789abcdefghij" $flacfile)
241 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
244 (set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghi" $flacfile)
247 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
250 (set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789abcde" $flacfile)
253 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
256 (set -x && run_metaflac --remove-all-tags --set-tag="f=0" $flacfile)
259 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
262 (set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789" $flacfile)
265 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
268 (set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghi" $flacfile)
271 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
274 (set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789" $flacfile)
277 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
280 (set -x && run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghij" $flacfile)
283 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
286 (set -x && echo "TITLE=Tittle" | run_metaflac --import-tags-from=- $flacfile)
289 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
296 (set -x && run_metaflac --import-tags-from=vc.txt $flacfile)
299 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
304 cs_in=cuesheets/good.000.cue
306 cs_out2=metaflac2.cue
307 (set -x && run_metaflac --import-cuesheet-from="$cs_in" $flacfile)
310 (set -x && run_metaflac --export-cuesheet-to=$cs_out $flacfile)
312 (set -x && run_metaflac --remove --block-type=CUESHEET $flacfile)
315 (set -x && run_metaflac --import-cuesheet-from=$cs_out $flacfile)
318 (set -x && run_metaflac --export-cuesheet-to=$cs_out2 $flacfile)
320 echo "comparing cuesheets:"
321 diff $cs_out $cs_out2 || die "ERROR, cuesheets should be identical"
324 rm -f $cs_out $cs_out2
326 (set -x && run_metaflac --add-replay-gain $flacfile)
329 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
332 (set -x && run_metaflac --remove-replay-gain $flacfile)
335 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
338 echo -n "Testing FLAC file with unknown metadata... "
339 cp -p metaflac.flac.in $flacfile
340 # remove the VORBIS_COMMENT block so vendor string changes don't interfere with the comparison:
341 run_metaflac --remove --block-type=VORBIS_COMMENT --dont-use-padding $flacfile
342 cmp $flacfile metaflac.flac.ok || die "ERROR, $flacfile and metaflac.flac.ok differ"