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.
20 LD_LIBRARY_PATH=../src/libFLAC/.libs:../obj/release/lib:../obj/debug/lib:$LD_LIBRARY_PATH
21 export LD_LIBRARY_PATH
22 PATH=../src/flac:../src/metaflac:../obj/release/bin:../obj/debug/bin:$PATH
24 flacfile=metaflac.flac
26 flac --help 1>/dev/null 2>/dev/null || (echo "ERROR can't find flac executable" 1>&2 && exit 1)
27 if [ $? != 0 ] ; then exit 1 ; fi
29 metaflac --help 1>/dev/null 2>/dev/null || (echo "ERROR can't find metaflac executable" 1>&2 && exit 1)
30 if [ $? != 0 ] ; then exit 1 ; fi
34 if [ "$FLAC__VALGRIND" = yes ] ; then
35 valgrind --leak-check=yes --show-reachable=yes --num-callers=10 --logfile-fd=4 flac $* 4>>valgrind.log
43 if [ "$FLAC__VALGRIND" = yes ] ; then
44 valgrind --leak-check=yes --show-reachable=yes --num-callers=10 --logfile-fd=4 metaflac $* 4>>valgrind.log
50 echo "Generating stream..."
51 if [ -f /bin/sh.exe ] ; then
56 if run_flac --verify -0 --output-name=$flacfile --force-raw-format --endian=big --sign=signed --channels=1 --bps=8 --sample-rate=44100 $inputfile ; then
59 echo "ERROR during generation" 1>&2
66 if [ $exit_code != 0 ] ; then
67 echo "ERROR, exit code = $exit_code" 1>&2
74 if run_flac --silent --test $flacfile ; then : ; else
75 echo "ERROR in $flacfile" 1>&2
82 (set -x && run_metaflac --list $flacfile)
88 --show-min-blocksize \
89 --show-max-blocksize \
90 --show-min-framesize \
91 --show-max-framesize \
95 --show-total-samples \
100 (set -x && run_metaflac --preserve-modtime --add-padding=12345 $flacfile)
104 # some flavors of /bin/sh (e.g. Darwin's) won't even handle quoted spaces, so we underscore:
105 (set -x && run_metaflac --set-vc-field="ARTIST=The_artist_formerly_known_as_the_artist..." $flacfile)
109 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
112 (set -x && run_metaflac --set-vc-field="ARTIST=Chuck_Woolery" $flacfile)
116 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
119 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
122 (set -x && run_metaflac --set-vc-field="ARTIST=Vern" $flacfile)
126 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
129 (set -x && run_metaflac --set-vc-field="TITLE=He_who_smelt_it_dealt_it" $flacfile)
133 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
136 (set -x && run_metaflac --show-vc-vendor --show-vc-field=ARTIST $flacfile)
139 (set -x && run_metaflac --remove-vc-firstfield=ARTIST $flacfile)
143 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
146 (set -x && run_metaflac --remove-vc-field=ARTIST $flacfile)
150 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
153 (set -x && run_metaflac --list --block-number=0 $flacfile)
156 (set -x && run_metaflac --list --block-number=1,2,999 $flacfile)
159 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT,PADDING $flacfile)
162 (set -x && run_metaflac --list --except-block-type=SEEKTABLE,VORBIS_COMMENT $flacfile)
165 (set -x && run_metaflac --add-padding=4321 $flacfile $flacfile)
169 (set -x && run_metaflac --merge-padding $flacfile)
173 (set -x && run_metaflac --add-padding=0 $flacfile)
177 (set -x && run_metaflac --sort-padding $flacfile)
181 (set -x && run_metaflac --add-padding=0 $flacfile)
185 (set -x && run_metaflac --remove-vc-all $flacfile)
189 (set -x && run_metaflac --remove --block-number=1,99 --dont-use-padding $flacfile)
193 (set -x && run_metaflac --remove --block-number=99 --dont-use-padding $flacfile)
197 (set -x && run_metaflac --remove --block-type=PADDING $flacfile)
201 (set -x && run_metaflac --remove --block-type=PADDING --dont-use-padding $flacfile)
205 (set -x && run_metaflac --add-padding=0 $flacfile $flacfile)
209 (set -x && run_metaflac --remove --except-block-type=PADDING $flacfile)
213 (set -x && run_metaflac --remove-all $flacfile)
217 (set -x && run_metaflac --remove-all --dont-use-padding $flacfile)
221 (set -x && run_metaflac --remove-all --dont-use-padding $flacfile)
225 (set -x && run_metaflac --set-vc-field="f=0123456789abcdefghij" $flacfile)
228 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
231 (set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcdefghi" $flacfile)
234 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
237 (set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcde" $flacfile)
240 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
243 (set -x && run_metaflac --remove-vc-all --set-vc-field="f=0" $flacfile)
246 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
249 (set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789" $flacfile)
252 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
255 (set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcdefghi" $flacfile)
258 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
261 (set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789" $flacfile)
264 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
267 (set -x && run_metaflac --remove-vc-all --set-vc-field="f=0123456789abcdefghij" $flacfile)
270 (set -x && run_metaflac --list --except-block-type=STREAMINFO $flacfile)
273 (set -x && echo "TITLE=Tittle" | run_metaflac --import-vc-from=- $flacfile)
276 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
283 (set -x && run_metaflac --import-vc-from=vc.txt $flacfile)
286 (set -x && run_metaflac --list --block-type=VORBIS_COMMENT $flacfile)
291 cs_in=cuesheets/good.000.cue
293 cs_out2=metaflac2.cue
294 (set -x && run_metaflac --import-cuesheet-from="$cs_in" $flacfile)
297 (set -x && run_metaflac --export-cuesheet-to=$cs_out $flacfile)
299 (set -x && run_metaflac --remove --block-type=CUESHEET $flacfile)
302 (set -x && run_metaflac --import-cuesheet-from=$cs_out $flacfile)
305 (set -x && run_metaflac --export-cuesheet-to=$cs_out2 $flacfile)
307 echo "comparing cuesheets:"
308 if diff $cs_out $cs_out2 ; then : ; else
309 echo "ERROR, cuesheets should be identical"
314 rm -f $cs_out $cs_out2