#include "decode.h"
typedef struct {
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
FLAC__bool is_ogg;
#endif
if(!
DecoderSession_construct(
&decoder_session,
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
options.common.is_ogg,
#else
/*is_ogg=*/false,
if(!
DecoderSession_construct(
&decoder_session,
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
options.common.is_ogg,
#else
/*is_ogg=*/false,
if(!
DecoderSession_construct(
&decoder_session,
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
options.common.is_ogg,
#else
/*is_ogg=*/false,
FLAC__bool DecoderSession_construct(DecoderSession *d, FLAC__bool is_ogg, FLAC__bool is_aiff_out, FLAC__bool is_wave_out, FLAC__bool continue_through_decode_errors, FLAC__bool channel_map_none, replaygain_synthesis_spec_t replaygain_synthesis_spec, FLAC__bool analysis_mode, analysis_options aopts, utils__SkipUntilSpecification *skip_specification, utils__SkipUntilSpecification *until_specification, utils__CueSpecification *cue_specification, const char *infilename, const char *outfilename)
{
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
d->is_ogg = is_ogg;
#else
(void)is_ogg;
if (decoder_session->replaygain.spec.apply)
FLAC__stream_decoder_set_metadata_respond(decoder_session->decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT);
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
if(decoder_session->is_ogg) {
if(!decode_options.use_first_serial_number)
FLAC__stream_decoder_set_ogg_serial_number(decoder_session->decoder, decode_options.serial_number);
typedef struct {
FLAC__bool continue_through_decode_errors;
replaygain_synthesis_spec_t replaygain_synthesis_spec;
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
FLAC__bool is_ogg;
FLAC__bool use_first_serial_number;
long serial_number;
#define CHUNK_OF_SAMPLES 2048
typedef struct {
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
FLAC__bool use_ogg;
#endif
FLAC__bool verify;
if(!
EncoderSession_construct(
&encoder_session,
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
options.common.use_ogg,
#else
/*use_ogg=*/false,
if(!
EncoderSession_construct(
&encoder_session,
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
options.common.use_ogg,
#else
/*use_ogg=*/false,
if(!
EncoderSession_construct(
&encoder_session,
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
options.common.use_ogg,
#else
/*use_ogg=*/false,
if(!
EncoderSession_construct(
&encoder_session,
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
options.common.use_ogg,
#else
/*use_ogg=*/false,
* initialize instance
*/
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
e->use_ogg = use_ogg;
#else
(void)use_ogg;
FLAC__stream_encoder_disable_fixed_subframes(e->encoder, options.debug.disable_fixed_subframes);
FLAC__stream_encoder_disable_verbatim_subframes(e->encoder, options.debug.disable_verbatim_subframes);
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
if(e->use_ogg) {
FLAC__stream_encoder_set_ogg_serial_number(e->encoder, options.serial_number);
utils__SkipUntilSpecification skip_specification;
utils__SkipUntilSpecification until_specification;
FLAC__bool verify;
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
FLAC__bool use_ogg;
long serial_number;
#endif
{ "sector-align" , share__no_argument, 0, 0 },
{ "seekpoint" , share__required_argument, 0, 'S' },
{ "padding" , share__required_argument, 0, 'P' },
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
{ "ogg" , share__no_argument, 0, 0 },
{ "serial-number" , share__required_argument, 0, 0 },
#endif
{ "no-replay-gain" , share__no_argument, 0, 0 },
{ "no-sector-align" , share__no_argument, 0, 0 },
{ "no-lax" , share__no_argument, 0, 0 },
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
{ "no-ogg" , share__no_argument, 0, 0 },
#endif
{ "no-exhaustive-model-search", share__no_argument, 0, 0 },
else if(0 == strcmp(long_option, "sector-align")) {
option_values.sector_align = true;
}
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
else if(0 == strcmp(long_option, "ogg")) {
option_values.use_ogg = true;
}
else if(0 == strcmp(long_option, "no-lax")) {
option_values.lax = false;
}
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
else if(0 == strcmp(long_option, "no-ogg")) {
option_values.use_ogg = false;
}
printf(" --delete-input-file Deletes after a successful encode/decode\n");
printf(" --skip={#|mm:ss.ss} Skip the given initial samples for each input\n");
printf(" --until={#|[+|-]mm:ss.ss} Stop at the given sample for each input file\n");
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
printf(" --ogg Use Ogg as transport layer\n");
printf(" --serial-number Serial number to use for the FLAC stream\n");
#endif
printf(" --no-exhaustive-model-search\n");
printf(" --no-lax\n");
printf(" --no-mid-side\n");
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
printf(" --no-ogg\n");
#endif
printf(" --no-padding\n");
printf(" relative to the --skip point. If a `-' sign is\n");
printf(" at the beginning, the --until point is relative\n");
printf(" to end of the audio.\n");
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
printf(" --ogg When encoding, generate Ogg FLAC output instead\n");
printf(" of native FLAC. Ogg FLAC streams are FLAC\n");
printf(" streams wrapped in an Ogg transport layer. The\n");
printf(" --no-exhaustive-model-search\n");
printf(" --no-lax\n");
printf(" --no-mid-side\n");
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
printf(" --no-ogg\n");
#endif
printf(" --no-padding\n");
common_options.until_specification.is_relative = true;
common_options.verify = option_values.verify;
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
common_options.use_ogg = option_values.use_ogg;
/* set a random serial number if one has not yet been specified */
if(!option_values.has_serial_number) {
else
treat_as_ogg = false;
-#ifndef FLAC__HAS_OGG
+#if !FLAC__HAS_OGG
if(treat_as_ogg) {
flac__utils_printf(stderr, 1, "%s: Ogg support has not been built into this copy of flac\n", infilename);
return 1;
common_options.continue_through_decode_errors = option_values.continue_through_decode_errors;
common_options.replaygain_synthesis_spec = option_values.replaygain_synthesis_spec;
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
common_options.is_ogg = treat_as_ogg;
common_options.use_first_serial_number = !option_values.has_serial_number;
common_options.serial_number = option_values.serial_number;
#define FLAC__PROTECTED__STREAM_DECODER_H
#include "FLAC/stream_decoder.h"
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
#include "private/ogg_decoder_aspect.h"
#endif
unsigned sample_rate; /* in Hz */
unsigned blocksize; /* in samples (per channel) */
FLAC__bool md5_checking; /* if true, generate MD5 signature of decoded data and compare against signature in the STREAMINFO metadata block */
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
FLAC__OggDecoderAspect ogg_decoder_aspect;
#endif
} FLAC__StreamDecoderProtected;
#define FLAC__PROTECTED__STREAM_ENCODER_H
#include "FLAC/stream_encoder.h"
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
#include "private/ogg_encoder_aspect.h"
#endif
FLAC__StreamMetadata **metadata;
unsigned num_metadata_blocks;
FLAC__uint64 streaminfo_offset, seektable_offset, audio_offset;
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
FLAC__OggEncoderAspect ogg_encoder_aspect;
#endif
} FLAC__StreamEncoderProtected;
static FLAC__bool read_residual_partitioned_rice_(FLAC__StreamDecoder *decoder, unsigned predictor_order, unsigned partition_order, FLAC__EntropyCodingMethod_PartitionedRiceContents *partitioned_rice_contents, FLAC__int32 *residual);
static FLAC__bool read_zero_padding_(FLAC__StreamDecoder *decoder);
static FLAC__bool read_callback_(FLAC__byte buffer[], size_t *bytes, void *client_data);
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
static FLAC__StreamDecoderReadStatus read_callback_ogg_aspect_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes);
static FLAC__OggDecoderAspectReadStatus read_callback_proxy_(const void *void_decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
#endif
static FLAC__StreamDecoderWriteStatus write_audio_frame_to_client_(FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 * const buffer[]);
static void send_error_to_client_(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status);
static FLAC__bool seek_to_absolute_sample_(FLAC__StreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample);
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
static FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample);
#endif
static FLAC__StreamDecoderReadStatus file_read_callback_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
***********************************************************************/
typedef struct FLAC__StreamDecoderPrivate {
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
FLAC__bool is_ogg;
#endif
FLAC__StreamDecoderReadCallback read_callback;
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 */
-#ifdef FLAC__HAS_OGG
+#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;
if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
return FLAC__STREAM_DECODER_INIT_STATUS_ALREADY_INITIALIZED;
-#ifndef FLAC__HAS_OGG
+#if !FLAC__HAS_OGG
if(is_ogg)
return FLAC__STREAM_DECODER_INIT_STATUS_UNSUPPORTED_CONTAINER;
#endif
)
return FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS;
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
decoder->private_->is_ogg = is_ogg;
if(is_ogg && !FLAC__ogg_decoder_aspect_init(&decoder->protected_->ogg_decoder_aspect))
return decoder->protected_->state = FLAC__STREAM_DECODER_OGG_ERROR;
decoder->private_->output_capacity = 0;
decoder->private_->output_channels = 0;
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
if(decoder->private_->is_ogg)
FLAC__ogg_decoder_aspect_finish(&decoder->protected_->ogg_decoder_aspect);
#endif
FLAC__ASSERT(0 != decoder->protected_);
if(decoder->protected_->state != FLAC__STREAM_DECODER_UNINITIALIZED)
return false;
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
/* can't check decoder->private_->is_ogg since that's not set until init time */
FLAC__ogg_decoder_aspect_set_serial_number(&decoder->protected_->ogg_decoder_aspect, value);
return true;
FLAC__ASSERT(0 != decoder->private_);
FLAC__ASSERT(0 != position);
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
if(decoder->private_->is_ogg)
return false;
#endif
decoder->private_->samples_decoded = 0;
decoder->private_->do_md5_checking = false;
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
if(decoder->private_->is_ogg)
FLAC__ogg_decoder_aspect_flush(&decoder->protected_->ogg_decoder_aspect);
#endif
return false;
}
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
/*@@@ could go in !internal_reset_hack block below */
if(decoder->private_->is_ogg)
FLAC__ogg_decoder_aspect_reset(&decoder->protected_->ogg_decoder_aspect);
{
const FLAC__bool ok =
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
decoder->private_->is_ogg?
seek_to_absolute_sample_ogg_(decoder, length, sample) :
#endif
void set_defaults_(FLAC__StreamDecoder *decoder)
{
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
decoder->private_->is_ogg = false;
#endif
decoder->private_->read_callback = 0;
decoder->protected_->md5_checking = false;
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
FLAC__ogg_decoder_aspect_set_defaults(&decoder->protected_->ogg_decoder_aspect);
#endif
}
}
else {
const FLAC__StreamDecoderReadStatus status =
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
decoder->private_->is_ogg?
read_callback_ogg_aspect_(decoder, buffer, bytes) :
#endif
*/
}
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
FLAC__StreamDecoderReadStatus read_callback_ogg_aspect_(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes)
{
switch(FLAC__ogg_decoder_aspect_read_callback_wrapper(&decoder->protected_->ogg_decoder_aspect, buffer, bytes, read_callback_proxy_, decoder, decoder->private_->client_data)) {
FLAC__ASSERT(frame->header.number_type == FLAC__FRAME_NUMBER_TYPE_SAMPLE_NUMBER);
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
decoder->private_->got_a_frame = true;
#endif
decoder->private_->last_frame = *frame; /* save the frame */
return true;
}
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
FLAC__bool seek_to_absolute_sample_ogg_(FLAC__StreamDecoder *decoder, FLAC__uint64 stream_length, FLAC__uint64 target_sample)
{
FLAC__uint64 left_pos = 0, right_pos = stream_length;
#include "private/lpc.h"
#include "private/md5.h"
#include "private/memory.h"
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
#include "private/ogg_helper.h"
#include "private/ogg_mapping.h"
#endif
if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
return FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED;
-#ifndef FLAC__HAS_OGG
+#if !FLAC__HAS_OGG
if(is_ogg)
return FLAC__STREAM_ENCODER_INIT_STATUS_UNSUPPORTED_CONTAINER;
#endif
FLAC__ASSERT(0 != encoder->protected_);
if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
return false;
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
/* can't check encoder->private_->is_ogg since that's not set until init time */
FLAC__ogg_encoder_aspect_set_serial_number(&encoder->protected_->ogg_encoder_aspect, value);
return true;
for (read_mode = 0; read_mode <= 2; read_mode++) {
FLAC__bool ok;
if (strlen(filename) > 4 && 0 == strcmp(filename+strlen(filename)-4, ".ogg")) {
-#ifdef FLAC__HAS_OGG
+#if FLAC__HAS_OGG
ok = seek_barrage(/*is_ogg=*/true, filename, filesize, count, samples, read_mode);
#else
fprintf(stderr, "ERROR: Ogg FLAC not supported\n");