add in some stream decoder tests
[flac.git] / src / test_unit / decoders.c
1 /* test_unit - Simple FLAC unit tester
2  * Copyright (C) 2002  Josh Coalson
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 "decoders.h"
20 #include "file_utils.h"
21 #include "metadata_utils.h"
22 #include "FLAC/assert.h"
23 #include "FLAC/file_decoder.h"
24 #include "FLAC/seekable_stream_decoder.h"
25 #include "FLAC/stream_decoder.h"
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <string.h>
29
30 typedef struct {
31         FILE *file;
32         unsigned current_metadata_number;
33         FLAC__bool error_occurred;
34 } stream_decoder_client_data_struct;
35
36 static FLAC__StreamMetaData streaminfo_, padding_, seektable_, application1_, application2_, vorbiscomment_;
37 static FLAC__StreamMetaData *expected_metadata_sequence_[6];
38 static unsigned num_expected_;
39 static const char *flacfilename_ = "metadata.flac";
40
41 static FLAC__bool die_(const char *msg)
42 {
43         printf("ERROR: %s\n", msg);
44         return false;
45 }
46
47 static void *malloc_or_die_(size_t size)
48 {
49         void *x = malloc(size);
50         if(0 == x) {
51                 fprintf(stderr, "ERROR: out of memory allocating %u bytes\n", (unsigned)size);
52                 exit(1);
53         }
54         return x;
55 }
56
57 static void init_metadata_blocks_()
58 {
59         /*
60                 most of the actual numbers and data in the blocks don't matter,
61                 we just want to make sure the decoder parses them correctly
62
63                 remember, the metadata interface gets tested after the decoders,
64                 so we do all the metadata manipulation here without it.
65         */
66
67         /* min/max_framesize and md5sum don't get written at first, so we have to leave them 0 */
68     streaminfo_.is_last = false;
69     streaminfo_.type = FLAC__METADATA_TYPE_STREAMINFO;
70     streaminfo_.length = FLAC__STREAM_METADATA_STREAMINFO_LENGTH;
71     streaminfo_.data.stream_info.min_blocksize = 576;
72     streaminfo_.data.stream_info.max_blocksize = 576;
73     streaminfo_.data.stream_info.min_framesize = 0;
74     streaminfo_.data.stream_info.max_framesize = 0;
75     streaminfo_.data.stream_info.sample_rate = 44100;
76     streaminfo_.data.stream_info.channels = 1;
77     streaminfo_.data.stream_info.bits_per_sample = 8;
78     streaminfo_.data.stream_info.total_samples = 0;
79         memset(streaminfo_.data.stream_info.md5sum, 0, 16);
80
81     padding_.is_last = false;
82     padding_.type = FLAC__METADATA_TYPE_PADDING;
83     padding_.length = 1234;
84
85     seektable_.is_last = false;
86     seektable_.type = FLAC__METADATA_TYPE_SEEKTABLE;
87         seektable_.data.seek_table.num_points = 2;
88     seektable_.length = seektable_.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH;
89         seektable_.data.seek_table.points = malloc_or_die_(seektable_.data.seek_table.num_points * sizeof(FLAC__StreamMetaData_SeekPoint));
90         seektable_.data.seek_table.points[0].sample_number = 0;
91         seektable_.data.seek_table.points[0].stream_offset = 0;
92         seektable_.data.seek_table.points[0].frame_samples = streaminfo_.data.stream_info.min_blocksize;
93         seektable_.data.seek_table.points[1].sample_number = FLAC__STREAM_METADATA_SEEKPOINT_PLACEHOLDER;
94         seektable_.data.seek_table.points[1].stream_offset = 1000;
95         seektable_.data.seek_table.points[1].frame_samples = streaminfo_.data.stream_info.min_blocksize;
96
97     application1_.is_last = false;
98     application1_.type = FLAC__METADATA_TYPE_APPLICATION;
99     application1_.length = 8;
100         memcpy(application1_.data.application.id, "\xfe\xdc\xba\x98", 4);
101         application1_.data.application.data = malloc_or_die_(4);
102         memcpy(application1_.data.application.data, "\xf0\xe1\xd2\xc3", 4);
103
104     application2_.is_last = false;
105     application2_.type = FLAC__METADATA_TYPE_APPLICATION;
106     application2_.length = 4;
107         memcpy(application2_.data.application.id, "\x76\x54\x32\x10", 4);
108         application2_.data.application.data = 0;
109
110     vorbiscomment_.is_last = true;
111     vorbiscomment_.type = FLAC__METADATA_TYPE_VORBIS_COMMENT;
112     vorbiscomment_.length = (4 + 8) + 4 + (4 + 5) + (4 + 0);
113         vorbiscomment_.data.vorbis_comment.vendor_string.length = 8;
114         vorbiscomment_.data.vorbis_comment.vendor_string.entry = malloc_or_die_(8);
115         memcpy(vorbiscomment_.data.vorbis_comment.vendor_string.entry, "flac 1.x", 8);
116         vorbiscomment_.data.vorbis_comment.num_comments = 2;
117         vorbiscomment_.data.vorbis_comment.comments = malloc_or_die_(vorbiscomment_.data.vorbis_comment.num_comments * sizeof(FLAC__StreamMetaData_VorbisComment_Entry));
118         vorbiscomment_.data.vorbis_comment.comments[0].length = 5;
119         vorbiscomment_.data.vorbis_comment.comments[0].entry = malloc_or_die_(5);
120         memcpy(vorbiscomment_.data.vorbis_comment.comments[0].entry, "ab=cd", 5);
121         vorbiscomment_.data.vorbis_comment.comments[1].length = 0;
122         vorbiscomment_.data.vorbis_comment.comments[1].entry = 0;
123 }
124
125 static void free_metadata_blocks_()
126 {
127         free(seektable_.data.seek_table.points);
128         free(application1_.data.application.data);
129         free(vorbiscomment_.data.vorbis_comment.vendor_string.entry);
130         free(vorbiscomment_.data.vorbis_comment.comments[0].entry);
131         free(vorbiscomment_.data.vorbis_comment.comments);
132 }
133
134 static FLAC__bool generate_file_()
135 {
136         printf("\n\ngenerating FLAC file for decoder tests...\n");
137
138         expected_metadata_sequence_[0] = &padding_;
139         expected_metadata_sequence_[1] = &seektable_;
140         expected_metadata_sequence_[2] = &application1_;
141         expected_metadata_sequence_[3] = &application2_;
142         expected_metadata_sequence_[4] = &vorbiscomment_;
143         num_expected_ = 5;
144
145         if(!file_utils__generate_flacfile(flacfilename_, 512 * 1024, &streaminfo_, expected_metadata_sequence_, num_expected_))
146                 return die_("creating the encoded file"); 
147
148         return true;
149 }
150
151 FLAC__StreamDecoderReadStatus stream_decoder_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data)
152 {
153         stream_decoder_client_data_struct *dcd = (stream_decoder_client_data_struct*)client_data;
154
155         (void)decoder;
156
157         if(0 == dcd) {
158                 printf("ERROR: client_data in read callback is NULL\n");
159                 return FLAC__STREAM_DECODER_READ_ABORT;
160         }
161
162         if(dcd->error_occurred)
163                 return FLAC__STREAM_DECODER_READ_ABORT;
164
165         if(feof(dcd->file))
166                 return FLAC__STREAM_DECODER_READ_END_OF_STREAM;
167     else if(*bytes > 0) {
168         unsigned bytes_read = fread(buffer, 1, *bytes, dcd->file);
169         if(bytes_read == 0) {
170             if(feof(dcd->file))
171                 return FLAC__STREAM_DECODER_READ_END_OF_STREAM;
172             else
173                 return FLAC__STREAM_DECODER_READ_CONTINUE;
174         }
175         else {
176             *bytes = bytes_read;
177             return FLAC__STREAM_DECODER_READ_CONTINUE;
178         }
179     }
180     else
181         return FLAC__STREAM_DECODER_READ_ABORT; /* abort to avoid a deadlock */
182 }
183
184 FLAC__StreamDecoderWriteStatus stream_decoder_write_callback_(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data)
185 {
186         stream_decoder_client_data_struct *dcd = (stream_decoder_client_data_struct*)client_data;
187
188         (void)decoder, (void)frame, (void)buffer;
189
190         if(0 == dcd) {
191                 printf("ERROR: client_data in write callback is NULL\n");
192                 return FLAC__STREAM_DECODER_WRITE_ABORT;
193         }
194
195         if(dcd->error_occurred)
196                 return FLAC__STREAM_DECODER_WRITE_ABORT;
197
198     if(
199         (frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_FRAME_NUMBER && frame->header.number.frame_number == 0) ||
200         (frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER && frame->header.number.sample_number == 0)
201     ) {
202         printf("content... ");
203         fflush(stdout);
204     }
205
206         return FLAC__STREAM_DECODER_WRITE_CONTINUE;
207 }
208
209 void stream_decoder_metadata_callback_(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data)
210 {
211         stream_decoder_client_data_struct *dcd = (stream_decoder_client_data_struct*)client_data;
212
213         (void)decoder;
214
215         if(0 == dcd) {
216                 printf("ERROR: client_data in metadata callback is NULL\n");
217                 return;
218         }
219
220         if(dcd->error_occurred)
221                 return;
222
223         printf("%d... ", dcd->current_metadata_number);
224         fflush(stdout);
225
226         if(dcd->current_metadata_number >= num_expected_) {
227                 (void)die_("got more metadata blocks than expected");
228                 dcd->error_occurred = true;
229         }
230         else {
231                 if(!compare_block_(expected_metadata_sequence_[dcd->current_metadata_number], metadata)) {
232                         (void)die_("metadata block mismatch");
233                         dcd->error_occurred = true;
234                 }
235         }
236         dcd->current_metadata_number++;
237 }
238
239 void stream_decoder_error_callback_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
240 {
241         stream_decoder_client_data_struct *dcd = (stream_decoder_client_data_struct*)client_data;
242
243         (void)decoder;
244
245         printf("ERROR: got error callback: err = %u (%s)\n", (unsigned)status, FLAC__StreamDecoderErrorStatusString[status]);
246
247         if(0 == dcd) {
248                 printf("ERROR: client_data in error callback is NULL\n");
249                 return;
250         }
251
252         dcd->error_occurred = true;
253 }
254
255 FLAC__bool test_stream_decoder()
256 {
257         FLAC__StreamDecoder *decoder;
258         FLAC__StreamDecoderState state;
259         stream_decoder_client_data_struct decoder_client_data;
260
261         printf("\n+++ unit test: FLAC__StreamDecoder\n\n");
262
263         num_expected_ = 0;
264         expected_metadata_sequence_[num_expected_++] = &streaminfo_;
265
266         printf("testing FLAC__stream_decoder_new()... ");
267         decoder = FLAC__stream_decoder_new();
268         if(0 == decoder) {
269                 printf("FAILED, returned NULL\n");
270                 return false;
271         }
272         printf("OK\n");
273
274         printf("testing FLAC__stream_decoder_set_read_callback()... ");
275         if(!FLAC__stream_decoder_set_read_callback(decoder, stream_decoder_read_callback_)) {
276                 printf("FAILED, returned false\n");
277                 return false;
278         }
279         printf("OK\n");
280
281         printf("testing FLAC__stream_decoder_set_write_callback()... ");
282         if(!FLAC__stream_decoder_set_write_callback(decoder, stream_decoder_write_callback_)) {
283                 printf("FAILED, returned false\n");
284                 return false;
285         }
286         printf("OK\n");
287
288         printf("testing FLAC__stream_decoder_set_metadata_callback()... ");
289         if(!FLAC__stream_decoder_set_metadata_callback(decoder, stream_decoder_metadata_callback_)) {
290                 printf("FAILED, returned false\n");
291                 return false;
292         }
293         printf("OK\n");
294
295         printf("testing FLAC__stream_decoder_set_error_callback()... ");
296         if(!FLAC__stream_decoder_set_error_callback(decoder, stream_decoder_error_callback_)) {
297                 printf("FAILED, returned false\n");
298                 return false;
299         }
300         printf("OK\n");
301
302         printf("testing FLAC__stream_decoder_set_client_data()... ");
303         if(!FLAC__stream_decoder_set_client_data(decoder, &decoder_client_data)) {
304                 printf("FAILED, returned false\n");
305                 return false;
306         }
307         printf("OK\n");
308
309         printf("testing FLAC__stream_decoder_init()... ");
310         if((state = FLAC__stream_decoder_init(decoder)) != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA) {
311                 printf("FAILED, returned state = %u (%s)\n", state, FLAC__StreamDecoderStateString[state]);
312                 return false;
313         }
314         printf("OK\n");
315
316         decoder_client_data.current_metadata_number = 0;
317         decoder_client_data.error_occurred = false;
318
319         printf("opening FLAC file... ");
320         decoder_client_data.file = fopen(flacfilename_, "rb");
321         if(0 == decoder_client_data.file) {
322                 printf("ERROR\n");
323                 return false;
324         }
325         printf("OK\n");
326
327         printf("testing FLAC__stream_decoder_process_metadata()... ");
328         if(!FLAC__stream_decoder_process_metadata(decoder)) {
329                 state = FLAC__stream_decoder_get_state(decoder);
330                 printf("FAILED, returned false, state = %u (%s)\n", state, FLAC__StreamDecoderStateString[state]);
331                 return false;
332         }
333         printf("OK\n");
334
335         printf("testing FLAC__stream_decoder_process_one_frame()... ");
336         if(!FLAC__stream_decoder_process_one_frame(decoder)) {
337                 state = FLAC__stream_decoder_get_state(decoder);
338                 printf("FAILED, returned false, state = %u (%s)\n", state, FLAC__StreamDecoderStateString[state]);
339                 return false;
340         }
341         printf("OK\n");
342
343         printf("testing FLAC__stream_decoder_process_remaining_frames()... ");
344         if(!FLAC__stream_decoder_process_remaining_frames(decoder)) {
345                 state = FLAC__stream_decoder_get_state(decoder);
346                 printf("FAILED, returned false, state = %u (%s)\n", state, FLAC__StreamDecoderStateString[state]);
347                 return false;
348         }
349         printf("OK\n");
350
351         printf("testing FLAC__stream_decoder_finish()... ");
352         FLAC__stream_decoder_finish(decoder);
353         printf("OK\n");
354
355
356         num_expected_ = 0;
357         expected_metadata_sequence_[num_expected_++] = &streaminfo_;
358         expected_metadata_sequence_[num_expected_++] = &padding_;
359         expected_metadata_sequence_[num_expected_++] = &seektable_;
360         expected_metadata_sequence_[num_expected_++] = &application1_;
361         expected_metadata_sequence_[num_expected_++] = &application2_;
362         expected_metadata_sequence_[num_expected_++] = &vorbiscomment_;
363
364         printf("testing FLAC__stream_decoder_delete()... ");
365         FLAC__stream_decoder_delete(decoder);
366         printf("OK\n");
367
368         printf("\nPASSED!\n");
369
370         return true;
371 }
372
373 FLAC__bool test_seekable_stream_decoder()
374 {
375         printf("\n+++ unit test: FLAC__SeekableStreamDecoder\n\n");
376
377         printf("\nPASSED!\n");
378
379         return true;
380 }
381
382 FLAC__bool test_file_decoder()
383 {
384         printf("\n+++ unit test: FLAC__FileDecoder\n\n");
385
386         printf("\nPASSED!\n");
387
388         return true;
389 }
390
391 int test_decoders()
392 {
393         init_metadata_blocks_();
394         if(!generate_file_())
395                 return 1;
396
397         if(!test_stream_decoder())
398                 return 1;
399
400         if(!test_seekable_stream_decoder())
401                 return 1;
402
403         if(!test_file_decoder())
404                 return 1;
405
406         (void) file_utils__remove_file(flacfilename_);
407         free_metadata_blocks_();
408
409         return 0;
410 }
411 #if 0
412 extern const char *FLAC__StreamDecoderStateString[];
413
414 typedef enum {
415         FLAC__STREAM_DECODER_READ_CONTINUE,
416         FLAC__STREAM_DECODER_READ_END_OF_STREAM,
417         FLAC__STREAM_DECODER_READ_ABORT
418 } FLAC__StreamDecoderReadStatus;
419 extern const char *FLAC__StreamDecoderReadStatusString[];
420
421 typedef enum {
422         FLAC__STREAM_DECODER_WRITE_CONTINUE,
423         FLAC__STREAM_DECODER_WRITE_ABORT
424 } FLAC__StreamDecoderWriteStatus;
425 extern const char *FLAC__StreamDecoderWriteStatusString[];
426
427 typedef enum {
428         FLAC__STREAM_DECODER_ERROR_LOST_SYNC,
429         FLAC__STREAM_DECODER_ERROR_BAD_HEADER,
430         FLAC__STREAM_DECODER_ERROR_FRAME_CRC_MISMATCH
431 } FLAC__StreamDecoderErrorStatus;
432 extern const char *FLAC__StreamDecoderErrorStatusString[];
433
434 /***********************************************************************
435  *
436  * Class constructor/destructor
437  *
438  ***********************************************************************/
439
440 /*
441  * Any parameters that are not set before FLAC__stream_decoder_init()
442  * will take on the defaults from the constructor, shown below.
443  * For more on what the parameters mean, see the documentation.
444  *
445  *        (*read_callback)()               (DEFAULT: NULL ) The callbacks are the only values that MUST be set before FLAC__stream_decoder_init()
446  *        (*write_callback)()              (DEFAULT: NULL )
447  *        (*metadata_callback)()           (DEFAULT: NULL )
448  *        (*error_callback)()              (DEFAULT: NULL )
449  * void*    client_data                    (DEFAULT: NULL ) passed back through the callbacks
450  */
451 FLAC__StreamDecoder *FLAC__stream_decoder_new();
452 void FLAC__stream_decoder_delete(FLAC__StreamDecoder *);
453
454 /***********************************************************************
455  *
456  * Public class method prototypes
457  *
458  ***********************************************************************/
459
460 /*
461  * Various "set" methods.  These may only be called when the decoder
462  * is in the state FLAC__STREAM_DECODER_UNINITIALIZED, i.e. after
463  * FLAC__stream_decoder_new() or FLAC__stream_decoder_finish(), but
464  * before FLAC__stream_decoder_init().  If this is the case they will
465  * return true, otherwise false.
466  *
467  * NOTE that these functions do not validate the values as many are
468  * interdependent.  The FLAC__stream_decoder_init() function will do
469  * this, so make sure to pay attention to the state returned by
470  * FLAC__stream_decoder_init().
471  *
472  * Any parameters that are not set before FLAC__stream_decoder_init()
473  * will take on the defaults from the constructor.  NOTE that
474  * FLAC__stream_decoder_flush() or FLAC__stream_decoder_reset() do
475  * NOT reset the values to the constructor defaults.
476 @@@@ update so that only _set_ methods that need to return FLAC__bool, else void; update documentation.html also
477 @@@@ update defaults above and in documentation.html about the metadata_respond/ignore defaults
478  */
479 FLAC__bool FLAC__stream_decoder_set_read_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderReadStatus (*value)(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data));
480 FLAC__bool FLAC__stream_decoder_set_write_callback(FLAC__StreamDecoder *decoder, FLAC__StreamDecoderWriteStatus (*value)(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *buffer[], void *client_data));
481 FLAC__bool FLAC__stream_decoder_set_metadata_callback(FLAC__StreamDecoder *decoder, void (*value)(const FLAC__StreamDecoder *decoder, const FLAC__StreamMetaData *metadata, void *client_data));
482 FLAC__bool FLAC__stream_decoder_set_error_callback(FLAC__StreamDecoder *decoder, void (*value)(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data));
483 FLAC__bool FLAC__stream_decoder_set_client_data(FLAC__StreamDecoder *decoder, void *value);
484 /*
485  * These deserve special attention.  By default, the decoder only calls the
486  * metadata_callback for the STREAMINFO block.  These functions allow you to
487  * tell the decoder explicitly which blocks to parse and return via the
488  * metadata_callback and/or which to skip.  Use a _respond_all(), _ignore() ...
489  * or _ignore_all(), _respond() ... sequence to exactly specify which blocks
490  * to return.  Remember that some metadata blocks can be big so filtering out
491  * the ones you don't use can reduce the memory requirements of the decoder.
492  * Also note the special forms _respond/_ignore_application(id) for filtering
493  * APPLICATION blocks based on the application ID.
494  *
495  * STREAMINFO and SEEKTABLE blocks are always parsed and used internally, but
496  * they still can legally be filtered from the metadata_callback here.
497  */
498 FLAC__bool FLAC__stream_decoder_set_metadata_respond(FLAC__StreamDecoder *decoder, FLAC__MetaDataType type);
499 FLAC__bool FLAC__stream_decoder_set_metadata_respond_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
500 FLAC__bool FLAC__stream_decoder_set_metadata_respond_all(FLAC__StreamDecoder *decoder);
501 FLAC__bool FLAC__stream_decoder_set_metadata_ignore(FLAC__StreamDecoder *decoder, FLAC__MetaDataType type);
502 FLAC__bool FLAC__stream_decoder_set_metadata_ignore_application(FLAC__StreamDecoder *decoder, const FLAC__byte id[4]);
503 FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDecoder *decoder);
504
505 /*
506  * Methods to return the current stream decoder state, number
507  * of channels, channel assignment, bits-per-sample, sample
508  * rate in Hz, and blocksize in samples.  All but the decoder
509  * state will only be valid after decoding has started.
510  */
511 FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder);
512 unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder);
513 FLAC__ChannelAssignment FLAC__stream_decoder_get_channel_assignment(const FLAC__StreamDecoder *decoder);
514 unsigned FLAC__stream_decoder_get_bits_per_sample(const FLAC__StreamDecoder *decoder);
515 unsigned FLAC__stream_decoder_get_sample_rate(const FLAC__StreamDecoder *decoder);
516 unsigned FLAC__stream_decoder_get_blocksize(const FLAC__StreamDecoder *decoder);
517
518 /*
519  * Initialize the instance; should be called after construction and
520  * 'set' calls but before any of the 'process' calls.  Will set and
521  * return the decoder state, which will be
522  * FLAC__STREAM_DECODER_SEARCH_FOR_METADATA if initialization
523  * succeeded.
524  */
525 FLAC__StreamDecoderState FLAC__stream_decoder_init(FLAC__StreamDecoder *decoder);
526
527 /*
528  * Flush the decoding buffer, release resources, and return the decoder
529  * state to FLAC__STREAM_DECODER_UNINITIALIZED.
530  */
531 void FLAC__stream_decoder_finish(FLAC__StreamDecoder *decoder);
532
533 /*
534  * state control methods
535  */
536 FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder);
537 FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder);
538
539 /*
540  * Methods for decoding the data
541  */
542 FLAC__bool FLAC__stream_decoder_process_whole_stream(FLAC__StreamDecoder *decoder);
543 FLAC__bool FLAC__stream_decoder_process_metadata(FLAC__StreamDecoder *decoder);
544 FLAC__bool FLAC__stream_decoder_process_one_frame(FLAC__StreamDecoder *decoder);
545 FLAC__bool FLAC__stream_decoder_process_remaining_frames(FLAC__StreamDecoder *decoder);
546
547 #endif