Commit cfdfc828 authored by Josh Coalson's avatar Josh Coalson
Browse files

revamp decoder process calls

parent ebece62e
......@@ -524,7 +524,7 @@ FLAC__FileDecoderState FLAC__file_decoder_init(FLAC__FileDecoder *decoder);
FLAC__bool FLAC__file_decoder_finish(FLAC__FileDecoder *decoder);
/** This is inherited from FLAC__SeekableStreamDecoder; see
* FLAC__seekable_stream_decoder_process_whole_stream().
* FLAC__seekable_stream_decoder_process_single().
*
* \param decoder A decoder instance.
* \assert
......@@ -532,10 +532,10 @@ FLAC__bool FLAC__file_decoder_finish(FLAC__FileDecoder *decoder);
* \retval FLAC__bool
* See above.
*/
FLAC__bool FLAC__file_decoder_process_whole_file(FLAC__FileDecoder *decoder);
FLAC__bool FLAC__file_decoder_process_single(FLAC__FileDecoder *decoder);
/** This is inherited from FLAC__SeekableStreamDecoder; see
* FLAC__seekable_stream_decoder_process_metadata().
* FLAC__seekable_stream_decoder_process_until_end_of_metadata().
*
* \param decoder A decoder instance.
* \assert
......@@ -543,10 +543,10 @@ FLAC__bool FLAC__file_decoder_process_whole_file(FLAC__FileDecoder *decoder);
* \retval FLAC__bool
* See above.
*/
FLAC__bool FLAC__file_decoder_process_metadata(FLAC__FileDecoder *decoder);
FLAC__bool FLAC__file_decoder_process_until_end_of_metadata(FLAC__FileDecoder *decoder);
/** This is inherited from FLAC__SeekableStreamDecoder; see
* FLAC__seekable_stream_decoder_process_one_frame().
* FLAC__seekable_stream_decoder_process_until_end_of_stream().
*
* \param decoder A decoder instance.
* \assert
......@@ -554,7 +554,7 @@ FLAC__bool FLAC__file_decoder_process_metadata(FLAC__FileDecoder *decoder);
* \retval FLAC__bool
* See above.
*/
FLAC__bool FLAC__file_decoder_process_one_frame(FLAC__FileDecoder *decoder);
FLAC__bool FLAC__file_decoder_process_until_end_of_file(FLAC__FileDecoder *decoder);
/** This is inherited from FLAC__SeekableStreamDecoder; see
* FLAC__seekable_stream_decoder_process_remaining_frames().
......
......@@ -732,7 +732,7 @@ FLAC__bool FLAC__seekable_stream_decoder_flush(FLAC__SeekableStreamDecoder *deco
FLAC__bool FLAC__seekable_stream_decoder_reset(FLAC__SeekableStreamDecoder *decoder);
/** This is inherited from FLAC__StreamDecoder; see
* FLAC__stream_decoder_process_whole_stream().
* FLAC__stream_decoder_process_single().
*
* \param decoder A decoder instance.
* \assert
......@@ -740,10 +740,10 @@ FLAC__bool FLAC__seekable_stream_decoder_reset(FLAC__SeekableStreamDecoder *deco
* \retval FLAC__bool
* See above.
*/
FLAC__bool FLAC__seekable_stream_decoder_process_whole_stream(FLAC__SeekableStreamDecoder *decoder);
FLAC__bool FLAC__seekable_stream_decoder_process_single(FLAC__SeekableStreamDecoder *decoder);
/** This is inherited from FLAC__StreamDecoder; see
* FLAC__stream_decoder_process_metadata().
* FLAC__stream_decoder_process_until_end_of_metadata().
*
* \param decoder A decoder instance.
* \assert
......@@ -751,10 +751,10 @@ FLAC__bool FLAC__seekable_stream_decoder_process_whole_stream(FLAC__SeekableStre
* \retval FLAC__bool
* See above.
*/
FLAC__bool FLAC__seekable_stream_decoder_process_metadata(FLAC__SeekableStreamDecoder *decoder);
FLAC__bool FLAC__seekable_stream_decoder_process_until_end_of_metadata(FLAC__SeekableStreamDecoder *decoder);
/** This is inherited from FLAC__StreamDecoder; see
* FLAC__stream_decoder_process_one_frame().
* FLAC__stream_decoder_process_until_end_of_stream().
*
* \param decoder A decoder instance.
* \assert
......@@ -762,18 +762,7 @@ FLAC__bool FLAC__seekable_stream_decoder_process_metadata(FLAC__SeekableStreamDe
* \retval FLAC__bool
* See above.
*/
FLAC__bool FLAC__seekable_stream_decoder_process_one_frame(FLAC__SeekableStreamDecoder *decoder);
/** This is inherited from FLAC__StreamDecoder; see
* FLAC__stream_decoder_process_remaining_frames().
*
* \param decoder A decoder instance.
* \assert
* \code decoder != NULL \endcode
* \retval FLAC__bool
* See above.
*/
FLAC__bool FLAC__seekable_stream_decoder_process_remaining_frames(FLAC__SeekableStreamDecoder *decoder);
FLAC__bool FLAC__seekable_stream_decoder_process_until_end_of_stream(FLAC__SeekableStreamDecoder *decoder);
/** Flush the input and seek to an absolute sample.
* Decoding will resume at the given sample. Note that because of
......
......@@ -117,19 +117,20 @@ extern "C" {
* Once the decoder is initialized, your program will call one of several
* functions to start the decoding process:
*
* - FLAC__stream_decoder_process_whole_stream() - Tells the decoder to
* start and continue processing the stream until the read callback
* - FLAC__stream_decoder_process_single() - Tells the decoder to process at
* most one metadata block or audio frame and return, calling either the
* metadata callback or write callback, respectively, once. If the decoder
* loses sync it will return with only the error callback being called.
* - FLAC__stream_decoder_process_until_end_of_metadata() - Tells the decoder
* to process the stream from the current location and stop upon reaching
* the first audio frame. The user will get one metadata, write, or error
* callback per metadata block, audio frame, or sync error, respectively.
* - FLAC__stream_decoder_process_until_end_of_stream() - Tells the decoder
* to process the stream from the current location until the read callback
* returns FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM or
* FLAC__STREAM_DECODER_READ_STATUS_ABORT.
* - FLAC__stream_decoder_process_metadata() - Tells the decoder to start
* processing the stream and stop upon reaching the first audio frame.
* - FLAC__stream_decoder_process_one_frame() - Tells the decoder to
* process one audio frame and return. The decoder must have processed
* all metadata first before calling this function.
* - FLAC__stream_decoder_process_remaining_frames() - Tells the decoder to
* process all remaining frames. The decoder must have processed all
* metadata first but may also have processed frames with
* FLAC__stream_decoder_process_one_frame().
* FLAC__STREAM_DECODER_READ_STATUS_ABORT. The user will get one metadata,
* write, or error callback per metadata block, audio frame, or sync error,
* respectively.
*
* When the decoder has finished decoding (normally or through an abort),
* the instance is finished by calling FLAC__stream_decoder_finish(), which
......@@ -662,20 +663,23 @@ FLAC__bool FLAC__stream_decoder_flush(FLAC__StreamDecoder *decoder);
*/
FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder);
/** Decode the entire stream.
* This version instructs the decoder to start and continue decoding
* the entire stream until the callbacks return a fatal error or the
* read callback returns \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
/** Decode one metadata block or audio frame.
* This version instructs the decoder to decode a either a single metadata
* block or a single frame and stop, unless the callbacks return a fatal
* error or the read callback returns
* \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
*
* As the decoder needs more input it will call the read callback.
* As each metadata block and frame is decoded, the metadata or write
* callback will be called with the decoded metadata or frame.
* Depending on what was decoded, the metadata or write callback will be
* called with the decoded metadata block or audio frame, unless an error
* occurred. If the decoder loses sync it will call the error callback
* instead.
*
* \param decoder An initialized decoder instance in the state
* \c FLAC__STREAM_DECODER_SEARCH_FOR_METADATA.
* \c FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC.
* \assert
* \code decoder != NULL \endcode
* \code FLAC__stream_decoder_get_state(decoder) == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA \endcode
* \code FLAC__stream_decoder_get_state(decoder) == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC \endcode
* \retval FLAC__bool
* \c false if any read or write error occurred (except
* \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), else \c false;
......@@ -683,17 +687,18 @@ FLAC__bool FLAC__stream_decoder_reset(FLAC__StreamDecoder *decoder);
* FLAC__stream_decoder_get_state() to see what went wrong or to
* check for lost synchronization (a sign of stream corruption).
*/
FLAC__bool FLAC__stream_decoder_process_whole_stream(FLAC__StreamDecoder *decoder);
FLAC__bool FLAC__stream_decoder_process_single(FLAC__StreamDecoder *decoder);
/** Decode just the metadata.
* This version instructs the decoder to start decoding and stop after
* all the metadata has been read, or until the callbacks return a fatal
* error or the read callback returns
/** Decode until the end of the metadata.
* This version instructs the decoder to decode from the current position
* and continue until all the metadata has been read, or until the
* callbacks return a fatal error or the read callback returns
* \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
*
* As the decoder needs more input it will call the read callback.
* As each metadata block is decoded, the metadata callback will be called
* with the decoded metadata.
* with the decoded metadata. If the decoder loses sync it will call the
* error callback.
*
* \param decoder An initialized decoder instance in the state
* \c FLAC__STREAM_DECODER_SEARCH_FOR_METADATA.
......@@ -707,44 +712,24 @@ FLAC__bool FLAC__stream_decoder_process_whole_stream(FLAC__StreamDecoder *decode
* FLAC__stream_decoder_get_state() to see what went wrong or to
* check for lost synchronization (a sign of stream corruption).
*/
FLAC__bool FLAC__stream_decoder_process_metadata(FLAC__StreamDecoder *decoder);
FLAC__bool FLAC__stream_decoder_process_until_end_of_metadata(FLAC__StreamDecoder *decoder);
/** Decode one frame.
* This version instructs the decoder to decode a single frame and stop,
* or until the callbacks return a fatal error or the read callback returns
* \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
/** Decode until the end of the stream.
* This version instructs the decoder to decode from the current position
* and continue until the end of stream (the read callback returns
* \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM), or until the
* callbacks return a fatal error.
*
* As the decoder needs more input it will call the read callback.
* The write callback will be called with the decoded frame.
*
* \param decoder An initialized decoder instance in the state
* \c FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC.
* \assert
* \code decoder != NULL \endcode
* \code FLAC__stream_decoder_get_state(decoder) == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC \endcode
* \retval FLAC__bool
* \c false if any read or write error occurred (except
* \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), else \c false;
* in any case, check the decoder state with
* FLAC__stream_decoder_get_state() to see what went wrong or to
* check for lost synchronization (a sign of stream corruption).
*/
FLAC__bool FLAC__stream_decoder_process_one_frame(FLAC__StreamDecoder *decoder);
/** Decode the remaining frames until end of stream.
* This version instructs the decoder to decode all remaining frames,
* until the callbacks return a fatal error or the read callback returns
* \c FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM.
*
* As the decoder needs more input it will call the read callback.
* As each frame is decoded, the write callback will be called with the
* decoded frame.
* As each metadata block and frame is decoded, the metadata or write
* callback will be called with the decoded metadata or frame. If the
* decoder loses sync it will call the error callback.
*
* \param decoder An initialized decoder instance in the state
* \c FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC.
* \c FLAC__STREAM_DECODER_SEARCH_FOR_METADATA.
* \assert
* \code decoder != NULL \endcode
* \code FLAC__stream_decoder_get_state(decoder) == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC \endcode
* \code FLAC__stream_decoder_get_state(decoder) == FLAC__STREAM_DECODER_SEARCH_FOR_METADATA \endcode
* \retval FLAC__bool
* \c false if any read or write error occurred (except
* \c FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC), else \c false;
......@@ -752,7 +737,7 @@ FLAC__bool FLAC__stream_decoder_process_one_frame(FLAC__StreamDecoder *decoder);
* FLAC__stream_decoder_get_state() to see what went wrong or to
* check for lost synchronization (a sign of stream corruption).
*/
FLAC__bool FLAC__stream_decoder_process_remaining_frames(FLAC__StreamDecoder *decoder);
FLAC__bool FLAC__stream_decoder_process_until_end_of_stream(FLAC__StreamDecoder *decoder);
/* \} */
......
......@@ -164,7 +164,7 @@ int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool
goto wav_abort_;
}
#endif
if(!FLAC__file_decoder_process_metadata(stream_info.decoder.file)) {
if(!FLAC__file_decoder_process_until_end_of_metadata(stream_info.decoder.file)) {
fprintf(stderr, "%s: ERROR while decoding metadata, state=%d:%s\n", stream_info.inbasefilename, FLAC__file_decoder_get_state(stream_info.decoder.file), FLAC__FileDecoderStateString[FLAC__file_decoder_get_state(stream_info.decoder.file)]);
goto wav_abort_;
}
......@@ -174,7 +174,7 @@ int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool
fprintf(stderr, "%s: ERROR seeking while skipping bytes, state=%d:%s\n", stream_info.inbasefilename, FLAC__file_decoder_get_state(stream_info.decoder.file), FLAC__FileDecoderStateString[FLAC__file_decoder_get_state(stream_info.decoder.file)]);
goto wav_abort_;
}
if(!FLAC__file_decoder_process_remaining_frames(stream_info.decoder.file)) {
if(!FLAC__file_decoder_process_until_end_of_file(stream_info.decoder.file)) {
if(stream_info.verbose) fprintf(stderr, "\n");
fprintf(stderr, "%s: ERROR while decoding frames, state=%d:%s\n", stream_info.inbasefilename, FLAC__file_decoder_get_state(stream_info.decoder.file), FLAC__FileDecoderStateString[FLAC__file_decoder_get_state(stream_info.decoder.file)]);
goto wav_abort_;
......@@ -188,7 +188,7 @@ int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool
else {
#ifdef FLAC__HAS_OGG
if(stream_info.is_ogg) {
if(!FLAC__stream_decoder_process_whole_stream(stream_info.decoder.stream)) {
if(!FLAC__stream_decoder_process_until_end_of_stream(stream_info.decoder.stream)) {
if(stream_info.verbose) fprintf(stderr, "\n");
fprintf(stderr, "%s: ERROR while decoding data, state=%d:%s\n", stream_info.inbasefilename, FLAC__stream_decoder_get_state(stream_info.decoder.stream), FLAC__StreamDecoderStateString[FLAC__stream_decoder_get_state(stream_info.decoder.stream)]);
goto wav_abort_;
......@@ -202,7 +202,7 @@ int flac__decode_wav(const char *infilename, const char *outfilename, FLAC__bool
else
#endif
{
if(!FLAC__file_decoder_process_whole_file(stream_info.decoder.file)) {
if(!FLAC__file_decoder_process_until_end_of_file(stream_info.decoder.file)) {
if(stream_info.verbose) fprintf(stderr, "\n");
fprintf(stderr, "%s: ERROR while decoding data, state=%d:%s\n", stream_info.inbasefilename, FLAC__file_decoder_get_state(stream_info.decoder.file), FLAC__FileDecoderStateString[FLAC__file_decoder_get_state(stream_info.decoder.file)]);
goto wav_abort_;
......@@ -352,7 +352,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool
goto raw_abort_;
}
#endif
if(!FLAC__file_decoder_process_metadata(stream_info.decoder.file)) {
if(!FLAC__file_decoder_process_until_end_of_metadata(stream_info.decoder.file)) {
fprintf(stderr, "%s: ERROR while decoding metadata, state=%d:%s\n", stream_info.inbasefilename, FLAC__file_decoder_get_state(stream_info.decoder.file), FLAC__FileDecoderStateString[FLAC__file_decoder_get_state(stream_info.decoder.file)]);
goto raw_abort_;
}
......@@ -362,7 +362,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool
fprintf(stderr, "%s: ERROR seeking while skipping bytes, state=%d:%s\n", stream_info.inbasefilename, FLAC__file_decoder_get_state(stream_info.decoder.file), FLAC__FileDecoderStateString[FLAC__file_decoder_get_state(stream_info.decoder.file)]);
goto raw_abort_;
}
if(!FLAC__file_decoder_process_remaining_frames(stream_info.decoder.file)) {
if(!FLAC__file_decoder_process_until_end_of_file(stream_info.decoder.file)) {
if(stream_info.verbose) fprintf(stderr, "\n");
fprintf(stderr, "%s: ERROR while decoding frames, state=%d:%s\n", stream_info.inbasefilename, FLAC__file_decoder_get_state(stream_info.decoder.file), FLAC__FileDecoderStateString[FLAC__file_decoder_get_state(stream_info.decoder.file)]);
goto raw_abort_;
......@@ -376,7 +376,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool
else {
#ifdef FLAC__HAS_OGG
if(stream_info.is_ogg) {
if(!FLAC__stream_decoder_process_whole_stream(stream_info.decoder.stream)) {
if(!FLAC__stream_decoder_process_until_end_of_stream(stream_info.decoder.stream)) {
if(stream_info.verbose) fprintf(stderr, "\n");
fprintf(stderr, "%s: ERROR while decoding data, state=%d:%s\n", stream_info.inbasefilename, FLAC__stream_decoder_get_state(stream_info.decoder.stream), FLAC__StreamDecoderStateString[FLAC__stream_decoder_get_state(stream_info.decoder.stream)]);
goto raw_abort_;
......@@ -390,7 +390,7 @@ int flac__decode_raw(const char *infilename, const char *outfilename, FLAC__bool
else
#endif
{
if(!FLAC__file_decoder_process_whole_file(stream_info.decoder.file)) {
if(!FLAC__file_decoder_process_until_end_of_file(stream_info.decoder.file)) {
if(stream_info.verbose) fprintf(stderr, "\n");
fprintf(stderr, "%s: ERROR while decoding data, state=%d:%s\n", stream_info.inbasefilename, FLAC__file_decoder_get_state(stream_info.decoder.file), FLAC__FileDecoderStateString[FLAC__file_decoder_get_state(stream_info.decoder.file)]);
goto raw_abort_;
......
......@@ -94,6 +94,18 @@ namespace FLAC {
return State(::FLAC__file_decoder_get_state(decoder_));
}
SeekableStream::State File::get_seekable_stream_decoder_state() const
{
FLAC__ASSERT(0 != decoder_);
return SeekableStream::State(::FLAC__file_decoder_get_seekable_stream_decoder_state(decoder_));
}
Stream::State File::get_stream_decoder_state() const
{
FLAC__ASSERT(0 != decoder_);
return Stream::State(::FLAC__file_decoder_get_stream_decoder_state(decoder_));
}
bool File::get_md5_checking() const
{
FLAC__ASSERT(0 != decoder_);
......@@ -146,28 +158,22 @@ namespace FLAC {
return (bool)::FLAC__file_decoder_finish(decoder_);
}
bool File::process_whole_file()
{
FLAC__ASSERT(0 != decoder_);
return (bool)::FLAC__file_decoder_process_whole_file(decoder_);
}
bool File::process_metadata()
bool File::process_single()
{
FLAC__ASSERT(0 != decoder_);
return (bool)::FLAC__file_decoder_process_metadata(decoder_);
return (bool)::FLAC__file_decoder_process_single(decoder_);
}
bool File::process_one_frame()
bool File::process_until_end_of_metadata()
{
FLAC__ASSERT(0 != decoder_);
return (bool)::FLAC__file_decoder_process_one_frame(decoder_);
return (bool)::FLAC__file_decoder_process_until_end_of_metadata(decoder_);
}
bool File::process_remaining_frames()
bool File::process_until_end_of_file()
{
FLAC__ASSERT(0 != decoder_);
return (bool)::FLAC__file_decoder_process_remaining_frames(decoder_);
return (bool)::FLAC__file_decoder_process_until_end_of_file(decoder_);
}
bool File::seek_absolute(FLAC__uint64 sample)
......
......@@ -88,6 +88,12 @@ namespace FLAC {
return State(::FLAC__seekable_stream_decoder_get_state(decoder_));
}
Stream::State SeekableStream::get_stream_decoder_state() const
{
FLAC__ASSERT(is_valid());
return Stream::State(::FLAC__seekable_stream_decoder_get_stream_decoder_state(decoder_));
}
bool SeekableStream::get_md5_checking() const
{
FLAC__ASSERT(is_valid());
......@@ -157,28 +163,22 @@ namespace FLAC {
return (bool)::FLAC__seekable_stream_decoder_reset(decoder_);
}
bool SeekableStream::process_whole_stream()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__seekable_stream_decoder_process_whole_stream(decoder_);
}
bool SeekableStream::process_metadata()
bool SeekableStream::process_single()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__seekable_stream_decoder_process_metadata(decoder_);
return (bool)::FLAC__seekable_stream_decoder_process_single(decoder_);
}
bool SeekableStream::process_one_frame()
bool SeekableStream::process_until_end_of_metadata()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__seekable_stream_decoder_process_one_frame(decoder_);
return (bool)::FLAC__seekable_stream_decoder_process_until_end_of_metadata(decoder_);
}
bool SeekableStream::process_remaining_frames()
bool SeekableStream::process_until_end_of_stream()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__seekable_stream_decoder_process_remaining_frames(decoder_);
return (bool)::FLAC__seekable_stream_decoder_process_until_end_of_stream(decoder_);
}
bool SeekableStream::seek_absolute(FLAC__uint64 sample)
......
......@@ -141,28 +141,22 @@ namespace FLAC {
return (bool)::FLAC__stream_decoder_reset(decoder_);
}
bool Stream::process_whole_stream()
bool Stream::process_single()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_process_whole_stream(decoder_);
return (bool)::FLAC__stream_decoder_process_single(decoder_);
}
bool Stream::process_metadata()
bool Stream::process_until_end_of_metadata()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_process_metadata(decoder_);
return (bool)::FLAC__stream_decoder_process_until_end_of_metadata(decoder_);
}
bool Stream::process_one_frame()
bool Stream::process_until_end_of_stream()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_process_one_frame(decoder_);
}
bool Stream::process_remaining_frames()
{
FLAC__ASSERT(is_valid());
return (bool)::FLAC__stream_decoder_process_remaining_frames(decoder_);
return (bool)::FLAC__stream_decoder_process_until_end_of_stream(decoder_);
}
::FLAC__StreamDecoderReadStatus Stream::read_callback_(const ::FLAC__StreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data)
......
......@@ -418,7 +418,7 @@ unsigned FLAC__file_decoder_get_blocksize(const FLAC__FileDecoder *decoder)
return FLAC__seekable_stream_decoder_get_blocksize(decoder->private_->seekable_stream_decoder);
}
FLAC__bool FLAC__file_decoder_process_whole_file(FLAC__FileDecoder *decoder)
FLAC__bool FLAC__file_decoder_process_single(FLAC__FileDecoder *decoder)
{
FLAC__bool ret;
FLAC__ASSERT(0 != decoder);
......@@ -431,14 +431,14 @@ FLAC__bool FLAC__file_decoder_process_whole_file(FLAC__FileDecoder *decoder)
FLAC__ASSERT(decoder->protected_->state == FLAC__FILE_DECODER_OK);
ret = FLAC__seekable_stream_decoder_process_whole_stream(decoder->private_->seekable_stream_decoder);
ret = FLAC__seekable_stream_decoder_process_single(decoder->private_->seekable_stream_decoder);
if(!ret)
decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR;
return ret;
}
FLAC__bool FLAC__file_decoder_process_metadata(FLAC__FileDecoder *decoder)
FLAC__bool FLAC__file_decoder_process_until_end_of_metadata(FLAC__FileDecoder *decoder)
{
FLAC__bool ret;
FLAC__ASSERT(0 != decoder);
......@@ -451,14 +451,14 @@ FLAC__bool FLAC__file_decoder_process_metadata(FLAC__FileDecoder *decoder)
FLAC__ASSERT(decoder->protected_->state == FLAC__FILE_DECODER_OK);
ret = FLAC__seekable_stream_decoder_process_metadata(decoder->private_->seekable_stream_decoder);
ret = FLAC__seekable_stream_decoder_process_until_end_of_metadata(decoder->private_->seekable_stream_decoder);
if(!ret)
decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR;
return ret;
}
FLAC__bool FLAC__file_decoder_process_one_frame(FLAC__FileDecoder *decoder)
FLAC__bool FLAC__file_decoder_process_until_end_of_file(FLAC__FileDecoder *decoder)
{
FLAC__bool ret;
FLAC__ASSERT(0 != decoder);
......@@ -471,27 +471,7 @@ FLAC__bool FLAC__file_decoder_process_one_frame(FLAC__FileDecoder *decoder)
FLAC__ASSERT(decoder->protected_->state == FLAC__FILE_DECODER_OK);
ret = FLAC__seekable_stream_decoder_process_one_frame(decoder->private_->seekable_stream_decoder);
if(!ret)
decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR;
return ret;
}
FLAC__bool FLAC__file_decoder_process_remaining_frames(FLAC__FileDecoder *decoder)
{
FLAC__bool ret;
FLAC__ASSERT(0 != decoder);
if(decoder->private_->seekable_stream_decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM)
decoder->protected_->state = FLAC__FILE_DECODER_END_OF_FILE;
if(decoder->protected_->state == FLAC__FILE_DECODER_END_OF_FILE)
return true;
FLAC__ASSERT(decoder->protected_->state == FLAC__FILE_DECODER_OK);
ret = FLAC__seekable_stream_decoder_process_remaining_frames(decoder->private_->seekable_stream_decoder);
ret = FLAC__seekable_stream_decoder_process_until_end_of_stream(decoder->private_->seekable_stream_decoder);
if(!ret)
decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR;
......
......@@ -545,7 +545,7 @@ FLAC__bool FLAC__seekable_stream_decoder_reset(FLAC__SeekableStreamDecoder *deco
return true;
}
FLAC__bool FLAC__seekable_stream_decoder_process_whole_stream(FLAC__SeekableStreamDecoder *decoder)
FLAC__bool FLAC__seekable_stream_decoder_process_single(FLAC__SeekableStreamDecoder *decoder)
{
FLAC__bool ret;
FLAC__ASSERT(0 != decoder);
......@@ -558,14 +558,14 @@ FLAC__bool FLAC__seekable_stream_decoder_process_whole_stream(FLAC__SeekableStre
FLAC__ASSERT(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_OK);
ret = FLAC__stream_decoder_process_whole_stream(decoder->private_->stream_decoder);
ret = FLAC__stream_decoder_process_single(decoder->private_->stream_decoder);
if(!ret)
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR;
return ret;
}
FLAC__bool FLAC__seekable_stream_decoder_process_metadata(FLAC__SeekableStreamDecoder *decoder)
FLAC__bool FLAC__seekable_stream_decoder_process_until_end_of_metadata(FLAC__SeekableStreamDecoder *decoder)
{
FLAC__bool ret;
FLAC__ASSERT(0 != decoder);
......@@ -578,14 +578,14 @@ FLAC__bool FLAC__seekable_stream_decoder_process_metadata(FLAC__SeekableStreamDe
FLAC__ASSERT(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_OK);
ret = FLAC__stream_decoder_process_metadata(decoder->private_->stream_decoder);
ret = FLAC__stream_decoder_process_until_end_of_metadata(decoder->private_->stream_decoder);
if(!ret)
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR;
return ret;
}
FLAC__bool FLAC__seekable_stream_decoder_process_one_frame(FLAC__SeekableStreamDecoder *decoder)
FLAC__bool FLAC__seekable_stream_decoder_process_until_end_of_stream(FLAC__SeekableStreamDecoder *decoder)
{
FLAC__bool ret;
FLAC__ASSERT(0 != decoder);
......@@ -598,27 +598,7 @@ FLAC__bool FLAC__seekable_stream_decoder_process_one_frame(FLAC__SeekableStreamD
FLAC__ASSERT(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_OK);
ret = FLAC__stream_decoder_process_one_frame(decoder->private_->stream_decoder);
if(!ret)
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR;
return ret;
}
FLAC__bool FLAC__seekable_stream_decoder_process_remaining_frames(FLAC__SeekableStreamDecoder *decoder)
{
FLAC__bool ret;
FLAC__ASSERT(0 != decoder);
if(decoder->private_->stream_decoder->protected_->state == FLAC__STREAM_DECODER_END_OF_STREAM)
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM;
if(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM)
return true;
FLAC__ASSERT(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_OK);
ret = FLAC__stream_decoder_process_remaining_frames(decoder->private_->stream_decoder);
ret = FLAC__stream_decoder_process_until_end_of_stream(decoder->private_->stream_decoder);
if(!ret)
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR;
......@@ -651,7 +631,7 @@ FLAC__bool FLAC__seekable_stream_decoder_seek_absolute(FLAC__SeekableStreamDecod
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR;
return false;
}
if(!FLAC__stream_decoder_process_metadata(decoder->private_->stream_decoder)) {
if(!FLAC__stream_decoder_process_until_end_of_metadata(decoder->private_->stream_decoder)) {
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR;
return false;
}
......@@ -961,7 +941,7 @@ FLAC__bool seek_to_absolute_sample_(FLAC__SeekableStreamDecoder *decoder, FLAC__
return false;
}
}
if(!FLAC__stream_decoder_process_one_frame(decoder->private_->stream_decoder)) {
if(!FLAC__stream_decoder_process_single(decoder->private_->