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/release/lib:../obj/debug/lib:$LD_LIBRARY_PATH
21 export LD_LIBRARY_PATH
22 PATH=../src/flac:../src/test_streams:../obj/release/bin:../obj/debug/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
29 if [ "$FLAC__VALGRIND" = yes ] ; then
30 valgrind --leak-check=yes --show-reachable=yes --num-callers=10 --logfile-fd=4 flac $* 4>>valgrind.log
36 echo "Checking for --ogg support in flac..."
37 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
39 echo "flac --ogg works"
42 echo "flac --ogg doesn't work"
48 echo "123456789012345678901234567890123456789" > 39c.raw
49 echo "012345678901234567890123456789012345678" > 39cu.raw
50 echo "0123456789012345678901234567890123456789" > 40c.raw
51 echo "01234567890123456789012345678901234567890123456789" > 50c.raw
53 # test encode --skip=#
54 echo "testing --skip=# (encode)"
55 if run_flac --silent --verify --lax --force-raw-format --endian=big --sign=signed --sample-rate=10 --bps=8 --channels=1 --skip=10 -o 50c.skip10.flac 50c.raw ; then : ; else
56 echo "ERROR generating FLAC file" 1>&2
59 if run_flac --silent --decode --force-raw-format --endian=big --sign=signed -o 50c.skip10.raw 50c.skip10.flac ; then : ; else
60 echo "ERROR decoding FLAC file" 1>&2
63 if cmp 40c.raw 50c.skip10.raw ; then : ; else
64 echo "ERROR: file mismatch for --skip=10 (encode)" 1>&2
67 rm -f 50c.skip10.flac 50c.skip10.raw
70 # test encode --skip=mm:ss
71 echo "testing --skip=mm:ss (encode)"
72 if run_flac --silent --verify --lax --force-raw-format --endian=big --sign=signed --sample-rate=10 --bps=8 --channels=1 --skip=0:01 -o 50c.skip0:01.flac 50c.raw ; then : ; else
73 echo "ERROR generating FLAC file" 1>&2
76 if run_flac --silent --decode --force-raw-format --endian=big --sign=signed -o 50c.skip0:01.raw 50c.skip0:01.flac ; then : ; else
77 echo "ERROR decoding FLAC file" 1>&2
80 if cmp 40c.raw 50c.skip0:01.raw ; then : ; else
81 echo "ERROR: file mismatch for --skip=0:01 (encode)" 1>&2
84 rm -f 50c.skip0:01.flac 50c.skip0:01.raw
87 # test encode --skip=mm:ss.sss
88 echo "testing --skip=mm:ss.sss (encode)"
89 if run_flac --silent --verify --lax --force-raw-format --endian=big --sign=signed --sample-rate=10 --bps=8 --channels=1 --skip=0:01.1 -o 50c.skip0:01.1.flac 50c.raw ; then : ; else
90 echo "ERROR generating FLAC file" 1>&2
93 if run_flac --silent --decode --force-raw-format --endian=big --sign=signed -o 50c.skip0:01.1.raw 50c.skip0:01.1.flac ; then : ; else
94 echo "ERROR decoding FLAC file" 1>&2
97 if cmp 39c.raw 50c.skip0:01.1.raw ; then : ; else
98 echo "ERROR: file mismatch for --skip=0:01.1 (encode)" 1>&2
101 rm -f 50c.skip0:01.1.flac 50c.skip0:01.1.raw
104 # test decode --skip=#
105 echo "testing --skip=# (decode)"
106 if run_flac --silent --verify --lax --force-raw-format --endian=big --sign=signed --sample-rate=10 --bps=8 --channels=1 -o 50c.flac 50c.raw ; then : ; else
107 echo "ERROR generating FLAC file" 1>&2
110 if run_flac --silent --decode --force-raw-format --endian=big --sign=signed --skip=10 -o 50c.skip10.raw 50c.flac ; then : ; else
111 echo "ERROR decoding FLAC file" 1>&2
114 if cmp 40c.raw 50c.skip10.raw ; then : ; else
115 echo "ERROR: file mismatch for --skip=10 (decode)" 1>&2
121 # test decode --skip=mm:ss
122 echo "testing --skip=mm:ss (decode)"
123 if run_flac --silent --decode --force-raw-format --endian=big --sign=signed --skip=0:01 -o 50c.skip0:01.raw 50c.flac ; then : ; else
124 echo "ERROR decoding FLAC file" 1>&2
127 if cmp 40c.raw 50c.skip0:01.raw ; then : ; else
128 echo "ERROR: file mismatch for --skip=0:01 (decode)" 1>&2
131 rm -f 50c.skip0:01.raw
134 # test decode --skip=mm:ss.sss
135 echo "testing --skip=mm:ss.sss (decode)"
136 if run_flac --silent --decode --force-raw-format --endian=big --sign=signed --skip=0:01.1 -o 50c.skip0:01.1.raw 50c.flac ; then : ; else
137 echo "ERROR decoding FLAC file" 1>&2
140 if cmp 39c.raw 50c.skip0:01.1.raw ; then : ; else
141 echo "ERROR: file mismatch for --skip=0:01.1 (decode)" 1>&2
144 rm -f 50c.skip0:01.1.raw
154 echo "Generating streams..."
155 if [ ! -f wacky1.wav ] ; then
156 if test_streams ; then : ; else
157 echo "ERROR during test_streams" 1>&2
162 echo "Generating multiple input files from noise..."
163 if run_flac --verify --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 noise.raw ; then : ; else
164 echo "ERROR generating FLAC file" 1>&2
167 if run_flac --decode --silent noise.flac ; then : ; else
168 echo "ERROR generating WAVE file" 1>&2
172 mv noise.wav file0.wav
173 cp file0.wav file1.wav
174 cp file1.wav file2.wav
182 if [ $streamtype = ogg ] ; then
184 encode_options="$encode_options --ogg"
189 if [ $sector_align = sector_align ] ; then
190 encode_options="$encode_options --sector-align"
193 if run_flac $encode_options file0.wav file1.wav file2.wav ; then : ; else
198 mv file$n.$suffix file${n}x.$suffix
200 if run_flac --decode file0x.$suffix file1x.$suffix file2x.$suffix ; then : ; else
204 if [ $sector_align != sector_align ] ; then
206 if cmp file$n.wav file${n}x.wav ; then : ; else
207 echo "ERROR: file mismatch on file #$n" 1>&2
213 rm -f file${n}x.$suffix file${n}x.wav
217 echo "Testing multiple files without verify..."
218 test_multifile flac no_sector_align ""
220 echo "Testing multiple files with verify..."
221 test_multifile flac no_sector_align "--verify"
223 echo "Testing multiple files with --sector-align, without verify..."
224 test_multifile flac sector_align ""
226 echo "Testing multiple files with --sector-align, with verify..."
227 test_multifile flac sector_align "--verify"
229 if [ $has_ogg = "yes" ] ; then
230 echo "Testing multiple files with --ogg, without verify..."
231 test_multifile ogg no_sector_align ""
233 echo "Testing multiple files with --ogg, with verify..."
234 test_multifile ogg no_sector_align "--verify"
236 echo "Testing multiple files with --ogg and --sector-align, without verify..."
237 test_multifile ogg sector_align ""
239 echo "Testing multiple files with --ogg and --sector-align, with verify..."
240 test_multifile sector_align ogg "--verify"
242 echo "Testing multiple files with --ogg and --serial-number, with verify..."
243 test_multifile ogg no_sector_align "--serial-number=321 --verify"