fix state enums

This commit is contained in:
Josh Coalson 2002-06-01 05:45:50 +00:00
parent e869fd33ea
commit a90f80fc9f
4 changed files with 18 additions and 24 deletions

View File

@ -28,18 +28,14 @@ extern "C" {
typedef enum { typedef enum {
FLAC__FILE_DECODER_OK = 0, FLAC__FILE_DECODER_OK = 0,
FLAC__FILE_DECODER_SEEKING, /*@@@ NOTE: unused; remove this in the next minor-version */
FLAC__FILE_DECODER_END_OF_FILE, FLAC__FILE_DECODER_END_OF_FILE,
FLAC__FILE_DECODER_ERROR_OPENING_FILE, FLAC__FILE_DECODER_ERROR_OPENING_FILE,
FLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR, FLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR,
FLAC__FILE_DECODER_SEEK_ERROR, FLAC__FILE_DECODER_SEEK_ERROR,
FLAC__FILE_DECODER_STREAM_ERROR, FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR,
FLAC__FILE_DECODER_MD5_ERROR, /*@@@ NOTE: unused; remove this in the next minor-version */
FLAC__FILE_DECODER_STREAM_DECODER_ERROR,
FLAC__FILE_DECODER_ALREADY_INITIALIZED, FLAC__FILE_DECODER_ALREADY_INITIALIZED,
FLAC__FILE_DECODER_INVALID_CALLBACK, FLAC__FILE_DECODER_INVALID_CALLBACK,
FLAC__FILE_DECODER_UNINITIALIZED, FLAC__FILE_DECODER_UNINITIALIZED
FLAC__FILE_DECODER_SEEKABLE_STREAM_ERROR = FLAC__FILE_DECODER_STREAM_ERROR /*@@@ NOTE: do the actual replacement in the next minor-version */
} FLAC__FileDecoderState; } FLAC__FileDecoderState;
extern const char *FLAC__FileDecoderStateString[]; extern const char *FLAC__FileDecoderStateString[];

View File

@ -32,7 +32,7 @@ typedef enum {
FLAC__SEEKABLE_STREAM_DECODER_SEEKING, FLAC__SEEKABLE_STREAM_DECODER_SEEKING,
FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM, FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM,
FLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR, FLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR,
FLAC__SEEKABLE_STREAM_DECODER_STREAM_ERROR, FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR,
FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR, FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR,
FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR, FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR,
FLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED, FLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED,

View File

@ -72,13 +72,11 @@ typedef struct FLAC__FileDecoderPrivate {
const char *FLAC__FileDecoderStateString[] = { const char *FLAC__FileDecoderStateString[] = {
"FLAC__FILE_DECODER_OK", "FLAC__FILE_DECODER_OK",
"FLAC__FILE_DECODER_SEEKING",
"FLAC__FILE_DECODER_END_OF_FILE", "FLAC__FILE_DECODER_END_OF_FILE",
"FLAC__FILE_DECODER_ERROR_OPENING_FILE", "FLAC__FILE_DECODER_ERROR_OPENING_FILE",
"FLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR", "FLAC__FILE_DECODER_MEMORY_ALLOCATION_ERROR",
"FLAC__FILE_DECODER_SEEK_ERROR", "FLAC__FILE_DECODER_SEEK_ERROR",
"FLAC__FILE_DECODER_STREAM_ERROR", "FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_DECODER_ERROR",
"FLAC__FILE_DECODER_STREAM_DECODER_ERROR",
"FLAC__FILE_DECODER_ALREADY_INITIALIZED", "FLAC__FILE_DECODER_ALREADY_INITIALIZED",
"FLAC__FILE_DECODER_INVALID_CALLBACK", "FLAC__FILE_DECODER_INVALID_CALLBACK",
"FLAC__FILE_DECODER_UNINITIALIZED" "FLAC__FILE_DECODER_UNINITIALIZED"
@ -188,7 +186,7 @@ FLAC__FileDecoderState FLAC__file_decoder_init(FLAC__FileDecoder *decoder)
FLAC__seekable_stream_decoder_set_client_data(decoder->private_->seekable_stream_decoder, decoder); FLAC__seekable_stream_decoder_set_client_data(decoder->private_->seekable_stream_decoder, decoder);
if(FLAC__seekable_stream_decoder_init(decoder->private_->seekable_stream_decoder) != FLAC__SEEKABLE_STREAM_DECODER_OK) if(FLAC__seekable_stream_decoder_init(decoder->private_->seekable_stream_decoder) != FLAC__SEEKABLE_STREAM_DECODER_OK)
return decoder->protected_->state = FLAC__FILE_DECODER_STREAM_DECODER_ERROR; /*@@@ change this to FLAC__FILE_DECODER_SEEKABLE_STREAM_ERROR in next minor-revision */ return decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR;
return decoder->protected_->state; return decoder->protected_->state;
} }
@ -388,7 +386,7 @@ FLAC__bool FLAC__file_decoder_process_whole_file(FLAC__FileDecoder *decoder)
ret = FLAC__seekable_stream_decoder_process_whole_stream(decoder->private_->seekable_stream_decoder); ret = FLAC__seekable_stream_decoder_process_whole_stream(decoder->private_->seekable_stream_decoder);
if(!ret) if(!ret)
decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_ERROR; decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR;
return ret; return ret;
} }
@ -408,7 +406,7 @@ FLAC__bool FLAC__file_decoder_process_metadata(FLAC__FileDecoder *decoder)
ret = FLAC__seekable_stream_decoder_process_metadata(decoder->private_->seekable_stream_decoder); ret = FLAC__seekable_stream_decoder_process_metadata(decoder->private_->seekable_stream_decoder);
if(!ret) if(!ret)
decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_ERROR; decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR;
return ret; return ret;
} }
@ -428,7 +426,7 @@ FLAC__bool FLAC__file_decoder_process_one_frame(FLAC__FileDecoder *decoder)
ret = FLAC__seekable_stream_decoder_process_one_frame(decoder->private_->seekable_stream_decoder); ret = FLAC__seekable_stream_decoder_process_one_frame(decoder->private_->seekable_stream_decoder);
if(!ret) if(!ret)
decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_ERROR; decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR;
return ret; return ret;
} }
@ -448,7 +446,7 @@ FLAC__bool FLAC__file_decoder_process_remaining_frames(FLAC__FileDecoder *decode
ret = FLAC__seekable_stream_decoder_process_remaining_frames(decoder->private_->seekable_stream_decoder); ret = FLAC__seekable_stream_decoder_process_remaining_frames(decoder->private_->seekable_stream_decoder);
if(!ret) if(!ret)
decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_ERROR; decoder->protected_->state = FLAC__FILE_DECODER_SEEKABLE_STREAM_DECODER_ERROR;
return ret; return ret;
} }

View File

@ -75,7 +75,7 @@ const char *FLAC__SeekableStreamDecoderStateString[] = {
"FLAC__SEEKABLE_STREAM_DECODER_SEEKING", "FLAC__SEEKABLE_STREAM_DECODER_SEEKING",
"FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM", "FLAC__SEEKABLE_STREAM_DECODER_END_OF_STREAM",
"FLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR", "FLAC__SEEKABLE_STREAM_DECODER_MEMORY_ALLOCATION_ERROR",
"FLAC__SEEKABLE_STREAM_DECODER_STREAM_ERROR", "FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR",
"FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR", "FLAC__SEEKABLE_STREAM_DECODER_READ_ERROR",
"FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR", "FLAC__SEEKABLE_STREAM_DECODER_SEEK_ERROR",
"FLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED", "FLAC__SEEKABLE_STREAM_DECODER_ALREADY_INITIALIZED",
@ -209,7 +209,7 @@ FLAC__SeekableStreamDecoderState FLAC__seekable_stream_decoder_init(FLAC__Seekab
FLAC__stream_decoder_set_client_data(decoder->private_->stream_decoder, decoder); FLAC__stream_decoder_set_client_data(decoder->private_->stream_decoder, decoder);
if(FLAC__stream_decoder_init(decoder->private_->stream_decoder) != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA) if(FLAC__stream_decoder_init(decoder->private_->stream_decoder) != FLAC__STREAM_DECODER_SEARCH_FOR_METADATA)
return decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_ERROR; return decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR;
return decoder->protected_->state; return decoder->protected_->state;
} }
@ -448,7 +448,7 @@ FLAC__bool FLAC__seekable_stream_decoder_process_whole_stream(FLAC__SeekableStre
ret = FLAC__stream_decoder_process_whole_stream(decoder->private_->stream_decoder); ret = FLAC__stream_decoder_process_whole_stream(decoder->private_->stream_decoder);
if(!ret) if(!ret)
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_ERROR; decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR;
return ret; return ret;
} }
@ -468,7 +468,7 @@ FLAC__bool FLAC__seekable_stream_decoder_process_metadata(FLAC__SeekableStreamDe
ret = FLAC__stream_decoder_process_metadata(decoder->private_->stream_decoder); ret = FLAC__stream_decoder_process_metadata(decoder->private_->stream_decoder);
if(!ret) if(!ret)
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_ERROR; decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR;
return ret; return ret;
} }
@ -488,7 +488,7 @@ FLAC__bool FLAC__seekable_stream_decoder_process_one_frame(FLAC__SeekableStreamD
ret = FLAC__stream_decoder_process_one_frame(decoder->private_->stream_decoder); ret = FLAC__stream_decoder_process_one_frame(decoder->private_->stream_decoder);
if(!ret) if(!ret)
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_ERROR; decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR;
return ret; return ret;
} }
@ -508,7 +508,7 @@ FLAC__bool FLAC__seekable_stream_decoder_process_remaining_frames(FLAC__Seekable
ret = FLAC__stream_decoder_process_remaining_frames(decoder->private_->stream_decoder); ret = FLAC__stream_decoder_process_remaining_frames(decoder->private_->stream_decoder);
if(!ret) if(!ret)
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_ERROR; decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR;
return ret; return ret;
} }
@ -526,7 +526,7 @@ FLAC__bool FLAC__seekable_stream_decoder_seek_absolute(FLAC__SeekableStreamDecod
decoder->protected_->md5_checking = false; decoder->protected_->md5_checking = false;
if(!FLAC__stream_decoder_reset(decoder->private_->stream_decoder)) { if(!FLAC__stream_decoder_reset(decoder->private_->stream_decoder)) {
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_ERROR; decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR;
return false; return false;
} }
/* get the file length */ /* get the file length */
@ -540,7 +540,7 @@ FLAC__bool FLAC__seekable_stream_decoder_seek_absolute(FLAC__SeekableStreamDecod
return false; return false;
} }
if(!FLAC__stream_decoder_process_metadata(decoder->private_->stream_decoder)) { if(!FLAC__stream_decoder_process_metadata(decoder->private_->stream_decoder)) {
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_ERROR; decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR;
return false; return false;
} }
if(sample > decoder->private_->stream_info.total_samples) { if(sample > decoder->private_->stream_info.total_samples) {
@ -784,7 +784,7 @@ FLAC__bool seek_to_absolute_sample_(FLAC__SeekableStreamDecoder *decoder, FLAC__
return false; return false;
} }
if(!FLAC__stream_decoder_flush(decoder->private_->stream_decoder)) { if(!FLAC__stream_decoder_flush(decoder->private_->stream_decoder)) {
decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_ERROR; decoder->protected_->state = FLAC__SEEKABLE_STREAM_DECODER_STREAM_DECODER_ERROR;
return false; return false;
} }
} }