# Components. libfaam is always built.
option('encoder',
    description: 'Build the FAAC encoder library (libfaac) and the faac frontend',
    type: 'boolean',
    value: true)

option('decoder',
    description: 'Build the FAAD decoder library (libfaad) and the faad frontend',
    type: 'boolean',
    value: true)

option('frontend',
    description: 'Build the command-line tools',
    type: 'boolean',
    value: true)

option('frontend-static',
    description: 'Link the frontend executables to the static libraries',
    type: 'boolean',
    value: false)

# Decoder tuning
option('decoder-sbr',
    description: 'Enable Spectral Band Replication (HE-AAC v1) support in libfaad',
    type: 'boolean',
    value: true)

option('decoder-ps',
    description: 'Enable Parametric Stereo (HE-AAC v2) support in libfaad',
    type: 'boolean',
    value: true)

option('decoder-dab',
    description: 'Enable Digital Audio Broadcasting (960/120 frame length) support in libfaad',
    type: 'boolean',
    value: true)

# Muxer (libfaam)
option('muxer',
    description: 'Build the faam CLI tool (libfaam itself is always built)',
    type: 'boolean',
    value: true)

option('resampler',
    description: 'Build the faar CLI tool (libfaar itself is always built)',
    type: 'boolean',
    value: true)

option('muxer-video',
    description: 'libfaam: H.264/H.265 video tracks (avc1/hvc1 entries, stss, ctts, Annex-B conversion); off leaves an audio-only muxer/demuxer',
    type: 'boolean',
    value: true)

option('muxer-fragmented',
    description: 'libfaam: fragmented MP4 (moof/mdat) crash-safe recording and demuxing',
    type: 'boolean',
    value: true)

option('muxer-chapters',
    description: 'libfaam: write, update and read chapters (Nero chpl plus a QuickTime text track)',
    type: 'boolean',
    value: true)

option('encoder-sbr',
    description: 'Enable Spectral Band Replication (HE-AAC v1) support in libfaac',
    type: 'boolean',
    value: true)

# Encoder tuning
option('encoder-ps',
    description: 'Enable Parametric Stereo (HE-AAC v2) encoding',
    type: 'boolean',
    value: false)

# SBR spectral analysis density: analyze every Nth slot per frame.
# 1 = full quality (every slot); higher values trade MOS for faster encode.
# Max 8: above that, both halves of the frame are sampled but the gain is negligible.
# Only affects HE-AAC; LC encodes are identical regardless of this setting.
#   1: every slot  -- reference quality (MOS d: 0)
#   2: every 2nd   -- ~17% faster HE-AAC encode; MOS d: ~0
#   4: every 4th   -- ~26% faster HE-AAC encode; MOS d: -0.010
#   8: every 8th   -- ~30% faster HE-AAC encode; MOS d: -0.038
option('sbr-decimation',
    description: 'Encoder Spectral Band Replication analysis density: analyze every Nth slot (1=full quality, max=8)',
    type: 'integer',
    min: 1,
    max: 8,
    value: 1)

# Shared
option('max-channels',
    description: 'Maximum number of channels (encoder and decoder)',
    type: 'integer',
    min: 1,
    max: 8,
    value: 8)

option('resampler-float',
    description: 'FAAR resampler: use the float-only engine (double-free sample path for FPU-less targets); the default mixed build runs High filter kernels in double',
    type: 'boolean',
    value: false)

# End-of-stream diagnostics banner on stderr: the encoder (FAAC_STATS) prints
# Qavg, transient/tool-usage %, rate-control health, etc on faac_encoder_close();
# the decoder (FAAD_STATS) prints its own on close.
option('stats',
    description: 'Enable optional end-of-stream statistics banners (encoder and decoder)',
    type: 'boolean',
    value: false)

option('decoder-drc', type: 'boolean', value: true,
    description: 'Enable decoder dynamic range control')

# The fuzz harnesses are always built and replay tests/fuzz/corpus as the
# "fuzz" test suite. Name a libFuzzer-compatible engine here (for example
# -fsanitize=fuzzer, or $LIB_FUZZING_ENGINE under OSS-Fuzz) to link it in place
# of the file-replay driver. Instrument the libraries themselves through
# b_sanitize and -fsanitize=fuzzer-no-link in c_args.
option('fuzzing-engine',
    description: 'Link argument that supplies main() to the fuzz harnesses (empty replays corpus files instead)',
    type: 'string',
    value: '')

option('encoder-drc', type: 'boolean', value: true,
    description: 'Enable dynamic range control metadata generation in libfaac')
