add ..._get_resolved_state_string() convenience function
authorJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 8 Nov 2002 06:16:31 +0000 (06:16 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 8 Nov 2002 06:16:31 +0000 (06:16 +0000)
include/FLAC/stream_encoder.h
src/libFLAC/file_encoder.c
src/libFLAC/seekable_stream_encoder.c
src/libFLAC/stream_encoder.c

index 3fdbdc8..cd55146 100644 (file)
@@ -743,6 +743,9 @@ FLAC_API FLAC__StreamEncoderState FLAC__stream_encoder_get_state(const FLAC__Str
  */
 FLAC_API FLAC__StreamDecoderState FLAC__stream_encoder_get_verify_decoder_state(const FLAC__StreamEncoder *encoder);
 
+/*@@@@ document */
+FLAC_API const char *FLAC__stream_encoder_get_resolved_state_string(const FLAC__StreamEncoder *encoder);
+
 /** Get relevant values about the nature of a verify decoder error.
  *  Useful when the stream encoder state is
  *  \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR.  The arguments should
index 376a456..7827e61 100644 (file)
@@ -508,6 +508,14 @@ FLAC_API FLAC__StreamDecoderState FLAC__file_encoder_get_verify_decoder_state(co
        return FLAC__seekable_stream_encoder_get_verify_decoder_state(encoder->private_->seekable_stream_encoder);
 }
 
+FLAC_API const char *FLAC__file_encoder_get_resolved_state_string(const FLAC__FileEncoder *encoder)
+{
+       if(encoder->protected_->state != FLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR)
+               return FLAC__FileEncoderStateString[encoder->protected_->state];
+       else
+               return FLAC__seekable_stream_encoder_get_resolved_state_string(encoder->private_->seekable_stream_encoder);
+}
+
 FLAC_API void FLAC__file_encoder_get_verify_decoder_error_stats(const FLAC__FileEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got)
 {
        FLAC__ASSERT(0 != encoder);
index a7888c0..6585ee2 100644 (file)
@@ -508,6 +508,14 @@ FLAC_API FLAC__StreamDecoderState FLAC__seekable_stream_encoder_get_verify_decod
        return FLAC__stream_encoder_get_verify_decoder_state(encoder->private_->stream_encoder);
 }
 
+FLAC_API const char *FLAC__seekable_stream_encoder_get_resolved_state_string(const FLAC__SeekableStreamEncoder *encoder)
+{
+       if(encoder->protected_->state != FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR)
+               return FLAC__SeekableStreamEncoderStateString[encoder->protected_->state];
+       else
+               return FLAC__stream_encoder_get_resolved_state_string(encoder->private_->stream_encoder);
+}
+
 FLAC_API void FLAC__seekable_stream_encoder_get_verify_decoder_error_stats(const FLAC__SeekableStreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got)
 {
        FLAC__ASSERT(0 != encoder);
index adf2914..9275ce2 100644 (file)
@@ -1175,6 +1175,14 @@ FLAC_API FLAC__StreamDecoderState FLAC__stream_encoder_get_verify_decoder_state(
                return FLAC__STREAM_DECODER_UNINITIALIZED;
 }
 
+FLAC_API const char *FLAC__stream_encoder_get_resolved_state_string(const FLAC__StreamEncoder *encoder)
+{
+       if(encoder->protected_->state != FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR)
+               return FLAC__StreamEncoderStateString[encoder->protected_->state];
+       else
+               return FLAC__StreamDecoderStateString[FLAC__stream_decoder_get_state(encoder->private_->verify.decoder)];
+}
+
 FLAC_API void FLAC__stream_encoder_get_verify_decoder_error_stats(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got)
 {
        FLAC__ASSERT(0 != encoder);