diff options
author | Erik de Castro Lopo <erikd@mega-nerd.com> | 2016-03-20 19:28:41 +1100 |
---|---|---|
committer | Erik de Castro Lopo <erikd@mega-nerd.com> | 2016-03-20 19:28:41 +1100 |
commit | 1be4f9537e306931a3c2115f9cfedc325fdef4e7 (patch) | |
tree | 1113c4bcc9f0dadfaf6b143234fa240835fea924 | |
parent | eae85ee7665d4d8604617d7bfb6529d112e7db91 (diff) | |
download | flac-1be4f9537e306931a3c2115f9cfedc325fdef4e7.tar.gz |
libFLAC: Reduce FLAC__HAS_OGG #ifdef crud
-rw-r--r-- | src/libFLAC/stream_decoder.c | 23 | ||||
-rw-r--r-- | src/libFLAC/stream_encoder.c | 8 |
2 files changed, 5 insertions, 26 deletions
diff --git a/src/libFLAC/stream_decoder.c b/src/libFLAC/stream_decoder.c index bd9f9a6e..9c1f14e9 100644 --- a/src/libFLAC/stream_decoder.c +++ b/src/libFLAC/stream_decoder.c @@ -56,13 +56,7 @@ /* technically this should be in an "export.c" but this is convenient enough */ -FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC = -#if FLAC__HAS_OGG - 1 -#else - 0 -#endif -; +FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC = FLAC__HAS_OGG; /*********************************************************************** @@ -125,9 +119,7 @@ static FLAC__bool file_eof_callback_(const FLAC__StreamDecoder *decoder, void *c ***********************************************************************/ typedef struct FLAC__StreamDecoderPrivate { -#if FLAC__HAS_OGG FLAC__bool is_ogg; -#endif FLAC__StreamDecoderReadCallback read_callback; FLAC__StreamDecoderSeekCallback seek_callback; FLAC__StreamDecoderTellCallback tell_callback; @@ -174,9 +166,7 @@ typedef struct FLAC__StreamDecoderPrivate { FLAC__uint64 first_frame_offset; /* hint to the seek routine of where in the stream the first audio frame starts */ FLAC__uint64 target_sample; unsigned unparseable_frame_count; /* used to tell whether we're decoding a future version of FLAC or just got a bad sync */ -#if FLAC__HAS_OGG FLAC__bool got_a_frame; /* hack needed in Ogg FLAC seek routine to check when process_single() actually writes a frame */ -#endif } FLAC__StreamDecoderPrivate; /*********************************************************************** @@ -362,10 +352,8 @@ static FLAC__StreamDecoderInitStatus init_stream_internal_( if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED) return FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED; -#if !FLAC__HAS_OGG - if(is_ogg) + if(!FLAC__HAS_OGG == 0 && is_ogg) return FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER; -#endif if( 0 == read_callback || @@ -914,10 +902,9 @@ FLAC_API FLAC__bool FLAC__stream_decoder_get_decode_position(const FLAC__StreamD FLAC__ASSERT(0 != decoder->private_); FLAC__ASSERT(0 != position); -#if FLAC__HAS_OGG - if(decoder->private_->is_ogg) + if(FLAC__HAS_OGG && decoder->private_->is_ogg) return false; -#endif + if(0 == decoder->private_->tell_callback) return false; if(decoder->private_->tell_callback(decoder, position, decoder->private_->client_data) != FLAC__STREAM_DECODER_TELL_STATUS_OK) @@ -1234,9 +1221,7 @@ unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecod void set_defaults_(FLAC__StreamDecoder *decoder) { -#if FLAC__HAS_OGG decoder->private_->is_ogg = false; -#endif decoder->private_->read_callback = 0; decoder->private_->seek_callback = 0; decoder->private_->tell_callback = 0; diff --git a/src/libFLAC/stream_encoder.c b/src/libFLAC/stream_encoder.c index 98905a95..3f0622a4 100644 --- a/src/libFLAC/stream_encoder.c +++ b/src/libFLAC/stream_encoder.c @@ -368,9 +368,7 @@ typedef struct FLAC__StreamEncoderPrivate { FLAC__bool disable_constant_subframes; FLAC__bool disable_fixed_subframes; FLAC__bool disable_verbatim_subframes; -#if FLAC__HAS_OGG FLAC__bool is_ogg; -#endif FLAC__StreamEncoderReadCallback read_callback; /* currently only needed for Ogg FLAC */ FLAC__StreamEncoderSeekCallback seek_callback; FLAC__StreamEncoderTellCallback tell_callback; @@ -635,10 +633,8 @@ static FLAC__StreamEncoderInitStatus init_stream_internal_( if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED) return FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED; -#if !FLAC__HAS_OGG - if(is_ogg) + if(FLAC__HAS_OGG == 0 && is_ogg) return FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER; -#endif if(0 == write_callback || (seek_callback && 0 == tell_callback)) return FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_CALLBACKS; @@ -2328,9 +2324,7 @@ void set_defaults_(FLAC__StreamEncoder *encoder) encoder->private_->disable_constant_subframes = false; encoder->private_->disable_fixed_subframes = false; encoder->private_->disable_verbatim_subframes = false; -#if FLAC__HAS_OGG encoder->private_->is_ogg = false; -#endif encoder->private_->read_callback = 0; encoder->private_->write_callback = 0; encoder->private_->seek_callback = 0; |