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 |
| 28 | PATH=../src/flac:../src/test_streams:../obj/release/bin:../obj/debug/bin:$PATH |
| 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 | |
| 41 | echo "Checking for --ogg support in flac..." |
| 42 | if flac --ogg --silent --force-raw-format --endian=little --sign=signed --channels=1 --bps=8 --sample-rate=44100 -c $0 1>/dev/null 2>&1 ; then |
| 43 | has_ogg=yes; |
| 44 | echo "flac --ogg works" |
| 45 | else |
| 46 | has_ogg=no; |
| 47 | echo "flac --ogg doesn't work" |
| 48 | fi |
| 49 | |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 50 | |
| 51 | echo "Generating streams..." |
| 52 | if [ ! -f wacky1.wav ] ; then |
| 53 | test_streams || die "ERROR during test_streams" |
| 54 | fi |
| 55 | |
| 56 | ############################################################################ |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame^] | 57 | # test that flac doesn't automatically overwrite files unless -f is used |
| 58 | ############################################################################ |
| 59 | |
| 60 | echo "Try encoding to a file that exists; should fail" |
| 61 | cp wacky1.wav exist.wav |
| 62 | touch exist.flac |
| 63 | if run_flac -s -0 exist.wav ; then |
| 64 | die "ERROR: it should have failed but didn't" |
| 65 | else |
| 66 | echo "OK, it failed as it should" |
| 67 | fi |
| 68 | |
| 69 | echo "Try encoding with -f to a file that exists; should succeed" |
| 70 | if run_flac -s -0 --force exist.wav ; then |
| 71 | echo "OK, it succeeded as it should" |
| 72 | else |
| 73 | die "ERROR: it should have succeeded but didn't" |
| 74 | fi |
| 75 | |
| 76 | echo "Try decoding to a file that exists; should fail" |
| 77 | if run_flac -s -d exist.flac ; then |
| 78 | die "ERROR: it should have failed but didn't" |
| 79 | else |
| 80 | echo "OK, it failed as it should" |
| 81 | fi |
| 82 | |
| 83 | echo "Try decoding with -f to a file that exists; should succeed" |
| 84 | if run_flac -s -d -f exist.flac ; then |
| 85 | echo "OK, it succeeded as it should" |
| 86 | else |
| 87 | die "ERROR: it should have succeeded but didn't" |
| 88 | fi |
| 89 | |
| 90 | rm -f exist.wav exist.flac |
| 91 | |
| 92 | ############################################################################ |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 93 | # basic 'round-trip' tests of various kinds of streams |
| 94 | ############################################################################ |
| 95 | |
| 96 | rt_test_raw () |
| 97 | { |
| 98 | f="$1" |
| 99 | channels=`echo $f | awk -F- '{print $2}'` |
| 100 | bytes_per_sample=`echo $f | awk -F- '{print $3}'` |
| 101 | bps=`expr $bytes_per_sample '*' 8` |
| 102 | echo -n "round-trip test ($f) encode... " |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame^] | 103 | 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] | 104 | echo -n "decode... " |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame^] | 105 | 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] | 106 | echo -n "compare... " |
| 107 | cmp $f rt.raw || die "ERROR: file mismatch" |
| 108 | echo "OK" |
| 109 | rm -f rt.flac rt.raw |
| 110 | } |
| 111 | |
| 112 | rt_test_wav () |
| 113 | { |
| 114 | f="$1" |
| 115 | echo -n "round-trip test ($f) encode... " |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame^] | 116 | run_flac --silent --force --verify $f -o rt.flac || die "ERROR" |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 117 | echo -n "decode... " |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame^] | 118 | run_flac --silent --force --decode -o rt.wav rt.flac || die "ERROR" |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 119 | echo -n "compare... " |
| 120 | cmp $f rt.wav || die "ERROR: file mismatch" |
| 121 | echo "OK" |
| 122 | rm -f rt.flac rt.wav |
| 123 | } |
| 124 | |
| 125 | rt_test_aiff () |
| 126 | { |
| 127 | f="$1" |
| 128 | echo -n "round-trip test ($f) encode... " |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame^] | 129 | run_flac --silent --force --verify $f -o rt.flac || die "ERROR" |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 130 | echo -n "decode... " |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame^] | 131 | run_flac --silent --force --decode -o rt.aiff rt.flac || die "ERROR" |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 132 | echo -n "compare... " |
| 133 | cmp $f rt.aiff || die "ERROR: file mismatch" |
| 134 | echo "OK" |
| 135 | rm -f rt.flac rt.aiff |
| 136 | } |
| 137 | |
| 138 | for f in rt-*.raw ; do |
| 139 | rt_test_raw $f |
| 140 | done |
| 141 | for f in rt-*.wav ; do |
| 142 | rt_test_wav $f |
| 143 | done |
| 144 | for f in rt-*.aiff ; do |
| 145 | rt_test_aiff $f |
| 146 | done |
| 147 | |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 148 | ############################################################################ |
| 149 | # test --skip and --until |
| 150 | ############################################################################ |
| 151 | |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 152 | # |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 153 | # first make some chopped-up raw files |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 154 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 155 | echo "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMN" > master.raw |
| 156 | dddie="die ERROR: creating files for --skip/--until tests" |
| 157 | dd if=master.raw ibs=1 count=50 of=50c.raw 2>/dev/null || $dddie |
| 158 | dd if=master.raw ibs=1 skip=10 count=40 of=50c.skip10.raw 2>/dev/null || $dddie |
| 159 | dd if=master.raw ibs=1 skip=11 count=39 of=50c.skip11.raw 2>/dev/null || $dddie |
| 160 | dd if=master.raw ibs=1 count=40 of=50c.until40.raw 2>/dev/null || $dddie |
| 161 | dd if=master.raw ibs=1 count=39 of=50c.until39.raw 2>/dev/null || $dddie |
| 162 | dd if=master.raw ibs=1 skip=10 count=30 of=50c.skip10.until40.raw 2>/dev/null || $dddie |
| 163 | dd if=master.raw ibs=1 skip=10 count=29 of=50c.skip10.until39.raw 2>/dev/null || $dddie |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 164 | |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame^] | 165 | wav_eopt="--silent --force --verify --lax" |
| 166 | wav_dopt="--silent --force --decode" |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 167 | |
| 168 | raw_eopt="$wav_eopt --force-raw-format --endian=big --sign=signed --sample-rate=10 --bps=8 --channels=1" |
| 169 | raw_dopt="$wav_dopt --force-raw-format --endian=big --sign=signed" |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 170 | |
| 171 | # |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 172 | # convert them to WAVE and AIFF files |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 173 | # |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 174 | convert_to_wav () |
| 175 | { |
| 176 | run_flac $raw_eopt $1.raw || die "ERROR converting $1.raw to WAVE" |
| 177 | run_flac $wav_dopt $1.flac || die "ERROR converting $1.raw to WAVE" |
| 178 | } |
| 179 | convert_to_wav 50c |
| 180 | convert_to_wav 50c.skip10 |
| 181 | convert_to_wav 50c.skip11 |
| 182 | convert_to_wav 50c.until40 |
| 183 | convert_to_wav 50c.until39 |
| 184 | convert_to_wav 50c.skip10.until40 |
| 185 | convert_to_wav 50c.skip10.until39 |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 186 | |
Josh Coalson | 5126bb0 | 2002-12-17 08:15:48 +0000 | [diff] [blame] | 187 | convert_to_aiff () |
| 188 | { |
| 189 | run_flac $raw_eopt $1.raw || die "ERROR converting $1.raw to AIFF" |
| 190 | run_flac $wav_dopt $1.flac -o $1.aiff || die "ERROR converting $1.raw to AIFF" |
| 191 | } |
| 192 | convert_to_aiff 50c |
| 193 | convert_to_aiff 50c.skip10 |
| 194 | convert_to_aiff 50c.skip11 |
| 195 | convert_to_aiff 50c.until40 |
| 196 | convert_to_aiff 50c.until39 |
| 197 | convert_to_aiff 50c.skip10.until40 |
| 198 | convert_to_aiff 50c.skip10.until39 |
| 199 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 200 | test_skip_until () |
| 201 | { |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 202 | in_fmt=$1 |
| 203 | out_fmt=$2 |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 204 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 205 | [ "$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] | 206 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 207 | [ "$out_fmt" = flac ] || [ "$out_fmt" = ogg ] || die "ERROR: internal error, bad 'out' format '$out_fmt'" |
| 208 | |
| 209 | if [ $in_fmt = raw ] ; then |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 210 | eopt="$raw_eopt" |
| 211 | dopt="$raw_dopt" |
| 212 | else |
| 213 | eopt="$wav_eopt" |
| 214 | dopt="$wav_dopt" |
| 215 | fi |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 216 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 217 | if [ $out_fmt = ogg ] ; then |
| 218 | eopt="--ogg $eopt" |
| 219 | fi |
| 220 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 221 | # |
| 222 | # test --skip when encoding |
| 223 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 224 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 225 | desc="($in_fmt<->$out_fmt)" |
| 226 | |
| 227 | echo -n "testing --skip=# (encode) $desc... " |
| 228 | run_flac $eopt --skip=10 -o z50c.skip10.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 229 | run_flac $dopt -o z50c.skip10.$in_fmt z50c.skip10.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 230 | cmp 50c.skip10.$in_fmt z50c.skip10.$in_fmt || die "ERROR: file mismatch for --skip=10 (encode) $desc" |
| 231 | rm -f z50c.skip10.$out_fmt z50c.skip10.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 232 | echo OK |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 233 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 234 | echo -n "testing --skip=mm:ss (encode) $desc... " |
| 235 | run_flac $eopt --skip=0:01 -o z50c.skip0:01.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 236 | run_flac $dopt -o z50c.skip0:01.$in_fmt z50c.skip0:01.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 237 | cmp 50c.skip10.$in_fmt z50c.skip0:01.$in_fmt || die "ERROR: file mismatch for --skip=0:01 (encode) $desc" |
| 238 | rm -f z50c.skip0:01.$out_fmt z50c.skip0:01.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 239 | echo OK |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 240 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 241 | echo -n "testing --skip=mm:ss.sss (encode) $desc... " |
| 242 | run_flac $eopt --skip=0:01.1001 -o z50c.skip0:01.1001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 243 | run_flac $dopt -o z50c.skip0:01.1001.$in_fmt z50c.skip0:01.1001.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 244 | cmp 50c.skip11.$in_fmt z50c.skip0:01.1001.$in_fmt || die "ERROR: file mismatch for --skip=0:01.1001 (encode) $desc" |
| 245 | 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] | 246 | echo OK |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 247 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 248 | # |
| 249 | # test --skip when decoding |
| 250 | # |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 251 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 252 | echo -n "testing --skip=# (decode) $desc... " |
| 253 | run_flac $eopt -o z50c.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 254 | run_flac $dopt --skip=10 -o z50c.skip10.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 255 | cmp 50c.skip10.$in_fmt z50c.skip10.$in_fmt || die "ERROR: file mismatch for --skip=10 (decode) $desc" |
| 256 | rm -f z50c.skip10.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 257 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 258 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 259 | echo -n "testing --skip=mm:ss (decode) $desc... " |
| 260 | run_flac $dopt --skip=0:01 -o z50c.skip0:01.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 261 | cmp 50c.skip10.$in_fmt z50c.skip0:01.$in_fmt || die "ERROR: file mismatch for --skip=0:01 (decode) $desc" |
| 262 | rm -f z50c.skip0:01.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 263 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 264 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 265 | echo -n "testing --skip=mm:ss.sss (decode) $desc... " |
| 266 | run_flac $dopt --skip=0:01.1001 -o z50c.skip0:01.1001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 267 | cmp 50c.skip11.$in_fmt z50c.skip0:01.1001.$in_fmt || die "ERROR: file mismatch for --skip=0:01.1001 (decode) $desc" |
| 268 | rm -f z50c.skip0:01.1001.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 269 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 270 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 271 | rm -f z50c.$out_fmt |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 272 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 273 | # |
| 274 | # test --until when encoding |
| 275 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 276 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 277 | echo -n "testing --until=# (encode) $desc... " |
| 278 | run_flac $eopt --until=40 -o z50c.until40.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 279 | run_flac $dopt -o z50c.until40.$in_fmt z50c.until40.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 280 | cmp 50c.until40.$in_fmt z50c.until40.$in_fmt || die "ERROR: file mismatch for --until=40 (encode) $desc" |
| 281 | rm -f z50c.until40.$out_fmt z50c.until40.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 282 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 283 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 284 | echo -n "testing --until=mm:ss (encode) $desc... " |
| 285 | run_flac $eopt --until=0:04 -o z50c.until0:04.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 286 | run_flac $dopt -o z50c.until0:04.$in_fmt z50c.until0:04.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 287 | cmp 50c.until40.$in_fmt z50c.until0:04.$in_fmt || die "ERROR: file mismatch for --until=0:04 (encode) $desc" |
| 288 | rm -f z50c.until0:04.$out_fmt z50c.until0:04.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 289 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 290 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 291 | echo -n "testing --until=mm:ss.sss (encode) $desc... " |
| 292 | run_flac $eopt --until=0:03.9001 -o z50c.until0:03.9001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 293 | run_flac $dopt -o z50c.until0:03.9001.$in_fmt z50c.until0:03.9001.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 294 | cmp 50c.until39.$in_fmt z50c.until0:03.9001.$in_fmt || die "ERROR: file mismatch for --until=0:03.9001 (encode) $desc" |
| 295 | 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] | 296 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 297 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 298 | echo -n "testing --until=-# (encode) $desc... " |
| 299 | run_flac $eopt --until=-10 -o z50c.until-10.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 300 | run_flac $dopt -o z50c.until-10.$in_fmt z50c.until-10.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 301 | cmp 50c.until40.$in_fmt z50c.until-10.$in_fmt || die "ERROR: file mismatch for --until=-10 (encode) $desc" |
| 302 | rm -f z50c.until-10.$out_fmt z50c.until-10.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 303 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 304 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 305 | echo -n "testing --until=-mm:ss (encode) $desc... " |
| 306 | run_flac $eopt --until=-0:01 -o z50c.until-0:01.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 307 | run_flac $dopt -o z50c.until-0:01.$in_fmt z50c.until-0:01.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 308 | cmp 50c.until40.$in_fmt z50c.until-0:01.$in_fmt || die "ERROR: file mismatch for --until=-0:01 (encode) $desc" |
| 309 | 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] | 310 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 311 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 312 | echo -n "testing --until=-mm:ss.sss (encode) $desc... " |
| 313 | run_flac $eopt --until=-0:01.1001 -o z50c.until-0:01.1001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 314 | run_flac $dopt -o z50c.until-0:01.1001.$in_fmt z50c.until-0:01.1001.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 315 | cmp 50c.until39.$in_fmt z50c.until-0:01.1001.$in_fmt || die "ERROR: file mismatch for --until=-0:01.1001 (encode) $desc" |
| 316 | 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] | 317 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 318 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 319 | # |
| 320 | # test --until when decoding |
| 321 | # |
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 | 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] | 324 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 325 | echo -n "testing --until=# (decode) $desc... " |
| 326 | run_flac $dopt --until=40 -o z50c.until40.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 327 | cmp 50c.until40.$in_fmt z50c.until40.$in_fmt || die "ERROR: file mismatch for --until=40 (decode) $desc" |
| 328 | rm -f z50c.until40.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 329 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 330 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 331 | echo -n "testing --until=mm:ss (decode) $desc... " |
| 332 | run_flac $dopt --until=0:04 -o z50c.until0:04.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 333 | cmp 50c.until40.$in_fmt z50c.until0:04.$in_fmt || die "ERROR: file mismatch for --until=0:04 (decode) $desc" |
| 334 | rm -f z50c.until0:04.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 335 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 336 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 337 | echo -n "testing --until=mm:ss.sss (decode) $desc... " |
| 338 | run_flac $dopt --until=0:03.9001 -o z50c.until0:03.9001.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 339 | cmp 50c.until39.$in_fmt z50c.until0:03.9001.$in_fmt || die "ERROR: file mismatch for --until=0:03.9001 (decode) $desc" |
| 340 | rm -f z50c.until0:03.9001.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 341 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 342 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 343 | echo -n "testing --until=-# (decode) $desc... " |
| 344 | run_flac $dopt --until=-10 -o z50c.until-10.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 345 | cmp 50c.until40.$in_fmt z50c.until-10.$in_fmt || die "ERROR: file mismatch for --until=-10 (decode) $desc" |
| 346 | rm -f z50c.until-10.$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 (decode) $desc... " |
| 350 | run_flac $dopt --until=-0:01 -o z50c.until-0:01.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 351 | cmp 50c.until40.$in_fmt z50c.until-0:01.$in_fmt || die "ERROR: file mismatch for --until=-0:01 (decode) $desc" |
| 352 | rm -f z50c.until-0:01.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 353 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 354 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 355 | echo -n "testing --until=-mm:ss.sss (decode) $desc... " |
| 356 | run_flac $dopt --until=-0:01.1001 -o z50c.until-0:01.1001.$in_fmt z50c.$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 (decode) $desc" |
| 358 | rm -f 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 | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 361 | rm -f z50c.$out_fmt |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 362 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 363 | # |
| 364 | # test --skip and --until when encoding |
| 365 | # |
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 --skip=10 --until=# (encode) $desc... " |
| 368 | run_flac $eopt --skip=10 --until=40 -o z50c.skip10.until40.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 369 | run_flac $dopt -o z50c.skip10.until40.$in_fmt z50c.skip10.until40.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 370 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until40.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=40 (encode) $desc" |
| 371 | rm -f z50c.skip10.until40.$out_fmt z50c.skip10.until40.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 372 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 373 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 374 | echo -n "testing --skip=10 --until=mm:ss (encode) $desc... " |
| 375 | run_flac $eopt --skip=10 --until=0:04 -o z50c.skip10.until0:04.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 376 | run_flac $dopt -o z50c.skip10.until0:04.$in_fmt z50c.skip10.until0:04.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 377 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until0:04.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:04 (encode) $desc" |
| 378 | 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] | 379 | echo OK |
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 | echo -n "testing --skip=10 --until=mm:ss.sss (encode) $desc... " |
| 382 | 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" |
| 383 | run_flac $dopt -o z50c.skip10.until0:03.9001.$in_fmt z50c.skip10.until0:03.9001.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 384 | 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" |
| 385 | 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] | 386 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 387 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 388 | echo -n "testing --skip=10 --until=+# (encode) $desc... " |
| 389 | run_flac $eopt --skip=10 --until=+30 -o z50c.skip10.until+30.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 390 | run_flac $dopt -o z50c.skip10.until+30.$in_fmt z50c.skip10.until+30.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 391 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until+30.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=+30 (encode) $desc" |
| 392 | 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] | 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 --skip=10 --until=+mm:ss (encode) $desc... " |
| 396 | 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" |
| 397 | run_flac $dopt -o z50c.skip10.until+0:03.$in_fmt z50c.skip10.until+0:03.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 398 | 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" |
| 399 | 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] | 400 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 401 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 402 | echo -n "testing --skip=10 --until=+mm:ss.sss (encode) $desc... " |
| 403 | 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" |
| 404 | 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" |
| 405 | 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" |
| 406 | 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] | 407 | echo OK |
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=-10 -o z50c.skip10.until-10.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 411 | run_flac $dopt -o z50c.skip10.until-10.$in_fmt z50c.skip10.until-10.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 412 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until-10.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-10 (encode) $desc" |
| 413 | 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] | 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:01 -o z50c.skip10.until-0:01.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 418 | run_flac $dopt -o z50c.skip10.until-0:01.$in_fmt z50c.skip10.until-0:01.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 419 | 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" |
| 420 | 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] | 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:01.1001 -o z50c.skip10.until-0:01.1001.$out_fmt 50c.$in_fmt || die "ERROR generating FLAC file $desc" |
| 425 | 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" |
| 426 | 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" |
| 427 | 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] | 428 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 429 | |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 430 | # |
| 431 | # test --skip and --until when decoding |
| 432 | # |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 433 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 434 | 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] | 435 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 436 | echo -n "testing --skip=10 --until=# (decode) $desc... " |
| 437 | run_flac $dopt --skip=10 --until=40 -o z50c.skip10.until40.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 438 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until40.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=40 (decode) $desc" |
| 439 | rm -f z50c.skip10.until40.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 440 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 441 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 442 | echo -n "testing --skip=10 --until=mm:ss (decode) $desc... " |
| 443 | run_flac $dopt --skip=10 --until=0:04 -o z50c.skip10.until0:04.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 444 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until0:04.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=0:04 (decode) $desc" |
| 445 | rm -f z50c.skip10.until0:04.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 446 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 447 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 448 | echo -n "testing --skip=10 --until=mm:ss.sss (decode) $desc... " |
| 449 | 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" |
| 450 | 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" |
| 451 | rm -f z50c.skip10.until0:03.9001.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 452 | echo OK |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 453 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 454 | echo -n "testing --skip=10 --until=-# (decode) $desc... " |
| 455 | run_flac $dopt --skip=10 --until=-10 -o z50c.skip10.until-10.$in_fmt z50c.$out_fmt || die "ERROR decoding FLAC file $desc" |
| 456 | cmp 50c.skip10.until40.$in_fmt z50c.skip10.until-10.$in_fmt || die "ERROR: file mismatch for --skip=10 --until=-10 (decode) $desc" |
| 457 | rm -f z50c.skip10.until-10.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 458 | echo OK |
| 459 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 460 | echo -n "testing --skip=10 --until=-mm:ss (decode) $desc... " |
| 461 | 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" |
| 462 | 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" |
| 463 | rm -f z50c.skip10.until-0:01.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 464 | echo OK |
| 465 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 466 | echo -n "testing --skip=10 --until=-mm:ss.sss (decode) $desc... " |
| 467 | 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" |
| 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 (decode) $desc" |
| 469 | rm -f z50c.skip10.until-0:01.1001.$in_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 470 | echo OK |
| 471 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 472 | rm -f z50c.$out_fmt |
Josh Coalson | 8232e29 | 2002-12-14 06:22:22 +0000 | [diff] [blame] | 473 | } |
| 474 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 475 | test_skip_until raw flac |
| 476 | test_skip_until wav flac |
| 477 | test_skip_until aiff flac |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 478 | |
Josh Coalson | 3e3ad0c | 2004-07-07 07:39:59 +0000 | [diff] [blame] | 479 | if [ $has_ogg = "yes" ] ; then |
| 480 | test_skip_until raw ogg |
| 481 | test_skip_until wav ogg |
| 482 | test_skip_until aiff ogg |
| 483 | fi |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 484 | |
| 485 | ############################################################################ |
| 486 | # test 'fixup' code that happens when a FLAC file with total_samples == 0 |
| 487 | # in the STREAMINFO block is converted to WAVE or AIFF, requiring the |
| 488 | # decoder go back and fix up the chunk headers |
| 489 | ############################################################################ |
| 490 | |
| 491 | echo -n "WAVE fixup test... " |
| 492 | echo -n "prepare... " |
| 493 | convert_to_wav noise || die "ERROR creating reference WAVE" |
| 494 | echo -n "encode... " |
| 495 | cat noise.raw | run_flac $raw_eopt - -c > fixup.flac || die "ERROR generating FLAC file" |
| 496 | echo -n "decode... " |
| 497 | run_flac $wav_dopt fixup.flac -o fixup.wav || die "ERROR decoding FLAC file" |
| 498 | echo -n "compare... " |
| 499 | cmp noise.wav fixup.wav || die "ERROR: file mismatch" |
| 500 | echo OK |
| 501 | rm -f noise.wav fixup.wav fixup.flac |
| 502 | |
| 503 | echo -n "AIFF fixup test... " |
| 504 | echo -n "prepare... " |
| 505 | convert_to_aiff noise || die "ERROR creating reference AIFF" |
| 506 | echo -n "encode... " |
| 507 | cat noise.raw | run_flac $raw_eopt - -c > fixup.flac || die "ERROR generating FLAC file" |
| 508 | echo -n "decode... " |
| 509 | run_flac $wav_dopt fixup.flac -o fixup.aiff || die "ERROR decoding FLAC file" |
| 510 | echo -n "compare... " |
| 511 | cmp noise.aiff fixup.aiff || die "ERROR: file mismatch" |
| 512 | echo OK |
| 513 | rm -f noise.aiff fixup.aiff fixup.flac |
| 514 | |
| 515 | |
| 516 | ############################################################################ |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 517 | # multi-file tests |
Josh Coalson | 9238a14 | 2002-12-21 03:29:26 +0000 | [diff] [blame] | 518 | ############################################################################ |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 519 | |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 520 | echo "Generating multiple input files from noise..." |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame^] | 521 | 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" |
| 522 | run_flac --decode --force --silent noise.flac || die "ERROR generating WAVE file" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 523 | rm -f noise.flac |
| 524 | mv noise.wav file0.wav |
| 525 | cp file0.wav file1.wav |
| 526 | cp file1.wav file2.wav |
| 527 | |
| 528 | test_multifile () |
| 529 | { |
| 530 | streamtype=$1 |
| 531 | sector_align=$2 |
| 532 | encode_options="$3" |
| 533 | |
| 534 | if [ $streamtype = ogg ] ; then |
| 535 | suffix=ogg |
| 536 | encode_options="$encode_options --ogg" |
| 537 | else |
| 538 | suffix=flac |
| 539 | fi |
| 540 | |
| 541 | if [ $sector_align = sector_align ] ; then |
| 542 | encode_options="$encode_options --sector-align" |
| 543 | fi |
| 544 | |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame^] | 545 | 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] | 546 | for n in 0 1 2 ; do |
| 547 | mv file$n.$suffix file${n}x.$suffix |
| 548 | done |
Josh Coalson | 0bb57d0 | 2004-07-16 00:50:42 +0000 | [diff] [blame^] | 549 | run_flac --force --decode file0x.$suffix file1x.$suffix file2x.$suffix || die "ERROR" |
Josh Coalson | 463d0f8 | 2002-12-10 06:41:27 +0000 | [diff] [blame] | 550 | if [ $sector_align != sector_align ] ; then |
| 551 | for n in 0 1 2 ; do |
Josh Coalson | 8fac5d6 | 2002-12-12 03:57:47 +0000 | [diff] [blame] | 552 | 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] | 553 | done |
| 554 | fi |
| 555 | for n in 0 1 2 ; do |
| 556 | rm -f file${n}x.$suffix file${n}x.wav |
| 557 | done |
| 558 | } |
| 559 | |
| 560 | echo "Testing multiple files without verify..." |
| 561 | test_multifile flac no_sector_align "" |
| 562 | |
| 563 | echo "Testing multiple files with verify..." |
| 564 | test_multifile flac no_sector_align "--verify" |
| 565 | |
| 566 | echo "Testing multiple files with --sector-align, without verify..." |
| 567 | test_multifile flac sector_align "" |
| 568 | |
| 569 | echo "Testing multiple files with --sector-align, with verify..." |
| 570 | test_multifile flac sector_align "--verify" |
| 571 | |
| 572 | if [ $has_ogg = "yes" ] ; then |
| 573 | echo "Testing multiple files with --ogg, without verify..." |
| 574 | test_multifile ogg no_sector_align "" |
| 575 | |
| 576 | echo "Testing multiple files with --ogg, with verify..." |
| 577 | test_multifile ogg no_sector_align "--verify" |
| 578 | |
| 579 | echo "Testing multiple files with --ogg and --sector-align, without verify..." |
| 580 | test_multifile ogg sector_align "" |
| 581 | |
| 582 | echo "Testing multiple files with --ogg and --sector-align, with verify..." |
| 583 | test_multifile sector_align ogg "--verify" |
| 584 | |
| 585 | echo "Testing multiple files with --ogg and --serial-number, with verify..." |
| 586 | test_multifile ogg no_sector_align "--serial-number=321 --verify" |
| 587 | fi |