Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
| 3 | # FLAC - Free Lossless Audio Codec |
Erik de Castro Lopo | b1982fb | 2013-05-25 17:11:19 +1000 | [diff] [blame] | 4 | # Copyright (C) 2002-2009 Josh Coalson |
| 5 | # Copyright (C) 2011-2013 Xiph.Org Foundation |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 6 | # |
Josh Coalson | e8a7601 | 2003-02-07 00:14:32 +0000 | [diff] [blame] | 7 | # This file is part the FLAC project. FLAC is comprised of several |
Ulrich Klauer | cd4ddab | 2013-05-26 22:53:43 +0200 | [diff] [blame] | 8 | # components distributed under different licenses. The codec libraries |
Josh Coalson | e8a7601 | 2003-02-07 00:14:32 +0000 | [diff] [blame] | 9 | # are distributed under Xiph.Org's BSD-like license (see the file |
| 10 | # COPYING.Xiph in this distribution). All other programs, libraries, and |
| 11 | # plugins are distributed under the GPL (see COPYING.GPL). The documentation |
| 12 | # is distributed under the Gnu FDL (see COPYING.FDL). Each file in the |
| 13 | # FLAC distribution contains at the top the terms under which it may be |
| 14 | # distributed. |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 15 | # |
Josh Coalson | e8a7601 | 2003-02-07 00:14:32 +0000 | [diff] [blame] | 16 | # Since this particular file is relevant to all components of FLAC, |
| 17 | # it may be distributed under the Xiph.Org license, which is the least |
| 18 | # restrictive of those mentioned above. See the file COPYING.Xiph in this |
| 19 | # distribution. |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 20 | |
Josh Coalson | 6218b34 | 2002-12-12 03:58:18 +0000 | [diff] [blame] | 21 | die () |
| 22 | { |
| 23 | echo $* 1>&2 |
| 24 | exit 1 |
| 25 | } |
| 26 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 27 | if [ x = x"$1" ] ; then |
Josh Coalson | b43d3cb | 2004-11-09 01:28:05 +0000 | [diff] [blame] | 28 | BUILD=debug |
| 29 | else |
| 30 | BUILD="$1" |
| 31 | fi |
| 32 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 33 | # change to 'false' to show all flac/metaflac output (useful for debugging) |
| 34 | if true ; then |
| 35 | SILENT='--silent' |
| 36 | TOTALLY_SILENT='--totally-silent' |
| 37 | else |
| 38 | SILENT='' |
| 39 | TOTALLY_SILENT='' |
| 40 | fi |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 41 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 42 | LD_LIBRARY_PATH=`pwd`/../src/libFLAC/.libs:$LD_LIBRARY_PATH |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 43 | LD_LIBRARY_PATH=`pwd`/../src/share/grabbag/.libs:$LD_LIBRARY_PATH |
| 44 | LD_LIBRARY_PATH=`pwd`/../src/share/getopt/.libs:$LD_LIBRARY_PATH |
| 45 | LD_LIBRARY_PATH=`pwd`/../src/share/replaygain_analysis/.libs:$LD_LIBRARY_PATH |
| 46 | LD_LIBRARY_PATH=`pwd`/../src/share/replaygain_synthesis/.libs:$LD_LIBRARY_PATH |
| 47 | LD_LIBRARY_PATH=`pwd`/../src/share/utf8/.libs:$LD_LIBRARY_PATH |
Erik de Castro Lopo | 85d5c53 | 2013-01-02 22:37:42 +1100 | [diff] [blame] | 48 | LD_LIBRARY_PATH=`pwd`/../objs/$BUILD/lib:$LD_LIBRARY_PATH |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 49 | export LD_LIBRARY_PATH |
Cristian RodrÃguez | 95f0f75 | 2012-04-17 22:12:45 -0300 | [diff] [blame] | 50 | export MALLOC_CHECK_=3 |
Erik de Castro Lopo | 4f24161 | 2013-04-25 12:31:50 +1000 | [diff] [blame] | 51 | export MALLOC_PERTURB_=$((1$(date +%N) % 255 + 1)) |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 52 | PATH=`pwd`/../src/flac:$PATH |
| 53 | PATH=`pwd`/../src/metaflac:$PATH |
Erik de Castro Lopo | 85d5c53 | 2013-01-02 22:37:42 +1100 | [diff] [blame] | 54 | PATH=`pwd`/../objs/$BUILD/bin:$PATH |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 55 | |
Josh Coalson | 412a037 | 2007-08-29 00:38:16 +0000 | [diff] [blame] | 56 | if echo a | (grep -E '(a|b)') >/dev/null 2>&1 |
| 57 | then EGREP='grep -E' |
| 58 | else EGREP='egrep' |
| 59 | fi |
| 60 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 61 | testdir="metaflac-test-files" |
| 62 | flacfile="metaflac.flac" |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 63 | |
Josh Coalson | 6218b34 | 2002-12-12 03:58:18 +0000 | [diff] [blame] | 64 | flac --help 1>/dev/null 2>/dev/null || die "ERROR can't find flac executable" |
| 65 | metaflac --help 1>/dev/null 2>/dev/null || die "ERROR can't find metaflac executable" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 66 | |
Josh Coalson | 34c1ea8 | 2002-12-04 04:57:33 +0000 | [diff] [blame] | 67 | run_flac () |
| 68 | { |
Josh Coalson | de9091e | 2006-05-25 02:48:22 +0000 | [diff] [blame] | 69 | if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then |
Martijn van Beurden | f6585b0 | 2013-04-21 23:12:16 +0200 | [diff] [blame] | 70 | echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 flac $*" >>test_metaflac.valgrind.log |
| 71 | valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 flac $* 4>>test_metaflac.valgrind.log |
Josh Coalson | 34c1ea8 | 2002-12-04 04:57:33 +0000 | [diff] [blame] | 72 | else |
| 73 | flac $* |
| 74 | fi |
| 75 | } |
| 76 | |
| 77 | run_metaflac () |
| 78 | { |
Josh Coalson | de9091e | 2006-05-25 02:48:22 +0000 | [diff] [blame] | 79 | if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then |
Martijn van Beurden | f6585b0 | 2013-04-21 23:12:16 +0200 | [diff] [blame] | 80 | echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 metaflac $*" >>test_metaflac.valgrind.log |
| 81 | valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 metaflac $* 4>>test_metaflac.valgrind.log |
Josh Coalson | 34c1ea8 | 2002-12-04 04:57:33 +0000 | [diff] [blame] | 82 | else |
| 83 | metaflac $* |
| 84 | fi |
| 85 | } |
Josh Coalson | 2858ff3 | 2002-10-11 06:22:43 +0000 | [diff] [blame] | 86 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 87 | run_metaflac_silent () |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 88 | { |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 89 | if [ -z "$SILENT" ] ; then |
| 90 | run_metaflac $* |
| 91 | else |
| 92 | if [ x"$FLAC__TEST_WITH_VALGRIND" = xyes ] ; then |
Martijn van Beurden | f6585b0 | 2013-04-21 23:12:16 +0200 | [diff] [blame] | 93 | echo "valgrind --leak-check=yes --show-reachable=yes --num-callers=50 metaflac $*" >>test_metaflac.valgrind.log |
| 94 | valgrind --leak-check=yes --show-reachable=yes --num-callers=50 --log-fd=4 metaflac $* 2>/dev/null 4>>test_metaflac.valgrind.log |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 95 | else |
| 96 | metaflac $* 2>/dev/null |
| 97 | fi |
| 98 | fi |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 99 | } |
| 100 | |
| 101 | check_flac () |
| 102 | { |
Josh Coalson | 6218b34 | 2002-12-12 03:58:18 +0000 | [diff] [blame] | 103 | run_flac --silent --test $flacfile || die "ERROR in $flacfile" 1>&2 |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 104 | } |
| 105 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 106 | echo "Generating stream..." |
| 107 | bytes=80000 |
| 108 | if dd if=/dev/zero ibs=1 count=$bytes | flac --force --verify -0 --input-size=$bytes --output-name=$flacfile --force-raw-format --endian=big --sign=signed --channels=1 --bps=8 --sample-rate=8000 - ; then |
| 109 | chmod +w $flacfile |
| 110 | else |
| 111 | die "ERROR during generation" |
| 112 | fi |
| 113 | |
Josh Coalson | d09958f | 2002-06-14 06:31:35 +0000 | [diff] [blame] | 114 | check_flac |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 115 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 116 | echo |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 117 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 118 | filter () |
| 119 | { |
| 120 | # minor danger, changing vendor strings will change the length of the |
| 121 | # VORBIS_COMMENT block, but if we add "^ length: " to the patterns, |
| 122 | # we lose info about PADDING size that we need |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 123 | # grep pattern 1: remove vendor string |
| 124 | # grep pattern 2: remove minimum/maximum frame and block size from STREAMINFO |
| 125 | # grep pattern 3: remove hexdump data from PICTURE metadata blocks |
| 126 | # sed pattern 1: remove stream offset values from SEEKTABLE points |
Josh Coalson | 412a037 | 2007-08-29 00:38:16 +0000 | [diff] [blame] | 127 | $EGREP -v '^ vendor string: |^ m..imum .....size: |^ 0000[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]: ' | sed -e 's/, stream_offset.*//' |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 128 | } |
| 129 | metaflac_test () |
| 130 | { |
| 131 | case="$1" |
| 132 | desc="$2" |
| 133 | args="$3" |
| 134 | expect="$testdir/$case-expect.meta" |
| 135 | echo -n "test $case: $desc... " |
| 136 | run_metaflac $args $flacfile | filter > $testdir/out.meta || die "ERROR running metaflac" |
Josh Coalson | 412a037 | 2007-08-29 00:38:16 +0000 | [diff] [blame] | 137 | diff -w $expect $testdir/out.meta > /dev/null 2>&1 || die "ERROR: metadata does not match expected $expect" |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 138 | echo OK |
| 139 | } |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 140 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 141 | metaflac_test case00 "--list" "--list" |
| 142 | |
| 143 | metaflac_test case01 "STREAMINFO --show-* shortcuts" " |
| 144 | --show-md5sum |
| 145 | --show-min-blocksize |
| 146 | --show-max-blocksize |
| 147 | --show-min-framesize |
| 148 | --show-max-framesize |
| 149 | --show-sample-rate |
| 150 | --show-channels |
| 151 | --show-bps |
| 152 | --show-total-samples" |
| 153 | |
| 154 | run_metaflac --preserve-modtime --add-padding=12345 $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 155 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 156 | metaflac_test case02 "--add-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 157 | |
Josh Coalson | c6ea43b | 2002-10-26 04:28:11 +0000 | [diff] [blame] | 158 | # some flavors of /bin/sh (e.g. Darwin's) won't even handle quoted spaces, so we underscore: |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 159 | run_metaflac --set-tag="ARTIST=The_artist_formerly_known_as_the_artist..." $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 160 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 161 | metaflac_test case03 "--set-tag=ARTIST" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 162 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 163 | run_metaflac --set-tag="ARTIST=Chuck_Woolery" $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 164 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 165 | metaflac_test case04 "--set-tag=ARTIST" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 166 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 167 | run_metaflac --set-tag="ARTIST=Vern" $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 168 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 169 | metaflac_test case05 "--set-tag=ARTIST" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 170 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 171 | run_metaflac --set-tag="TITLE=He_who_smelt_it_dealt_it" $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 172 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 173 | metaflac_test case06 "--set-tag=TITLE" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 174 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 175 | metaflac_test case07 "--show-vendor-tag --show-tag=ARTIST" "--show-vendor-tag --show-tag=ARTIST" |
Josh Coalson | c6ea43b | 2002-10-26 04:28:11 +0000 | [diff] [blame] | 176 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 177 | run_metaflac --remove-first-tag=ARTIST $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 178 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 179 | metaflac_test case08 "--remove-first-tag=ARTIST" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 180 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 181 | run_metaflac --remove-tag=ARTIST $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 182 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 183 | metaflac_test case09 "--remove-tag=ARTIST" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 184 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 185 | metaflac_test case10 "--list --block-type=VORBIS_COMMENT" "--list --block-type=VORBIS_COMMENT" |
| 186 | metaflac_test case11 "--list --block-number=0" "--list --block-number=0" |
| 187 | metaflac_test case12 "--list --block-number=1,2,999" "--list --block-number=1,2,999" |
| 188 | metaflac_test case13 "--list --block-type=VORBIS_COMMENT,PADDING" "--list --block-type=VORBIS_COMMENT,PADDING" |
| 189 | metaflac_test case14 "--list --except-block-type=SEEKTABLE,VORBIS_COMMENT" "--list --except-block-type=SEEKTABLE,VORBIS_COMMENT" |
| 190 | metaflac_test case15 "--list --except-block-type=STREAMINFO" "--list --except-block-type=STREAMINFO" |
Josh Coalson | c6ea43b | 2002-10-26 04:28:11 +0000 | [diff] [blame] | 191 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 192 | run_metaflac --add-padding=4321 $flacfile $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 193 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 194 | metaflac_test case16 "--add-padding=4321 * 2" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 195 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 196 | run_metaflac --merge-padding $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 197 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 198 | metaflac_test case17 "--merge-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 199 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 200 | run_metaflac --add-padding=0 $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 201 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 202 | metaflac_test case18 "--add-padding=0" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 203 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 204 | run_metaflac --sort-padding $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 205 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 206 | metaflac_test case19 "--sort-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 207 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 208 | run_metaflac --add-padding=0 $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 209 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 210 | metaflac_test case20 "--add-padding=0" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 211 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 212 | run_metaflac --remove-all-tags $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 213 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 214 | metaflac_test case21 "--remove-all-tags" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 215 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 216 | run_metaflac --remove --block-number=1,99 --dont-use-padding $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 217 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 218 | metaflac_test case22 "--remove --block-number=1,99 --dont-use-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 219 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 220 | run_metaflac --remove --block-number=99 --dont-use-padding $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 221 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 222 | metaflac_test case23 "--remove --block-number=99 --dont-use-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 223 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 224 | run_metaflac --remove --block-type=PADDING $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 225 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 226 | metaflac_test case24 "--remove --block-type=PADDING" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 227 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 228 | run_metaflac --remove --block-type=PADDING --dont-use-padding $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 229 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 230 | metaflac_test case25 "--remove --block-type=PADDING --dont-use-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 231 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 232 | run_metaflac --add-padding=0 $flacfile $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 233 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 234 | metaflac_test case26 "--add-padding=0 * 2" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 235 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 236 | run_metaflac --remove --except-block-type=PADDING $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 237 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 238 | metaflac_test case27 "--remove --except-block-type=PADDING" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 239 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 240 | run_metaflac --remove-all $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 241 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 242 | metaflac_test case28 "--remove-all" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 243 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 244 | run_metaflac --remove-all --dont-use-padding $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 245 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 246 | metaflac_test case29 "--remove-all --dont-use-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 247 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 248 | run_metaflac --remove-all --dont-use-padding $flacfile |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 249 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 250 | metaflac_test case30 "--remove-all --dont-use-padding" "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 251 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 252 | run_metaflac --set-tag="f=0123456789abcdefghij" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 253 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 254 | metaflac_test case31 "--set-tag=..." "--list" |
Josh Coalson | 16a16e2 | 2002-06-15 05:14:04 +0000 | [diff] [blame] | 255 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 256 | run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghi" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 257 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 258 | metaflac_test case32 "--remove-all-tags --set-tag=..." "--list" |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 259 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 260 | run_metaflac --remove-all-tags --set-tag="f=0123456789abcde" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 261 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 262 | metaflac_test case33 "--remove-all-tags --set-tag=..." "--list" |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 263 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 264 | run_metaflac --remove-all-tags --set-tag="f=0" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 265 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 266 | metaflac_test case34 "--remove-all-tags --set-tag=..." "--list" |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 267 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 268 | run_metaflac --remove-all-tags --set-tag="f=0123456789" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 269 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 270 | metaflac_test case35 "--remove-all-tags --set-tag=..." "--list" |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 271 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 272 | run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghi" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 273 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 274 | metaflac_test case36 "--remove-all-tags --set-tag=..." "--list" |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 275 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 276 | run_metaflac --remove-all-tags --set-tag="f=0123456789" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 277 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 278 | metaflac_test case37 "--remove-all-tags --set-tag=..." "--list" |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 279 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 280 | run_metaflac --remove-all-tags --set-tag="f=0123456789abcdefghij" $flacfile |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 281 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 282 | metaflac_test case38 "--remove-all-tags --set-tag=..." "--list" |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 283 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 284 | echo "TITLE=Tittle" | run_metaflac --import-tags-from=- $flacfile |
Josh Coalson | d4f6234 | 2002-09-05 05:38:22 +0000 | [diff] [blame] | 285 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 286 | metaflac_test case39 "--import-tags-from=-" "--list" |
Josh Coalson | d4f6234 | 2002-09-05 05:38:22 +0000 | [diff] [blame] | 287 | |
| 288 | cat > vc.txt << EOF |
| 289 | artist=Fartist |
| 290 | artist=artits |
| 291 | EOF |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 292 | run_metaflac --import-tags-from=vc.txt $flacfile |
Josh Coalson | d4f6234 | 2002-09-05 05:38:22 +0000 | [diff] [blame] | 293 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 294 | metaflac_test case40 "--import-tags-from=[FILE]" "--list" |
Josh Coalson | d4f6234 | 2002-09-05 05:38:22 +0000 | [diff] [blame] | 295 | |
| 296 | rm vc.txt |
| 297 | |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 298 | run_metaflac --add-replay-gain $flacfile |
| 299 | check_flac |
| 300 | metaflac_test case41 "--add-replay-gain" "--list" |
| 301 | |
| 302 | run_metaflac --remove-replay-gain $flacfile |
| 303 | check_flac |
| 304 | metaflac_test case42 "--remove-replay-gain" "--list" |
| 305 | |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 306 | # CUESHEET blocks |
Josh Coalson | 3c75a39 | 2002-11-27 04:46:14 +0000 | [diff] [blame] | 307 | cs_in=cuesheets/good.000.cue |
| 308 | cs_out=metaflac.cue |
| 309 | cs_out2=metaflac2.cue |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 310 | run_metaflac --import-cuesheet-from="$cs_in" $flacfile |
Josh Coalson | 3c75a39 | 2002-11-27 04:46:14 +0000 | [diff] [blame] | 311 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 312 | metaflac_test case43 "--import-cuesheet-from" "--list" |
| 313 | run_metaflac --export-cuesheet-to=$cs_out $flacfile |
| 314 | run_metaflac --remove --block-type=CUESHEET $flacfile |
Josh Coalson | 3c75a39 | 2002-11-27 04:46:14 +0000 | [diff] [blame] | 315 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 316 | metaflac_test case44 "--remove --block-type=CUESHEET" "--list" |
| 317 | run_metaflac --import-cuesheet-from=$cs_out $flacfile |
Josh Coalson | 3c75a39 | 2002-11-27 04:46:14 +0000 | [diff] [blame] | 318 | check_flac |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 319 | metaflac_test case45 "--import-cuesheet-from" "--list" |
| 320 | run_metaflac --export-cuesheet-to=$cs_out2 $flacfile |
Josh Coalson | 3c75a39 | 2002-11-27 04:46:14 +0000 | [diff] [blame] | 321 | echo "comparing cuesheets:" |
Josh Coalson | 6218b34 | 2002-12-12 03:58:18 +0000 | [diff] [blame] | 322 | diff $cs_out $cs_out2 || die "ERROR, cuesheets should be identical" |
Josh Coalson | 3c75a39 | 2002-11-27 04:46:14 +0000 | [diff] [blame] | 323 | echo identical |
| 324 | |
| 325 | rm -f $cs_out $cs_out2 |
| 326 | |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 327 | # PICTURE blocks |
| 328 | ncase=46 |
| 329 | for f in \ |
| 330 | 0.gif \ |
| 331 | 1.gif \ |
| 332 | 2.gif \ |
| 333 | ; do |
Josh Coalson | aec8bb3 | 2006-11-02 04:06:56 +0000 | [diff] [blame] | 334 | run_metaflac --import-picture-from="|image/gif|$f||pictures/$f" $flacfile |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 335 | check_flac |
Josh Coalson | aec8bb3 | 2006-11-02 04:06:56 +0000 | [diff] [blame] | 336 | metaflac_test "case$ncase" "--import-picture-from" "--list" |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 337 | ncase=`expr $ncase + 1` |
| 338 | done |
| 339 | for f in \ |
| 340 | 0.jpg \ |
| 341 | 4.jpg \ |
| 342 | ; do |
Josh Coalson | aec8bb3 | 2006-11-02 04:06:56 +0000 | [diff] [blame] | 343 | run_metaflac --import-picture-from="4|image/jpeg|$f||pictures/$f" $flacfile |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 344 | check_flac |
Josh Coalson | aec8bb3 | 2006-11-02 04:06:56 +0000 | [diff] [blame] | 345 | metaflac_test "case$ncase" "--import-picture-from" "--list" |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 346 | ncase=`expr $ncase + 1` |
| 347 | done |
| 348 | for f in \ |
| 349 | 0.png \ |
| 350 | 1.png \ |
| 351 | 2.png \ |
| 352 | 3.png \ |
| 353 | 4.png \ |
| 354 | 5.png \ |
| 355 | 6.png \ |
| 356 | 7.png \ |
| 357 | 8.png \ |
| 358 | ; do |
Josh Coalson | aec8bb3 | 2006-11-02 04:06:56 +0000 | [diff] [blame] | 359 | run_metaflac --import-picture-from="5|image/png|$f||pictures/$f" $flacfile |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 360 | check_flac |
Josh Coalson | aec8bb3 | 2006-11-02 04:06:56 +0000 | [diff] [blame] | 361 | metaflac_test "case$ncase" "--import-picture-from" "--list" |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 362 | ncase=`expr $ncase + 1` |
| 363 | done |
Josh Coalson | a65fd93 | 2006-10-03 01:02:44 +0000 | [diff] [blame] | 364 | [ $ncase = 60 ] || die "expected case# to be 60" |
Josh Coalson | 989f267 | 2006-11-02 03:40:44 +0000 | [diff] [blame] | 365 | |
| 366 | fn=export-picture-check |
| 367 | echo -n "Testing --export-picture-to... " |
| 368 | run_metaflac --export-picture-to=$fn $flacfile |
| 369 | check_flac |
| 370 | cmp $fn pictures/0.gif || die "ERROR, exported picture file and original differ" |
| 371 | echo OK |
| 372 | rm -f $fn |
| 373 | echo -n "Testing --block-number --export-picture-to... " |
| 374 | run_metaflac --block-number=9 --export-picture-to=$fn $flacfile |
| 375 | check_flac |
| 376 | cmp $fn pictures/0.png || die "ERROR, exported picture file and original differ" |
| 377 | echo OK |
| 378 | rm -f $fn |
| 379 | |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 380 | run_metaflac --remove --block-type=PICTURE $flacfile |
| 381 | check_flac |
| 382 | metaflac_test case60 "--remove --block-type=PICTURE" "--list" |
Josh Coalson | aec8bb3 | 2006-11-02 04:06:56 +0000 | [diff] [blame] | 383 | run_metaflac --import-picture-from="1|image/png|standard_icon|32x32x24|pictures/0.png" $flacfile |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 384 | check_flac |
Josh Coalson | aec8bb3 | 2006-11-02 04:06:56 +0000 | [diff] [blame] | 385 | metaflac_test case61 "--import-picture-from" "--list" |
| 386 | run_metaflac --import-picture-from="2|image/png|icon|64x64x24|pictures/1.png" $flacfile |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 387 | check_flac |
Josh Coalson | aec8bb3 | 2006-11-02 04:06:56 +0000 | [diff] [blame] | 388 | metaflac_test case62 "--import-picture-from" "--list" |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 389 | |
| 390 | # UNKNOWN blocks |
Josh Coalson | 6b4dfd0 | 2003-01-11 06:23:16 +0000 | [diff] [blame] | 391 | echo -n "Testing FLAC file with unknown metadata... " |
| 392 | cp -p metaflac.flac.in $flacfile |
Josh Coalson | 43bb14d | 2003-01-16 07:21:20 +0000 | [diff] [blame] | 393 | # remove the VORBIS_COMMENT block so vendor string changes don't interfere with the comparison: |
| 394 | run_metaflac --remove --block-type=VORBIS_COMMENT --dont-use-padding $flacfile |
Josh Coalson | 6b4dfd0 | 2003-01-11 06:23:16 +0000 | [diff] [blame] | 395 | cmp $flacfile metaflac.flac.ok || die "ERROR, $flacfile and metaflac.flac.ok differ" |
| 396 | echo OK |
| 397 | |
Erik de Castro Lopo | f20770e | 2012-03-19 07:44:11 +1100 | [diff] [blame] | 398 | # Replay gain tests - Test the rates which have specific filter table entries |
| 399 | # and verify that harmonics can be processed correctly. |
| 400 | |
| 401 | tonegenerator () |
| 402 | { |
Erik de Castro Lopo | 69c44a5 | 2013-04-25 13:53:21 +1000 | [diff] [blame] | 403 | # When using GAWK, use --lint=posix to identify non-POSIX awk usages. |
Erik de Castro Lopo | f20770e | 2012-03-19 07:44:11 +1100 | [diff] [blame] | 404 | awk -- ' |
| 405 | BEGIN { |
| 406 | samplerate = '$1'; |
| 407 | |
| 408 | tone = 1000; |
| 409 | duration = 1; |
| 410 | bitspersample = 24; |
| 411 | |
Erik de Castro Lopo | 69c44a5 | 2013-04-25 13:53:21 +1000 | [diff] [blame] | 412 | samplemidpoint = 1; |
| 413 | for (sps = 0 ; sps < bitspersample - 1 ; sps++) { |
| 414 | samplemidpoint *= 2; |
| 415 | } |
| 416 | |
Erik de Castro Lopo | f20770e | 2012-03-19 07:44:11 +1100 | [diff] [blame] | 417 | samplerange = samplemidpoint - 1; |
| 418 | |
| 419 | pi = 4 * atan2(1,1); |
| 420 | |
| 421 | for (ix = 0; ix < duration * samplerate; ++ix) { |
| 422 | sample = sin(2 * pi * tone * ix / samplerate); |
| 423 | sample *= samplerange; |
| 424 | sample += samplemidpoint; |
| 425 | sample = int(sample); |
| 426 | for (bx = 0; bx < bitspersample/8; ++bx) { |
| 427 | byte[bx] = sample % 256; |
| 428 | sample /= 256; |
| 429 | } |
| 430 | while (bx--) { |
| 431 | printf("%c", byte[bx]); |
| 432 | } |
| 433 | } |
| 434 | |
| 435 | }' /dev/null | |
| 436 | flac --silent \ |
| 437 | --endian=big --channels=1 --bps=24 --sample-rate=$1 --sign=unsigned - |
| 438 | } |
| 439 | |
| 440 | REPLAYGAIN_FREQ= |
| 441 | REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 8000/-12.73" |
| 442 | REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 11025/-12.93" |
| 443 | REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 11025/-12.93" |
| 444 | REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 12000/-12.98" |
| 445 | REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 16000/-13.27" |
| 446 | REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 18900/-13.41" |
| 447 | REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 22050/-13.77" |
| 448 | REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 24000/-13.82" |
| 449 | REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 28000/-14.06" |
| 450 | REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 32000/-14.08" |
| 451 | REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 36000/-14.12" |
| 452 | REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 37800/-14.18" |
| 453 | REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 44100/-14.17" |
| 454 | REPLAYGAIN_FREQ="$REPLAYGAIN_FREQ 48000/-14.16:1:2:4" |
| 455 | |
Martijn van Beurden | 690205b | 2013-04-25 15:20:23 +0200 | [diff] [blame] | 456 | set -e |
| 457 | |
Erik de Castro Lopo | f20770e | 2012-03-19 07:44:11 +1100 | [diff] [blame] | 458 | for ACTION in $REPLAYGAIN_FREQ ; do |
| 459 | if [ -n "${ACTION##*:*}" ] ; then |
| 460 | HARMONICS=1 |
| 461 | else |
| 462 | HARMONICS="${ACTION#*:}" |
| 463 | fi |
| 464 | FREQ="${ACTION%%/*}" |
| 465 | GAIN="${ACTION#*/}" |
| 466 | GAIN="${GAIN%%:*}" |
| 467 | while [ -n "$HARMONICS" ] ; do |
| 468 | MULTIPLE="${HARMONICS%%:*}" |
| 469 | if [ x"$MULTIPLE" = x"$HARMONICS" ] ; then |
| 470 | HARMONICS= |
| 471 | else |
| 472 | HARMONICS="${HARMONICS#*:}" |
| 473 | fi |
| 474 | RATE=$(($MULTIPLE * FREQ)) |
| 475 | [ $MULTIPLE -eq 1 -o -n "${REPLAYGAIN_FREQ##* $RATE/*}" ] || break |
| 476 | echo -n "Testing FLAC replaygain $RATE ($FREQ x $MULTIPLE) ... " |
| 477 | tonegenerator $RATE > $flacfile |
| 478 | run_metaflac --add-replay-gain $flacfile |
| 479 | run_metaflac --list $flacfile | grep REPLAYGAIN.*GAIN= | |
| 480 | while read -r REPLAYGAIN ; do |
| 481 | MEASUREDGAIN="${REPLAYGAIN##*=}" |
| 482 | MEASUREDGAIN="${MEASUREDGAIN%% *}" |
| 483 | if [ x"$MEASUREDGAIN" != x"$GAIN" ] ; then |
| 484 | die "ERROR, Expected $GAIN db instead of $REPLAYGAIN" |
| 485 | fi |
| 486 | done |
| 487 | echo OK |
| 488 | done |
| 489 | done |
| 490 | |
| 491 | |
Josh Coalson | b02574e | 2006-09-26 00:43:48 +0000 | [diff] [blame] | 492 | rm -f $testdir/out.flac $testdir/out.meta |
Josh Coalson | ff151cc | 2006-08-28 03:39:45 +0000 | [diff] [blame] | 493 | |
Josh Coalson | daaf0a4 | 2002-06-18 05:25:41 +0000 | [diff] [blame] | 494 | exit 0 |