Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # FLAC - Free Lossless Audio Codec |
Josh Coalson | 9564390 | 2004-01-17 04:14:43 +0000 | [diff] [blame] | 4 | # Copyright (C) 2001,2002,2003,2004 Josh Coalson |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 5 | # |
Josh Coalson | e8a7601 | 2003-02-07 00:14:32 +0000 | [diff] [blame] | 6 | # This file is part the FLAC project. FLAC is comprised of several |
| 7 | # components distributed under difference licenses. The codec libraries |
| 8 | # are distributed under Xiph.Org's BSD-like license (see the file |
| 9 | # COPYING.Xiph in this distribution). All other programs, libraries, and |
| 10 | # plugins are distributed under the GPL (see COPYING.GPL). The documentation |
| 11 | # is distributed under the Gnu FDL (see COPYING.FDL). Each file in the |
| 12 | # FLAC distribution contains at the top the terms under which it may be |
| 13 | # distributed. |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 14 | # |
Josh Coalson | e8a7601 | 2003-02-07 00:14:32 +0000 | [diff] [blame] | 15 | # Since this particular file is relevant to all components of FLAC, |
| 16 | # it may be distributed under the Xiph.Org license, which is the least |
| 17 | # restrictive of those mentioned above. See the file COPYING.Xiph in this |
| 18 | # distribution. |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 19 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 20 | die () |
| 21 | { |
| 22 | echo $* 1>&2 |
| 23 | exit 1 |
| 24 | } |
| 25 | |
Josh Coalson | b43d3cb | 2004-11-09 01:28:05 +0000 | [diff] [blame] | 26 | if [ x = x"$1" ] ; then |
| 27 | BUILD=debug |
| 28 | else |
| 29 | BUILD="$1" |
| 30 | fi |
| 31 | |
| 32 | LD_LIBRARY_PATH=../src/libFLAC/.libs:$LD_LIBRARY_PATH |
| 33 | LD_LIBRARY_PATH=../src/libOggFLAC/.libs:$LD_LIBRARY_PATH |
| 34 | LD_LIBRARY_PATH=../src/share/grabbag/.libs:$LD_LIBRARY_PATH |
| 35 | LD_LIBRARY_PATH=../src/share/getopt/.libs:$LD_LIBRARY_PATH |
| 36 | LD_LIBRARY_PATH=../src/share/replaygain_analysis/.libs:$LD_LIBRARY_PATH |
| 37 | LD_LIBRARY_PATH=../src/share/replaygain_synthesis/.libs:$LD_LIBRARY_PATH |
| 38 | LD_LIBRARY_PATH=../src/share/utf8/.libs:$LD_LIBRARY_PATH |
| 39 | LD_LIBRARY_PATH=../obj/$BUILD/lib:$LD_LIBRARY_PATH |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 40 | export LD_LIBRARY_PATH |
Josh Coalson | b43d3cb | 2004-11-09 01:28:05 +0000 | [diff] [blame] | 41 | PATH=../src/flac:$PATH |
| 42 | PATH=../src/metaflac:$PATH |
| 43 | PATH=../src/test_streams:$PATH |
| 44 | PATH=../obj/$BUILD/bin:$PATH |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 45 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 46 | flac --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 47 | |
| 48 | run_flac () |
| 49 | { |
Josh Coalson | ecf57b7 | 2003-01-14 09:00:25 +0000 | [diff] [blame] | 50 | if [ x"$FLAC__VALGRIND" = xyes ] ; then |
Josh Coalson | 80936c5 | 2002-12-30 23:31:47 +0000 | [diff] [blame] | 51 | valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 flac $* 4>>test_flac.valgrind.log |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 52 | else |
| 53 | flac $* |
| 54 | fi |
| 55 | } |
| 56 | |
Josh Coalson | 68d1321 | 2004-09-14 00:25:43 +0000 | [diff] [blame] | 57 | run_metaflac () |
| 58 | { |
| 59 | if [ x"$FLAC__VALGRIND" = xyes ] ; then |
Josh Coalson | b43d3cb | 2004-11-09 01:28:05 +0000 | [diff] [blame] | 60 | valgrind --leak-check=yes --show-reachable=yes --num-callers=100 --logfile-fd=4 metaflac $* 4>>test_flac.valgrind.log |
Josh Coalson | 68d1321 | 2004-09-14 00:25:43 +0000 | [diff] [blame] | 61 | else |
| 62 | metaflac $* |
| 63 | fi |
| 64 | } |
| 65 | |
Josh Coalson | d434672 | 2004-09-12 22:58:13 +0000 | [diff] [blame] | 66 | if [ `env | grep -ic '^comspec='` != 0 ] ; then |
| 67 | is_win=yes |
| 68 | else |
| 69 | is_win=no |
| 70 | fi |
| 71 | |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 72 | echo "Checking for --ogg support in flac..." |
| 73 | 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 |
| 74 | has_ogg=yes; |
| 75 | echo "flac --ogg works" |
| 76 | else |
| 77 | has_ogg=no; |
| 78 | echo "flac --ogg doesn't work" |
| 79 | fi |
| 80 | |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 81 | |
| 82 | echo "Generating streams..." |
| 83 | if [ ! -f wacky1.wav ] ; then |
| 84 | test_streams || die "ERROR during test_streams" |
| 85 | fi |
| 86 | |
| 87 | ############################################################################ |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame] | 88 | # test that flac doesn't automatically overwrite files unless -f is used |
| 89 | ############################################################################ |
| 90 | |
| 91 | echo "Try encoding to a file that exists; should fail" |
| 92 | cp wacky1.wav exist.wav |
| 93 | touch exist.flac |
Josh Coalson | e4240db | 2004-07-17 18:14:45 +0000 | [diff] [blame] | 94 | if run_flac --totally-silent -0 exist.wav ; then |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame] | 95 | die "ERROR: it should have failed but didn't" |
| 96 | else |
| 97 | echo "OK, it failed as it should" |
| 98 | fi |
| 99 | |
| 100 | echo "Try encoding with -f to a file that exists; should succeed" |
Josh Coalson | e4240db | 2004-07-17 18:14:45 +0000 | [diff] [blame] | 101 | if run_flac --totally-silent -0 --force exist.wav ; then |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame] | 102 | echo "OK, it succeeded as it should" |
| 103 | else |
| 104 | die "ERROR: it should have succeeded but didn't" |
| 105 | fi |
| 106 | |
| 107 | echo "Try decoding to a file that exists; should fail" |
Josh Coalson | e4240db | 2004-07-17 18:14:45 +0000 | [diff] [blame] | 108 | if run_flac --totally-silent -d exist.flac ; then |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame] | 109 | die "ERROR: it should have failed but didn't" |
| 110 | else |
| 111 | echo "OK, it failed as it should" |
| 112 | fi |
| 113 | |
| 114 | echo "Try decoding with -f to a file that exists; should succeed" |
Josh Coalson | e4240db | 2004-07-17 18:14:45 +0000 | [diff] [blame] | 115 | if run_flac --totally-silent -d -f exist.flac ; then |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame] | 116 | echo "OK, it succeeded as it should" |
| 117 | else |
| 118 | die "ERROR: it should have succeeded but didn't" |
| 119 | fi |
| 120 | |
| 121 | rm -f exist.wav exist.flac |
| 122 | |
| 123 | ############################################################################ |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 124 | # basic 'round-trip' tests of various kinds of streams |
| 125 | ############################################################################ |
| 126 | |
| 127 | rt_test_raw () |
| 128 | { |
| 129 | f="$1" |
| 130 | channels=`echo $f | awk -F- '{print $2}'` |
| 131 | bytes_per_sample=`echo $f | awk -F- '{print $3}'` |
| 132 | bps=`expr $bytes_per_sample '*' 8` |
| 133 | echo -n "round-trip test ($f) encode... " |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame] | 134 | run_flac --silent --force --verify --force-raw-format --endian=little --sign=signed --sample-rate=44100 --bps=$bps --channels=$channels $f -o rt.flac || die "ERROR" |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 135 | echo -n "decode... " |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame] | 136 | run_flac --silent --force --decode --force-raw-format --endian=little --sign=signed -o rt.raw rt.flac || die "ERROR" |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 137 | echo -n "compare... " |
| 138 | cmp $f rt.raw || die "ERROR: file mismatch" |
| 139 | echo "OK" |
| 140 | rm -f rt.flac rt.raw |
| 141 | } |
| 142 | |
| 143 | rt_test_wav () |
| 144 | { |
| 145 | f="$1" |
| 146 | echo -n "round-trip test ($f) encode... " |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame] | 147 | run_flac --silent --force --verify $f -o rt.flac || die "ERROR" |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 148 | echo -n "decode... " |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame] | 149 | run_flac --silent --force --decode -o rt.wav rt.flac || die "ERROR" |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 150 | echo -n "compare... " |
| 151 | cmp $f rt.wav || die "ERROR: file mismatch" |
| 152 | echo "OK" |
| 153 | rm -f rt.flac rt.wav |
| 154 | } |
| 155 | |
| 156 | rt_test_aiff () |
| 157 | { |
| 158 | f="$1" |
| 159 | echo -n "round-trip test ($f) encode... " |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame] | 160 | run_flac --silent --force --verify $f -o rt.flac || die "ERROR" |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 161 | echo -n "decode... " |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame] | 162 | run_flac --silent --force --decode -o rt.aiff rt.flac || die "ERROR" |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 163 | echo -n "compare... " |
| 164 | cmp $f rt.aiff || die "ERROR: file mismatch" |
| 165 | echo "OK" |
| 166 | rm -f rt.flac rt.aiff |
| 167 | } |
| 168 | |
| 169 | for f in rt-*.raw ; do |
| 170 | rt_test_raw $f |
| 171 | done |
| 172 | for f in rt-*.wav ; do |
| 173 | rt_test_wav $f |
| 174 | done |
| 175 | for f in rt-*.aiff ; do |
| 176 | rt_test_aiff $f |
| 177 | done |
| 178 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 179 | ############################################################################ |
| 180 | # test --skip and --until |
| 181 | ############################################################################ |
| 182 | |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 183 | # |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 184 | # first make some chopped-up raw files |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 185 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 186 | echo "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMN" > master.raw |
| 187 | dddie="die ERROR: creating files for --skip/--until tests" |
| 188 | dd if=master.raw ibs=1 count=50 of=50c.raw 2>/dev/null || $dddie |
| 189 | dd if=master.raw ibs=1 skip=10 count=40 of=50c.skip10.raw 2>/dev/null || $dddie |
| 190 | dd if=master.raw ibs=1 skip=11 count=39 of=50c.skip11.raw 2>/dev/null || $dddie |
Josh Coalson | 03a5a69 | 2004-07-17 00:23:17 +0000 | [diff] [blame] | 191 | dd if=master.raw ibs=1 skip=20 count=30 of=50c.skip20.raw 2>/dev/null || $dddie |
| 192 | dd if=master.raw ibs=1 skip=30 count=20 of=50c.skip30.raw 2>/dev/null || $dddie |
| 193 | dd if=master.raw ibs=1 skip=40 count=10 of=50c.skip40.raw 2>/dev/null || $dddie |
| 194 | dd if=master.raw ibs=1 count=10 of=50c.until10.raw 2>/dev/null || $dddie |
| 195 | dd if=master.raw ibs=1 count=20 of=50c.until20.raw 2>/dev/null || $dddie |
| 196 | dd if=master.raw ibs=1 count=30 of=50c.until30.raw 2>/dev/null || $dddie |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 197 | dd if=master.raw ibs=1 count=39 of=50c.until39.raw 2>/dev/null || $dddie |
Josh Coalson | 03a5a69 | 2004-07-17 00:23:17 +0000 | [diff] [blame] | 198 | dd if=master.raw ibs=1 count=40 of=50c.until40.raw 2>/dev/null || $dddie |
| 199 | dd if=master.raw ibs=1 skip=10 count=20 of=50c.skip10.until30.raw 2>/dev/null || $dddie |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 200 | dd if=master.raw ibs=1 skip=10 count=29 of=50c.skip10.until39.raw 2>/dev/null || $dddie |
Josh Coalson | 03a5a69 | 2004-07-17 00:23:17 +0000 | [diff] [blame] | 201 | dd if=master.raw ibs=1 skip=10 count=30 of=50c.skip10.until40.raw 2>/dev/null || $dddie |
| 202 | dd if=master.raw ibs=1 skip=20 count=10 of=50c.skip20.until30.raw 2>/dev/null || $dddie |
| 203 | dd if=master.raw ibs=1 skip=20 count=20 of=50c.skip20.until40.raw 2>/dev/null || $dddie |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 204 | |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame] | 205 | wav_eopt="--silent --force --verify --lax" |
| 206 | wav_dopt="--silent --force --decode" |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 207 | |
| 208 | raw_eopt="$wav_eopt --force-raw-format --endian=big --sign=signed --sample-rate=10 --bps=8 --channels=1" |
| 209 | raw_dopt="$wav_dopt --force-raw-format --endian=big --sign=signed" |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 210 | |
| 211 | # |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 212 | # convert them to WAVE and AIFF files |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 213 | # |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 214 | convert_to_wav () |
| 215 | { |
| 216 | run_flac $raw_eopt $1.raw || die "ERROR converting $1.raw to WAVE" |
| 217 | run_flac $wav_dopt $1.flac || die "ERROR converting $1.raw to WAVE" |
| 218 | } |
| 219 | convert_to_wav 50c |
| 220 | convert_to_wav 50c.skip10 |
| 221 | convert_to_wav 50c.skip11 |
Josh Coalson | 03a5a69 | 2004-07-17 00:23:17 +0000 | [diff] [blame] | 222 | convert_to_wav 50c.skip20 |
| 223 | convert_to_wav 50c.skip30 |
| 224 | convert_to_wav 50c.skip40 |
| 225 | convert_to_wav 50c.until10 |
| 226 | convert_to_wav 50c.until20 |
| 227 | convert_to_wav 50c.until30 |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 228 | convert_to_wav 50c.until39 |
Josh Coalson | 03a5a69 | 2004-07-17 00:23:17 +0000 | [diff] [blame] | 229 | convert_to_wav 50c.until40 |
| 230 | convert_to_wav 50c.skip10.until30 |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 231 | convert_to_wav 50c.skip10.until39 |
Josh Coalson | 03a5a69 | 2004-07-17 00:23:17 +0000 | [diff] [blame] | 232 | convert_to_wav 50c.skip10.until40 |
| 233 | convert_to_wav 50c.skip20.until30 |
| 234 | convert_to_wav 50c.skip20.until40 |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 235 | |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 236 | convert_to_aiff () |
| 237 | { |
| 238 | run_flac $raw_eopt $1.raw || die "ERROR converting $1.raw to AIFF" |
| 239 | run_flac $wav_dopt $1.flac -o $1.aiff || die "ERROR converting $1.raw to AIFF" |
| 240 | } |
| 241 | convert_to_aiff 50c |
| 242 | convert_to_aiff 50c.skip10 |
| 243 | convert_to_aiff 50c.skip11 |
Josh Coalson | 03a5a69 | 2004-07-17 00:23:17 +0000 | [diff] [blame] | 244 | convert_to_aiff 50c.skip20 |
| 245 | convert_to_aiff 50c.skip30 |
| 246 | convert_to_aiff 50c.skip40 |
| 247 | convert_to_aiff 50c.until10 |
| 248 | convert_to_aiff 50c.until20 |
| 249 | convert_to_aiff 50c.until30 |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 250 | convert_to_aiff 50c.until39 |
Josh Coalson | 03a5a69 | 2004-07-17 00:23:17 +0000 | [diff] [blame] | 251 | convert_to_aiff 50c.until40 |
| 252 | convert_to_aiff 50c.skip10.until30 |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 253 | convert_to_aiff 50c.skip10.until39 |
Josh Coalson | 03a5a69 | 2004-07-17 00:23:17 +0000 | [diff] [blame] | 254 | convert_to_aiff 50c.skip10.until40 |
| 255 | convert_to_aiff 50c.skip20.until30 |
| 256 | convert_to_aiff 50c.skip20.until40 |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 257 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 258 | test_skip_until () |
| 259 | { |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 260 | in_fmt=$1 |
| 261 | out_fmt=$2 |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 262 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 263 | [ "$in_fmt" = wav ] || [ "$in_fmt" = aiff ] || [ "$in_fmt" = raw ] || die "ERROR: internal error, bad 'in' format '$in_fmt'" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 264 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 265 | [ "$out_fmt" = flac ] || [ "$out_fmt" = ogg ] || die "ERROR: internal error, bad 'out' format '$out_fmt'" |
| 266 | |
| 267 | if [ $in_fmt = raw ] ; then |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 268 | eopt="$raw_eopt" |
| 269 | dopt="$raw_dopt" |
| 270 | else |
| 271 | eopt="$wav_eopt" |
| 272 | dopt="$wav_dopt" |
| 273 | fi |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 274 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 275 | if [ $out_fmt = ogg ] ; then |
| 276 | eopt="--ogg $eopt" |
| 277 | fi |
| 278 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 279 | # |
| 280 | # test --skip when encoding |
| 281 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 282 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 283 | desc="($in_fmt<->$out_fmt)" |
| 284 | |
| 285 | echo -n "testing --skip=# (encode) $desc... " |
| 286 | run_flac $eopt --skip=10 -o z50c.skip10.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 287 | run_flac $dopt -o z50c.skip10.$in_fmt z50c.skip10.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 288 | cmp 50c.skip10.$in_fmt z50c.skip10.$in_fmt || die "ERROR: file mismatch for --skip=10 (encode) $desc" |
| 289 | rm -f z50c.skip10.$out_fmt z50c.skip10.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 290 | echo OK |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 291 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 292 | echo -n "testing --skip=mm:ss (encode) $desc... " |
| 293 | run_flac $eopt --skip=0:01 -o z50c.skip0:01.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 294 | run_flac $dopt -o z50c.skip0:01.$in_fmt z50c.skip0:01.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 295 | cmp 50c.skip10.$in_fmt z50c.skip0:01.$in_fmt || die "ERROR: file mismatch for --skip=0:01 (encode) $desc" |
| 296 | rm -f z50c.skip0:01.$out_fmt z50c.skip0:01.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 297 | echo OK |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 298 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 299 | echo -n "testing --skip=mm:ss.sss (encode) $desc... " |
| 300 | run_flac $eopt --skip=0:01.1001 -o z50c.skip0:01.1001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 301 | run_flac $dopt -o z50c.skip0:01.1001.$in_fmt z50c.skip0:01.1001.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 302 | cmp 50c.skip11.$in_fmt z50c.skip0:01.1001.$in_fmt || die "ERROR: file mismatch for --skip=0:01.1001 (encode) $desc" |
| 303 | rm -f z50c.skip0:01.1001.$out_fmt z50c.skip0:01.1001.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 304 | echo OK |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 305 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 306 | # |
| 307 | # test --skip when decoding |
| 308 | # |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 309 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 310 | echo -n "testing --skip=# (decode) $desc... " |
| 311 | run_flac $eopt -o z50c.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 312 | run_flac $dopt --skip=10 -o z50c.skip10.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 313 | cmp 50c.skip10.$in_fmt z50c.skip10.$in_fmt || die "ERROR: file mismatch for --skip=10 (decode) $desc" |
| 314 | rm -f z50c.skip10.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 315 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 316 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 317 | echo -n "testing --skip=mm:ss (decode) $desc... " |
| 318 | run_flac $dopt --skip=0:01 -o z50c.skip0:01.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 319 | cmp 50c.skip10.$in_fmt z50c.skip0:01.$in_fmt || die "ERROR: file mismatch for --skip=0:01 (decode) $desc" |
| 320 | rm -f z50c.skip0:01.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 321 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 322 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 323 | echo -n "testing --skip=mm:ss.sss (decode) $desc... " |
| 324 | run_flac $dopt --skip=0:01.1001 -o z50c.skip0:01.1001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 325 | cmp 50c.skip11.$in_fmt z50c.skip0:01.1001.$in_fmt || die "ERROR: file mismatch for --skip=0:01.1001 (decode) $desc" |
| 326 | rm -f z50c.skip0:01.1001.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 327 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 328 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 329 | rm -f z50c.$out_fmt |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 330 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 331 | # |
| 332 | # test --until when encoding |
| 333 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 334 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 335 | echo -n "testing --until=# (encode) $desc... " |
| 336 | run_flac $eopt --until=40 -o z50c.until40.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 337 | run_flac $dopt -o z50c.until40.$in_fmt z50c.until40.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 338 | cmp 50c.until40.$in_fmt z50c.until40.$in_fmt || die "ERROR: file mismatch for --until=40 (encode) $desc" |
| 339 | rm -f z50c.until40.$out_fmt z50c.until40.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 340 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 341 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 342 | echo -n "testing --until=mm:ss (encode) $desc... " |
| 343 | run_flac $eopt --until=0:04 -o z50c.until0:04.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 344 | run_flac $dopt -o z50c.until0:04.$in_fmt z50c.until0:04.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 345 | cmp 50c.until40.$in_fmt z50c.until0:04.$in_fmt || die "ERROR: file mismatch for --until=0:04 (encode) $desc" |
| 346 | rm -f z50c.until0:04.$out_fmt z50c.until0:04.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 347 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 348 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 349 | echo -n "testing --until=mm:ss.sss (encode) $desc... " |
| 350 | run_flac $eopt --until=0:03.9001 -o z50c.until0:03.9001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 351 | run_flac $dopt -o z50c.until0:03.9001.$in_fmt z50c.until0:03.9001.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 352 | cmp 50c.until39.$in_fmt z50c.until0:03.9001.$in_fmt || die "ERROR: file mismatch for --until=0:03.9001 (encode) $desc" |
| 353 | rm -f z50c.until0:03.9001.$out_fmt z50c.until0:03.9001.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 354 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 355 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 356 | echo -n "testing --until=-# (encode) $desc... " |
| 357 | run_flac $eopt --until=-10 -o z50c.until-10.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 358 | run_flac $dopt -o z50c.until-10.$in_fmt z50c.until-10.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 359 | cmp 50c.until40.$in_fmt z50c.until-10.$in_fmt || die "ERROR: file mismatch for --until=-10 (encode) $desc" |
| 360 | rm -f z50c.until-10.$out_fmt z50c.until-10.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 361 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 362 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 363 | echo -n "testing --until=-mm:ss (encode) $desc... " |
| 364 | run_flac $eopt --until=-0:01 -o z50c.until-0:01.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 365 | run_flac $dopt -o z50c.until-0:01.$in_fmt z50c.until-0:01.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 366 | cmp 50c.until40.$in_fmt z50c.until-0:01.$in_fmt || die "ERROR: file mismatch for --until=-0:01 (encode) $desc" |
| 367 | rm -f z50c.until-0:01.$out_fmt z50c.until-0:01.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 368 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 369 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 370 | echo -n "testing --until=-mm:ss.sss (encode) $desc... " |
| 371 | run_flac $eopt --until=-0:01.1001 -o z50c.until-0:01.1001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 372 | run_flac $dopt -o z50c.until-0:01.1001.$in_fmt z50c.until-0:01.1001.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 373 | cmp 50c.until39.$in_fmt z50c.until-0:01.1001.$in_fmt || die "ERROR: file mismatch for --until=-0:01.1001 (encode) $desc" |
| 374 | rm -f z50c.until-0:01.1001.$out_fmt z50c.until-0:01.1001.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 375 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 376 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 377 | # |
| 378 | # test --until when decoding |
| 379 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 380 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 381 | run_flac $eopt -o z50c.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 382 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 383 | echo -n "testing --until=# (decode) $desc... " |
| 384 | run_flac $dopt --until=40 -o z50c.until40.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 385 | cmp 50c.until40.$in_fmt z50c.until40.$in_fmt || die "ERROR: file mismatch for --until=40 (decode) $desc" |
| 386 | rm -f z50c.until40.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 387 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 388 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 389 | echo -n "testing --until=mm:ss (decode) $desc... " |
| 390 | run_flac $dopt --until=0:04 -o z50c.until0:04.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 391 | cmp 50c.until40.$in_fmt z50c.until0:04.$in_fmt || die "ERROR: file mismatch for --until=0:04 (decode) $desc" |
| 392 | rm -f z50c.until0:04.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 393 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 394 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 395 | echo -n "testing --until=mm:ss.sss (decode) $desc... " |
| 396 | run_flac $dopt --until=0:03.9001 -o z50c.until0:03.9001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 397 | cmp 50c.until39.$in_fmt z50c.until0:03.9001.$in_fmt || die "ERROR: file mismatch for --until=0:03.9001 (decode) $desc" |
| 398 | rm -f z50c.until0:03.9001.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 399 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 400 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 401 | echo -n "testing --until=-# (decode) $desc... " |
| 402 | run_flac $dopt --until=-10 -o z50c.until-10.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 403 | cmp 50c.until40.$in_fmt z50c.until-10.$in_fmt || die "ERROR: file mismatch for --until=-10 (decode) $desc" |
| 404 | rm -f z50c.until-10.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 405 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 406 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 407 | echo -n "testing --until=-mm:ss (decode) $desc... " |
| 408 | run_flac $dopt --until=-0:01 -o z50c.until-0:01.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 409 | cmp 50c.until40.$in_fmt z50c.until-0:01.$in_fmt || die "ERROR: file mismatch for --until=-0:01 (decode) $desc" |
| 410 | rm -f z50c.until-0:01.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 411 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 412 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 413 | echo -n "testing --until=-mm:ss.sss (decode) $desc... " |
| 414 | run_flac $dopt --until=-0:01.1001 -o z50c.until-0:01.1001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 415 | cmp 50c.until39.$in_fmt z50c.until-0:01.1001.$in_fmt || die "ERROR: file mismatch for --until=-0:01.1001 (decode) $desc" |
| 416 | rm -f z50c.until-0:01.1001.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 417 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 418 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 419 | rm -f z50c.$out_fmt |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 420 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 421 | # |
| 422 | # test --skip and --until when encoding |
| 423 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 424 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 425 | echo -n "testing --skip=10 --until=# (encode) $desc... " |
| 426 | run_flac $eopt --skip=10 --until=40 -o z50c.skip10.until40.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 427 | run_flac $dopt -o z50c.skip10.until40.$in_fmt z50c.skip10.until40.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 428 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until40.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=40 (encode) $desc" |
| 429 | rm -f z50c.skip10.until40.$out_fmt z50c.skip10.until40.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 430 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 431 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 432 | echo -n "testing --skip=10 --until=mm:ss (encode) $desc... " |
| 433 | run_flac $eopt --skip=10 --until=0:04 -o z50c.skip10.until0:04.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 434 | run_flac $dopt -o z50c.skip10.until0:04.$in_fmt z50c.skip10.until0:04.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 435 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until0:04.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:04 (encode) $desc" |
| 436 | rm -f z50c.skip10.until0:04.$out_fmt z50c.skip10.until0:04.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 437 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 438 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 439 | echo -n "testing --skip=10 --until=mm:ss.sss (encode) $desc... " |
| 440 | run_flac $eopt --skip=10 --until=0:03.9001 -o z50c.skip10.until0:03.9001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 441 | run_flac $dopt -o z50c.skip10.until0:03.9001.$in_fmt z50c.skip10.until0:03.9001.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 442 | cmp 50c.skip10.until39.$in_fmt z50c.skip10.until0:03.9001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:03.9001 (encode) $desc" |
| 443 | rm -f z50c.skip10.until0:03.9001.$out_fmt z50c.skip10.until0:03.9001.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 444 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 445 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 446 | echo -n "testing --skip=10 --until=+# (encode) $desc... " |
| 447 | run_flac $eopt --skip=10 --until=+30 -o z50c.skip10.until+30.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 448 | run_flac $dopt -o z50c.skip10.until+30.$in_fmt z50c.skip10.until+30.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 449 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until+30.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=+30 (encode) $desc" |
| 450 | rm -f z50c.skip10.until+30.$out_fmt z50c.skip10.until+30.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 451 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 452 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 453 | echo -n "testing --skip=10 --until=+mm:ss (encode) $desc... " |
| 454 | run_flac $eopt --skip=10 --until=+0:03 -o z50c.skip10.until+0:03.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 455 | run_flac $dopt -o z50c.skip10.until+0:03.$in_fmt z50c.skip10.until+0:03.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 456 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until+0:03.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=+0:03 (encode) $desc" |
| 457 | rm -f z50c.skip10.until+0:03.$out_fmt z50c.skip10.until+0:03.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 458 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 459 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 460 | echo -n "testing --skip=10 --until=+mm:ss.sss (encode) $desc... " |
| 461 | run_flac $eopt --skip=10 --until=+0:02.9001 -o z50c.skip10.until+0:02.9001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 462 | run_flac $dopt -o z50c.skip10.until+0:02.9001.$in_fmt z50c.skip10.until+0:02.9001.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 463 | cmp 50c.skip10.until39.$in_fmt z50c.skip10.until+0:02.9001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=+0:02.9001 (encode) $desc" |
| 464 | rm -f z50c.skip10.until+0:02.9001.$out_fmt z50c.skip10.until+0:02.9001.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 465 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 466 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 467 | echo -n "testing --skip=10 --until=-# (encode) $desc... " |
| 468 | run_flac $eopt --skip=10 --until=-10 -o z50c.skip10.until-10.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 469 | run_flac $dopt -o z50c.skip10.until-10.$in_fmt z50c.skip10.until-10.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 470 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until-10.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-10 (encode) $desc" |
| 471 | rm -f z50c.skip10.until-10.$out_fmt z50c.skip10.until-10.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 472 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 473 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 474 | echo -n "testing --skip=10 --until=-mm:ss (encode) $desc... " |
| 475 | run_flac $eopt --skip=10 --until=-0:01 -o z50c.skip10.until-0:01.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 476 | run_flac $dopt -o z50c.skip10.until-0:01.$in_fmt z50c.skip10.until-0:01.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 477 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until-0:01.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01 (encode) $desc" |
| 478 | rm -f z50c.skip10.until-0:01.$out_fmt z50c.skip10.until-0:01.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 479 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 480 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 481 | echo -n "testing --skip=10 --until=-mm:ss.sss (encode) $desc... " |
| 482 | run_flac $eopt --skip=10 --until=-0:01.1001 -o z50c.skip10.until-0:01.1001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 483 | run_flac $dopt -o z50c.skip10.until-0:01.1001.$in_fmt z50c.skip10.until-0:01.1001.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 484 | cmp 50c.skip10.until39.$in_fmt z50c.skip10.until-0:01.1001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01.1001 (encode) $desc" |
| 485 | rm -f z50c.skip10.until-0:01.1001.$out_fmt z50c.skip10.until-0:01.1001.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 486 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 487 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 488 | # |
| 489 | # test --skip and --until when decoding |
| 490 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 491 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 492 | run_flac $eopt -o z50c.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 493 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 494 | echo -n "testing --skip=10 --until=# (decode) $desc... " |
| 495 | run_flac $dopt --skip=10 --until=40 -o z50c.skip10.until40.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 496 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until40.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=40 (decode) $desc" |
| 497 | rm -f z50c.skip10.until40.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 498 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 499 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 500 | echo -n "testing --skip=10 --until=mm:ss (decode) $desc... " |
| 501 | run_flac $dopt --skip=10 --until=0:04 -o z50c.skip10.until0:04.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 502 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until0:04.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:04 (decode) $desc" |
| 503 | rm -f z50c.skip10.until0:04.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 504 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 505 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 506 | echo -n "testing --skip=10 --until=mm:ss.sss (decode) $desc... " |
| 507 | run_flac $dopt --skip=10 --until=0:03.9001 -o z50c.skip10.until0:03.9001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 508 | cmp 50c.skip10.until39.$in_fmt z50c.skip10.until0:03.9001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:03.9001 (decode) $desc" |
| 509 | rm -f z50c.skip10.until0:03.9001.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 510 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 511 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 512 | echo -n "testing --skip=10 --until=-# (decode) $desc... " |
| 513 | run_flac $dopt --skip=10 --until=-10 -o z50c.skip10.until-10.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 514 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until-10.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-10 (decode) $desc" |
| 515 | rm -f z50c.skip10.until-10.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 516 | echo OK |
| 517 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 518 | echo -n "testing --skip=10 --until=-mm:ss (decode) $desc... " |
| 519 | run_flac $dopt --skip=10 --until=-0:01 -o z50c.skip10.until-0:01.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 520 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until-0:01.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01 (decode) $desc" |
| 521 | rm -f z50c.skip10.until-0:01.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 522 | echo OK |
| 523 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 524 | echo -n "testing --skip=10 --until=-mm:ss.sss (decode) $desc... " |
| 525 | run_flac $dopt --skip=10 --until=-0:01.1001 -o z50c.skip10.until-0:01.1001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 526 | cmp 50c.skip10.until39.$in_fmt z50c.skip10.until-0:01.1001.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-0:01.1001 (decode) $desc" |
| 527 | rm -f z50c.skip10.until-0:01.1001.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 528 | echo OK |
| 529 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 530 | rm -f z50c.$out_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 531 | } |
| 532 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 533 | test_skip_until raw flac |
| 534 | test_skip_until wav flac |
| 535 | test_skip_until aiff flac |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 536 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 537 | if [ $has_ogg = "yes" ] ; then |
| 538 | test_skip_until raw ogg |
| 539 | test_skip_until wav ogg |
| 540 | test_skip_until aiff ogg |
| 541 | fi |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 542 | |
Josh Coalson | 70d8563 | 2004-09-21 05:29:01 +0000 | [diff] [blame] | 543 | echo "testing seek extremes:" |
Josh Coalson | 29f52ea | 2004-07-30 00:22:46 +0000 | [diff] [blame] | 544 | |
| 545 | run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 --blocksize=576 noise.raw || die "ERROR generating FLAC file" |
| 546 | |
Josh Coalson | d434672 | 2004-09-12 22:58:13 +0000 | [diff] [blame] | 547 | if [ $is_win = no ] ; then |
Josh Coalson | 68d1321 | 2004-09-14 00:25:43 +0000 | [diff] [blame] | 548 | total_samples=`run_metaflac --show-total-samples noise.flac` |
Josh Coalson | d434672 | 2004-09-12 22:58:13 +0000 | [diff] [blame] | 549 | [ $? = 0 ] || die "ERROR getting total sample count from noise.flac" |
| 550 | else |
| 551 | # some flavors of cygwin don't seem to treat the \x0d as a word |
| 552 | # separator, so we hard code it. we'll just have to fix it later |
| 553 | # if we change the way noise.flac is made. |
| 554 | total_samples=393216 |
| 555 | fi |
Josh Coalson | 29f52ea | 2004-07-30 00:22:46 +0000 | [diff] [blame] | 556 | |
Josh Coalson | 70d8563 | 2004-09-21 05:29:01 +0000 | [diff] [blame] | 557 | echo -n "testing --skip=0... " |
Josh Coalson | 4f4beee | 2004-07-30 00:35:51 +0000 | [diff] [blame] | 558 | run_flac $wav_dopt --skip=0 -o z.wav noise.flac || die "ERROR decoding FLAC file noise.flac" |
Josh Coalson | 29f52ea | 2004-07-30 00:22:46 +0000 | [diff] [blame] | 559 | echo OK |
| 560 | |
| 561 | for delta in 2 1 ; do |
| 562 | n=`expr $total_samples - $delta` |
Josh Coalson | 70d8563 | 2004-09-21 05:29:01 +0000 | [diff] [blame] | 563 | echo -n "testing --skip=$n... " |
Josh Coalson | 4f4beee | 2004-07-30 00:35:51 +0000 | [diff] [blame] | 564 | run_flac $wav_dopt --skip=$n -o z.wav noise.flac || die "ERROR decoding FLAC file noise.flac" |
Josh Coalson | 29f52ea | 2004-07-30 00:22:46 +0000 | [diff] [blame] | 565 | echo OK |
| 566 | done |
| 567 | |
| 568 | rm noise.flac z.wav |
| 569 | |
| 570 | |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 571 | ############################################################################ |
Josh Coalson | dad6ad4 | 2004-12-30 03:49:46 +0000 | [diff] [blame] | 572 | # test --input-size |
| 573 | ############################################################################ |
| 574 | |
| 575 | echo -n "testing --input-size=50 --skip=10... " |
| 576 | cat 50c.raw | run_flac $raw_eopt --input-size=50 --skip=10 -o z50c.skip10.flac - || die "ERROR generating FLAC file" |
| 577 | run_flac $raw_dopt -o z50c.skip10.raw z50c.skip10.flac || die "ERROR decoding FLAC file" |
| 578 | cmp 50c.skip10.raw z50c.skip10.raw || die "ERROR: file mismatch for --input-size=50 --skip=10" |
| 579 | rm -f z50c.skip10.raw z50c.skip10.flac |
| 580 | echo OK |
| 581 | |
| 582 | |
| 583 | ############################################################################ |
| 584 | # test --skip and --until |
| 585 | ############################################################################ |
| 586 | |
| 587 | ############################################################################ |
Josh Coalson | 03a5a69 | 2004-07-17 00:23:17 +0000 | [diff] [blame] | 588 | # test --cue |
| 589 | ############################################################################ |
| 590 | |
| 591 | # |
| 592 | # create the cue sheet |
| 593 | # |
| 594 | cuesheet=cuetest.cue |
| 595 | cat > $cuesheet << EOF |
| 596 | CATALOG 1234567890123 |
| 597 | FILE "blah" WAVE |
| 598 | TRACK 01 AUDIO |
| 599 | INDEX 01 0 |
| 600 | INDEX 02 10 |
| 601 | INDEX 03 20 |
| 602 | TRACK 02 AUDIO |
| 603 | INDEX 01 30 |
| 604 | TRACK 04 AUDIO |
| 605 | INDEX 01 40 |
| 606 | EOF |
| 607 | |
| 608 | test_cue () |
| 609 | { |
| 610 | in_fmt=$1 |
| 611 | out_fmt=$2 |
| 612 | |
| 613 | [ "$in_fmt" = wav ] || [ "$in_fmt" = aiff ] || [ "$in_fmt" = raw ] || die "ERROR: internal error, bad 'in' format '$in_fmt'" |
| 614 | |
| 615 | [ "$out_fmt" = flac ] || [ "$out_fmt" = ogg ] || die "ERROR: internal error, bad 'out' format '$out_fmt'" |
| 616 | |
| 617 | if [ $in_fmt = raw ] ; then |
| 618 | eopt="$raw_eopt" |
| 619 | dopt="$raw_dopt" |
| 620 | else |
| 621 | eopt="$wav_eopt" |
| 622 | dopt="$wav_dopt" |
| 623 | fi |
| 624 | |
| 625 | if [ $out_fmt = ogg ] ; then |
| 626 | eopt="--ogg $eopt" |
| 627 | fi |
| 628 | |
| 629 | desc="($in_fmt<->$out_fmt)" |
| 630 | |
| 631 | # |
| 632 | # for this we need just need just one FLAC file; --cue only works while decoding |
| 633 | # |
| 634 | run_flac $eopt --cuesheet=$cuesheet -o z50c.cue.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 635 | |
| 636 | # To make it easy to translate from cue point to sample numbers, the |
| 637 | # file has a sample rate of 10 Hz and a cuesheet like so: |
| 638 | # |
| 639 | # TRACK 01, INDEX 01 : 0:00.00 -> sample 0 |
| 640 | # TRACK 01, INDEX 02 : 0:01.00 -> sample 10 |
| 641 | # TRACK 01, INDEX 03 : 0:02.00 -> sample 20 |
| 642 | # TRACK 02, INDEX 01 : 0:03.00 -> sample 30 |
| 643 | # TRACK 04, INDEX 01 : 0:04.00 -> sample 40 |
| 644 | # |
| 645 | echo -n "testing --cue=- $desc... " |
| 646 | run_flac $dopt -o z50c.cue.$in_fmt --cue=- z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 647 | cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=- $desc" |
| 648 | rm -f z50c.cue.$in_fmt |
| 649 | echo OK |
| 650 | |
| 651 | echo -n "testing --cue=1.0 $desc... " |
| 652 | run_flac $dopt -o z50c.cue.$in_fmt --cue=1.0 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 653 | cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.0 $desc" |
| 654 | rm -f z50c.cue.$in_fmt |
| 655 | echo OK |
| 656 | |
| 657 | echo -n "testing --cue=1.0- $desc... " |
| 658 | run_flac $dopt -o z50c.cue.$in_fmt --cue=1.0- z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 659 | cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.0- $desc" |
| 660 | rm -f z50c.cue.$in_fmt |
| 661 | echo OK |
| 662 | |
| 663 | echo -n "testing --cue=1.1 $desc... " |
| 664 | run_flac $dopt -o z50c.cue.$in_fmt --cue=1.1 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 665 | cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.1 $desc" |
| 666 | rm -f z50c.cue.$in_fmt |
| 667 | echo OK |
| 668 | |
| 669 | echo -n "testing --cue=1.1- $desc... " |
| 670 | run_flac $dopt -o z50c.cue.$in_fmt --cue=1.1- z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 671 | cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.1- $desc" |
| 672 | rm -f z50c.cue.$in_fmt |
| 673 | echo OK |
| 674 | |
| 675 | echo -n "testing --cue=1.2 $desc... " |
| 676 | run_flac $dopt -o z50c.cue.$in_fmt --cue=1.2 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 677 | cmp 50c.skip10.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.2 $desc" |
| 678 | rm -f z50c.cue.$in_fmt |
| 679 | echo OK |
| 680 | |
| 681 | echo -n "testing --cue=1.2- $desc... " |
| 682 | run_flac $dopt -o z50c.cue.$in_fmt --cue=1.2- z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 683 | cmp 50c.skip10.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.2- $desc" |
| 684 | rm -f z50c.cue.$in_fmt |
| 685 | echo OK |
| 686 | |
| 687 | echo -n "testing --cue=1.4 $desc... " |
| 688 | run_flac $dopt -o z50c.cue.$in_fmt --cue=1.4 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 689 | cmp 50c.skip20.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.4 $desc" |
| 690 | rm -f z50c.cue.$in_fmt |
| 691 | echo OK |
| 692 | |
| 693 | echo -n "testing --cue=1.4- $desc... " |
| 694 | run_flac $dopt -o z50c.cue.$in_fmt --cue=1.4- z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 695 | cmp 50c.skip20.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.4- $desc" |
| 696 | rm -f z50c.cue.$in_fmt |
| 697 | echo OK |
| 698 | |
| 699 | echo -n "testing --cue=-5.0 $desc... " |
| 700 | run_flac $dopt -o z50c.cue.$in_fmt --cue=-5.0 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 701 | cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=-5.0 $desc" |
| 702 | rm -f z50c.cue.$in_fmt |
| 703 | echo OK |
| 704 | |
| 705 | echo -n "testing --cue=-4.1 $desc... " |
| 706 | run_flac $dopt -o z50c.cue.$in_fmt --cue=-4.1 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 707 | cmp 50c.until40.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=-4.1 $desc" |
| 708 | rm -f z50c.cue.$in_fmt |
| 709 | echo OK |
| 710 | |
| 711 | echo -n "testing --cue=-3.1 $desc... " |
| 712 | run_flac $dopt -o z50c.cue.$in_fmt --cue=-3.1 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 713 | cmp 50c.until40.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=-3.1 $desc" |
| 714 | rm -f z50c.cue.$in_fmt |
| 715 | echo OK |
| 716 | |
| 717 | echo -n "testing --cue=-1.4 $desc... " |
| 718 | run_flac $dopt -o z50c.cue.$in_fmt --cue=-1.4 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 719 | cmp 50c.until30.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=-1.4 $desc" |
| 720 | rm -f z50c.cue.$in_fmt |
| 721 | echo OK |
| 722 | |
| 723 | echo -n "testing --cue=1.0-5.0 $desc... " |
| 724 | run_flac $dopt -o z50c.cue.$in_fmt --cue=1.0-5.0 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 725 | cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.0-5.0 $desc" |
| 726 | rm -f z50c.cue.$in_fmt |
| 727 | echo OK |
| 728 | |
| 729 | echo -n "testing --cue=1.1-5.0 $desc... " |
| 730 | run_flac $dopt -o z50c.cue.$in_fmt --cue=1.1-5.0 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 731 | cmp 50c.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.1-5.0 $desc" |
| 732 | rm -f z50c.cue.$in_fmt |
| 733 | echo OK |
| 734 | |
| 735 | echo -n "testing --cue=1.2-4.1 $desc... " |
| 736 | run_flac $dopt -o z50c.cue.$in_fmt --cue=1.2-4.1 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 737 | cmp 50c.skip10.until40.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.2-4.1 $desc" |
| 738 | rm -f z50c.cue.$in_fmt |
| 739 | echo OK |
| 740 | |
| 741 | echo -n "testing --cue=1.4-2.0 $desc... " |
| 742 | run_flac $dopt -o z50c.cue.$in_fmt --cue=1.4-2.0 z50c.cue.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 743 | cmp 50c.skip20.until30.$in_fmt z50c.cue.$in_fmt || die "ERROR: file mismatch for --cue=1.4-2.0 $desc" |
| 744 | rm -f z50c.cue.$in_fmt |
| 745 | echo OK |
| 746 | |
| 747 | rm -f z50c.cue.$out_fmt |
| 748 | } |
| 749 | |
| 750 | test_cue raw flac |
| 751 | test_cue wav flac |
| 752 | test_cue aiff flac |
| 753 | |
| 754 | if [ $has_ogg = "yes" ] ; then |
| 755 | test_cue raw ogg |
| 756 | test_cue wav ogg |
| 757 | test_cue aiff ogg |
| 758 | fi |
| 759 | |
| 760 | ############################################################################ |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 761 | # test 'fixup' code that happens when a FLAC file with total_samples == 0 |
| 762 | # in the STREAMINFO block is converted to WAVE or AIFF, requiring the |
| 763 | # decoder go back and fix up the chunk headers |
| 764 | ############################################################################ |
| 765 | |
| 766 | echo -n "WAVE fixup test... " |
Josh Coalson | d434672 | 2004-09-12 22:58:13 +0000 | [diff] [blame] | 767 | |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 768 | echo -n "prepare... " |
| 769 | convert_to_wav noise || die "ERROR creating reference WAVE" |
Josh Coalson | d434672 | 2004-09-12 22:58:13 +0000 | [diff] [blame] | 770 | |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 771 | echo -n "encode... " |
Josh Coalson | d434672 | 2004-09-12 22:58:13 +0000 | [diff] [blame] | 772 | # the pipe from 'cat' to 'flac' does not work on cygwin because of the EOF/ |
| 773 | # binary-mode stdin problem, so we use an undocumented option to metaflac to |
| 774 | # set the total sample count to 0 |
| 775 | if [ $is_win = yes ] ; then |
| 776 | run_flac $raw_eopt noise.raw -o fixup.flac || die "ERROR generating FLAC file" |
Josh Coalson | 68d1321 | 2004-09-14 00:25:43 +0000 | [diff] [blame] | 777 | run_metaflac --set-total-samples=0 fixup.flac 2> /dev/null |
Josh Coalson | d434672 | 2004-09-12 22:58:13 +0000 | [diff] [blame] | 778 | else |
| 779 | cat noise.raw | run_flac $raw_eopt - -c > fixup.flac || die "ERROR generating FLAC file" |
| 780 | fi |
| 781 | |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 782 | echo -n "decode... " |
| 783 | run_flac $wav_dopt fixup.flac -o fixup.wav || die "ERROR decoding FLAC file" |
Josh Coalson | d434672 | 2004-09-12 22:58:13 +0000 | [diff] [blame] | 784 | |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 785 | echo -n "compare... " |
| 786 | cmp noise.wav fixup.wav || die "ERROR: file mismatch" |
Josh Coalson | d434672 | 2004-09-12 22:58:13 +0000 | [diff] [blame] | 787 | |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 788 | echo OK |
| 789 | rm -f noise.wav fixup.wav fixup.flac |
| 790 | |
| 791 | echo -n "AIFF fixup test... " |
Josh Coalson | d434672 | 2004-09-12 22:58:13 +0000 | [diff] [blame] | 792 | |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 793 | echo -n "prepare... " |
| 794 | convert_to_aiff noise || die "ERROR creating reference AIFF" |
Josh Coalson | d434672 | 2004-09-12 22:58:13 +0000 | [diff] [blame] | 795 | |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 796 | echo -n "encode... " |
Josh Coalson | d434672 | 2004-09-12 22:58:13 +0000 | [diff] [blame] | 797 | # the pipe from 'cat' to 'flac' does not work on cygwin because of the EOF/ |
| 798 | # binary-mode stdin problem, so we use an undocumented option to metaflac to |
| 799 | # set the total sample count to 0 |
| 800 | if [ $is_win = yes ] ; then |
| 801 | run_flac $raw_eopt noise.raw -o fixup.flac || die "ERROR generating FLAC file" |
Josh Coalson | 68d1321 | 2004-09-14 00:25:43 +0000 | [diff] [blame] | 802 | run_metaflac --set-total-samples=0 fixup.flac 2> /dev/null |
Josh Coalson | d434672 | 2004-09-12 22:58:13 +0000 | [diff] [blame] | 803 | else |
| 804 | cat noise.raw | run_flac $raw_eopt - -c > fixup.flac || die "ERROR generating FLAC file" |
| 805 | fi |
| 806 | |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 807 | echo -n "decode... " |
| 808 | run_flac $wav_dopt fixup.flac -o fixup.aiff || die "ERROR decoding FLAC file" |
Josh Coalson | d434672 | 2004-09-12 22:58:13 +0000 | [diff] [blame] | 809 | |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 810 | echo -n "compare... " |
| 811 | cmp noise.aiff fixup.aiff || die "ERROR: file mismatch" |
Josh Coalson | d434672 | 2004-09-12 22:58:13 +0000 | [diff] [blame] | 812 | |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 813 | echo OK |
| 814 | rm -f noise.aiff fixup.aiff fixup.flac |
| 815 | |
| 816 | |
| 817 | ############################################################################ |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 818 | # multi-file tests |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 819 | ############################################################################ |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 820 | |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 821 | echo "Generating multiple input files from noise..." |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame] | 822 | run_flac --verify --force --silent --force-raw-format --endian=big --sign=signed --sample-rate=44100 --bps=16 --channels=2 noise.raw || die "ERROR generating FLAC file" |
| 823 | run_flac --decode --force --silent noise.flac || die "ERROR generating WAVE file" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 824 | rm -f noise.flac |
| 825 | mv noise.wav file0.wav |
| 826 | cp file0.wav file1.wav |
| 827 | cp file1.wav file2.wav |
| 828 | |
| 829 | test_multifile () |
| 830 | { |
| 831 | streamtype=$1 |
| 832 | sector_align=$2 |
| 833 | encode_options="$3" |
| 834 | |
| 835 | if [ $streamtype = ogg ] ; then |
| 836 | suffix=ogg |
| 837 | encode_options="$encode_options --ogg" |
| 838 | else |
| 839 | suffix=flac |
| 840 | fi |
| 841 | |
| 842 | if [ $sector_align = sector_align ] ; then |
| 843 | encode_options="$encode_options --sector-align" |
| 844 | fi |
| 845 | |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame] | 846 | run_flac --force $encode_options file0.wav file1.wav file2.wav || die "ERROR" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 847 | for n in 0 1 2 ; do |
| 848 | mv file$n.$suffix file${n}x.$suffix |
| 849 | done |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame] | 850 | run_flac --force --decode file0x.$suffix file1x.$suffix file2x.$suffix || die "ERROR" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 851 | if [ $sector_align != sector_align ] ; then |
| 852 | for n in 0 1 2 ; do |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 853 | cmp file$n.wav file${n}x.wav || die "ERROR: file mismatch on file #$n" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 854 | done |
| 855 | fi |
| 856 | for n in 0 1 2 ; do |
| 857 | rm -f file${n}x.$suffix file${n}x.wav |
| 858 | done |
| 859 | } |
| 860 | |
| 861 | echo "Testing multiple files without verify..." |
| 862 | test_multifile flac no_sector_align "" |
| 863 | |
| 864 | echo "Testing multiple files with verify..." |
| 865 | test_multifile flac no_sector_align "--verify" |
| 866 | |
| 867 | echo "Testing multiple files with --sector-align, without verify..." |
| 868 | test_multifile flac sector_align "" |
| 869 | |
| 870 | echo "Testing multiple files with --sector-align, with verify..." |
| 871 | test_multifile flac sector_align "--verify" |
| 872 | |
| 873 | if [ $has_ogg = "yes" ] ; then |
| 874 | echo "Testing multiple files with --ogg, without verify..." |
| 875 | test_multifile ogg no_sector_align "" |
| 876 | |
| 877 | echo "Testing multiple files with --ogg, with verify..." |
| 878 | test_multifile ogg no_sector_align "--verify" |
| 879 | |
| 880 | echo "Testing multiple files with --ogg and --sector-align, without verify..." |
| 881 | test_multifile ogg sector_align "" |
| 882 | |
| 883 | echo "Testing multiple files with --ogg and --sector-align, with verify..." |
| 884 | test_multifile sector_align ogg "--verify" |
| 885 | |
| 886 | echo "Testing multiple files with --ogg and --serial-number, with verify..." |
| 887 | test_multifile ogg no_sector_align "--serial-number=321 --verify" |
| 888 | fi |