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.
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/test_streams:../obj/release/bin:../obj/debug/bin:$PATH
30 flac --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable"
34 if [ "$FLAC__VALGRIND" = yes ] ; then
35 valgrind --leak-check=yes --show-reachable=yes --num-callers=10 --logfile-fd=4 flac $* 4>>valgrind.log
41 echo "Checking for --ogg support in flac..."
42 if flac --ogg --silent --force-raw-format --endian=little --sign=signed --channels=1 --bps=8 --sample-rate=44100 -c $0 1>/dev/null 2>&1 ; then
44 echo "flac --ogg works"
47 echo "flac --ogg doesn't work"
51 echo "Generating streams..."
52 if [ ! -f wacky1.wav ] ; then
53 test_streams || die "ERROR during test_streams"
56 ############################################################################
57 # basic 'round-trip' tests of various kinds of streams
58 ############################################################################
63 channels=`echo $f | awk -F- '{print $2}'`
64 bytes_per_sample=`echo $f | awk -F- '{print $3}'`
65 bps=`expr $bytes_per_sample '*' 8`
66 echo -n "round-trip test ($f) encode... "
67 run_flac --silent --verify --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $f -o rt.flac || die "ERROR"
69 run_flac --silent --decode --force-raw-format --endian=little --sign=signed -o rt.raw rt.flac || die "ERROR"
71 cmp $f rt.raw || die "ERROR: file mismatch"
79 echo -n "round-trip test ($f) encode... "
80 run_flac --silent --verify $f -o rt.flac || die "ERROR"
82 run_flac --silent --decode -o rt.wav rt.flac || die "ERROR"
84 cmp $f rt.wav || die "ERROR: file mismatch"
92 echo -n "round-trip test ($f) encode... "
93 run_flac --silent --verify $f -o rt.flac || die "ERROR"
95 run_flac --silent --decode -o rt.aiff rt.flac || die "ERROR"
97 cmp $f rt.aiff || die "ERROR: file mismatch"
102 for f in rt-*.raw ; do
105 for f in rt-*.wav ; do
108 for f in rt-*.aiff ; do
112 ############################################################################
113 # test --skip and --until
114 ############################################################################
117 # first make some chopped-up raw files
119 echo "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMN" > master.raw
120 dddie="die ERROR: creating files for --skip/--until tests"
121 dd if=master.raw ibs=1 count=50 of=50c.raw 2>/dev/null || $dddie
122 dd if=master.raw ibs=1 skip=10 count=40 of=50c.skip10.raw 2>/dev/null || $dddie
123 dd if=master.raw ibs=1 skip=11 count=39 of=50c.skip11.raw 2>/dev/null || $dddie
124 dd if=master.raw ibs=1 count=40 of=50c.until40.raw 2>/dev/null || $dddie
125 dd if=master.raw ibs=1 count=39 of=50c.until39.raw 2>/dev/null || $dddie
126 dd if=master.raw ibs=1 skip=10 count=30 of=50c.skip10.until40.raw 2>/dev/null || $dddie
127 dd if=master.raw ibs=1 skip=10 count=29 of=50c.skip10.until39.raw 2>/dev/null || $dddie
129 wav_eopt="--silent --verify --lax"
130 wav_dopt="--silent --decode"
132 raw_eopt="$wav_eopt --force-raw-format --endian=big --sign=signed --sample-rate=10 --bps=8 --channels=1"
133 raw_dopt="$wav_dopt --force-raw-format --endian=big --sign=signed"
136 # convert them to WAVE and AIFF files
140 run_flac $raw_eopt $1.raw || die "ERROR converting $1.raw to WAVE"
141 run_flac $wav_dopt $1.flac || die "ERROR converting $1.raw to WAVE"
144 convert_to_wav 50c.skip10
145 convert_to_wav 50c.skip11
146 convert_to_wav 50c.until40
147 convert_to_wav 50c.until39
148 convert_to_wav 50c.skip10.until40
149 convert_to_wav 50c.skip10.until39
153 run_flac $raw_eopt $1.raw || die "ERROR converting $1.raw to AIFF"
154 run_flac $wav_dopt $1.flac -o $1.aiff || die "ERROR converting $1.raw to AIFF"
157 convert_to_aiff 50c.skip10
158 convert_to_aiff 50c.skip11
159 convert_to_aiff 50c.until40
160 convert_to_aiff 50c.until39
161 convert_to_aiff 50c.skip10.until40
162 convert_to_aiff 50c.skip10.until39
168 [ $fmt = wav ] || [ $fmt = aiff ] || [ $fmt = raw ] || die "ERROR: internal error, bad format '$fmt'"
170 if [ $fmt = raw ] ; then
179 # test --skip when encoding
182 echo -n "testing --skip=# (encode) ($fmt)... "
183 run_flac $eopt --skip=10 -o z50c.skip10.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
184 run_flac $dopt -o z50c.skip10.$fmt z50c.skip10.flac || die "ERROR decoding FLAC file ($fmt)"
185 cmp 50c.skip10.$fmt z50c.skip10.$fmt || die "ERROR: file mismatch for --skip=10 (encode) ($fmt)"
186 rm -f z50c.skip10.flac z50c.skip10.$fmt
189 echo -n "testing --skip=mm:ss (encode) ($fmt)... "
190 run_flac $eopt --skip=0:01 -o z50c.skip0:01.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
191 run_flac $dopt -o z50c.skip0:01.$fmt z50c.skip0:01.flac || die "ERROR decoding FLAC file ($fmt)"
192 cmp 50c.skip10.$fmt z50c.skip0:01.$fmt || die "ERROR: file mismatch for --skip=0:01 (encode) ($fmt)"
193 rm -f z50c.skip0:01.flac z50c.skip0:01.$fmt
196 echo -n "testing --skip=mm:ss.sss (encode) ($fmt)... "
197 run_flac $eopt --skip=0:01.1001 -o z50c.skip0:01.1001.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
198 run_flac $dopt -o z50c.skip0:01.1001.$fmt z50c.skip0:01.1001.flac || die "ERROR decoding FLAC file ($fmt)"
199 cmp 50c.skip11.$fmt z50c.skip0:01.1001.$fmt || die "ERROR: file mismatch for --skip=0:01.1001 (encode) ($fmt)"
200 rm -f z50c.skip0:01.1001.flac z50c.skip0:01.1001.$fmt
204 # test --skip when decoding
207 echo -n "testing --skip=# (decode) ($fmt)... "
208 run_flac $eopt -o z50c.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
209 run_flac $dopt --skip=10 -o z50c.skip10.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)"
210 cmp 50c.skip10.$fmt z50c.skip10.$fmt || die "ERROR: file mismatch for --skip=10 (decode) ($fmt)"
211 rm -f z50c.skip10.$fmt
214 echo -n "testing --skip=mm:ss (decode) ($fmt)... "
215 run_flac $dopt --skip=0:01 -o z50c.skip0:01.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)"
216 cmp 50c.skip10.$fmt z50c.skip0:01.$fmt || die "ERROR: file mismatch for --skip=0:01 (decode) ($fmt)"
217 rm -f z50c.skip0:01.$fmt
220 echo -n "testing --skip=mm:ss.sss (decode) ($fmt)... "
221 run_flac $dopt --skip=0:01.1001 -o z50c.skip0:01.1001.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)"
222 cmp 50c.skip11.$fmt z50c.skip0:01.1001.$fmt || die "ERROR: file mismatch for --skip=0:01.1001 (decode) ($fmt)"
223 rm -f z50c.skip0:01.1001.$fmt
229 # test --until when encoding
232 echo -n "testing --until=# (encode) ($fmt)... "
233 run_flac $eopt --until=40 -o z50c.until40.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
234 run_flac $dopt -o z50c.until40.$fmt z50c.until40.flac || die "ERROR decoding FLAC file ($fmt)"
235 cmp 50c.until40.$fmt z50c.until40.$fmt || die "ERROR: file mismatch for --until=40 (encode) ($fmt)"
236 rm -f z50c.until40.flac z50c.until40.$fmt
239 echo -n "testing --until=mm:ss (encode) ($fmt)... "
240 run_flac $eopt --until=0:04 -o z50c.until0:04.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
241 run_flac $dopt -o z50c.until0:04.$fmt z50c.until0:04.flac || die "ERROR decoding FLAC file ($fmt)"
242 cmp 50c.until40.$fmt z50c.until0:04.$fmt || die "ERROR: file mismatch for --until=0:04 (encode) ($fmt)"
243 rm -f z50c.until0:04.flac z50c.until0:04.$fmt
246 echo -n "testing --until=mm:ss.sss (encode) ($fmt)... "
247 run_flac $eopt --until=0:03.9001 -o z50c.until0:03.9001.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
248 run_flac $dopt -o z50c.until0:03.9001.$fmt z50c.until0:03.9001.flac || die "ERROR decoding FLAC file ($fmt)"
249 cmp 50c.until39.$fmt z50c.until0:03.9001.$fmt || die "ERROR: file mismatch for --until=0:03.9001 (encode) ($fmt)"
250 rm -f z50c.until0:03.9001.flac z50c.until0:03.9001.$fmt
253 echo -n "testing --until=-# (encode) ($fmt)... "
254 run_flac $eopt --until=-10 -o z50c.until-10.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
255 run_flac $dopt -o z50c.until-10.$fmt z50c.until-10.flac || die "ERROR decoding FLAC file ($fmt)"
256 cmp 50c.until40.$fmt z50c.until-10.$fmt || die "ERROR: file mismatch for --until=-10 (encode) ($fmt)"
257 rm -f z50c.until-10.flac z50c.until-10.$fmt
260 echo -n "testing --until=-mm:ss (encode) ($fmt)... "
261 run_flac $eopt --until=-0:01 -o z50c.until-0:01.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
262 run_flac $dopt -o z50c.until-0:01.$fmt z50c.until-0:01.flac || die "ERROR decoding FLAC file ($fmt)"
263 cmp 50c.until40.$fmt z50c.until-0:01.$fmt || die "ERROR: file mismatch for --until=-0:01 (encode) ($fmt)"
264 rm -f z50c.until-0:01.flac z50c.until-0:01.$fmt
267 echo -n "testing --until=-mm:ss.sss (encode) ($fmt)... "
268 run_flac $eopt --until=-0:01.1001 -o z50c.until-0:01.1001.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
269 run_flac $dopt -o z50c.until-0:01.1001.$fmt z50c.until-0:01.1001.flac || die "ERROR decoding FLAC file ($fmt)"
270 cmp 50c.until39.$fmt z50c.until-0:01.1001.$fmt || die "ERROR: file mismatch for --until=-0:01.1001 (encode) ($fmt)"
271 rm -f z50c.until-0:01.1001.flac z50c.until-0:01.1001.$fmt
275 # test --until when decoding
278 run_flac $eopt -o z50c.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
280 echo -n "testing --until=# (decode) ($fmt)... "
281 run_flac $dopt --until=40 -o z50c.until40.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)"
282 cmp 50c.until40.$fmt z50c.until40.$fmt || die "ERROR: file mismatch for --until=40 (decode) ($fmt)"
283 rm -f z50c.until40.$fmt
286 echo -n "testing --until=mm:ss (decode) ($fmt)... "
287 run_flac $dopt --until=0:04 -o z50c.until0:04.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)"
288 cmp 50c.until40.$fmt z50c.until0:04.$fmt || die "ERROR: file mismatch for --until=0:04 (decode) ($fmt)"
289 rm -f z50c.until0:04.$fmt
292 echo -n "testing --until=mm:ss.sss (decode) ($fmt)... "
293 run_flac $dopt --until=0:03.9001 -o z50c.until0:03.9001.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)"
294 cmp 50c.until39.$fmt z50c.until0:03.9001.$fmt || die "ERROR: file mismatch for --until=0:03.9001 (decode) ($fmt)"
295 rm -f z50c.until0:03.9001.$fmt
298 echo -n "testing --until=-# (decode) ($fmt)... "
299 run_flac $dopt --until=-10 -o z50c.until-10.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)"
300 cmp 50c.until40.$fmt z50c.until-10.$fmt || die "ERROR: file mismatch for --until=-10 (decode) ($fmt)"
301 rm -f z50c.until-10.$fmt
304 echo -n "testing --until=-mm:ss (decode) ($fmt)... "
305 run_flac $dopt --until=-0:01 -o z50c.until-0:01.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)"
306 cmp 50c.until40.$fmt z50c.until-0:01.$fmt || die "ERROR: file mismatch for --until=-0:01 (decode) ($fmt)"
307 rm -f z50c.until-0:01.$fmt
310 echo -n "testing --until=-mm:ss.sss (decode) ($fmt)... "
311 run_flac $dopt --until=-0:01.1001 -o z50c.until-0:01.1001.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)"
312 cmp 50c.until39.$fmt z50c.until-0:01.1001.$fmt || die "ERROR: file mismatch for --until=-0:01.1001 (decode) ($fmt)"
313 rm -f z50c.until-0:01.1001.$fmt
319 # test --skip and --until when encoding
322 echo -n "testing --skip=10 --until=# (encode) ($fmt)... "
323 run_flac $eopt --skip=10 --until=40 -o z50c.skip10.until40.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
324 run_flac $dopt -o z50c.skip10.until40.$fmt z50c.skip10.until40.flac || die "ERROR decoding FLAC file ($fmt)"
325 cmp 50c.skip10.until40.$fmt z50c.skip10.until40.$fmt || die "ERROR: file mismatch for --skip=10 --until=40 (encode) ($fmt)"
326 rm -f z50c.skip10.until40.flac z50c.skip10.until40.$fmt
329 echo -n "testing --skip=10 --until=mm:ss (encode) ($fmt)... "
330 run_flac $eopt --skip=10 --until=0:04 -o z50c.skip10.until0:04.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
331 run_flac $dopt -o z50c.skip10.until0:04.$fmt z50c.skip10.until0:04.flac || die "ERROR decoding FLAC file ($fmt)"
332 cmp 50c.skip10.until40.$fmt z50c.skip10.until0:04.$fmt || die "ERROR: file mismatch for --skip=10 --until=0:04 (encode) ($fmt)"
333 rm -f z50c.skip10.until0:04.flac z50c.skip10.until0:04.$fmt
336 echo -n "testing --skip=10 --until=mm:ss.sss (encode) ($fmt)... "
337 run_flac $eopt --skip=10 --until=0:03.9001 -o z50c.skip10.until0:03.9001.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
338 run_flac $dopt -o z50c.skip10.until0:03.9001.$fmt z50c.skip10.until0:03.9001.flac || die "ERROR decoding FLAC file ($fmt)"
339 cmp 50c.skip10.until39.$fmt z50c.skip10.until0:03.9001.$fmt || die "ERROR: file mismatch for --skip=10 --until=0:03.9001 (encode) ($fmt)"
340 rm -f z50c.skip10.until0:03.9001.flac z50c.skip10.until0:03.9001.$fmt
343 echo -n "testing --skip=10 --until=+# (encode) ($fmt)... "
344 run_flac $eopt --skip=10 --until=+30 -o z50c.skip10.until+30.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
345 run_flac $dopt -o z50c.skip10.until+30.$fmt z50c.skip10.until+30.flac || die "ERROR decoding FLAC file ($fmt)"
346 cmp 50c.skip10.until40.$fmt z50c.skip10.until+30.$fmt || die "ERROR: file mismatch for --skip=10 --until=+30 (encode) ($fmt)"
347 rm -f z50c.skip10.until+30.flac z50c.skip10.until+30.$fmt
350 echo -n "testing --skip=10 --until=+mm:ss (encode) ($fmt)... "
351 run_flac $eopt --skip=10 --until=+0:03 -o z50c.skip10.until+0:03.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
352 run_flac $dopt -o z50c.skip10.until+0:03.$fmt z50c.skip10.until+0:03.flac || die "ERROR decoding FLAC file ($fmt)"
353 cmp 50c.skip10.until40.$fmt z50c.skip10.until+0:03.$fmt || die "ERROR: file mismatch for --skip=10 --until=+0:03 (encode) ($fmt)"
354 rm -f z50c.skip10.until+0:03.flac z50c.skip10.until+0:03.$fmt
357 echo -n "testing --skip=10 --until=+mm:ss.sss (encode) ($fmt)... "
358 run_flac $eopt --skip=10 --until=+0:02.9001 -o z50c.skip10.until+0:02.9001.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
359 run_flac $dopt -o z50c.skip10.until+0:02.9001.$fmt z50c.skip10.until+0:02.9001.flac || die "ERROR decoding FLAC file ($fmt)"
360 cmp 50c.skip10.until39.$fmt z50c.skip10.until+0:02.9001.$fmt || die "ERROR: file mismatch for --skip=10 --until=+0:02.9001 (encode) ($fmt)"
361 rm -f z50c.skip10.until+0:02.9001.flac z50c.skip10.until+0:02.9001.$fmt
364 echo -n "testing --skip=10 --until=-# (encode) ($fmt)... "
365 run_flac $eopt --skip=10 --until=-10 -o z50c.skip10.until-10.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
366 run_flac $dopt -o z50c.skip10.until-10.$fmt z50c.skip10.until-10.flac || die "ERROR decoding FLAC file ($fmt)"
367 cmp 50c.skip10.until40.$fmt z50c.skip10.until-10.$fmt || die "ERROR: file mismatch for --skip=10 --until=-10 (encode) ($fmt)"
368 rm -f z50c.skip10.until-10.flac z50c.skip10.until-10.$fmt
371 echo -n "testing --skip=10 --until=-mm:ss (encode) ($fmt)... "
372 run_flac $eopt --skip=10 --until=-0:01 -o z50c.skip10.until-0:01.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
373 run_flac $dopt -o z50c.skip10.until-0:01.$fmt z50c.skip10.until-0:01.flac || die "ERROR decoding FLAC file ($fmt)"
374 cmp 50c.skip10.until40.$fmt z50c.skip10.until-0:01.$fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01 (encode) ($fmt)"
375 rm -f z50c.skip10.until-0:01.flac z50c.skip10.until-0:01.$fmt
378 echo -n "testing --skip=10 --until=-mm:ss.sss (encode) ($fmt)... "
379 run_flac $eopt --skip=10 --until=-0:01.1001 -o z50c.skip10.until-0:01.1001.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
380 run_flac $dopt -o z50c.skip10.until-0:01.1001.$fmt z50c.skip10.until-0:01.1001.flac || die "ERROR decoding FLAC file ($fmt)"
381 cmp 50c.skip10.until39.$fmt z50c.skip10.until-0:01.1001.$fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01.1001 (encode) ($fmt)"
382 rm -f z50c.skip10.until-0:01.1001.flac z50c.skip10.until-0:01.1001.$fmt
386 # test --skip and --until when decoding
389 run_flac $eopt -o z50c.flac 50c.$fmt || die "ERROR generating FLAC file ($fmt)"
391 echo -n "testing --skip=10 --until=# (decode) ($fmt)... "
392 run_flac $dopt --skip=10 --until=40 -o z50c.skip10.until40.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)"
393 cmp 50c.skip10.until40.$fmt z50c.skip10.until40.$fmt || die "ERROR: file mismatch for --skip=10 --until=40 (decode) ($fmt)"
394 rm -f z50c.skip10.until40.$fmt
397 echo -n "testing --skip=10 --until=mm:ss (decode) ($fmt)... "
398 run_flac $dopt --skip=10 --until=0:04 -o z50c.skip10.until0:04.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)"
399 cmp 50c.skip10.until40.$fmt z50c.skip10.until0:04.$fmt || die "ERROR: file mismatch for --skip=10 --until=0:04 (decode) ($fmt)"
400 rm -f z50c.skip10.until0:04.$fmt
403 echo -n "testing --skip=10 --until=mm:ss.sss (decode) ($fmt)... "
404 run_flac $dopt --skip=10 --until=0:03.9001 -o z50c.skip10.until0:03.9001.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)"
405 cmp 50c.skip10.until39.$fmt z50c.skip10.until0:03.9001.$fmt || die "ERROR: file mismatch for --skip=10 --until=0:03.9001 (decode) ($fmt)"
406 rm -f z50c.skip10.until0:03.9001.$fmt
409 echo -n "testing --skip=10 --until=-# (decode) ($fmt)... "
410 run_flac $dopt --skip=10 --until=-10 -o z50c.skip10.until-10.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)"
411 cmp 50c.skip10.until40.$fmt z50c.skip10.until-10.$fmt || die "ERROR: file mismatch for --skip=10 --until=-10 (decode) ($fmt)"
412 rm -f z50c.skip10.until-10.$fmt
415 echo -n "testing --skip=10 --until=-mm:ss (decode) ($fmt)... "
416 run_flac $dopt --skip=10 --until=-0:01 -o z50c.skip10.until-0:01.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)"
417 cmp 50c.skip10.until40.$fmt z50c.skip10.until-0:01.$fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01 (decode) ($fmt)"
418 rm -f z50c.skip10.until-0:01.$fmt
421 echo -n "testing --skip=10 --until=-mm:ss.sss (decode) ($fmt)... "
422 run_flac $dopt --skip=10 --until=-0:01.1001 -o z50c.skip10.until-0:01.1001.$fmt z50c.flac || die "ERROR decoding FLAC file ($fmt)"
423 cmp 50c.skip10.until39.$fmt z50c.skip10.until-0:01.1001.$fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01.1001 (decode) ($fmt)"
424 rm -f z50c.skip10.until-0:01.1001.$fmt
435 ############################################################################
436 # test 'fixup' code that happens when a FLAC file with total_samples == 0
437 # in the STREAMINFO block is converted to WAVE or AIFF, requiring the
438 # decoder go back and fix up the chunk headers
439 ############################################################################
441 echo -n "WAVE fixup test... "
442 echo -n "prepare... "
443 convert_to_wav noise || die "ERROR creating reference WAVE"
445 cat noise.raw | run_flac $raw_eopt - -c > fixup.flac || die "ERROR generating FLAC file"
447 run_flac $wav_dopt fixup.flac -o fixup.wav || die "ERROR decoding FLAC file"
448 echo -n "compare... "
449 cmp noise.wav fixup.wav || die "ERROR: file mismatch"
451 rm -f noise.wav fixup.wav fixup.flac
453 echo -n "AIFF fixup test... "
454 echo -n "prepare... "
455 convert_to_aiff noise || die "ERROR creating reference AIFF"
457 cat noise.raw | run_flac $raw_eopt - -c > fixup.flac || die "ERROR generating FLAC file"
459 run_flac $wav_dopt fixup.flac -o fixup.aiff || die "ERROR decoding FLAC file"
460 echo -n "compare... "
461 cmp noise.aiff fixup.aiff || die "ERROR: file mismatch"
463 rm -f noise.aiff fixup.aiff fixup.flac
466 ############################################################################
468 ############################################################################
470 echo "Generating multiple input files from noise..."
471 run_flac --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 noise.raw || die "ERROR generating FLAC file"
472 run_flac --decode --silent noise.flac || die "ERROR generating WAVE file"
474 mv noise.wav file0.wav
475 cp file0.wav file1.wav
476 cp file1.wav file2.wav
484 if [ $streamtype = ogg ] ; then
486 encode_options="$encode_options --ogg"
491 if [ $sector_align = sector_align ] ; then
492 encode_options="$encode_options --sector-align"
495 run_flac $encode_options file0.wav file1.wav file2.wav || die "ERROR"
497 mv file$n.$suffix file${n}x.$suffix
499 run_flac --decode file0x.$suffix file1x.$suffix file2x.$suffix || die "ERROR"
500 if [ $sector_align != sector_align ] ; then
502 cmp file$n.wav file${n}x.wav || die "ERROR: file mismatch on file #$n"
506 rm -f file${n}x.$suffix file${n}x.wav
510 echo "Testing multiple files without verify..."
511 test_multifile flac no_sector_align ""
513 echo "Testing multiple files with verify..."
514 test_multifile flac no_sector_align "--verify"
516 echo "Testing multiple files with --sector-align, without verify..."
517 test_multifile flac sector_align ""
519 echo "Testing multiple files with --sector-align, with verify..."
520 test_multifile flac sector_align "--verify"
522 if [ $has_ogg = "yes" ] ; then
523 echo "Testing multiple files with --ogg, without verify..."
524 test_multifile ogg no_sector_align ""
526 echo "Testing multiple files with --ogg, with verify..."
527 test_multifile ogg no_sector_align "--verify"
529 echo "Testing multiple files with --ogg and --sector-align, without verify..."
530 test_multifile ogg sector_align ""
532 echo "Testing multiple files with --ogg and --sector-align, with verify..."
533 test_multifile sector_align ogg "--verify"
535 echo "Testing multiple files with --ogg and --serial-number, with verify..."
536 test_multifile ogg no_sector_align "--serial-number=321 --verify"