opus_defines.h(3)

🌸 NAME 🌸

okay so this is the opus_defines.h(3) manual page, and it's literally just the Opus reference implementation constants πŸ’… like, all the little #defines and the two functions that go with them. that's the whole vibe. no cap.


✨ SYNOPSIS ✨

bestie you get there like this:

#include 'opus_types.h'

and then everything below is just macros and functions chilling in there. let's go πŸ¦‹

Macros

these are the error codes first, and honestly they're giving "things that can go wrong" energy:

  • OPUS_OK β€” no error. we love her. ✨
  • OPUS_BAD_ARG β€” one or more invalid/out of range arguments. rude of you tbh.
  • OPUS_BUFFER_TOO_SMALL β€” not enough bytes allocated in the buffer. she needs more room πŸ’€
  • OPUS_INTERNAL_ERROR β€” an internal error was detected. something inside is Not Okay.
  • OPUS_INVALID_PACKET β€” the compressed data passed is corrupted. 😭
  • OPUS_UNIMPLEMENTED β€” invalid/unsupported request number. we don't do that here.
  • OPUS_INVALID_STATE β€” an encoder or decoder structure is invalid or already freed. bestie she's gone, let her rest πŸ™ˆ
  • OPUS_ALLOC_FAIL β€” memory allocation has failed. the RAM said no.

then the settings-y ones:

  • OPUS_AUTO β€” auto/default setting. the "you pick, i trust you" option 🫢
  • OPUS_BITRATE_MAX β€” maximum bitrate. all the bits. every last one πŸ”₯

the applications (aka "what are you even doing with this encoder"):

  • OPUS_APPLICATION_VOIP β€” best for most VoIP/videoconference applications where listening quality and intelligibility matter most. like, you need to actually hear your friend.
  • OPUS_APPLICATION_AUDIO β€” best for broadcast/high-fidelity application where the decoded audio should be as close as possible to the input. the audiophile icon πŸ‘‘
  • OPUS_APPLICATION_RESTRICTED_LOWDELAY β€” only use when lowest-achievable latency is what matters most. speed. speed. speed.
  • OPUS_APPLICATION_RESTRICTED_SILK (2052) β€” experts only: forces SILK encoding; don't allocate CELT state at all. like, do not try this if you don't know what you're doing, fr fr.
  • OPUS_APPLICATION_RESTRICTED_CELT (2053) β€” experts only: forces CELT encoding; don't allocate SILK state at all. same warning, opposite girlie.

signal types:

  • OPUS_SIGNAL_VOICE (3001) β€” signal being encoded is voice. talking. yapping. πŸ—£οΈ
  • OPUS_SIGNAL_MUSIC (3002) β€” signal being encoded is music. the vibes πŸŽ€

bandwidths, aka how wide is the band bestie:

  • OPUS_BANDWIDTH_NARROWBAND β€” 4 kHz bandpass
  • OPUS_BANDWIDTH_MEDIUMBAND β€” 6 kHz bandpass
  • OPUS_BANDWIDTH_WIDEBAND β€” 8 kHz bandpass
  • OPUS_BANDWIDTH_SUPERWIDEBAND β€” 12 kHz bandpass
  • OPUS_BANDWIDTH_FULLBAND β€” 20 kHz bandpass 🌈

frame sizes, from tiny to not-so-tiny:

  • OPUS_FRAMESIZE_ARG (5000) β€” select frame size from the argument (default).
  • OPUS_FRAMESIZE_2_5_MS (5001) β€” use 2.5 ms frames.
  • OPUS_FRAMESIZE_5_MS (5002) β€” use 5 ms frames.
  • OPUS_FRAMESIZE_10_MS (5003) β€” use 10 ms frames.
  • OPUS_FRAMESIZE_20_MS (5004) β€” use 20 ms frames.
  • OPUS_FRAMESIZE_40_MS (5005) β€” use 40 ms frames.
  • OPUS_FRAMESIZE_60_MS (5006) β€” use 60 ms frames.
  • OPUS_FRAMESIZE_80_MS (5007) β€” use 80 ms frames.
  • OPUS_FRAMESIZE_100_MS (5008) β€” use 100 ms frames.
  • OPUS_FRAMESIZE_120_MS (5009) β€” use 120 ms frames.

and now the actual getters and setters, the main character section:

  • OPUS_SET_COMPLEXITY(x) β€” configures the encoder's computational complexity.
  • OPUS_GET_COMPLEXITY(x) β€” gets the encoder's complexity configuration.
  • OPUS_SET_BITRATE(x) β€” configures the bitrate in the encoder.
  • OPUS_GET_BITRATE(x) β€” gets the encoder's bitrate configuration.
  • OPUS_SET_VBR(x) β€” enables or disables variable bitrate (VBR) in the encoder.
  • OPUS_GET_VBR(x) β€” determine if variable bitrate (VBR) is enabled in the encoder.
  • OPUS_SET_VBR_CONSTRAINT(x) β€” enables or disables constrained VBR in the encoder.
  • OPUS_GET_VBR_CONSTRAINT(x) β€” determine if constrained VBR is enabled in the encoder.
  • OPUS_SET_FORCE_CHANNELS(x) β€” configures mono/stereo forcing in the encoder.
  • OPUS_GET_FORCE_CHANNELS(x) β€” gets the encoder's forced channel configuration.
  • OPUS_SET_MAX_BANDWIDTH(x) β€” configures the maximum bandpass that the encoder will select automatically.
  • OPUS_GET_MAX_BANDWIDTH(x) β€” gets the encoder's configured maximum allowed bandpass.
  • OPUS_SET_BANDWIDTH(x) β€” sets the encoder's bandpass to a specific value.
  • OPUS_SET_SIGNAL(x) β€” configures the type of signal being encoded.
  • OPUS_GET_SIGNAL(x) β€” gets the encoder's configured signal type.
  • OPUS_SET_APPLICATION(x) β€” configures the encoder's intended application.
  • OPUS_GET_APPLICATION(x) β€” gets the encoder's configured application.
  • OPUS_GET_LOOKAHEAD(x) β€” gets the total samples of delay added by the entire codec.
  • OPUS_SET_INBAND_FEC(x) β€” configures the encoder's use of inband forward error correction (FEC).
  • OPUS_GET_INBAND_FEC(x) β€” gets encoder's configured use of inband forward error correction.
  • OPUS_SET_PACKET_LOSS_PERC(x) β€” configures the encoder's expected packet loss percentage.
  • OPUS_GET_PACKET_LOSS_PERC(x) β€” gets the encoder's configured packet loss percentage.
  • OPUS_SET_DTX(x) β€” configures the encoder's use of discontinuous transmission (DTX).
  • OPUS_GET_DTX(x) β€” gets encoder's configured use of discontinuous transmission.
  • OPUS_SET_LSB_DEPTH(x) β€” configures the depth of signal being encoded.
  • OPUS_GET_LSB_DEPTH(x) β€” gets the encoder's configured signal depth.
  • OPUS_SET_EXPERT_FRAME_DURATION(x) β€” configures the encoder's use of variable duration frames.
  • OPUS_GET_EXPERT_FRAME_DURATION(x) β€” gets the encoder's configured use of variable duration frames.
  • OPUS_SET_PREDICTION_DISABLED(x) β€” if set to 1, disables almost all use of prediction, making frames almost completely independent.
  • OPUS_GET_PREDICTION_DISABLED(x) β€” gets the encoder's configured prediction status.
  • OPUS_SET_DRED_DURATION(x) β€” if non-zero, enables Deep Redundancy (DRED) and use the specified maximum number of 10-ms redundant frames.
  • OPUS_GET_DRED_DURATION(x) β€” gets the encoder's configured Deep Redundancy (DRED) maximum number of frames.
  • OPUS_SET_DNN_BLOB(data, len) β€” provide external DNN weights from binary object (only when explicitly built without the weights).
  • OPUS_SET_QEXT(x) β€” if set to 1, enables quality extension (QEXT), otherwise disables it (default).
  • OPUS_GET_QEXT(x) β€” gets the encoder's configured quality extension (QEXT).
  • OPUS_RESET_STATE β€” resets the codec state to be equivalent to a freshly initialized state. she's reborn ✨
  • OPUS_GET_FINAL_RANGE(x) β€” gets the final state of the codec's entropy coder.
  • OPUS_GET_BANDWIDTH(x) β€” gets the encoder's configured bandpass or the decoder's last bandpass.
  • OPUS_GET_SAMPLE_RATE(x) β€” gets the sampling rate the encoder or decoder was initialized with.
  • OPUS_SET_PHASE_INVERSION_DISABLED(x) β€” if set to 1, disables the use of phase inversion for intensity stereo, improving the quality of mono downmixes, but slightly reducing normal stereo quality.
  • OPUS_GET_PHASE_INVERSION_DISABLED(x) β€” gets the encoder's configured phase inversion status.
  • OPUS_GET_IN_DTX(x) β€” gets the DTX state of the encoder.
  • OPUS_SET_GAIN(x) β€” configures decoder gain adjustment.
  • OPUS_GET_GAIN(x) β€” gets the decoder's configured gain adjustment.
  • OPUS_GET_LAST_PACKET_DURATION(x) β€” gets the duration (in samples) of the last packet successfully decoded or concealed.
  • OPUS_GET_PITCH(x) β€” gets the pitch of the last decoded frame, if available.
  • OPUS_SET_OSCE_BWE(x) β€” enables blind bandwidth extension for wideband signals if decoding sampling rate is 48 kHz.
  • OPUS_GET_OSCE_BWE(x) β€” gets blind bandwidth extension flag for wideband signals if decoding sampling rate is 48 kHz.
  • OPUS_SET_IGNORE_EXTENSIONS(x) β€” if set to 1, the decoder will ignore all extensions found in the padding area (does not affect DRED, which is decoded separately).
  • OPUS_GET_IGNORE_EXTENSIONS(x) β€” gets whether the decoder is ignoring extensions.

Functions

only two besties, and they're both little helpers:

  • const char * opus_strerror (int error) β€” converts an opus error code into a human readable string. so you can finally know what went wrong πŸ’€
  • const char * opus_get_version_string (void) β€” gets the libopus version string. hi what version are you πŸŽ€

πŸ’œ Detailed Description πŸ’œ

Opus reference implementation constants.

that's it. that's the description. iconic brevity honestly.


🫢 Author 🫢

Generated automatically by Doxygen for Opus from the source code. (yes, a robot wrote it, and it ate πŸ’…)


okay bestie that's the whole page!! Version 1.6.1, Thu Jan 29 2026 14:35:32 β€” that's the version and the date, mwah, love you, go encode something beautiful πŸŒΈβœ¨πŸ¦‹

πŸ“¦ where this page comes from