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