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/b:../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
32 #FLAC="valgrind --leak-check=yes --show-reachable=yes flac"
34 #METAFLAC="valgrind --leak-check=yes --show-reachable=yes metaflac"
37 echo "Generating stream..."
38 if [ -f /bin/sh.exe ] ; then
43 if $FLAC --verify -0 --output-name=$flacfile --force-raw-format --endian=big --sign=signed --channels=1 --bps=8 --sample-rate=44100 $inputfile ; then
46 echo "ERROR during generation" 1>&2
53 if [ $exit_code != 0 ] ; then
54 echo "ERROR, exit code = $exit_code" 1>&2
61 if $FLAC --silent --test $flacfile ; then : ; else
62 echo "ERROR in $flacfile" 1>&2
69 (set -x && $METAFLAC --list $flacfile)
75 --show-min-blocksize \
76 --show-max-blocksize \
77 --show-min-framesize \
78 --show-max-framesize \
82 --show-total-samples \
87 (set -x && $METAFLAC --preserve-modtime --add-padding=12345 $flacfile)
91 # some flavors of /bin/sh (e.g. Darwin's) won't even handle quoted spaces, so we underscore:
92 (set -x && $METAFLAC --set-vc-field="ARTIST=The_artist_formerly_known_as_the_artist..." $flacfile)
96 (set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
99 (set -x && $METAFLAC --set-vc-field="ARTIST=Chuck_Woolery" $flacfile)
103 (set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
106 (set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
109 (set -x && $METAFLAC --set-vc-field="ARTIST=Vern" $flacfile)
113 (set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
116 (set -x && $METAFLAC --set-vc-field="TITLE=He_who_smelt_it_dealt_it" $flacfile)
120 (set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
123 (set -x && $METAFLAC --show-vc-vendor --show-vc-field=ARTIST $flacfile)
126 (set -x && $METAFLAC --remove-vc-firstfield=ARTIST $flacfile)
130 (set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
133 (set -x && $METAFLAC --remove-vc-field=ARTIST $flacfile)
137 (set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
140 (set -x && $METAFLAC --list --block-number=0 $flacfile)
143 (set -x && $METAFLAC --list --block-number=1,2,999 $flacfile)
146 (set -x && $METAFLAC --list --block-type=VORBIS_COMMENT,PADDING $flacfile)
149 (set -x && $METAFLAC --list --except-block-type=SEEKTABLE,VORBIS_COMMENT $flacfile)
152 (set -x && $METAFLAC --add-padding=4321 $flacfile $flacfile)
156 (set -x && $METAFLAC --merge-padding $flacfile)
160 (set -x && $METAFLAC --add-padding=0 $flacfile)
164 (set -x && $METAFLAC --sort-padding $flacfile)
168 (set -x && $METAFLAC --add-padding=0 $flacfile)
172 (set -x && $METAFLAC --remove-vc-all $flacfile)
176 (set -x && $METAFLAC --remove --block-number=1,99 --dont-use-padding $flacfile)
180 (set -x && $METAFLAC --remove --block-number=99 --dont-use-padding $flacfile)
184 (set -x && $METAFLAC --remove --block-type=PADDING $flacfile)
188 (set -x && $METAFLAC --remove --block-type=PADDING --dont-use-padding $flacfile)
192 (set -x && $METAFLAC --add-padding=0 $flacfile $flacfile)
196 (set -x && $METAFLAC --remove --except-block-type=PADDING $flacfile)
200 (set -x && $METAFLAC --remove-all $flacfile)
204 (set -x && $METAFLAC --remove-all --dont-use-padding $flacfile)
208 (set -x && $METAFLAC --remove-all --dont-use-padding $flacfile)
212 (set -x && $METAFLAC --set-vc-field="f=0123456789abcdefghij" $flacfile)
215 (set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
218 (set -x && $METAFLAC --remove-vc-all --set-vc-field="f=0123456789abcdefghi" $flacfile)
221 (set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
224 (set -x && $METAFLAC --remove-vc-all --set-vc-field="f=0123456789abcde" $flacfile)
227 (set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
230 (set -x && $METAFLAC --remove-vc-all --set-vc-field="f=0" $flacfile)
233 (set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
236 (set -x && $METAFLAC --remove-vc-all --set-vc-field="f=0123456789" $flacfile)
239 (set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
242 (set -x && $METAFLAC --remove-vc-all --set-vc-field="f=0123456789abcdefghi" $flacfile)
245 (set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
248 (set -x && $METAFLAC --remove-vc-all --set-vc-field="f=0123456789" $flacfile)
251 (set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
254 (set -x && $METAFLAC --remove-vc-all --set-vc-field="f=0123456789abcdefghij" $flacfile)
257 (set -x && $METAFLAC --list --except-block-type=STREAMINFO $flacfile)
260 (set -x && echo "TITLE=Tittle" | $METAFLAC --import-vc-from=- $flacfile)
263 (set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
270 (set -x && $METAFLAC --import-vc-from=vc.txt $flacfile)
273 (set -x && $METAFLAC --list --block-type=VORBIS_COMMENT $flacfile)
278 cs_in=cuesheets/good.000.cue
280 cs_out2=metaflac2.cue
281 (set -x && $METAFLAC --import-cuesheet-from="$cs_in" $flacfile)
284 (set -x && $METAFLAC --export-cuesheet-to=$cs_out $flacfile)
286 (set -x && $METAFLAC --remove --block-type=CUESHEET $flacfile)
289 (set -x && $METAFLAC --import-cuesheet-from=$cs_out $flacfile)
292 (set -x && $METAFLAC --export-cuesheet-to=$cs_out2 $flacfile)
294 echo "comparing cuesheets:"
295 if diff $cs_out $cs_out2 ; then : ; else
296 echo "ERROR, cuesheets should be identical"
301 rm -f $cs_out $cs_out2