From 3cec051d3f6bdfdc55c142a88e1b259bf6ef59a7 Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Fri, 2 Aug 2002 06:26:12 +0000 Subject: [PATCH] revamp decoder process calls --- include/FLAC++/decoder.h | 26 +++++++++++++------------- src/libFLAC/metadata_iterators.c | 3 ++- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/include/FLAC++/decoder.h b/include/FLAC++/decoder.h index e665c0a..74770d1 100644 --- a/include/FLAC++/decoder.h +++ b/include/FLAC++/decoder.h @@ -27,7 +27,7 @@ // =============================================================== // // Full documentation for the decoder interfaces can be found -// in the C layer in include/FLAC/*_decoder.h +// in the C layer in include/FLAC/ *_decoder.h // // =============================================================== @@ -123,10 +123,9 @@ namespace FLAC { bool flush(); bool reset(); - bool process_whole_stream(); - bool process_metadata(); - bool process_one_frame(); - bool process_remaining_frames(); + bool process_single(); + bool process_until_end_of_metadata(); + bool process_until_end_of_stream(); protected: virtual ::FLAC__StreamDecoderReadStatus read_callback(FLAC__byte buffer[], unsigned *bytes) = 0; virtual ::FLAC__StreamDecoderWriteStatus write_callback(const ::FLAC__Frame *frame, const FLAC__int32 * const buffer[]) = 0; @@ -192,6 +191,7 @@ namespace FLAC { bool set_metadata_ignore_all(); State get_state() const; + Stream::State get_stream_decoder_state() const; bool get_md5_checking() const; unsigned get_channels() const; ::FLAC__ChannelAssignment get_channel_assignment() const; @@ -206,10 +206,9 @@ namespace FLAC { bool flush(); bool reset(); - bool process_whole_stream(); - bool process_metadata(); - bool process_one_frame(); - bool process_remaining_frames(); + bool process_single(); + bool process_until_end_of_metadata(); + bool process_until_end_of_stream(); bool seek_absolute(FLAC__uint64 sample); protected: @@ -286,6 +285,8 @@ namespace FLAC { bool set_metadata_ignore_all(); State get_state() const; + SeekableStream::State get_seekable_stream_decoder_state() const; + Stream::State get_stream_decoder_state() const; bool get_md5_checking() const; unsigned get_channels() const; ::FLAC__ChannelAssignment get_channel_assignment() const; @@ -297,10 +298,9 @@ namespace FLAC { bool finish(); - bool process_whole_file(); - bool process_metadata(); - bool process_one_frame(); - bool process_remaining_frames(); + bool process_single(); + bool process_until_end_of_metadata(); + bool process_until_end_of_file(); bool seek_absolute(FLAC__uint64 sample); protected: diff --git a/src/libFLAC/metadata_iterators.c b/src/libFLAC/metadata_iterators.c index fd0626a..52cf075 100644 --- a/src/libFLAC/metadata_iterators.c +++ b/src/libFLAC/metadata_iterators.c @@ -154,7 +154,8 @@ FLAC__bool FLAC__metadata_get_streaminfo(const char *filename, FLAC__StreamMetad return false; } - if(!FLAC__file_decoder_process_metadata(decoder) || cd.got_error) { + /* the first thing decoded must be the STREAMINFO block: */ + if(!FLAC__file_decoder_process_single(decoder) || cd.got_error) { FLAC__file_decoder_finish(decoder); FLAC__file_decoder_delete(decoder); return false; -- 2.7.4