3 # FLAC - Free Lossless Audio Codec
4 # Copyright (C) 2002 Josh Coalson
6 # This program is part of FLAC; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
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 [ "$FLAC__VALGRIND" = yes ] ; then
38 valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 flac $* 4>>valgrind.log
46 if [ "$FLAC__VALGRIND" = yes ] ; then
47 valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 metaflac $* 4>>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