3 # FLAC - Free Lossless Audio Codec
4 # Copyright (C) 2001,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/lib:$LD_LIBRARY_PATH
21 export LD_LIBRARY_PATH
22 PATH=../src/flac:../src/test_streams:../obj/bin:$PATH
24 flac --help 1>/dev/null 2>/dev/null || (echo "ERROR can't find flac executable" 1>&2 && exit 1)
25 if [ $? != 0 ] ; then exit 1 ; fi
27 echo "Generating streams..."
28 if test_streams ; then : ; else
29 echo "ERROR during test_streams" 1>&2
33 echo "Checking for --ogg support in flac..."
34 if flac --ogg wacky1.wav 1>/dev/null 2>&1 ; then
36 echo "flac --ogg works"
39 echo "flac --ogg doesn't work"
45 echo "Generating multiple input files from noise..."
46 if flac -V -s -fr -fb -fs 44100 -fp 16 -fc 2 noise.raw ; then : ; else
47 echo "ERROR generating FLAC file" 1>&2
50 if flac -d -s noise.flac ; then : ; else
51 echo "ERROR generating WAVE file" 1>&2
64 if [ $streamtype = ogg ] ; then
66 encode_options="$encode_options --ogg"
71 if flac $encode_options f0.wav f1.wav f2.wav ; then : ; else
76 mv f$n.$suffix f${n}x.$suffix
78 if flac -d f0x.$suffix f1x.$suffix f2x.$suffix ; then : ; else
83 if cmp f$n.wav f${n}x.wav ; then : ; else
84 echo "ERROR: file mismatch on file #$n" 1>&2
89 rm -f f${n}x.$suffix f${n}x.wav
93 echo "Testing multiple files without verify..."
94 test_multifile flac ""
96 echo "Testing multiple files with verify..."
97 test_multifile flac "-V"
99 echo "Testing multiple files with --sector-align, without verify..."
100 test_multifile flac "--sector-align"
102 echo "Testing multiple files with --sector-align, with verify..."
103 test_multifile flac "--sector-align -V"
105 if [ $has_ogg = "yes" ] ; then
106 echo "Testing multiple files with --ogg, without verify..."
107 test_multifile ogg ""
109 echo "Testing multiple files with --ogg, with verify..."
110 test_multifile ogg "-V"
112 echo "Testing multiple files with --ogg and --sector-align, without verify..."
113 test_multifile flac "--ogg --sector-align"
115 echo "Testing multiple files with --ogg and --sector-align, with verify..."
116 test_multifile flac "--ogg --sector-align -V"
132 echo -n "$name: encode..."
133 cmd="flac -V -s -fr -fb -fs 44100 -fp $bps -fc $channels $encode_options $name.raw"
134 echo "### ENCODE $name #######################################################" >> ./streams.log
135 echo "### cmd=$cmd" >> ./streams.log
136 if $cmd 2>>./streams.log ; then : ; else
137 echo "ERROR during encode of $name" 1>&2
141 cmd="flac -s -fb -d -fr -o $name.cmp $name.flac"
142 echo "### DECODE $name #######################################################" >> ./streams.log
143 echo "### cmd=$cmd" >> ./streams.log
144 if $cmd 2>>./streams.log ; then : ; else
145 echo "ERROR during decode of $name" 1>&2
148 ls -1l $name.raw >> ./streams.log
149 ls -1l $name.flac >> ./streams.log
150 ls -1l $name.cmp >> ./streams.log
152 if cmp $name.raw $name.cmp ; then : ; else
153 echo "ERROR during compare of $name" 1>&2
166 if [ `env | grep -ic '^comspec='` != 0 ] ; then
172 echo -n "$name: encode via pipes..."
173 if [ $is_win = yes ] ; then
174 cmd="flac -V -s -fr -fb -fs 44100 -fp $bps -fc $channels $encode_options -c $name.raw"
175 echo "### ENCODE $name #######################################################" >> ./streams.log
176 echo "### cmd=$cmd" >> ./streams.log
177 if $cmd 1>$name.flac 2>>./streams.log ; then : ; else
178 echo "ERROR during encode of $name" 1>&2
182 cmd="flac -V -s -fr -fb -fs 44100 -fp $bps -fc $channels $encode_options -c -"
183 echo "### ENCODE $name #######################################################" >> ./streams.log
184 echo "### cmd=$cmd" >> ./streams.log
185 if cat $name.raw | $cmd 1>$name.flac 2>>./streams.log ; then : ; else
186 echo "ERROR during encode of $name" 1>&2
190 echo -n "decode via pipes..."
191 if [ $is_win = yes ] ; then
192 cmd="flac -s -fb -d -fr -c $name.flac"
193 echo "### DECODE $name #######################################################" >> ./streams.log
194 echo "### cmd=$cmd" >> ./streams.log
195 if $cmd 1>$name.cmp 2>>./streams.log ; then : ; else
196 echo "ERROR during decode of $name" 1>&2
200 cmd="flac -s -fb -d -fr -c -"
201 echo "### DECODE $name #######################################################" >> ./streams.log
202 echo "### cmd=$cmd" >> ./streams.log
203 if cat $name.flac | $cmd 1>$name.cmp 2>>./streams.log ; then : ; else
204 echo "ERROR during decode of $name" 1>&2
208 ls -1l $name.raw >> ./streams.log
209 ls -1l $name.flac >> ./streams.log
210 ls -1l $name.cmp >> ./streams.log
212 if cmp $name.raw $name.cmp ; then : ; else
213 echo "ERROR during compare of $name" 1>&2
219 echo "Testing noise through pipes..."
220 test_file_piped noise 1 8 "-0"
222 echo "Testing small files..."
223 test_file test01 1 16 "-0 -l 16 -m -e -p"
224 test_file test02 2 16 "-0 -l 16 -m -e -p"
225 test_file test03 1 16 "-0 -l 16 -m -e -p"
226 test_file test04 2 16 "-0 -l 16 -m -e -p"
228 echo "Testing 8-bit full-scale deflection streams..."
229 for b in 01 02 03 04 05 06 07 ; do
230 test_file fsd8-$b 1 8 "-0 -l 16 -m -e -p"
233 echo "Testing 16-bit full-scale deflection streams..."
234 for b in 01 02 03 04 05 06 07 ; do
235 test_file fsd16-$b 1 16 "-0 -l 16 -m -e -p"
238 echo "Testing 24-bit full-scale deflection streams..."
239 for b in 01 02 03 04 05 06 07 ; do
240 test_file fsd24-$b 1 24 "-0 -l 16 -m -e -p"
243 echo "Testing 16-bit wasted-bits-per-sample streams..."
245 test_file wbps16-$b 1 16 "-0 -l 16 -m -e -p"
248 for bps in 16 24 ; do
249 echo "Testing $bps-bit sine wave streams..."
250 for b in 00 01 02 03 04 ; do
251 test_file sine${bps}-$b 1 $bps "-0 -l 16 -m -e"
253 for b in 10 11 12 13 14 15 16 17 18 19 ; do
254 test_file sine${bps}-$b 2 $bps "-0 -l 16 -m -e"
258 echo "Testing some frame header variations..."
259 test_file sine16-01 1 16 "-0 -l 8 -m -e -p --lax -b 16"
260 test_file sine16-01 1 16 "-0 -l 8 -m -e -p --lax -b 65535"
261 test_file sine16-01 1 16 "-0 -l 8 -m -e -p -b 16"
262 test_file sine16-01 1 16 "-0 -l 8 -m -e -p -b 65535"
263 test_file sine16-01 1 16 "-0 -l 8 -m -e -p --lax -fs 9"
264 test_file sine16-01 1 16 "-0 -l 8 -m -e -p --lax -fs 90"
265 test_file sine16-01 1 16 "-0 -l 8 -m -e -p --lax -fs 90000"
266 test_file sine16-01 1 16 "-0 -l 8 -m -e -p -fs 9"
267 test_file sine16-01 1 16 "-0 -l 8 -m -e -p -fs 90"
268 test_file sine16-01 1 16 "-0 -l 8 -m -e -p -fs 90000"
270 echo "Testing option variations..."
271 for f in 00 01 02 03 04 ; do
272 for opt in 0 1 2 4 5 6 8 ; do
273 for extras in '' '-p' '-e' ; do
274 test_file sine16-$f 1 16 "-$opt $extras"
278 for f in 10 11 12 13 14 15 16 17 18 19 ; do
279 for opt in 0 1 2 4 5 6 8 ; do
280 for extras in '' '-p' '-e' ; do
281 test_file sine16-$f 2 16 "-$opt $extras"
286 echo "Testing noise..."
287 for opt in 0 1 2 3 4 5 6 7 8 ; do
288 for extras in '' '-p' '-e' ; do
289 for blocksize in '' '-b 32' '-b 32768' '-b 65535' ; do
290 for channels in 1 2 4 8 ; do
291 for bps in 8 16 24 ; do
292 test_file noise $channels $bps "-$opt $extras $blocksize"