Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 1 | /* test_libOggFLAC - Unit tester for libOggFLAC |
Josh Coalson | 9564390 | 2004-01-17 04:14:43 +0000 | [diff] [blame] | 2 | * Copyright (C) 2002,2003,2004 Josh Coalson |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | */ |
| 18 | |
| 19 | #include "encoders.h" |
| 20 | #include "file_utils.h" |
Josh Coalson | a52a555 | 2003-01-10 05:40:09 +0000 | [diff] [blame] | 21 | #include "metadata_utils.h" |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 22 | #include "FLAC/assert.h" |
Josh Coalson | 3c2bdf8 | 2003-09-26 01:56:01 +0000 | [diff] [blame] | 23 | #include "OggFLAC/file_encoder.h" |
| 24 | #include "OggFLAC/seekable_stream_encoder.h" |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 25 | #include "OggFLAC/stream_encoder.h" |
Josh Coalson | b8f8a07 | 2002-11-07 05:07:30 +0000 | [diff] [blame] | 26 | #include "share/grabbag.h" |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 27 | #include <stdio.h> |
| 28 | #include <stdlib.h> |
| 29 | #include <string.h> |
| 30 | |
Josh Coalson | a47fa56 | 2003-01-10 08:15:35 +0000 | [diff] [blame] | 31 | static FLAC__StreamMetadata streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_, cuesheet_, unknown_; |
Josh Coalson | 69cfda7 | 2004-09-10 00:38:21 +0000 | [diff] [blame] | 32 | static FLAC__StreamMetadata *metadata_sequence_[] = { &vorbiscomment_, &padding_, &seektable_, &application1_, &application2_, &cuesheet_, &unknown_ }; |
Josh Coalson | a52a555 | 2003-01-10 05:40:09 +0000 | [diff] [blame] | 33 | static const unsigned num_metadata_ = sizeof(metadata_sequence_) / sizeof(metadata_sequence_[0]); |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 34 | static const char *oggflacfilename_ = "metadata.ogg"; |
| 35 | |
| 36 | static FLAC__bool die_s_(const char *msg, const OggFLAC__StreamEncoder *encoder) |
| 37 | { |
| 38 | OggFLAC__StreamEncoderState state = OggFLAC__stream_encoder_get_state(encoder); |
| 39 | |
| 40 | if(msg) |
| 41 | printf("FAILED, %s", msg); |
| 42 | else |
| 43 | printf("FAILED"); |
| 44 | |
| 45 | printf(", state = %u (%s)\n", (unsigned)state, OggFLAC__StreamEncoderStateString[state]); |
| 46 | if(state == OggFLAC__STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR) { |
| 47 | FLAC__StreamEncoderState state_ = OggFLAC__stream_encoder_get_FLAC_stream_encoder_state(encoder); |
| 48 | printf(" FLAC stream encoder state = %u (%s)\n", (unsigned)state_, FLAC__StreamEncoderStateString[state_]); |
| 49 | if(state_ == FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) { |
| 50 | FLAC__StreamDecoderState dstate = OggFLAC__stream_encoder_get_verify_decoder_state(encoder); |
| 51 | printf(" verify decoder state = %u (%s)\n", (unsigned)dstate, FLAC__StreamDecoderStateString[dstate]); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | return false; |
| 56 | } |
| 57 | |
Josh Coalson | 3c2bdf8 | 2003-09-26 01:56:01 +0000 | [diff] [blame] | 58 | static FLAC__bool die_ss_(const char *msg, const OggFLAC__SeekableStreamEncoder *encoder) |
| 59 | { |
| 60 | OggFLAC__SeekableStreamEncoderState state = OggFLAC__seekable_stream_encoder_get_state(encoder); |
| 61 | |
| 62 | if(msg) |
| 63 | printf("FAILED, %s", msg); |
| 64 | else |
| 65 | printf("FAILED"); |
| 66 | |
| 67 | printf(", state = %u (%s)\n", (unsigned)state, OggFLAC__SeekableStreamEncoderStateString[state]); |
Josh Coalson | b71b56c | 2004-01-16 00:03:15 +0000 | [diff] [blame] | 68 | if(state == OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR) { |
| 69 | FLAC__StreamEncoderState state_ = OggFLAC__seekable_stream_encoder_get_FLAC_stream_encoder_state(encoder); |
| 70 | printf(" FLAC stream encoder state = %u (%s)\n", (unsigned)state_, FLAC__StreamEncoderStateString[state_]); |
| 71 | if(state_ == FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) { |
| 72 | FLAC__StreamDecoderState dstate = OggFLAC__seekable_stream_encoder_get_verify_decoder_state(encoder); |
| 73 | printf(" verify decoder state = %u (%s)\n", (unsigned)dstate, FLAC__StreamDecoderStateString[dstate]); |
Josh Coalson | 3c2bdf8 | 2003-09-26 01:56:01 +0000 | [diff] [blame] | 74 | } |
| 75 | } |
| 76 | |
| 77 | return false; |
| 78 | } |
| 79 | |
| 80 | static FLAC__bool die_f_(const char *msg, const OggFLAC__FileEncoder *encoder) |
| 81 | { |
| 82 | OggFLAC__FileEncoderState state = OggFLAC__file_encoder_get_state(encoder); |
| 83 | |
| 84 | if(msg) |
| 85 | printf("FAILED, %s", msg); |
| 86 | else |
| 87 | printf("FAILED"); |
| 88 | |
| 89 | printf(", state = %u (%s)\n", (unsigned)state, OggFLAC__SeekableStreamEncoderStateString[state]); |
| 90 | if(state == OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR) { |
| 91 | OggFLAC__SeekableStreamEncoderState state_ = OggFLAC__file_encoder_get_seekable_stream_encoder_state(encoder); |
| 92 | printf(" seekable stream encoder state = %u (%s)\n", (unsigned)state_, OggFLAC__SeekableStreamEncoderStateString[state_]); |
Josh Coalson | b71b56c | 2004-01-16 00:03:15 +0000 | [diff] [blame] | 93 | if(state_ == OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR) { |
| 94 | FLAC__StreamEncoderState state__ = OggFLAC__file_encoder_get_FLAC_stream_encoder_state(encoder); |
| 95 | printf(" FLAC stream encoder state = %u (%s)\n", (unsigned)state__, FLAC__StreamEncoderStateString[state__]); |
| 96 | if(state__ == FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) { |
| 97 | FLAC__StreamDecoderState dstate = OggFLAC__file_encoder_get_verify_decoder_state(encoder); |
| 98 | printf(" verify decoder state = %u (%s)\n", (unsigned)dstate, FLAC__StreamDecoderStateString[dstate]); |
Josh Coalson | 3c2bdf8 | 2003-09-26 01:56:01 +0000 | [diff] [blame] | 99 | } |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | return false; |
| 104 | } |
| 105 | |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 106 | static void init_metadata_blocks_() |
| 107 | { |
Josh Coalson | a47fa56 | 2003-01-10 08:15:35 +0000 | [diff] [blame] | 108 | mutils__init_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_); |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | static void free_metadata_blocks_() |
| 112 | { |
Josh Coalson | a47fa56 | 2003-01-10 08:15:35 +0000 | [diff] [blame] | 113 | mutils__free_metadata_blocks(&streaminfo_, &padding_, &seektable_, &application1_, &application2_, &vorbiscomment_, &cuesheet_, &unknown_); |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | static FLAC__StreamEncoderWriteStatus stream_encoder_write_callback_(const OggFLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) |
| 117 | { |
| 118 | (void)encoder, (void)buffer, (void)bytes, (void)samples, (void)current_frame, (void)client_data; |
| 119 | return FLAC__STREAM_ENCODER_WRITE_STATUS_OK; |
| 120 | } |
| 121 | |
Josh Coalson | 8bd4884 | 2003-09-24 22:03:35 +0000 | [diff] [blame] | 122 | static void stream_encoder_metadata_callback_(const OggFLAC__StreamEncoder *encoder, const FLAC__StreamMetadata *metadata, void *client_data) |
| 123 | { |
| 124 | (void)encoder, (void)metadata, (void)client_data; |
| 125 | } |
| 126 | |
| 127 | |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 128 | static FLAC__bool test_stream_encoder() |
| 129 | { |
| 130 | OggFLAC__StreamEncoder *encoder; |
| 131 | OggFLAC__StreamEncoderState state; |
Josh Coalson | 3c2bdf8 | 2003-09-26 01:56:01 +0000 | [diff] [blame] | 132 | FLAC__StreamEncoderState fstate; |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 133 | FLAC__StreamDecoderState dstate; |
| 134 | FLAC__int32 samples[1024]; |
Josh Coalson | 27e1354 | 2003-05-20 00:01:49 +0000 | [diff] [blame] | 135 | FLAC__int32 *samples_array[1]; |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 136 | unsigned i; |
| 137 | |
Josh Coalson | 27e1354 | 2003-05-20 00:01:49 +0000 | [diff] [blame] | 138 | samples_array[0] = samples; |
| 139 | |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 140 | printf("\n+++ libOggFLAC unit test: OggFLAC__StreamEncoder\n\n"); |
| 141 | |
| 142 | printf("testing OggFLAC__stream_encoder_new()... "); |
| 143 | encoder = OggFLAC__stream_encoder_new(); |
| 144 | if(0 == encoder) { |
| 145 | printf("FAILED, returned NULL\n"); |
| 146 | return false; |
| 147 | } |
| 148 | printf("OK\n"); |
| 149 | |
Josh Coalson | 8304c8f | 2002-09-04 07:52:58 +0000 | [diff] [blame] | 150 | printf("testing OggFLAC__stream_encoder_set_serial_number()... "); |
| 151 | if(!OggFLAC__stream_encoder_set_serial_number(encoder, file_utils__serial_number)) |
| 152 | return die_s_("returned false", encoder); |
| 153 | printf("OK\n"); |
| 154 | |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 155 | printf("testing OggFLAC__stream_encoder_set_verify()... "); |
| 156 | if(!OggFLAC__stream_encoder_set_verify(encoder, true)) |
| 157 | return die_s_("returned false", encoder); |
| 158 | printf("OK\n"); |
| 159 | |
| 160 | printf("testing OggFLAC__stream_encoder_set_streamable_subset()... "); |
| 161 | if(!OggFLAC__stream_encoder_set_streamable_subset(encoder, true)) |
| 162 | return die_s_("returned false", encoder); |
| 163 | printf("OK\n"); |
| 164 | |
| 165 | printf("testing OggFLAC__stream_encoder_set_do_mid_side_stereo()... "); |
| 166 | if(!OggFLAC__stream_encoder_set_do_mid_side_stereo(encoder, false)) |
| 167 | return die_s_("returned false", encoder); |
| 168 | printf("OK\n"); |
| 169 | |
| 170 | printf("testing OggFLAC__stream_encoder_set_loose_mid_side_stereo()... "); |
| 171 | if(!OggFLAC__stream_encoder_set_loose_mid_side_stereo(encoder, false)) |
| 172 | return die_s_("returned false", encoder); |
| 173 | printf("OK\n"); |
| 174 | |
| 175 | printf("testing OggFLAC__stream_encoder_set_channels()... "); |
| 176 | if(!OggFLAC__stream_encoder_set_channels(encoder, streaminfo_.data.stream_info.channels)) |
| 177 | return die_s_("returned false", encoder); |
| 178 | printf("OK\n"); |
| 179 | |
| 180 | printf("testing OggFLAC__stream_encoder_set_bits_per_sample()... "); |
| 181 | if(!OggFLAC__stream_encoder_set_bits_per_sample(encoder, streaminfo_.data.stream_info.bits_per_sample)) |
| 182 | return die_s_("returned false", encoder); |
| 183 | printf("OK\n"); |
| 184 | |
| 185 | printf("testing OggFLAC__stream_encoder_set_sample_rate()... "); |
| 186 | if(!OggFLAC__stream_encoder_set_sample_rate(encoder, streaminfo_.data.stream_info.sample_rate)) |
| 187 | return die_s_("returned false", encoder); |
| 188 | printf("OK\n"); |
| 189 | |
| 190 | printf("testing OggFLAC__stream_encoder_set_blocksize()... "); |
| 191 | if(!OggFLAC__stream_encoder_set_blocksize(encoder, streaminfo_.data.stream_info.min_blocksize)) |
| 192 | return die_s_("returned false", encoder); |
| 193 | printf("OK\n"); |
| 194 | |
| 195 | printf("testing OggFLAC__stream_encoder_set_max_lpc_order()... "); |
| 196 | if(!OggFLAC__stream_encoder_set_max_lpc_order(encoder, 0)) |
| 197 | return die_s_("returned false", encoder); |
| 198 | printf("OK\n"); |
| 199 | |
| 200 | printf("testing OggFLAC__stream_encoder_set_qlp_coeff_precision()... "); |
| 201 | if(!OggFLAC__stream_encoder_set_qlp_coeff_precision(encoder, 0)) |
| 202 | return die_s_("returned false", encoder); |
| 203 | printf("OK\n"); |
| 204 | |
| 205 | printf("testing OggFLAC__stream_encoder_set_do_qlp_coeff_prec_search()... "); |
| 206 | if(!OggFLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder, false)) |
| 207 | return die_s_("returned false", encoder); |
| 208 | printf("OK\n"); |
| 209 | |
| 210 | printf("testing OggFLAC__stream_encoder_set_do_escape_coding()... "); |
| 211 | if(!OggFLAC__stream_encoder_set_do_escape_coding(encoder, false)) |
| 212 | return die_s_("returned false", encoder); |
| 213 | printf("OK\n"); |
| 214 | |
| 215 | printf("testing OggFLAC__stream_encoder_set_do_exhaustive_model_search()... "); |
| 216 | if(!OggFLAC__stream_encoder_set_do_exhaustive_model_search(encoder, false)) |
| 217 | return die_s_("returned false", encoder); |
| 218 | printf("OK\n"); |
| 219 | |
| 220 | printf("testing OggFLAC__stream_encoder_set_min_residual_partition_order()... "); |
| 221 | if(!OggFLAC__stream_encoder_set_min_residual_partition_order(encoder, 0)) |
| 222 | return die_s_("returned false", encoder); |
| 223 | printf("OK\n"); |
| 224 | |
| 225 | printf("testing OggFLAC__stream_encoder_set_max_residual_partition_order()... "); |
| 226 | if(!OggFLAC__stream_encoder_set_max_residual_partition_order(encoder, 0)) |
| 227 | return die_s_("returned false", encoder); |
| 228 | printf("OK\n"); |
| 229 | |
| 230 | printf("testing OggFLAC__stream_encoder_set_rice_parameter_search_dist()... "); |
| 231 | if(!OggFLAC__stream_encoder_set_rice_parameter_search_dist(encoder, 0)) |
| 232 | return die_s_("returned false", encoder); |
| 233 | printf("OK\n"); |
| 234 | |
| 235 | printf("testing OggFLAC__stream_encoder_set_total_samples_estimate()... "); |
| 236 | if(!OggFLAC__stream_encoder_set_total_samples_estimate(encoder, streaminfo_.data.stream_info.total_samples)) |
| 237 | return die_s_("returned false", encoder); |
| 238 | printf("OK\n"); |
| 239 | |
| 240 | printf("testing OggFLAC__stream_encoder_set_metadata()... "); |
| 241 | if(!OggFLAC__stream_encoder_set_metadata(encoder, metadata_sequence_, num_metadata_)) |
| 242 | return die_s_("returned false", encoder); |
| 243 | printf("OK\n"); |
| 244 | |
| 245 | printf("testing OggFLAC__stream_encoder_set_write_callback()... "); |
| 246 | if(!OggFLAC__stream_encoder_set_write_callback(encoder, stream_encoder_write_callback_)) |
| 247 | return die_s_("returned false", encoder); |
| 248 | printf("OK\n"); |
| 249 | |
Josh Coalson | 8bd4884 | 2003-09-24 22:03:35 +0000 | [diff] [blame] | 250 | printf("testing OggFLAC__stream_encoder_set_metadata_callback()... "); |
| 251 | if(!OggFLAC__stream_encoder_set_metadata_callback(encoder, stream_encoder_metadata_callback_)) |
| 252 | return die_s_("returned false", encoder); |
| 253 | printf("OK\n"); |
| 254 | |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 255 | printf("testing OggFLAC__stream_encoder_set_client_data()... "); |
| 256 | if(!OggFLAC__stream_encoder_set_client_data(encoder, 0)) |
| 257 | return die_s_("returned false", encoder); |
| 258 | printf("OK\n"); |
| 259 | |
| 260 | printf("testing OggFLAC__stream_encoder_init()... "); |
| 261 | if(OggFLAC__stream_encoder_init(encoder) != FLAC__STREAM_ENCODER_OK) |
| 262 | return die_s_(0, encoder); |
| 263 | printf("OK\n"); |
| 264 | |
| 265 | printf("testing OggFLAC__stream_encoder_get_state()... "); |
| 266 | state = OggFLAC__stream_encoder_get_state(encoder); |
| 267 | printf("returned state = %u (%s)... OK\n", (unsigned)state, OggFLAC__StreamEncoderStateString[state]); |
| 268 | |
| 269 | printf("testing OggFLAC__stream_encoder_get_FLAC_stream_encoder_state()... "); |
Josh Coalson | 3c2bdf8 | 2003-09-26 01:56:01 +0000 | [diff] [blame] | 270 | fstate = OggFLAC__stream_encoder_get_FLAC_stream_encoder_state(encoder); |
| 271 | printf("returned state = %u (%s)... OK\n", (unsigned)fstate, FLAC__StreamEncoderStateString[fstate]); |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 272 | |
| 273 | printf("testing OggFLAC__stream_encoder_get_verify_decoder_state()... "); |
| 274 | dstate = OggFLAC__stream_encoder_get_verify_decoder_state(encoder); |
| 275 | printf("returned state = %u (%s)... OK\n", (unsigned)dstate, FLAC__StreamDecoderStateString[dstate]); |
| 276 | |
| 277 | { |
| 278 | FLAC__uint64 absolute_sample; |
| 279 | unsigned frame_number; |
| 280 | unsigned channel; |
| 281 | unsigned sample; |
| 282 | FLAC__int32 expected; |
| 283 | FLAC__int32 got; |
| 284 | |
| 285 | printf("testing OggFLAC__stream_encoder_get_verify_decoder_error_stats()... "); |
| 286 | OggFLAC__stream_encoder_get_verify_decoder_error_stats(encoder, &absolute_sample, &frame_number, &channel, &sample, &expected, &got); |
| 287 | printf("OK\n"); |
| 288 | } |
| 289 | |
| 290 | printf("testing OggFLAC__stream_encoder_get_verify()... "); |
| 291 | if(OggFLAC__stream_encoder_get_verify(encoder) != true) { |
| 292 | printf("FAILED, expected true, got false\n"); |
| 293 | return false; |
| 294 | } |
| 295 | printf("OK\n"); |
| 296 | |
| 297 | printf("testing OggFLAC__stream_encoder_get_streamable_subset()... "); |
| 298 | if(OggFLAC__stream_encoder_get_streamable_subset(encoder) != true) { |
| 299 | printf("FAILED, expected true, got false\n"); |
| 300 | return false; |
| 301 | } |
| 302 | printf("OK\n"); |
| 303 | |
| 304 | printf("testing OggFLAC__stream_encoder_get_do_mid_side_stereo()... "); |
| 305 | if(OggFLAC__stream_encoder_get_do_mid_side_stereo(encoder) != false) { |
| 306 | printf("FAILED, expected false, got true\n"); |
| 307 | return false; |
| 308 | } |
| 309 | printf("OK\n"); |
| 310 | |
| 311 | printf("testing OggFLAC__stream_encoder_get_loose_mid_side_stereo()... "); |
| 312 | if(OggFLAC__stream_encoder_get_loose_mid_side_stereo(encoder) != false) { |
| 313 | printf("FAILED, expected false, got true\n"); |
| 314 | return false; |
| 315 | } |
| 316 | printf("OK\n"); |
| 317 | |
| 318 | printf("testing OggFLAC__stream_encoder_get_channels()... "); |
| 319 | if(OggFLAC__stream_encoder_get_channels(encoder) != streaminfo_.data.stream_info.channels) { |
| 320 | printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.channels, OggFLAC__stream_encoder_get_channels(encoder)); |
| 321 | return false; |
| 322 | } |
| 323 | printf("OK\n"); |
| 324 | |
| 325 | printf("testing OggFLAC__stream_encoder_get_bits_per_sample()... "); |
| 326 | if(OggFLAC__stream_encoder_get_bits_per_sample(encoder) != streaminfo_.data.stream_info.bits_per_sample) { |
| 327 | printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.bits_per_sample, OggFLAC__stream_encoder_get_bits_per_sample(encoder)); |
| 328 | return false; |
| 329 | } |
| 330 | printf("OK\n"); |
| 331 | |
| 332 | printf("testing OggFLAC__stream_encoder_get_sample_rate()... "); |
| 333 | if(OggFLAC__stream_encoder_get_sample_rate(encoder) != streaminfo_.data.stream_info.sample_rate) { |
| 334 | printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.sample_rate, OggFLAC__stream_encoder_get_sample_rate(encoder)); |
| 335 | return false; |
| 336 | } |
| 337 | printf("OK\n"); |
| 338 | |
| 339 | printf("testing OggFLAC__stream_encoder_get_blocksize()... "); |
| 340 | if(OggFLAC__stream_encoder_get_blocksize(encoder) != streaminfo_.data.stream_info.min_blocksize) { |
| 341 | printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.min_blocksize, OggFLAC__stream_encoder_get_blocksize(encoder)); |
| 342 | return false; |
| 343 | } |
| 344 | printf("OK\n"); |
| 345 | |
| 346 | printf("testing OggFLAC__stream_encoder_get_max_lpc_order()... "); |
| 347 | if(OggFLAC__stream_encoder_get_max_lpc_order(encoder) != 0) { |
| 348 | printf("FAILED, expected %u, got %u\n", 0, OggFLAC__stream_encoder_get_max_lpc_order(encoder)); |
| 349 | return false; |
| 350 | } |
| 351 | printf("OK\n"); |
| 352 | |
| 353 | printf("testing OggFLAC__stream_encoder_get_qlp_coeff_precision()... "); |
| 354 | (void)OggFLAC__stream_encoder_get_qlp_coeff_precision(encoder); |
| 355 | /* we asked the encoder to auto select this so we accept anything */ |
| 356 | printf("OK\n"); |
| 357 | |
| 358 | printf("testing OggFLAC__stream_encoder_get_do_qlp_coeff_prec_search()... "); |
| 359 | if(OggFLAC__stream_encoder_get_do_qlp_coeff_prec_search(encoder) != false) { |
| 360 | printf("FAILED, expected false, got true\n"); |
| 361 | return false; |
| 362 | } |
| 363 | printf("OK\n"); |
| 364 | |
| 365 | printf("testing OggFLAC__stream_encoder_get_do_escape_coding()... "); |
| 366 | if(OggFLAC__stream_encoder_get_do_escape_coding(encoder) != false) { |
| 367 | printf("FAILED, expected false, got true\n"); |
| 368 | return false; |
| 369 | } |
| 370 | printf("OK\n"); |
| 371 | |
| 372 | printf("testing OggFLAC__stream_encoder_get_do_exhaustive_model_search()... "); |
| 373 | if(OggFLAC__stream_encoder_get_do_exhaustive_model_search(encoder) != false) { |
| 374 | printf("FAILED, expected false, got true\n"); |
| 375 | return false; |
| 376 | } |
| 377 | printf("OK\n"); |
| 378 | |
| 379 | printf("testing OggFLAC__stream_encoder_get_min_residual_partition_order()... "); |
| 380 | if(OggFLAC__stream_encoder_get_min_residual_partition_order(encoder) != 0) { |
| 381 | printf("FAILED, expected %u, got %u\n", 0, OggFLAC__stream_encoder_get_min_residual_partition_order(encoder)); |
| 382 | return false; |
| 383 | } |
| 384 | printf("OK\n"); |
| 385 | |
| 386 | printf("testing OggFLAC__stream_encoder_get_max_residual_partition_order()... "); |
| 387 | if(OggFLAC__stream_encoder_get_max_residual_partition_order(encoder) != 0) { |
| 388 | printf("FAILED, expected %u, got %u\n", 0, OggFLAC__stream_encoder_get_max_residual_partition_order(encoder)); |
| 389 | return false; |
| 390 | } |
| 391 | printf("OK\n"); |
| 392 | |
| 393 | printf("testing OggFLAC__stream_encoder_get_rice_parameter_search_dist()... "); |
| 394 | if(OggFLAC__stream_encoder_get_rice_parameter_search_dist(encoder) != 0) { |
| 395 | printf("FAILED, expected %u, got %u\n", 0, OggFLAC__stream_encoder_get_rice_parameter_search_dist(encoder)); |
| 396 | return false; |
| 397 | } |
| 398 | printf("OK\n"); |
| 399 | |
| 400 | printf("testing OggFLAC__stream_encoder_get_total_samples_estimate()... "); |
| 401 | if(OggFLAC__stream_encoder_get_total_samples_estimate(encoder) != streaminfo_.data.stream_info.total_samples) { |
| 402 | printf("FAILED, expected %llu, got %llu\n", streaminfo_.data.stream_info.total_samples, OggFLAC__stream_encoder_get_total_samples_estimate(encoder)); |
| 403 | return false; |
| 404 | } |
| 405 | printf("OK\n"); |
| 406 | |
| 407 | /* init the dummy sample buffer */ |
| 408 | for(i = 0; i < sizeof(samples) / sizeof(FLAC__int32); i++) |
| 409 | samples[i] = i & 7; |
| 410 | |
| 411 | printf("testing OggFLAC__stream_encoder_process()... "); |
| 412 | if(!OggFLAC__stream_encoder_process(encoder, (const FLAC__int32 * const *)samples_array, sizeof(samples) / sizeof(FLAC__int32))) |
| 413 | return die_s_("returned false", encoder); |
| 414 | printf("OK\n"); |
| 415 | |
| 416 | printf("testing OggFLAC__stream_encoder_process_interleaved()... "); |
| 417 | if(!OggFLAC__stream_encoder_process_interleaved(encoder, samples, sizeof(samples) / sizeof(FLAC__int32))) |
| 418 | return die_s_("returned false", encoder); |
| 419 | printf("OK\n"); |
| 420 | |
| 421 | printf("testing OggFLAC__stream_encoder_finish()... "); |
| 422 | OggFLAC__stream_encoder_finish(encoder); |
| 423 | printf("OK\n"); |
| 424 | |
| 425 | printf("testing OggFLAC__stream_encoder_delete()... "); |
| 426 | OggFLAC__stream_encoder_delete(encoder); |
| 427 | printf("OK\n"); |
| 428 | |
| 429 | printf("\nPASSED!\n"); |
| 430 | |
| 431 | return true; |
| 432 | } |
| 433 | |
Josh Coalson | e6d52b0 | 2004-01-17 03:52:59 +0000 | [diff] [blame] | 434 | OggFLAC__SeekableStreamEncoderReadStatus seekable_stream_encoder_read_callback_(const OggFLAC__SeekableStreamEncoder *encoder, FLAC__byte buffer[], unsigned *bytes, void *client_data) |
| 435 | { |
| 436 | (void)encoder, (void)buffer, (void)bytes, (void)client_data; |
Josh Coalson | cc75611 | 2004-07-16 00:34:42 +0000 | [diff] [blame] | 437 | memset(buffer, 0, *bytes); /* init buffer to avoid valgrind errors */ |
Josh Coalson | e6d52b0 | 2004-01-17 03:52:59 +0000 | [diff] [blame] | 438 | return OggFLAC__SEEKABLE_STREAM_ENCODER_READ_STATUS_CONTINUE; |
| 439 | } |
| 440 | |
Josh Coalson | 3c2bdf8 | 2003-09-26 01:56:01 +0000 | [diff] [blame] | 441 | FLAC__SeekableStreamEncoderSeekStatus seekable_stream_encoder_seek_callback_(const OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data) |
| 442 | { |
| 443 | (void)encoder, (void)absolute_byte_offset, (void)client_data; |
| 444 | return FLAC__SEEKABLE_STREAM_ENCODER_SEEK_STATUS_OK; |
| 445 | } |
| 446 | |
| 447 | FLAC__SeekableStreamEncoderTellStatus seekable_stream_encoder_tell_callback_(const OggFLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data) |
| 448 | { |
Josh Coalson | 575c171 | 2003-12-30 03:44:12 +0000 | [diff] [blame] | 449 | (void)encoder, (void)client_data; |
| 450 | *absolute_byte_offset = 0; |
Josh Coalson | 3c2bdf8 | 2003-09-26 01:56:01 +0000 | [diff] [blame] | 451 | return FLAC__SEEKABLE_STREAM_ENCODER_TELL_STATUS_OK; |
| 452 | } |
| 453 | |
| 454 | FLAC__StreamEncoderWriteStatus seekable_stream_encoder_write_callback_(const OggFLAC__SeekableStreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data) |
| 455 | { |
| 456 | (void)encoder, (void)buffer, (void)bytes, (void)samples, (void)current_frame, (void)client_data; |
| 457 | return FLAC__STREAM_ENCODER_WRITE_STATUS_OK; |
| 458 | } |
| 459 | |
| 460 | static FLAC__bool test_seekable_stream_encoder() |
| 461 | { |
| 462 | OggFLAC__SeekableStreamEncoder *encoder; |
| 463 | OggFLAC__SeekableStreamEncoderState state; |
Josh Coalson | 3c2bdf8 | 2003-09-26 01:56:01 +0000 | [diff] [blame] | 464 | FLAC__StreamEncoderState fstate; |
| 465 | FLAC__StreamDecoderState dstate; |
| 466 | FLAC__int32 samples[1024]; |
| 467 | FLAC__int32 *samples_array[1]; |
| 468 | unsigned i; |
| 469 | |
| 470 | samples_array[0] = samples; |
| 471 | |
| 472 | printf("\n+++ libOggFLAC unit test: OggFLAC__SeekableStreamEncoder\n\n"); |
| 473 | |
| 474 | printf("testing OggFLAC__seekable_stream_encoder_new()... "); |
| 475 | encoder = OggFLAC__seekable_stream_encoder_new(); |
| 476 | if(0 == encoder) { |
| 477 | printf("FAILED, returned NULL\n"); |
| 478 | return false; |
| 479 | } |
| 480 | printf("OK\n"); |
| 481 | |
| 482 | printf("testing OggFLAC__seekable_stream_encoder_set_serial_number()... "); |
| 483 | if(!OggFLAC__seekable_stream_encoder_set_serial_number(encoder, file_utils__serial_number)) |
| 484 | return die_ss_("returned false", encoder); |
| 485 | printf("OK\n"); |
| 486 | |
| 487 | printf("testing OggFLAC__seekable_stream_encoder_set_verify()... "); |
| 488 | if(!OggFLAC__seekable_stream_encoder_set_verify(encoder, true)) |
| 489 | return die_ss_("returned false", encoder); |
| 490 | printf("OK\n"); |
| 491 | |
| 492 | printf("testing OggFLAC__seekable_stream_encoder_set_streamable_subset()... "); |
| 493 | if(!OggFLAC__seekable_stream_encoder_set_streamable_subset(encoder, true)) |
| 494 | return die_ss_("returned false", encoder); |
| 495 | printf("OK\n"); |
| 496 | |
| 497 | printf("testing OggFLAC__seekable_stream_encoder_set_do_mid_side_stereo()... "); |
| 498 | if(!OggFLAC__seekable_stream_encoder_set_do_mid_side_stereo(encoder, false)) |
| 499 | return die_ss_("returned false", encoder); |
| 500 | printf("OK\n"); |
| 501 | |
| 502 | printf("testing OggFLAC__seekable_stream_encoder_set_loose_mid_side_stereo()... "); |
| 503 | if(!OggFLAC__seekable_stream_encoder_set_loose_mid_side_stereo(encoder, false)) |
| 504 | return die_ss_("returned false", encoder); |
| 505 | printf("OK\n"); |
| 506 | |
| 507 | printf("testing OggFLAC__seekable_stream_encoder_set_channels()... "); |
| 508 | if(!OggFLAC__seekable_stream_encoder_set_channels(encoder, streaminfo_.data.stream_info.channels)) |
| 509 | return die_ss_("returned false", encoder); |
| 510 | printf("OK\n"); |
| 511 | |
| 512 | printf("testing OggFLAC__seekable_stream_encoder_set_bits_per_sample()... "); |
| 513 | if(!OggFLAC__seekable_stream_encoder_set_bits_per_sample(encoder, streaminfo_.data.stream_info.bits_per_sample)) |
| 514 | return die_ss_("returned false", encoder); |
| 515 | printf("OK\n"); |
| 516 | |
| 517 | printf("testing OggFLAC__seekable_stream_encoder_set_sample_rate()... "); |
| 518 | if(!OggFLAC__seekable_stream_encoder_set_sample_rate(encoder, streaminfo_.data.stream_info.sample_rate)) |
| 519 | return die_ss_("returned false", encoder); |
| 520 | printf("OK\n"); |
| 521 | |
| 522 | printf("testing OggFLAC__seekable_stream_encoder_set_blocksize()... "); |
| 523 | if(!OggFLAC__seekable_stream_encoder_set_blocksize(encoder, streaminfo_.data.stream_info.min_blocksize)) |
| 524 | return die_ss_("returned false", encoder); |
| 525 | printf("OK\n"); |
| 526 | |
| 527 | printf("testing OggFLAC__seekable_stream_encoder_set_max_lpc_order()... "); |
| 528 | if(!OggFLAC__seekable_stream_encoder_set_max_lpc_order(encoder, 0)) |
| 529 | return die_ss_("returned false", encoder); |
| 530 | printf("OK\n"); |
| 531 | |
| 532 | printf("testing OggFLAC__seekable_stream_encoder_set_qlp_coeff_precision()... "); |
| 533 | if(!OggFLAC__seekable_stream_encoder_set_qlp_coeff_precision(encoder, 0)) |
| 534 | return die_ss_("returned false", encoder); |
| 535 | printf("OK\n"); |
| 536 | |
| 537 | printf("testing OggFLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search()... "); |
| 538 | if(!OggFLAC__seekable_stream_encoder_set_do_qlp_coeff_prec_search(encoder, false)) |
| 539 | return die_ss_("returned false", encoder); |
| 540 | printf("OK\n"); |
| 541 | |
| 542 | printf("testing OggFLAC__seekable_stream_encoder_set_do_escape_coding()... "); |
| 543 | if(!OggFLAC__seekable_stream_encoder_set_do_escape_coding(encoder, false)) |
| 544 | return die_ss_("returned false", encoder); |
| 545 | printf("OK\n"); |
| 546 | |
| 547 | printf("testing OggFLAC__seekable_stream_encoder_set_do_exhaustive_model_search()... "); |
| 548 | if(!OggFLAC__seekable_stream_encoder_set_do_exhaustive_model_search(encoder, false)) |
| 549 | return die_ss_("returned false", encoder); |
| 550 | printf("OK\n"); |
| 551 | |
| 552 | printf("testing OggFLAC__seekable_stream_encoder_set_min_residual_partition_order()... "); |
| 553 | if(!OggFLAC__seekable_stream_encoder_set_min_residual_partition_order(encoder, 0)) |
| 554 | return die_ss_("returned false", encoder); |
| 555 | printf("OK\n"); |
| 556 | |
| 557 | printf("testing OggFLAC__seekable_stream_encoder_set_max_residual_partition_order()... "); |
| 558 | if(!OggFLAC__seekable_stream_encoder_set_max_residual_partition_order(encoder, 0)) |
| 559 | return die_ss_("returned false", encoder); |
| 560 | printf("OK\n"); |
| 561 | |
| 562 | printf("testing OggFLAC__seekable_stream_encoder_set_rice_parameter_search_dist()... "); |
| 563 | if(!OggFLAC__seekable_stream_encoder_set_rice_parameter_search_dist(encoder, 0)) |
| 564 | return die_ss_("returned false", encoder); |
| 565 | printf("OK\n"); |
| 566 | |
| 567 | printf("testing OggFLAC__seekable_stream_encoder_set_total_samples_estimate()... "); |
| 568 | if(!OggFLAC__seekable_stream_encoder_set_total_samples_estimate(encoder, streaminfo_.data.stream_info.total_samples)) |
| 569 | return die_ss_("returned false", encoder); |
| 570 | printf("OK\n"); |
| 571 | |
| 572 | printf("testing OggFLAC__seekable_stream_encoder_set_metadata()... "); |
| 573 | if(!OggFLAC__seekable_stream_encoder_set_metadata(encoder, metadata_sequence_, num_metadata_)) |
| 574 | return die_ss_("returned false", encoder); |
| 575 | printf("OK\n"); |
| 576 | |
Josh Coalson | e6d52b0 | 2004-01-17 03:52:59 +0000 | [diff] [blame] | 577 | printf("testing OggFLAC__seekable_stream_encoder_set_read_callback()... "); |
| 578 | if(!OggFLAC__seekable_stream_encoder_set_read_callback(encoder, seekable_stream_encoder_read_callback_)) |
| 579 | return die_ss_("returned false", encoder); |
| 580 | printf("OK\n"); |
| 581 | |
Josh Coalson | 3c2bdf8 | 2003-09-26 01:56:01 +0000 | [diff] [blame] | 582 | printf("testing OggFLAC__seekable_stream_encoder_set_seek_callback()... "); |
| 583 | if(!OggFLAC__seekable_stream_encoder_set_seek_callback(encoder, seekable_stream_encoder_seek_callback_)) |
| 584 | return die_ss_("returned false", encoder); |
| 585 | printf("OK\n"); |
| 586 | |
| 587 | printf("testing OggFLAC__seekable_stream_encoder_set_tell_callback()... "); |
| 588 | if(!OggFLAC__seekable_stream_encoder_set_tell_callback(encoder, seekable_stream_encoder_tell_callback_)) |
| 589 | return die_ss_("returned false", encoder); |
| 590 | printf("OK\n"); |
| 591 | |
| 592 | printf("testing OggFLAC__seekable_stream_encoder_set_write_callback()... "); |
| 593 | if(!OggFLAC__seekable_stream_encoder_set_write_callback(encoder, seekable_stream_encoder_write_callback_)) |
| 594 | return die_ss_("returned false", encoder); |
| 595 | printf("OK\n"); |
| 596 | |
| 597 | printf("testing OggFLAC__seekable_stream_encoder_set_client_data()... "); |
| 598 | if(!OggFLAC__seekable_stream_encoder_set_client_data(encoder, 0)) |
| 599 | return die_ss_("returned false", encoder); |
| 600 | printf("OK\n"); |
| 601 | |
| 602 | printf("testing OggFLAC__seekable_stream_encoder_init()... "); |
| 603 | if(OggFLAC__seekable_stream_encoder_init(encoder) != OggFLAC__SEEKABLE_STREAM_ENCODER_OK) |
| 604 | return die_ss_(0, encoder); |
| 605 | printf("OK\n"); |
| 606 | |
| 607 | printf("testing OggFLAC__seekable_stream_encoder_get_state()... "); |
| 608 | state = OggFLAC__seekable_stream_encoder_get_state(encoder); |
| 609 | printf("returned state = %u (%s)... OK\n", (unsigned)state, OggFLAC__SeekableStreamEncoderStateString[state]); |
| 610 | |
Josh Coalson | 3c2bdf8 | 2003-09-26 01:56:01 +0000 | [diff] [blame] | 611 | printf("testing OggFLAC__seekable_stream_encoder_get_FLAC_stream_encoder_state()... "); |
| 612 | fstate = OggFLAC__seekable_stream_encoder_get_FLAC_stream_encoder_state(encoder); |
| 613 | printf("returned state = %u (%s)... OK\n", (unsigned)fstate, FLAC__StreamEncoderStateString[fstate]); |
| 614 | |
| 615 | printf("testing OggFLAC__seekable_stream_encoder_get_verify_decoder_state()... "); |
| 616 | dstate = OggFLAC__seekable_stream_encoder_get_verify_decoder_state(encoder); |
| 617 | printf("returned state = %u (%s)... OK\n", (unsigned)dstate, FLAC__StreamDecoderStateString[dstate]); |
| 618 | |
| 619 | { |
| 620 | FLAC__uint64 absolute_sample; |
| 621 | unsigned frame_number; |
| 622 | unsigned channel; |
| 623 | unsigned sample; |
| 624 | FLAC__int32 expected; |
| 625 | FLAC__int32 got; |
| 626 | |
| 627 | printf("testing OggFLAC__seekable_stream_encoder_get_verify_decoder_error_stats()... "); |
| 628 | OggFLAC__seekable_stream_encoder_get_verify_decoder_error_stats(encoder, &absolute_sample, &frame_number, &channel, &sample, &expected, &got); |
| 629 | printf("OK\n"); |
| 630 | } |
| 631 | |
| 632 | printf("testing OggFLAC__seekable_stream_encoder_get_verify()... "); |
| 633 | if(OggFLAC__seekable_stream_encoder_get_verify(encoder) != true) { |
| 634 | printf("FAILED, expected true, got false\n"); |
| 635 | return false; |
| 636 | } |
| 637 | printf("OK\n"); |
| 638 | |
| 639 | printf("testing OggFLAC__seekable_stream_encoder_get_streamable_subset()... "); |
| 640 | if(OggFLAC__seekable_stream_encoder_get_streamable_subset(encoder) != true) { |
| 641 | printf("FAILED, expected true, got false\n"); |
| 642 | return false; |
| 643 | } |
| 644 | printf("OK\n"); |
| 645 | |
| 646 | printf("testing OggFLAC__seekable_stream_encoder_get_do_mid_side_stereo()... "); |
| 647 | if(OggFLAC__seekable_stream_encoder_get_do_mid_side_stereo(encoder) != false) { |
| 648 | printf("FAILED, expected false, got true\n"); |
| 649 | return false; |
| 650 | } |
| 651 | printf("OK\n"); |
| 652 | |
| 653 | printf("testing OggFLAC__seekable_stream_encoder_get_loose_mid_side_stereo()... "); |
| 654 | if(OggFLAC__seekable_stream_encoder_get_loose_mid_side_stereo(encoder) != false) { |
| 655 | printf("FAILED, expected false, got true\n"); |
| 656 | return false; |
| 657 | } |
| 658 | printf("OK\n"); |
| 659 | |
| 660 | printf("testing OggFLAC__seekable_stream_encoder_get_channels()... "); |
| 661 | if(OggFLAC__seekable_stream_encoder_get_channels(encoder) != streaminfo_.data.stream_info.channels) { |
| 662 | printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.channels, OggFLAC__seekable_stream_encoder_get_channels(encoder)); |
| 663 | return false; |
| 664 | } |
| 665 | printf("OK\n"); |
| 666 | |
| 667 | printf("testing OggFLAC__seekable_stream_encoder_get_bits_per_sample()... "); |
| 668 | if(OggFLAC__seekable_stream_encoder_get_bits_per_sample(encoder) != streaminfo_.data.stream_info.bits_per_sample) { |
| 669 | printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.bits_per_sample, OggFLAC__seekable_stream_encoder_get_bits_per_sample(encoder)); |
| 670 | return false; |
| 671 | } |
| 672 | printf("OK\n"); |
| 673 | |
| 674 | printf("testing OggFLAC__seekable_stream_encoder_get_sample_rate()... "); |
| 675 | if(OggFLAC__seekable_stream_encoder_get_sample_rate(encoder) != streaminfo_.data.stream_info.sample_rate) { |
| 676 | printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.sample_rate, OggFLAC__seekable_stream_encoder_get_sample_rate(encoder)); |
| 677 | return false; |
| 678 | } |
| 679 | printf("OK\n"); |
| 680 | |
| 681 | printf("testing OggFLAC__seekable_stream_encoder_get_blocksize()... "); |
| 682 | if(OggFLAC__seekable_stream_encoder_get_blocksize(encoder) != streaminfo_.data.stream_info.min_blocksize) { |
| 683 | printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.min_blocksize, OggFLAC__seekable_stream_encoder_get_blocksize(encoder)); |
| 684 | return false; |
| 685 | } |
| 686 | printf("OK\n"); |
| 687 | |
| 688 | printf("testing OggFLAC__seekable_stream_encoder_get_max_lpc_order()... "); |
| 689 | if(OggFLAC__seekable_stream_encoder_get_max_lpc_order(encoder) != 0) { |
| 690 | printf("FAILED, expected %u, got %u\n", 0, OggFLAC__seekable_stream_encoder_get_max_lpc_order(encoder)); |
| 691 | return false; |
| 692 | } |
| 693 | printf("OK\n"); |
| 694 | |
| 695 | printf("testing OggFLAC__seekable_stream_encoder_get_qlp_coeff_precision()... "); |
| 696 | (void)OggFLAC__seekable_stream_encoder_get_qlp_coeff_precision(encoder); |
| 697 | /* we asked the encoder to auto select this so we accept anything */ |
| 698 | printf("OK\n"); |
| 699 | |
| 700 | printf("testing OggFLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search()... "); |
| 701 | if(OggFLAC__seekable_stream_encoder_get_do_qlp_coeff_prec_search(encoder) != false) { |
| 702 | printf("FAILED, expected false, got true\n"); |
| 703 | return false; |
| 704 | } |
| 705 | printf("OK\n"); |
| 706 | |
| 707 | printf("testing OggFLAC__seekable_stream_encoder_get_do_escape_coding()... "); |
| 708 | if(OggFLAC__seekable_stream_encoder_get_do_escape_coding(encoder) != false) { |
| 709 | printf("FAILED, expected false, got true\n"); |
| 710 | return false; |
| 711 | } |
| 712 | printf("OK\n"); |
| 713 | |
| 714 | printf("testing OggFLAC__seekable_stream_encoder_get_do_exhaustive_model_search()... "); |
| 715 | if(OggFLAC__seekable_stream_encoder_get_do_exhaustive_model_search(encoder) != false) { |
| 716 | printf("FAILED, expected false, got true\n"); |
| 717 | return false; |
| 718 | } |
| 719 | printf("OK\n"); |
| 720 | |
| 721 | printf("testing OggFLAC__seekable_stream_encoder_get_min_residual_partition_order()... "); |
| 722 | if(OggFLAC__seekable_stream_encoder_get_min_residual_partition_order(encoder) != 0) { |
| 723 | printf("FAILED, expected %u, got %u\n", 0, OggFLAC__seekable_stream_encoder_get_min_residual_partition_order(encoder)); |
| 724 | return false; |
| 725 | } |
| 726 | printf("OK\n"); |
| 727 | |
| 728 | printf("testing OggFLAC__seekable_stream_encoder_get_max_residual_partition_order()... "); |
| 729 | if(OggFLAC__seekable_stream_encoder_get_max_residual_partition_order(encoder) != 0) { |
| 730 | printf("FAILED, expected %u, got %u\n", 0, OggFLAC__seekable_stream_encoder_get_max_residual_partition_order(encoder)); |
| 731 | return false; |
| 732 | } |
| 733 | printf("OK\n"); |
| 734 | |
| 735 | printf("testing OggFLAC__seekable_stream_encoder_get_rice_parameter_search_dist()... "); |
| 736 | if(OggFLAC__seekable_stream_encoder_get_rice_parameter_search_dist(encoder) != 0) { |
| 737 | printf("FAILED, expected %u, got %u\n", 0, OggFLAC__seekable_stream_encoder_get_rice_parameter_search_dist(encoder)); |
| 738 | return false; |
| 739 | } |
| 740 | printf("OK\n"); |
| 741 | |
| 742 | printf("testing OggFLAC__seekable_stream_encoder_get_total_samples_estimate()... "); |
| 743 | if(OggFLAC__seekable_stream_encoder_get_total_samples_estimate(encoder) != streaminfo_.data.stream_info.total_samples) { |
| 744 | printf("FAILED, expected %llu, got %llu\n", streaminfo_.data.stream_info.total_samples, OggFLAC__seekable_stream_encoder_get_total_samples_estimate(encoder)); |
| 745 | return false; |
| 746 | } |
| 747 | printf("OK\n"); |
| 748 | |
| 749 | /* init the dummy sample buffer */ |
| 750 | for(i = 0; i < sizeof(samples) / sizeof(FLAC__int32); i++) |
| 751 | samples[i] = i & 7; |
| 752 | |
| 753 | printf("testing OggFLAC__seekable_stream_encoder_process()... "); |
| 754 | if(!OggFLAC__seekable_stream_encoder_process(encoder, (const FLAC__int32 * const *)samples_array, sizeof(samples) / sizeof(FLAC__int32))) |
| 755 | return die_ss_("returned false", encoder); |
| 756 | printf("OK\n"); |
| 757 | |
| 758 | printf("testing OggFLAC__seekable_stream_encoder_process_interleaved()... "); |
| 759 | if(!OggFLAC__seekable_stream_encoder_process_interleaved(encoder, samples, sizeof(samples) / sizeof(FLAC__int32))) |
| 760 | return die_ss_("returned false", encoder); |
| 761 | printf("OK\n"); |
| 762 | |
| 763 | printf("testing OggFLAC__seekable_stream_encoder_finish()... "); |
| 764 | OggFLAC__seekable_stream_encoder_finish(encoder); |
| 765 | printf("OK\n"); |
| 766 | |
| 767 | printf("testing OggFLAC__seekable_stream_encoder_delete()... "); |
| 768 | OggFLAC__seekable_stream_encoder_delete(encoder); |
| 769 | printf("OK\n"); |
| 770 | |
| 771 | printf("\nPASSED!\n"); |
| 772 | |
| 773 | return true; |
| 774 | } |
| 775 | |
| 776 | static void file_encoder_progress_callback_(const OggFLAC__FileEncoder *encoder, FLAC__uint64 bytes_written, FLAC__uint64 samples_written, unsigned frames_written, unsigned total_frames_estimate, void *client_data) |
| 777 | { |
| 778 | (void)encoder, (void)bytes_written, (void)samples_written, (void)frames_written, (void)total_frames_estimate, (void)client_data; |
| 779 | } |
| 780 | |
| 781 | static FLAC__bool test_file_encoder() |
| 782 | { |
| 783 | OggFLAC__FileEncoder *encoder; |
| 784 | OggFLAC__FileEncoderState state; |
| 785 | OggFLAC__SeekableStreamEncoderState sstate; |
Josh Coalson | 3c2bdf8 | 2003-09-26 01:56:01 +0000 | [diff] [blame] | 786 | FLAC__StreamEncoderState fstate; |
| 787 | FLAC__StreamDecoderState dstate; |
| 788 | FLAC__int32 samples[1024]; |
| 789 | FLAC__int32 *samples_array[1]; |
| 790 | unsigned i; |
| 791 | |
| 792 | samples_array[0] = samples; |
| 793 | |
| 794 | printf("\n+++ libOggFLAC unit test: OggFLAC__FileEncoder\n\n"); |
| 795 | |
| 796 | printf("testing OggFLAC__file_encoder_new()... "); |
| 797 | encoder = OggFLAC__file_encoder_new(); |
| 798 | if(0 == encoder) { |
| 799 | printf("FAILED, returned NULL\n"); |
| 800 | return false; |
| 801 | } |
| 802 | printf("OK\n"); |
| 803 | |
| 804 | printf("testing OggFLAC__file_encoder_set_serial_number()... "); |
| 805 | if(!OggFLAC__file_encoder_set_serial_number(encoder, file_utils__serial_number)) |
| 806 | return die_f_("returned false", encoder); |
| 807 | printf("OK\n"); |
| 808 | |
| 809 | printf("testing OggFLAC__file_encoder_set_verify()... "); |
| 810 | if(!OggFLAC__file_encoder_set_verify(encoder, true)) |
| 811 | return die_f_("returned false", encoder); |
| 812 | printf("OK\n"); |
| 813 | |
| 814 | printf("testing OggFLAC__file_encoder_set_streamable_subset()... "); |
| 815 | if(!OggFLAC__file_encoder_set_streamable_subset(encoder, true)) |
| 816 | return die_f_("returned false", encoder); |
| 817 | printf("OK\n"); |
| 818 | |
| 819 | printf("testing OggFLAC__file_encoder_set_do_mid_side_stereo()... "); |
| 820 | if(!OggFLAC__file_encoder_set_do_mid_side_stereo(encoder, false)) |
| 821 | return die_f_("returned false", encoder); |
| 822 | printf("OK\n"); |
| 823 | |
| 824 | printf("testing OggFLAC__file_encoder_set_loose_mid_side_stereo()... "); |
| 825 | if(!OggFLAC__file_encoder_set_loose_mid_side_stereo(encoder, false)) |
| 826 | return die_f_("returned false", encoder); |
| 827 | printf("OK\n"); |
| 828 | |
| 829 | printf("testing OggFLAC__file_encoder_set_channels()... "); |
| 830 | if(!OggFLAC__file_encoder_set_channels(encoder, streaminfo_.data.stream_info.channels)) |
| 831 | return die_f_("returned false", encoder); |
| 832 | printf("OK\n"); |
| 833 | |
| 834 | printf("testing OggFLAC__file_encoder_set_bits_per_sample()... "); |
| 835 | if(!OggFLAC__file_encoder_set_bits_per_sample(encoder, streaminfo_.data.stream_info.bits_per_sample)) |
| 836 | return die_f_("returned false", encoder); |
| 837 | printf("OK\n"); |
| 838 | |
| 839 | printf("testing OggFLAC__file_encoder_set_sample_rate()... "); |
| 840 | if(!OggFLAC__file_encoder_set_sample_rate(encoder, streaminfo_.data.stream_info.sample_rate)) |
| 841 | return die_f_("returned false", encoder); |
| 842 | printf("OK\n"); |
| 843 | |
| 844 | printf("testing OggFLAC__file_encoder_set_blocksize()... "); |
| 845 | if(!OggFLAC__file_encoder_set_blocksize(encoder, streaminfo_.data.stream_info.min_blocksize)) |
| 846 | return die_f_("returned false", encoder); |
| 847 | printf("OK\n"); |
| 848 | |
| 849 | printf("testing OggFLAC__file_encoder_set_max_lpc_order()... "); |
| 850 | if(!OggFLAC__file_encoder_set_max_lpc_order(encoder, 0)) |
| 851 | return die_f_("returned false", encoder); |
| 852 | printf("OK\n"); |
| 853 | |
| 854 | printf("testing OggFLAC__file_encoder_set_qlp_coeff_precision()... "); |
| 855 | if(!OggFLAC__file_encoder_set_qlp_coeff_precision(encoder, 0)) |
| 856 | return die_f_("returned false", encoder); |
| 857 | printf("OK\n"); |
| 858 | |
| 859 | printf("testing OggFLAC__file_encoder_set_do_qlp_coeff_prec_search()... "); |
| 860 | if(!OggFLAC__file_encoder_set_do_qlp_coeff_prec_search(encoder, false)) |
| 861 | return die_f_("returned false", encoder); |
| 862 | printf("OK\n"); |
| 863 | |
| 864 | printf("testing OggFLAC__file_encoder_set_do_escape_coding()... "); |
| 865 | if(!OggFLAC__file_encoder_set_do_escape_coding(encoder, false)) |
| 866 | return die_f_("returned false", encoder); |
| 867 | printf("OK\n"); |
| 868 | |
| 869 | printf("testing OggFLAC__file_encoder_set_do_exhaustive_model_search()... "); |
| 870 | if(!OggFLAC__file_encoder_set_do_exhaustive_model_search(encoder, false)) |
| 871 | return die_f_("returned false", encoder); |
| 872 | printf("OK\n"); |
| 873 | |
| 874 | printf("testing OggFLAC__file_encoder_set_min_residual_partition_order()... "); |
| 875 | if(!OggFLAC__file_encoder_set_min_residual_partition_order(encoder, 0)) |
| 876 | return die_f_("returned false", encoder); |
| 877 | printf("OK\n"); |
| 878 | |
| 879 | printf("testing OggFLAC__file_encoder_set_max_residual_partition_order()... "); |
| 880 | if(!OggFLAC__file_encoder_set_max_residual_partition_order(encoder, 0)) |
| 881 | return die_f_("returned false", encoder); |
| 882 | printf("OK\n"); |
| 883 | |
| 884 | printf("testing OggFLAC__file_encoder_set_rice_parameter_search_dist()... "); |
| 885 | if(!OggFLAC__file_encoder_set_rice_parameter_search_dist(encoder, 0)) |
| 886 | return die_f_("returned false", encoder); |
| 887 | printf("OK\n"); |
| 888 | |
| 889 | printf("testing OggFLAC__file_encoder_set_total_samples_estimate()... "); |
| 890 | if(!OggFLAC__file_encoder_set_total_samples_estimate(encoder, streaminfo_.data.stream_info.total_samples)) |
| 891 | return die_f_("returned false", encoder); |
| 892 | printf("OK\n"); |
| 893 | |
| 894 | printf("testing OggFLAC__file_encoder_set_metadata()... "); |
| 895 | if(!OggFLAC__file_encoder_set_metadata(encoder, metadata_sequence_, num_metadata_)) |
| 896 | return die_f_("returned false", encoder); |
| 897 | printf("OK\n"); |
| 898 | |
| 899 | printf("testing OggFLAC__file_encoder_set_filename()... "); |
| 900 | if(!OggFLAC__file_encoder_set_filename(encoder, oggflacfilename_)) |
| 901 | return die_f_("returned false", encoder); |
| 902 | printf("OK\n"); |
| 903 | |
| 904 | printf("testing OggFLAC__file_encoder_set_progress_callback()... "); |
| 905 | if(!OggFLAC__file_encoder_set_progress_callback(encoder, file_encoder_progress_callback_)) |
| 906 | return die_f_("returned false", encoder); |
| 907 | printf("OK\n"); |
| 908 | |
| 909 | printf("testing OggFLAC__file_encoder_set_client_data()... "); |
| 910 | if(!OggFLAC__file_encoder_set_client_data(encoder, 0)) |
| 911 | return die_f_("returned false", encoder); |
| 912 | printf("OK\n"); |
| 913 | |
| 914 | printf("testing OggFLAC__file_encoder_init()... "); |
| 915 | if(OggFLAC__file_encoder_init(encoder) != OggFLAC__FILE_ENCODER_OK) |
| 916 | return die_f_(0, encoder); |
| 917 | printf("OK\n"); |
| 918 | |
| 919 | printf("testing OggFLAC__file_encoder_get_state()... "); |
| 920 | state = OggFLAC__file_encoder_get_state(encoder); |
| 921 | printf("returned state = %u (%s)... OK\n", (unsigned)state, OggFLAC__FileEncoderStateString[state]); |
| 922 | |
| 923 | printf("testing OggFLAC__file_encoder_get_seekable_stream_encoder_state()... "); |
| 924 | sstate = OggFLAC__file_encoder_get_seekable_stream_encoder_state(encoder); |
| 925 | printf("returned state = %u (%s)... OK\n", (unsigned)sstate, OggFLAC__SeekableStreamEncoderStateString[sstate]); |
| 926 | |
Josh Coalson | 3c2bdf8 | 2003-09-26 01:56:01 +0000 | [diff] [blame] | 927 | printf("testing OggFLAC__file_encoder_get_FLAC_stream_encoder_state()... "); |
| 928 | fstate = OggFLAC__file_encoder_get_FLAC_stream_encoder_state(encoder); |
| 929 | printf("returned state = %u (%s)... OK\n", (unsigned)fstate, FLAC__StreamEncoderStateString[fstate]); |
| 930 | |
| 931 | printf("testing OggFLAC__file_encoder_get_verify_decoder_state()... "); |
| 932 | dstate = OggFLAC__file_encoder_get_verify_decoder_state(encoder); |
| 933 | printf("returned state = %u (%s)... OK\n", (unsigned)dstate, FLAC__StreamDecoderStateString[dstate]); |
| 934 | |
| 935 | { |
| 936 | FLAC__uint64 absolute_sample; |
| 937 | unsigned frame_number; |
| 938 | unsigned channel; |
| 939 | unsigned sample; |
| 940 | FLAC__int32 expected; |
| 941 | FLAC__int32 got; |
| 942 | |
| 943 | printf("testing OggFLAC__file_encoder_get_verify_decoder_error_stats()... "); |
| 944 | OggFLAC__file_encoder_get_verify_decoder_error_stats(encoder, &absolute_sample, &frame_number, &channel, &sample, &expected, &got); |
| 945 | printf("OK\n"); |
| 946 | } |
| 947 | |
| 948 | printf("testing OggFLAC__file_encoder_get_verify()... "); |
| 949 | if(OggFLAC__file_encoder_get_verify(encoder) != true) { |
| 950 | printf("FAILED, expected true, got false\n"); |
| 951 | return false; |
| 952 | } |
| 953 | printf("OK\n"); |
| 954 | |
| 955 | printf("testing OggFLAC__file_encoder_get_streamable_subset()... "); |
| 956 | if(OggFLAC__file_encoder_get_streamable_subset(encoder) != true) { |
| 957 | printf("FAILED, expected true, got false\n"); |
| 958 | return false; |
| 959 | } |
| 960 | printf("OK\n"); |
| 961 | |
| 962 | printf("testing OggFLAC__file_encoder_get_do_mid_side_stereo()... "); |
| 963 | if(OggFLAC__file_encoder_get_do_mid_side_stereo(encoder) != false) { |
| 964 | printf("FAILED, expected false, got true\n"); |
| 965 | return false; |
| 966 | } |
| 967 | printf("OK\n"); |
| 968 | |
| 969 | printf("testing OggFLAC__file_encoder_get_loose_mid_side_stereo()... "); |
| 970 | if(OggFLAC__file_encoder_get_loose_mid_side_stereo(encoder) != false) { |
| 971 | printf("FAILED, expected false, got true\n"); |
| 972 | return false; |
| 973 | } |
| 974 | printf("OK\n"); |
| 975 | |
| 976 | printf("testing OggFLAC__file_encoder_get_channels()... "); |
| 977 | if(OggFLAC__file_encoder_get_channels(encoder) != streaminfo_.data.stream_info.channels) { |
| 978 | printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.channels, OggFLAC__file_encoder_get_channels(encoder)); |
| 979 | return false; |
| 980 | } |
| 981 | printf("OK\n"); |
| 982 | |
| 983 | printf("testing OggFLAC__file_encoder_get_bits_per_sample()... "); |
| 984 | if(OggFLAC__file_encoder_get_bits_per_sample(encoder) != streaminfo_.data.stream_info.bits_per_sample) { |
| 985 | printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.bits_per_sample, OggFLAC__file_encoder_get_bits_per_sample(encoder)); |
| 986 | return false; |
| 987 | } |
| 988 | printf("OK\n"); |
| 989 | |
| 990 | printf("testing OggFLAC__file_encoder_get_sample_rate()... "); |
| 991 | if(OggFLAC__file_encoder_get_sample_rate(encoder) != streaminfo_.data.stream_info.sample_rate) { |
| 992 | printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.sample_rate, OggFLAC__file_encoder_get_sample_rate(encoder)); |
| 993 | return false; |
| 994 | } |
| 995 | printf("OK\n"); |
| 996 | |
| 997 | printf("testing OggFLAC__file_encoder_get_blocksize()... "); |
| 998 | if(OggFLAC__file_encoder_get_blocksize(encoder) != streaminfo_.data.stream_info.min_blocksize) { |
| 999 | printf("FAILED, expected %u, got %u\n", streaminfo_.data.stream_info.min_blocksize, OggFLAC__file_encoder_get_blocksize(encoder)); |
| 1000 | return false; |
| 1001 | } |
| 1002 | printf("OK\n"); |
| 1003 | |
| 1004 | printf("testing OggFLAC__file_encoder_get_max_lpc_order()... "); |
| 1005 | if(OggFLAC__file_encoder_get_max_lpc_order(encoder) != 0) { |
| 1006 | printf("FAILED, expected %u, got %u\n", 0, OggFLAC__file_encoder_get_max_lpc_order(encoder)); |
| 1007 | return false; |
| 1008 | } |
| 1009 | printf("OK\n"); |
| 1010 | |
| 1011 | printf("testing OggFLAC__file_encoder_get_qlp_coeff_precision()... "); |
| 1012 | (void)OggFLAC__file_encoder_get_qlp_coeff_precision(encoder); |
| 1013 | /* we asked the encoder to auto select this so we accept anything */ |
| 1014 | printf("OK\n"); |
| 1015 | |
| 1016 | printf("testing OggFLAC__file_encoder_get_do_qlp_coeff_prec_search()... "); |
| 1017 | if(OggFLAC__file_encoder_get_do_qlp_coeff_prec_search(encoder) != false) { |
| 1018 | printf("FAILED, expected false, got true\n"); |
| 1019 | return false; |
| 1020 | } |
| 1021 | printf("OK\n"); |
| 1022 | |
| 1023 | printf("testing OggFLAC__file_encoder_get_do_escape_coding()... "); |
| 1024 | if(OggFLAC__file_encoder_get_do_escape_coding(encoder) != false) { |
| 1025 | printf("FAILED, expected false, got true\n"); |
| 1026 | return false; |
| 1027 | } |
| 1028 | printf("OK\n"); |
| 1029 | |
| 1030 | printf("testing OggFLAC__file_encoder_get_do_exhaustive_model_search()... "); |
| 1031 | if(OggFLAC__file_encoder_get_do_exhaustive_model_search(encoder) != false) { |
| 1032 | printf("FAILED, expected false, got true\n"); |
| 1033 | return false; |
| 1034 | } |
| 1035 | printf("OK\n"); |
| 1036 | |
| 1037 | printf("testing OggFLAC__file_encoder_get_min_residual_partition_order()... "); |
| 1038 | if(OggFLAC__file_encoder_get_min_residual_partition_order(encoder) != 0) { |
| 1039 | printf("FAILED, expected %u, got %u\n", 0, OggFLAC__file_encoder_get_min_residual_partition_order(encoder)); |
| 1040 | return false; |
| 1041 | } |
| 1042 | printf("OK\n"); |
| 1043 | |
| 1044 | printf("testing OggFLAC__file_encoder_get_max_residual_partition_order()... "); |
| 1045 | if(OggFLAC__file_encoder_get_max_residual_partition_order(encoder) != 0) { |
| 1046 | printf("FAILED, expected %u, got %u\n", 0, OggFLAC__file_encoder_get_max_residual_partition_order(encoder)); |
| 1047 | return false; |
| 1048 | } |
| 1049 | printf("OK\n"); |
| 1050 | |
| 1051 | printf("testing OggFLAC__file_encoder_get_rice_parameter_search_dist()... "); |
| 1052 | if(OggFLAC__file_encoder_get_rice_parameter_search_dist(encoder) != 0) { |
| 1053 | printf("FAILED, expected %u, got %u\n", 0, OggFLAC__file_encoder_get_rice_parameter_search_dist(encoder)); |
| 1054 | return false; |
| 1055 | } |
| 1056 | printf("OK\n"); |
| 1057 | |
| 1058 | printf("testing OggFLAC__file_encoder_get_total_samples_estimate()... "); |
| 1059 | if(OggFLAC__file_encoder_get_total_samples_estimate(encoder) != streaminfo_.data.stream_info.total_samples) { |
| 1060 | printf("FAILED, expected %llu, got %llu\n", streaminfo_.data.stream_info.total_samples, OggFLAC__file_encoder_get_total_samples_estimate(encoder)); |
| 1061 | return false; |
| 1062 | } |
| 1063 | printf("OK\n"); |
| 1064 | |
| 1065 | /* init the dummy sample buffer */ |
| 1066 | for(i = 0; i < sizeof(samples) / sizeof(FLAC__int32); i++) |
| 1067 | samples[i] = i & 7; |
| 1068 | |
| 1069 | printf("testing OggFLAC__file_encoder_process()... "); |
| 1070 | if(!OggFLAC__file_encoder_process(encoder, (const FLAC__int32 * const *)samples_array, sizeof(samples) / sizeof(FLAC__int32))) |
| 1071 | return die_f_("returned false", encoder); |
| 1072 | printf("OK\n"); |
| 1073 | |
| 1074 | printf("testing OggFLAC__file_encoder_process_interleaved()... "); |
| 1075 | if(!OggFLAC__file_encoder_process_interleaved(encoder, samples, sizeof(samples) / sizeof(FLAC__int32))) |
| 1076 | return die_f_("returned false", encoder); |
| 1077 | printf("OK\n"); |
| 1078 | |
| 1079 | printf("testing OggFLAC__file_encoder_finish()... "); |
| 1080 | OggFLAC__file_encoder_finish(encoder); |
| 1081 | printf("OK\n"); |
| 1082 | |
| 1083 | printf("testing OggFLAC__file_encoder_delete()... "); |
| 1084 | OggFLAC__file_encoder_delete(encoder); |
| 1085 | printf("OK\n"); |
| 1086 | |
| 1087 | printf("\nPASSED!\n"); |
| 1088 | |
| 1089 | return true; |
| 1090 | } |
| 1091 | |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 1092 | FLAC__bool test_encoders() |
| 1093 | { |
| 1094 | init_metadata_blocks_(); |
| 1095 | |
| 1096 | if(!test_stream_encoder()) |
| 1097 | return false; |
| 1098 | |
Josh Coalson | 3c2bdf8 | 2003-09-26 01:56:01 +0000 | [diff] [blame] | 1099 | if(!test_seekable_stream_encoder()) |
| 1100 | return false; |
| 1101 | |
| 1102 | if(!test_file_encoder()) |
| 1103 | return false; |
| 1104 | |
Josh Coalson | b8f8a07 | 2002-11-07 05:07:30 +0000 | [diff] [blame] | 1105 | (void) grabbag__file_remove_file(oggflacfilename_); |
Josh Coalson | a86f870 | 2002-08-20 04:03:24 +0000 | [diff] [blame] | 1106 | free_metadata_blocks_(); |
| 1107 | |
| 1108 | return true; |
| 1109 | } |