From b71b56cb4b53a4e22e8788bdf4c2d0e7fec7ecfd Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Fri, 16 Jan 2004 00:03:15 +0000 Subject: [PATCH] various fixes related to deriving OggFLAC__SeekableStreamEncoder from FLAC__StreamEncoder instead of FLAC__SeekableStreamEncoder --- include/OggFLAC++/encoder.h | 2 -- include/OggFLAC/file_encoder.h | 22 ++----------- src/libOggFLAC++/file_encoder.cpp | 6 ---- src/libOggFLAC++/seekable_stream_encoder.cpp | 6 ---- src/test_libOggFLAC++/encoders.cpp | 48 ++++++++++------------------ src/test_libOggFLAC/encoders.c | 42 +++++++----------------- 6 files changed, 30 insertions(+), 96 deletions(-) diff --git a/include/OggFLAC++/encoder.h b/include/OggFLAC++/encoder.h index 5c6b73e..4d26569 100644 --- a/include/OggFLAC++/encoder.h +++ b/include/OggFLAC++/encoder.h @@ -230,7 +230,6 @@ namespace OggFLAC { bool set_metadata(::FLAC__StreamMetadata **metadata, unsigned num_blocks); State get_state() const; - FLAC::Encoder::SeekableStream::State get_FLAC_seekable_stream_encoder_state() const; FLAC::Encoder::Stream::State get_FLAC_stream_encoder_state() const; FLAC::Decoder::Stream::State get_verify_decoder_state() const; void get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got); @@ -334,7 +333,6 @@ namespace OggFLAC { State get_state() const; SeekableStream::State get_seekable_stream_encoder_state() const; - FLAC::Encoder::SeekableStream::State get_FLAC_seekable_stream_encoder_state() const; FLAC::Encoder::Stream::State get_FLAC_stream_encoder_state() const; FLAC::Decoder::Stream::State get_verify_decoder_state() const; void get_verify_decoder_error_stats(FLAC__uint64 *absolute_sample, unsigned *frame_number, unsigned *channel, unsigned *sample, FLAC__int32 *expected, FLAC__int32 *got); diff --git a/include/OggFLAC/file_encoder.h b/include/OggFLAC/file_encoder.h index 015a7d4..7289f18 100644 --- a/include/OggFLAC/file_encoder.h +++ b/include/OggFLAC/file_encoder.h @@ -511,27 +511,11 @@ OggFLAC_API OggFLAC__FileEncoderState OggFLAC__file_encoder_get_state(const OggF */ OggFLAC_API OggFLAC__SeekableStreamEncoderState OggFLAC__file_encoder_get_seekable_stream_encoder_state(const OggFLAC__FileEncoder *encoder); -/** Get the state of the underlying FLAC seekable stream encoder. - * Useful when the file encoder state is - * \c OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR - * and the seekable stream encoder state is - * \c OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_SEEKABLE_STREAM_ENCODER_ERROR. - * - * \param encoder An encoder instance to query. - * \assert - * \code encoder != NULL \endcode - * \retval FLAC__SeekableStreamEncoderState - * The seekable stream encoder state. - */ -OggFLAC_API FLAC__SeekableStreamEncoderState OggFLAC__file_encoder_get_FLAC_seekable_stream_encoder_state(const OggFLAC__FileEncoder *encoder); - /** Get the state of the underlying FLAC stream encoder. * Useful when the file encoder state is * \c OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR * and the seekable stream encoder state is - * \c OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_SEEKABLE_STREAM_ENCODER_ERROR - * and the FLAC seekable stream encoder state is - * \c FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR. + * \c OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR. * * \param encoder An encoder instance to query. * \assert @@ -545,9 +529,7 @@ OggFLAC_API FLAC__StreamEncoderState OggFLAC__file_encoder_get_FLAC_stream_encod * Useful when the file encoder state is * \c OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR * and the seekable stream encoder state is - * \c OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_SEEKABLE_STREAM_ENCODER_ERROR - * and the FLAC seekable stream encoder state is - * \c FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR + * \c OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR * and the FLAC stream encoder state is * \c FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR. * diff --git a/src/libOggFLAC++/file_encoder.cpp b/src/libOggFLAC++/file_encoder.cpp index cd575b7..013074b 100644 --- a/src/libOggFLAC++/file_encoder.cpp +++ b/src/libOggFLAC++/file_encoder.cpp @@ -189,12 +189,6 @@ namespace OggFLAC { return SeekableStream::State(::OggFLAC__file_encoder_get_seekable_stream_encoder_state(encoder_)); } - FLAC::Encoder::SeekableStream::State File::get_FLAC_seekable_stream_encoder_state() const - { - FLAC__ASSERT(is_valid()); - return FLAC::Encoder::SeekableStream::State(::OggFLAC__file_encoder_get_FLAC_seekable_stream_encoder_state(encoder_)); - } - FLAC::Encoder::Stream::State File::get_FLAC_stream_encoder_state() const { FLAC__ASSERT(is_valid()); diff --git a/src/libOggFLAC++/seekable_stream_encoder.cpp b/src/libOggFLAC++/seekable_stream_encoder.cpp index 3930488..320b586 100644 --- a/src/libOggFLAC++/seekable_stream_encoder.cpp +++ b/src/libOggFLAC++/seekable_stream_encoder.cpp @@ -177,12 +177,6 @@ namespace OggFLAC { return State(::OggFLAC__seekable_stream_encoder_get_state(encoder_)); } - FLAC::Encoder::SeekableStream::State SeekableStream::get_FLAC_seekable_stream_encoder_state() const - { - FLAC__ASSERT(is_valid()); - return FLAC::Encoder::SeekableStream::State(::OggFLAC__seekable_stream_encoder_get_FLAC_seekable_stream_encoder_state(encoder_)); - } - FLAC::Encoder::Stream::State SeekableStream::get_FLAC_stream_encoder_state() const { FLAC__ASSERT(is_valid()); diff --git a/src/test_libOggFLAC++/encoders.cpp b/src/test_libOggFLAC++/encoders.cpp index d571681..b68bd13 100644 --- a/src/test_libOggFLAC++/encoders.cpp +++ b/src/test_libOggFLAC++/encoders.cpp @@ -425,16 +425,12 @@ bool SeekableStreamEncoder::die(const char *msg) const printf("FAILED"); printf(", state = %u (%s)\n", (unsigned)((::OggFLAC__SeekableStreamEncoderState)state), state.as_cstring()); - if(state == ::OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_SEEKABLE_STREAM_ENCODER_ERROR) { - FLAC::Encoder::SeekableStream::State state_ = get_FLAC_seekable_stream_encoder_state(); - printf(" FLAC seekable stream encoder state = %u (%s)\n", (unsigned)((::FLAC__SeekableStreamEncoderState)state_), state_.as_cstring()); - if(state_ == ::FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR) { - FLAC::Encoder::Stream::State state__ = get_FLAC_stream_encoder_state(); - printf(" FLAC stream encoder state = %u (%s)\n", (unsigned)((::FLAC__StreamEncoderState)state__), state__.as_cstring()); - if(state__ == ::FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) { - FLAC::Decoder::Stream::State dstate = get_verify_decoder_state(); - printf(" verify decoder state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)dstate), dstate.as_cstring()); - } + if(state == ::OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR) { + FLAC::Encoder::Stream::State state_ = get_FLAC_stream_encoder_state(); + printf(" FLAC stream encoder state = %u (%s)\n", (unsigned)((::FLAC__StreamEncoderState)state_), state_.as_cstring()); + if(state_ == ::FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) { + FLAC::Decoder::Stream::State dstate = get_verify_decoder_state(); + printf(" verify decoder state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)dstate), dstate.as_cstring()); } } @@ -569,13 +565,9 @@ static bool test_seekable_stream_encoder() OggFLAC::Encoder::SeekableStream::State state = encoder->get_state(); printf("returned state = %u (%s)... OK\n", (unsigned)((::OggFLAC__SeekableStreamEncoderState)state), state.as_cstring()); - printf("testing get_FLAC_seekable_stream_encoder_state()... "); - FLAC::Encoder::SeekableStream::State state_ = encoder->get_FLAC_seekable_stream_encoder_state(); - printf("returned state = %u (%s)... OK\n", (unsigned)((::FLAC__SeekableStreamEncoderState)state_), state_.as_cstring()); - printf("testing get_FLAC_stream_encoder_state()... "); - FLAC::Encoder::Stream::State state__ = encoder->get_FLAC_stream_encoder_state(); - printf("returned state = %u (%s)... OK\n", (unsigned)((::FLAC__StreamEncoderState)state__), state__.as_cstring()); + FLAC::Encoder::Stream::State state_ = encoder->get_FLAC_stream_encoder_state(); + printf("returned state = %u (%s)... OK\n", (unsigned)((::FLAC__StreamEncoderState)state_), state_.as_cstring()); printf("testing get_verify_decoder_state()... "); FLAC::Decoder::Stream::State dstate = encoder->get_verify_decoder_state(); @@ -766,16 +758,12 @@ bool FileEncoder::die(const char *msg) const if(state == ::OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR) { OggFLAC::Encoder::SeekableStream::State state_ = get_seekable_stream_encoder_state(); printf(" seekable stream encoder state = %u (%s)\n", (unsigned)((::OggFLAC__SeekableStreamEncoderState)state_), state_.as_cstring()); - if(state_ == ::OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_SEEKABLE_STREAM_ENCODER_ERROR) { - FLAC::Encoder::SeekableStream::State state__ = get_FLAC_seekable_stream_encoder_state(); - printf(" FLAC seekable stream encoder state = %u (%s)\n", (unsigned)((::FLAC__SeekableStreamEncoderState)state__), state__.as_cstring()); - if(state__ == ::FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR) { - FLAC::Encoder::Stream::State state___ = get_FLAC_stream_encoder_state(); - printf(" FLAC stream encoder state = %u (%s)\n", (unsigned)((::FLAC__StreamEncoderState)state___), state___.as_cstring()); - if(state___ == ::FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) { - FLAC::Decoder::Stream::State dstate = get_verify_decoder_state(); - printf(" verify decoder state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)dstate), dstate.as_cstring()); - } + if(state_ == ::OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR) { + FLAC::Encoder::Stream::State state__ = get_FLAC_stream_encoder_state(); + printf(" FLAC stream encoder state = %u (%s)\n", (unsigned)((::FLAC__StreamEncoderState)state__), state__.as_cstring()); + if(state__ == ::FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) { + FLAC::Decoder::Stream::State dstate = get_verify_decoder_state(); + printf(" verify decoder state = %u (%s)\n", (unsigned)((::FLAC__StreamDecoderState)dstate), dstate.as_cstring()); } } } @@ -920,13 +908,9 @@ static bool test_file_encoder() OggFLAC::Encoder::SeekableStream::State state_ = encoder->get_seekable_stream_encoder_state(); printf("returned state = %u (%s)... OK\n", (unsigned)((::OggFLAC__SeekableStreamEncoderState)state_), state_.as_cstring()); - printf("testing get_FLAC_seekable_stream_encoder_state()... "); - FLAC::Encoder::SeekableStream::State state__ = encoder->get_FLAC_seekable_stream_encoder_state(); - printf("returned state = %u (%s)... OK\n", (unsigned)((::FLAC__SeekableStreamEncoderState)state__), state__.as_cstring()); - printf("testing get_FLAC_stream_encoder_state()... "); - FLAC::Encoder::Stream::State state___ = encoder->get_FLAC_stream_encoder_state(); - printf("returned state = %u (%s)... OK\n", (unsigned)((::FLAC__StreamEncoderState)state___), state___.as_cstring()); + FLAC::Encoder::Stream::State state__ = encoder->get_FLAC_stream_encoder_state(); + printf("returned state = %u (%s)... OK\n", (unsigned)((::FLAC__StreamEncoderState)state__), state__.as_cstring()); printf("testing get_verify_decoder_state()... "); FLAC::Decoder::Stream::State dstate = encoder->get_verify_decoder_state(); diff --git a/src/test_libOggFLAC/encoders.c b/src/test_libOggFLAC/encoders.c index ead8c32..d8f4546 100644 --- a/src/test_libOggFLAC/encoders.c +++ b/src/test_libOggFLAC/encoders.c @@ -65,16 +65,12 @@ static FLAC__bool die_ss_(const char *msg, const OggFLAC__SeekableStreamEncoder printf("FAILED"); printf(", state = %u (%s)\n", (unsigned)state, OggFLAC__SeekableStreamEncoderStateString[state]); - if(state == OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_SEEKABLE_STREAM_ENCODER_ERROR) { - FLAC__SeekableStreamEncoderState state_ = OggFLAC__seekable_stream_encoder_get_FLAC_seekable_stream_encoder_state(encoder); - printf(" FLAC seekable stream encoder state = %u (%s)\n", (unsigned)state_, FLAC__SeekableStreamEncoderStateString[state_]); - if(state_ == FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR) { - FLAC__StreamEncoderState state__ = OggFLAC__seekable_stream_encoder_get_FLAC_stream_encoder_state(encoder); - printf(" FLAC stream encoder state = %u (%s)\n", (unsigned)state__, FLAC__StreamEncoderStateString[state__]); - if(state__ == FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) { - FLAC__StreamDecoderState dstate = OggFLAC__seekable_stream_encoder_get_verify_decoder_state(encoder); - printf(" verify decoder state = %u (%s)\n", (unsigned)dstate, FLAC__StreamDecoderStateString[dstate]); - } + if(state == OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR) { + FLAC__StreamEncoderState state_ = OggFLAC__seekable_stream_encoder_get_FLAC_stream_encoder_state(encoder); + printf(" FLAC stream encoder state = %u (%s)\n", (unsigned)state_, FLAC__StreamEncoderStateString[state_]); + if(state_ == FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) { + FLAC__StreamDecoderState dstate = OggFLAC__seekable_stream_encoder_get_verify_decoder_state(encoder); + printf(" verify decoder state = %u (%s)\n", (unsigned)dstate, FLAC__StreamDecoderStateString[dstate]); } } @@ -94,16 +90,12 @@ static FLAC__bool die_f_(const char *msg, const OggFLAC__FileEncoder *encoder) if(state == OggFLAC__FILE_ENCODER_SEEKABLE_STREAM_ENCODER_ERROR) { OggFLAC__SeekableStreamEncoderState state_ = OggFLAC__file_encoder_get_seekable_stream_encoder_state(encoder); printf(" seekable stream encoder state = %u (%s)\n", (unsigned)state_, OggFLAC__SeekableStreamEncoderStateString[state_]); - if(state_ == OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_SEEKABLE_STREAM_ENCODER_ERROR) { - FLAC__SeekableStreamEncoderState state__ = OggFLAC__file_encoder_get_FLAC_seekable_stream_encoder_state(encoder); - printf(" FLAC seekable stream encoder state = %u (%s)\n", (unsigned)state__, FLAC__SeekableStreamEncoderStateString[state__]); - if(state__ == FLAC__SEEKABLE_STREAM_ENCODER_STREAM_ENCODER_ERROR) { - FLAC__StreamEncoderState state___ = OggFLAC__file_encoder_get_FLAC_stream_encoder_state(encoder); - printf(" FLAC stream encoder state = %u (%s)\n", (unsigned)state___, FLAC__StreamEncoderStateString[state___]); - if(state___ == FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) { - FLAC__StreamDecoderState dstate = OggFLAC__file_encoder_get_verify_decoder_state(encoder); - printf(" verify decoder state = %u (%s)\n", (unsigned)dstate, FLAC__StreamDecoderStateString[dstate]); - } + if(state_ == OggFLAC__SEEKABLE_STREAM_ENCODER_FLAC_STREAM_ENCODER_ERROR) { + FLAC__StreamEncoderState state__ = OggFLAC__file_encoder_get_FLAC_stream_encoder_state(encoder); + printf(" FLAC stream encoder state = %u (%s)\n", (unsigned)state__, FLAC__StreamEncoderStateString[state__]); + if(state__ == FLAC__STREAM_ENCODER_VERIFY_DECODER_ERROR) { + FLAC__StreamDecoderState dstate = OggFLAC__file_encoder_get_verify_decoder_state(encoder); + printf(" verify decoder state = %u (%s)\n", (unsigned)dstate, FLAC__StreamDecoderStateString[dstate]); } } } @@ -462,7 +454,6 @@ static FLAC__bool test_seekable_stream_encoder() { OggFLAC__SeekableStreamEncoder *encoder; OggFLAC__SeekableStreamEncoderState state; - FLAC__SeekableStreamEncoderState fsstate; FLAC__StreamEncoderState fstate; FLAC__StreamDecoderState dstate; FLAC__int32 samples[1024]; @@ -605,10 +596,6 @@ static FLAC__bool test_seekable_stream_encoder() state = OggFLAC__seekable_stream_encoder_get_state(encoder); printf("returned state = %u (%s)... OK\n", (unsigned)state, OggFLAC__SeekableStreamEncoderStateString[state]); - printf("testing OggFLAC__seekable_stream_encoder_get_FLAC_seekable_stream_encoder_state()... "); - fsstate = OggFLAC__seekable_stream_encoder_get_FLAC_seekable_stream_encoder_state(encoder); - printf("returned state = %u (%s)... OK\n", (unsigned)fsstate, FLAC__SeekableStreamEncoderStateString[fsstate]); - printf("testing OggFLAC__seekable_stream_encoder_get_FLAC_stream_encoder_state()... "); fstate = OggFLAC__seekable_stream_encoder_get_FLAC_stream_encoder_state(encoder); printf("returned state = %u (%s)... OK\n", (unsigned)fstate, FLAC__StreamEncoderStateString[fstate]); @@ -784,7 +771,6 @@ static FLAC__bool test_file_encoder() OggFLAC__FileEncoder *encoder; OggFLAC__FileEncoderState state; OggFLAC__SeekableStreamEncoderState sstate; - FLAC__SeekableStreamEncoderState fsstate; FLAC__StreamEncoderState fstate; FLAC__StreamDecoderState dstate; FLAC__int32 samples[1024]; @@ -926,10 +912,6 @@ static FLAC__bool test_file_encoder() sstate = OggFLAC__file_encoder_get_seekable_stream_encoder_state(encoder); printf("returned state = %u (%s)... OK\n", (unsigned)sstate, OggFLAC__SeekableStreamEncoderStateString[sstate]); - printf("testing OggFLAC__file_encoder_get_FLAC_seekable_stream_encoder_state()... "); - fsstate = OggFLAC__file_encoder_get_FLAC_seekable_stream_encoder_state(encoder); - printf("returned state = %u (%s)... OK\n", (unsigned)fsstate, FLAC__SeekableStreamEncoderStateString[fsstate]); - printf("testing OggFLAC__file_encoder_get_FLAC_stream_encoder_state()... "); fstate = OggFLAC__file_encoder_get_FLAC_stream_encoder_state(encoder); printf("returned state = %u (%s)... OK\n", (unsigned)fstate, FLAC__StreamEncoderStateString[fstate]); -- 2.7.4