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

add resolved_as_cstring()

parent c6d1fc8a
...@@ -95,6 +95,7 @@ namespace FLAC { ...@@ -95,6 +95,7 @@ namespace FLAC {
inline State(::FLAC__StreamDecoderState state): state_(state) { } inline State(::FLAC__StreamDecoderState state): state_(state) { }
inline operator ::FLAC__StreamDecoderState() const { return state_; } inline operator ::FLAC__StreamDecoderState() const { return state_; }
inline const char *as_cstring() const { return ::FLAC__StreamDecoderStateString[state_]; } inline const char *as_cstring() const { return ::FLAC__StreamDecoderStateString[state_]; }
inline const char *resolved_as_cstring(const Stream &decoder) const { return ::FLAC__stream_decoder_get_resolved_state_string(decoder.decoder_); }
protected: protected:
::FLAC__StreamDecoderState state_; ::FLAC__StreamDecoderState state_;
}; };
......
...@@ -606,6 +606,16 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDec ...@@ -606,6 +606,16 @@ FLAC_API FLAC__bool FLAC__stream_decoder_set_metadata_ignore_all(FLAC__StreamDec
*/ */
FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder); FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__StreamDecoder *decoder);
/** Get the current decoder state as a C string.
*
* \param decoder A decoder instance to query.
* \assert
* \code decoder != NULL \endcode
* \retval const char *
* The decoder state as a C string. Do not modify the contents.
*/
FLAC_API const char *FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder);
/** Get the current number of channels in the stream being decoded. /** Get the current number of channels in the stream being decoded.
* Will only be valid after decoding has started and will contain the * Will only be valid after decoding has started and will contain the
* value from the most recently decoded frame header. * value from the most recently decoded frame header.
......
...@@ -516,6 +516,11 @@ FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__Str ...@@ -516,6 +516,11 @@ FLAC_API FLAC__StreamDecoderState FLAC__stream_decoder_get_state(const FLAC__Str
return decoder->protected_->state; return decoder->protected_->state;
} }
FLAC_API const char *FLAC__stream_decoder_get_resolved_state_string(const FLAC__StreamDecoder *decoder)
{
return FLAC__StreamDecoderStateString[decoder->protected_->state];
}
FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder) FLAC_API unsigned FLAC__stream_decoder_get_channels(const FLAC__StreamDecoder *decoder)
{ {
FLAC__ASSERT(0 != decoder); FLAC__ASSERT(0 != decoder);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment