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 --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 noise.raw ; then : ; else
47 echo "ERROR generating FLAC file" 1>&2
50 if flac --decode --silent noise.flac ; then : ; else
51 echo "ERROR generating WAVE file" 1>&2
55 mv noise.wav file0.wav
56 cp file0.wav file1.wav
57 cp file1.wav file2.wav
65 if [ $streamtype = ogg ] ; then
67 encode_options="$encode_options --ogg"
72 if [ $sector_align = sector_align ] ; then
73 encode_options="$encode_options --sector-align"
76 if flac $encode_options file0.wav file1.wav file2.wav ; then : ; else
81 mv file$n.$suffix file${n}x.$suffix
83 if flac --decode file0x.$suffix file1x.$suffix file2x.$suffix ; then : ; else
87 if [ $sector_align != sector_align ] ; then
89 if cmp file$n.wav file${n}x.wav ; then : ; else
90 echo "ERROR: file mismatch on file #$n" 1>&2
96 rm -f file${n}x.$suffix file${n}x.wav
100 echo "Testing multiple files without verify..."
101 test_multifile flac no_sector_align ""
103 echo "Testing multiple files with verify..."
104 test_multifile flac no_sector_align "--verify"
106 echo "Testing multiple files with --sector-align, without verify..."
107 test_multifile flac sector_align ""
109 echo "Testing multiple files with --sector-align, with verify..."
110 test_multifile flac sector_align "--verify"
112 if [ $has_ogg = "yes" ] ; then
113 echo "Testing multiple files with --ogg, without verify..."
114 test_multifile ogg no_sector_align ""
116 echo "Testing multiple files with --ogg, with verify..."
117 test_multifile ogg no_sector_align "--verify"
119 echo "Testing multiple files with --ogg and --sector-align, without verify..."
120 test_multifile ogg sector_align ""
122 echo "Testing multiple files with --ogg and --sector-align, with verify..."
123 test_multifile sector_align ogg "--verify"
137 echo -n "$name (--channels=$channels --bps=$bps $encode_options): encode..."
138 cmd="flac --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options $name.raw"
139 echo "### ENCODE $name #######################################################" >> ./streams.log
140 echo "### cmd=$cmd" >> ./streams.log
141 if $cmd 2>>./streams.log ; then : ; else
142 echo "ERROR during encode of $name" 1>&2
146 cmd="flac --silent --endian=big --sign=signed --decode --force-raw-format --output-name=$name.cmp $name.flac"
147 echo "### DECODE $name #######################################################" >> ./streams.log
148 echo "### cmd=$cmd" >> ./streams.log
149 if $cmd 2>>./streams.log ; then : ; else
150 echo "ERROR during decode of $name" 1>&2
153 ls -1l $name.raw >> ./streams.log
154 ls -1l $name.flac >> ./streams.log
155 ls -1l $name.cmp >> ./streams.log
157 if cmp $name.raw $name.cmp ; then : ; else
158 echo "ERROR during compare of $name" 1>&2
171 if [ `env | grep -ic '^comspec='` != 0 ] ; then
177 echo -n "$name: encode via pipes..."
178 if [ $is_win = yes ] ; then
179 cmd="flac --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --stdout $name.raw"
180 echo "### ENCODE $name #######################################################" >> ./streams.log
181 echo "### cmd=$cmd" >> ./streams.log
182 if $cmd 1>$name.flac 2>>./streams.log ; then : ; else
183 echo "ERROR during encode of $name" 1>&2
187 cmd="flac --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $encode_options --stdout -"
188 echo "### ENCODE $name #######################################################" >> ./streams.log
189 echo "### cmd=$cmd" >> ./streams.log
190 if cat $name.raw | $cmd 1>$name.flac 2>>./streams.log ; then : ; else
191 echo "ERROR during encode of $name" 1>&2
195 echo -n "decode via pipes..."
196 if [ $is_win = yes ] ; then
197 cmd="flac --silent --endian=big --sign=signed --decode --force-raw-format --stdout $name.flac"
198 echo "### DECODE $name #######################################################" >> ./streams.log
199 echo "### cmd=$cmd" >> ./streams.log
200 if $cmd 1>$name.cmp 2>>./streams.log ; then : ; else
201 echo "ERROR during decode of $name" 1>&2
205 cmd="flac --silent --endian=big --sign=signed --decode --force-raw-format --stdout -"
206 echo "### DECODE $name #######################################################" >> ./streams.log
207 echo "### cmd=$cmd" >> ./streams.log
208 if cat $name.flac | $cmd 1>$name.cmp 2>>./streams.log ; then : ; else
209 echo "ERROR during decode of $name" 1>&2
213 ls -1l $name.raw >> ./streams.log
214 ls -1l $name.flac >> ./streams.log
215 ls -1l $name.cmp >> ./streams.log
217 if cmp $name.raw $name.cmp ; then : ; else
218 echo "ERROR during compare of $name" 1>&2
224 if [ "$FLAC__EXHAUSTIVE_TESTS" = yes ] ; then
230 echo "Testing noise through pipes..."
231 test_file_piped noise 1 8 "-0"
233 echo "Testing small files..."
234 test_file test01 1 16 "-0 -l $max_lpc_order -m -e -p"
235 test_file test02 2 16 "-0 -l $max_lpc_order -m -e -p"
236 test_file test03 1 16 "-0 -l $max_lpc_order -m -e -p"
237 test_file test04 2 16 "-0 -l $max_lpc_order -m -e -p"
239 echo "Testing 8-bit full-scale deflection streams..."
240 for b in 01 02 03 04 05 06 07 ; do
241 test_file fsd8-$b 1 8 "-0 -l $max_lpc_order -m -e -p"
244 echo "Testing 16-bit full-scale deflection streams..."
245 for b in 01 02 03 04 05 06 07 ; do
246 test_file fsd16-$b 1 16 "-0 -l $max_lpc_order -m -e -p"
249 echo "Testing 24-bit full-scale deflection streams..."
250 for b in 01 02 03 04 05 06 07 ; do
251 test_file fsd24-$b 1 24 "-0 -l $max_lpc_order -m -e -p"
254 echo "Testing 16-bit wasted-bits-per-sample streams..."
256 test_file wbps16-$b 1 16 "-0 -l $max_lpc_order -m -e -p"
259 for bps in 8 16 24 ; do
260 echo "Testing $bps-bit sine wave streams..."
262 test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order -m -e --sample-rate=48000"
265 test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order -m -e --sample-rate=96000"
267 for b in 02 03 04 ; do
268 test_file sine${bps}-$b 1 $bps "-0 -l $max_lpc_order -m -e"
271 test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order -m -e --sample-rate=48000"
274 test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order -m -e --sample-rate=96000"
276 for b in 13 14 15 16 17 18 19 ; do
277 test_file sine${bps}-$b 2 $bps "-0 -l $max_lpc_order -m -e"
281 echo "Testing some frame header variations..."
282 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax -b $max_lpc_order"
283 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax -b 65535"
284 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=9"
285 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=90"
286 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --lax --sample-rate=90000"
287 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --sample-rate=9"
288 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --sample-rate=90"
289 test_file sine16-01 1 16 "-0 -l $max_lpc_order -m -e -p --sample-rate=90000"
291 echo "Testing option variations..."
292 for f in 00 01 02 03 04 ; do
293 for opt in 0 1 2 4 5 6 8 ; do
294 for extras in '' '-p' '-e' ; do
295 test_file sine16-$f 1 16 "-$opt $extras"
298 if [ "$FLAC__EXHAUSTIVE_TESTS" = yes ] ; then
299 test_file sine16-$f 1 16 "-b 16384 -m -r 8 -l $max_lpc_order -e -p"
303 for f in 10 11 12 13 14 15 16 17 18 19 ; do
304 for opt in 0 1 2 4 5 6 8 ; do
305 for extras in '' '-p' '-e' ; do
306 test_file sine16-$f 2 16 "-$opt $extras"
309 if [ "$FLAC__EXHAUSTIVE_TESTS" = yes ] ; then
310 test_file sine16-$f 2 16 "-b 16384 -m -r 8 -l $max_lpc_order -e -p"
314 echo "Testing noise..."
315 for channels in 1 2 4 8 ; do
316 for bps in 8 16 24 ; do
317 for opt in 0 1 2 3 4 5 6 7 8 ; do
318 for extras in '' '-p' '-e' ; do
319 for blocksize in '' '--lax -b 32' '--lax -b 32768' '--lax -b 65535' ; do
320 test_file noise $channels $bps "-$opt $extras $blocksize"
324 if [ "$FLAC__EXHAUSTIVE_TESTS" = yes ] ; then
325 test_file noise $channels $bps "-b 16384 -m -r 8 -l $max_lpc_order -e -p"