fix to ogg-less building
authorJosh Coalson <jcoalson@users.sourceforce.net>
Sun, 15 Oct 2006 05:15:55 +0000 (05:15 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Sun, 15 Oct 2006 05:15:55 +0000 (05:15 +0000)
src/libFLAC/stream_decoder.c
src/libFLAC/stream_encoder.c

index be71f09..ad20329 100644 (file)
@@ -2740,8 +2740,13 @@ FLAC__bool read_callback_(FLAC__byte buffer[], unsigned *bytes, void *client_dat
 {
        FLAC__StreamDecoder *decoder = (FLAC__StreamDecoder *)client_data;
 
-       /* see [1] HACK NOTE below for why we don't call the eof_callback when decoding Ogg FLAC */
-       if(!decoder->private_->is_ogg && decoder->private_->eof_callback && decoder->private_->eof_callback(decoder, decoder->private_->client_data)) {
+       if(
+#if FLAC__HAS_OGG
+               /* see [1] HACK NOTE below for why we don't call the eof_callback when decoding Ogg FLAC */
+               !decoder->private_->is_ogg &&
+#endif
+               decoder->private_->eof_callback && decoder->private_->eof_callback(decoder, decoder->private_->client_data)
+       ) {
                *bytes = 0;
                decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM;
                return false;
@@ -2774,8 +2779,16 @@ FLAC__bool read_callback_(FLAC__byte buffer[], unsigned *bytes, void *client_dat
                                return false;
                        }
                        else if(*bytes == 0) {
-                               /* see [1] HACK NOTE below for why we don't call the eof_callback when decoding Ogg FLAC */
-                               if(status == FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM || (!decoder->private_->is_ogg && decoder->private_->eof_callback && decoder->private_->eof_callback(decoder, decoder->private_->client_data))) {
+                               if(
+                                       status == FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM ||
+                                       (
+#if FLAC__HAS_OGG
+                                               /* see [1] HACK NOTE below for why we don't call the eof_callback when decoding Ogg FLAC */
+                                               !decoder->private_->is_ogg &&
+#endif
+                                               decoder->private_->eof_callback && decoder->private_->eof_callback(decoder, decoder->private_->client_data)
+                                       )
+                               ) {
                                        decoder->protected_->state = FLAC__STREAM_DECODER_END_OF_STREAM;
                                        return false;
                                }
index cf95d44..2a7a6aa 100644 (file)
@@ -110,7 +110,9 @@ static FLAC__bool resize_buffers_(FLAC__StreamEncoder *encoder, unsigned new_siz
 static FLAC__bool write_bitbuffer_(FLAC__StreamEncoder *encoder, unsigned samples);
 static FLAC__StreamEncoderWriteStatus write_frame_(FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples);
 static void update_metadata_(const FLAC__StreamEncoder *encoder);
+#if FLAC__HAS_OGG
 static void update_ogg_metadata_(FLAC__StreamEncoder *encoder);
+#endif
 static FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_last_frame);
 static FLAC__bool process_subframes_(FLAC__StreamEncoder *encoder, FLAC__bool is_last_frame);
 
@@ -2710,6 +2712,7 @@ void update_metadata_(const FLAC__StreamEncoder *encoder)
        }
 }
 
+#if FLAC__HAS_OGG
 /* Gets called when the encoding process has finished so that we can update the STREAMINFO and SEEKTABLE blocks.  */
 void update_ogg_metadata_(FLAC__StreamEncoder *encoder)
 {
@@ -2884,6 +2887,7 @@ void update_ogg_metadata_(FLAC__StreamEncoder *encoder)
                simple_ogg_page__clear(&page);
        }
 }
+#endif
 
 FLAC__bool process_frame_(FLAC__StreamEncoder *encoder, FLAC__bool is_last_frame)
 {