fix bug when seeking a file that is already at END_OF_FILE
This commit is contained in:
parent
ae84212bd5
commit
6cca87bb7b
@ -359,16 +359,10 @@ FLAC__bool FLAC__file_decoder_process_remaining_frames(FLAC__FileDecoder *decode
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Private class methods
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
FLAC__bool FLAC__file_decoder_seek_absolute(FLAC__FileDecoder *decoder, FLAC__uint64 sample)
|
||||
{
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
FLAC__ASSERT(decoder->protected_->state == FLAC__FILE_DECODER_OK);
|
||||
FLAC__ASSERT(decoder->protected_->state == FLAC__FILE_DECODER_OK || decoder->protected_->state == FLAC__FILE_DECODER_END_OF_FILE);
|
||||
|
||||
if(decoder->private_->filename == 0) { /* means the file is stdin... */
|
||||
decoder->protected_->state = FLAC__FILE_DECODER_SEEK_ERROR;
|
||||
@ -379,10 +373,18 @@ FLAC__bool FLAC__file_decoder_seek_absolute(FLAC__FileDecoder *decoder, FLAC__ui
|
||||
decoder->protected_->state = FLAC__FILE_DECODER_SEEK_ERROR;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
else {
|
||||
decoder->protected_->state = FLAC__FILE_DECODER_OK;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
* Private class methods
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
FLAC__SeekableStreamDecoderReadStatus read_callback_(const FLAC__SeekableStreamDecoder *decoder, FLAC__byte buffer[], unsigned *bytes, void *client_data)
|
||||
{
|
||||
FLAC__FileDecoder *file_decoder = (FLAC__FileDecoder *)client_data;
|
||||
|
@ -404,7 +404,7 @@ FLAC__bool FLAC__seekable_stream_decoder_seek_absolute(FLAC__SeekableStreamDecod
|
||||
FLAC__uint64 length;
|
||||
|
||||
FLAC__ASSERT(decoder != 0);
|
||||
FLAC__ASSERT(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_OK);
|
||||
FLAC__ASSERT(decoder->protected_->state == FLAC__SEEKABLE_STREAM_DECODER_OK || decoder->protected_->state == END_OF_STREAM);
|
||||
|
||||
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_SEEKING;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user