### ope_encoder_continue_new_callbacks() Source: https://opus-codec.org/docs/libopusenc_api-0.3/group__encoding.html Ends the current Opus stream and starts a new file using callbacks. ```APIDOC ## ope_encoder_continue_new_callbacks() ### Description Ends the stream and create a new file (callback-based). ### Parameters - **_enc_** (OggOpusEnc *) - in,out - Encoder - **_user_data_** (void *) - in - Pointer to be associated with the new stream and passed to the callbacks - **_comments_** (OggOpusComments *) - in - Comments associated with the stream ### Returns Error code ``` -------------------------------- ### Opus Encoder Configuration Options Source: https://opus-codec.org/docs/opus_api-1.6/opus__defines_8h.html Macros for setting and getting various encoder configuration parameters. ```APIDOC ## Opus Encoder Configuration Options ### Description These macros are used with Opus API functions to set or get specific encoder configuration parameters. ### Macros for Setting Configuration: - **OPUS_SET_COMPLEXITY(x)**: Configures the encoder's computational complexity. - **OPUS_SET_BITRATE(x)**: Configures the bitrate in the encoder. - **OPUS_SET_VBR(x)**: Enables or disables variable bitrate (VBR) in the encoder. - **OPUS_SET_VBR_CONSTRAINT(x)**: Enables or disables constrained VBR in the encoder. - **OPUS_SET_FORCE_CHANNELS(x)**: Configures mono/stereo forcing in the encoder. - **OPUS_SET_MAX_BANDWIDTH(x)**: Configures the maximum bandpass that the encoder will select automatically. - **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_SET_APPLICATION(x)**: Configures the encoder's intended application. - **OPUS_SET_INBAND_FEC(x)**: Configures the encoder's use of inband forward error correction (FEC). - **OPUS_SET_PACKET_LOSS_PERC(x)**: Configures the encoder's expected packet loss percentage. - **OPUS_SET_DTX(x)**: Configures the encoder's use of discontinuous transmission (DTX). - **OPUS_SET_LSB_DEPTH(x)**: Configures the depth of signal being encoded. ### Macros for Getting Configuration: - **OPUS_GET_COMPLEXITY(x)**: Gets the encoder's complexity configuration. - **OPUS_GET_BITRATE(x)**: Gets the encoder's bitrate configuration. - **OPUS_GET_VBR(x)**: Determine if variable bitrate (VBR) is enabled in the encoder. - **OPUS_GET_VBR_CONSTRAINT(x)**: Determine if constrained VBR is enabled in the encoder. - **OPUS_GET_FORCE_CHANNELS(x)**: Gets the encoder's forced channel configuration. - **OPUS_GET_MAX_BANDWIDTH(x)**: Gets the encoder's configured maximum allowed bandpass. - **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_GET_INBAND_FEC(x)**: Gets encoder's configured use of inband forward error correction. - **OPUS_GET_PACKET_LOSS_PERC(x)**: Gets the encoder's configured packet loss percentage. - **OPUS_GET_DTX(x)**: Gets encoder's configured use of discontinuous transmission. ``` -------------------------------- ### Example Opus Encoder CTL Usage Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__encoderctls.html Demonstrates how to use opus_encoder_ctl with macros like OPUS_SET_BANDWIDTH and OPUS_GET_BANDWIDTH. Ensure OPUS_OK is checked for successful operations. ```c int ret; ret = opus_encoder_ctl(enc_ctx, OPUS_SET_BANDWIDTH(OPUS_AUTO)); if (ret != OPUS_OK) return ret; opus_int32 rate; opus_encoder_ctl(enc_ctx, OPUS_GET_BANDWIDTH(&rate)); opus_encoder_ctl(enc_ctx, OPUS_RESET_STATE); ``` -------------------------------- ### Opus Encoder Control Macros Source: https://opus-codec.org/docs/opus_api-1.6/opus__defines_8h.html Macros for setting and getting encoder configuration parameters. ```c #define OPUS_SET_COMPLEXITY(x) ``` ```c #define OPUS_GET_COMPLEXITY(x) ``` ```c #define OPUS_SET_BITRATE(x) ``` ```c #define OPUS_GET_BITRATE(x) ``` ```c #define OPUS_SET_VBR(x) ``` ```c #define OPUS_GET_VBR(x) ``` ```c #define OPUS_SET_VBR_CONSTRAINT(x) ``` ```c #define OPUS_GET_VBR_CONSTRAINT(x) ``` ```c #define OPUS_SET_FORCE_CHANNELS(x) ``` ```c #define OPUS_GET_FORCE_CHANNELS(x) ``` ```c #define OPUS_SET_MAX_BANDWIDTH(x) ``` ```c #define OPUS_GET_MAX_BANDWIDTH(x) ``` ```c #define OPUS_SET_BANDWIDTH(x) ``` ```c #define OPUS_SET_SIGNAL(x) ``` ```c #define OPUS_GET_SIGNAL(x) ``` ```c #define OPUS_SET_APPLICATION(x) ``` ```c #define OPUS_GET_APPLICATION(x) ``` ```c #define OPUS_GET_LOOKAHEAD(x) ``` ```c #define OPUS_SET_INBAND_FEC(x) ``` ```c #define OPUS_GET_INBAND_FEC(x) ``` ```c #define OPUS_SET_PACKET_LOSS_PERC(x) ``` ```c #define OPUS_GET_PACKET_LOSS_PERC(x) ``` ```c #define OPUS_SET_DTX(x) ``` ```c #define OPUS_GET_DTX(x) ``` ```c #define OPUS_SET_LSB_DEPTH(x) ``` ```c #define OPUS_GET_LSB_DEPTH(x) ``` -------------------------------- ### ope_encoder_continue_new_file() Source: https://opus-codec.org/docs/libopusenc_api-0.3/group__encoding.html Ends the current Opus stream and starts a new file with specified comments. ```APIDOC ## ope_encoder_continue_new_file() ### Description Ends the stream and create a new file. ### Parameters - **_enc_** (OggOpusEnc *) - in,out - Encoder - **_path_** (const char *) - in - Path where to write the new file - **_comments_** (OggOpusComments *) - in - Comments associated with the stream ### Returns Error code ``` -------------------------------- ### Opus Configuration Macros Source: https://opus-codec.org/docs/opus_api-1.6/opus__defines_8h_source.html Macros for setting and getting various Opus codec parameters such as packet loss, DTX, gain, and bandwidth. ```APIDOC ## Opus Configuration Macros ### Description These macros are used to configure or retrieve settings from the Opus codec instance. ### Parameters - **x** (int/int_ptr) - Required - The value to set or the pointer to store the retrieved value. - **data** (void_ptr) - Required - Pointer to data for blob settings. - **len** (int) - Required - Length of the data blob. ### Available Macros - OPUS_GET_PACKET_LOSS_PERC(x) - OPUS_SET_DTX(x) / OPUS_GET_DTX(x) - OPUS_SET_LSB_DEPTH(x) / OPUS_GET_LSB_DEPTH(x) - OPUS_SET_EXPERT_FRAME_DURATION(x) / OPUS_GET_EXPERT_FRAME_DURATION(x) - OPUS_SET_PREDICTION_DISABLED(x) / OPUS_GET_PREDICTION_DISABLED(x) - OPUS_SET_DRED_DURATION(x) / OPUS_GET_DRED_DURATION(x) - OPUS_SET_DNN_BLOB(data, len) - OPUS_SET_QEXT(x) / OPUS_GET_QEXT(x) - OPUS_RESET_STATE - OPUS_GET_FINAL_RANGE(x) - OPUS_GET_BANDWIDTH(x) - OPUS_GET_SAMPLE_RATE(x) - OPUS_SET_PHASE_INVERSION_DISABLED(x) / OPUS_GET_PHASE_INVERSION_DISABLED(x) - OPUS_GET_IN_DTX(x) - OPUS_SET_GAIN(x) / OPUS_GET_GAIN(x) - OPUS_GET_LAST_PACKET_DURATION(x) - OPUS_GET_PITCH(x) - OPUS_SET_OSCE_BWE(x) / OPUS_GET_OSCE_BWE(x) - OPUS_SET_IGNORE_EXTENSIONS(x) / OPUS_GET_IGNORE_EXTENSIONS(x) ``` -------------------------------- ### Opus CTL Setter and Getter Macros Source: https://opus-codec.org/docs/opus_api-1.6/opus__defines_8h_source.html Macros for setting and getting specific codec parameters using the defined request identifiers and type-checking helpers. ```c #define OPUS_SET_COMPLEXITY(x) OPUS_SET_COMPLEXITY_REQUEST, opus_check_int(x) #define OPUS_GET_COMPLEXITY(x) OPUS_GET_COMPLEXITY_REQUEST, opus_check_int_ptr(x) #define OPUS_SET_BITRATE(x) OPUS_SET_BITRATE_REQUEST, opus_check_int(x) #define OPUS_GET_BITRATE(x) OPUS_GET_BITRATE_REQUEST, opus_check_int_ptr(x) #define OPUS_SET_VBR(x) OPUS_SET_VBR_REQUEST, opus_check_int(x) #define OPUS_GET_VBR(x) OPUS_GET_VBR_REQUEST, opus_check_int_ptr(x) #define OPUS_SET_VBR_CONSTRAINT(x) OPUS_SET_VBR_CONSTRAINT_REQUEST, opus_check_int(x) #define OPUS_GET_VBR_CONSTRAINT(x) OPUS_GET_VBR_CONSTRAINT_REQUEST, opus_check_int_ptr(x) #define OPUS_SET_FORCE_CHANNELS(x) OPUS_SET_FORCE_CHANNELS_REQUEST, opus_check_int(x) #define OPUS_GET_FORCE_CHANNELS(x) OPUS_GET_FORCE_CHANNELS_REQUEST, opus_check_int_ptr(x) #define OPUS_SET_MAX_BANDWIDTH(x) OPUS_SET_MAX_BANDWIDTH_REQUEST, opus_check_int(x) #define OPUS_GET_MAX_BANDWIDTH(x) OPUS_GET_MAX_BANDWIDTH_REQUEST, opus_check_int_ptr(x) #define OPUS_SET_BANDWIDTH(x) OPUS_SET_BANDWIDTH_REQUEST, opus_check_int(x) #define OPUS_SET_SIGNAL(x) OPUS_SET_SIGNAL_REQUEST, opus_check_int(x) #define OPUS_GET_SIGNAL(x) OPUS_GET_SIGNAL_REQUEST, opus_check_int_ptr(x) #define OPUS_SET_APPLICATION(x) OPUS_SET_APPLICATION_REQUEST, opus_check_int(x) #define OPUS_GET_APPLICATION(x) OPUS_GET_APPLICATION_REQUEST, opus_check_int_ptr(x) #define OPUS_GET_LOOKAHEAD(x) OPUS_GET_LOOKAHEAD_REQUEST, opus_check_int_ptr(x) #define OPUS_SET_INBAND_FEC(x) OPUS_SET_INBAND_FEC_REQUEST, opus_check_int(x) #define OPUS_GET_INBAND_FEC(x) OPUS_GET_INBAND_FEC_REQUEST, opus_check_int_ptr(x) #define OPUS_SET_PACKET_LOSS_PERC(x) OPUS_SET_PACKET_LOSS_PERC_REQUEST, opus_check_int(x) ``` -------------------------------- ### Opus Repacketizer Initialization Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__repacketizer.html Demonstrates how to create and initialize an OpusRepacketizer state. ```APIDOC ## Opus Repacketizer Initialization ### Description Initializes a repacketizer state. This can be done by allocating memory yourself and then calling `opus_repacketizer_init`, or by using `opus_repacketizer_create` (not shown here). ### Functions #### `opus_repacketizer_get_size()` Gets the size of an `OpusRepacketizer` structure. **Return Value**: The size of the `OpusRepacketizer` structure in bytes. #### `opus_repacketizer_init(OpusRepacketizer *rp)` (Re)initializes a previously allocated repacketizer state. **Parameters**: - **rp** (`OpusRepacketizer*`) - Pointer to the `OpusRepacketizer` state to initialize. **Return Value**: A pointer to the initialized `OpusRepacketizer` state, or NULL on error. ### Request Example ```c OpusRepacketizer *rp; // Allocate memory for the repacketizer state rp = (OpusRepacketizer*)malloc(opus_repacketizer_get_size()); if (rp != NULL) opus_repacketizer_init(rp); ``` ``` -------------------------------- ### opus_dred_get_size Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__decoder.html Gets the size of an OpusDRED structure. ```APIDOC ## opus_dred_get_size ### Description Gets the size of an OpusDRED structure. ### Response - **Return Value** (int) - The size in bytes. ``` -------------------------------- ### opus_dred_decoder_get_size Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__decoder.html Gets the size of an OpusDREDDecoder structure. ```APIDOC ## opus_dred_decoder_get_size ### Description Gets the size of an OpusDREDDecoder structure. ### Response - **Return Value** (int) - The size in bytes. ``` -------------------------------- ### opus_server_info_init Source: https://opus-codec.org/docs/opusfile_api-0.12/group__url__options.html Initializes an OpusServerInfo structure. ```APIDOC ## opus_server_info_init ### Description Initializes an OpusServerInfo structure, setting all fields to default values as if no header information was available. ### Parameters #### Path Parameters - **_info** (OpusServerInfo *) - Required - The structure to initialize. ### Note Requires linking against libopusurl. ``` -------------------------------- ### opus_decoder_get_size Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__decoder.html Gets the size of an OpusDecoder structure. ```APIDOC ## opus_decoder_get_size ### Description Gets the size of an OpusDecoder structure. ### Parameters #### Path Parameters - **channels** (int) - Required - Number of channels. This must be 1 or 2. ### Response - **Return Value** (int) - The size in bytes. ``` -------------------------------- ### opus_multistream_encoder_get_size Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__multistream.html Gets the size of an OpusMSEncoder structure. ```APIDOC ## opus_multistream_encoder_get_size ### Description Gets the size of an OpusMSEncoder structure. ### Parameters - **streams** (int) - Required - The total number of streams to encode. - **coupled_streams** (int) - Required - Number of coupled (2 channel) streams to encode. ### Response - **Return** (opus_int32) - The size in bytes on success, or a negative error code on error. ``` -------------------------------- ### Allocate and Initialize OpusRepacketizer Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__repacketizer.html Manual allocation and initialization of the repacketizer state. ```c OpusRepacketizer *rp; rp = (OpusRepacketizer*)malloc(opus_repacketizer_get_size()); if (rp != NULL) opus_repacketizer_init(rp); ``` -------------------------------- ### opus_decoder_get_nb_samples Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__decoder.html Gets the number of samples of an Opus packet. ```APIDOC ## opus_decoder_get_nb_samples ### Description Gets the number of samples of an Opus packet. ### Parameters #### Path Parameters - **dec** (OpusDecoder*) - Required - Decoder state - **packet** (char*) - Required - Opus packet - **len** (opus_int32) - Required - Length of packet ### Response - **Return Value** (int) - Number of samples - **OPUS_BAD_ARG** - Insufficient data was passed to the function - **OPUS_INVALID_PACKET** - The compressed data passed is corrupted or of an unsupported type ``` -------------------------------- ### opus_repacketizer_init Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__repacketizer.html Initializes or resets a repacketizer state. ```APIDOC ## opus_repacketizer_init ### Description (Re)initializes a previously allocated repacketizer state. Must be called to reset the queue of packets. ### Parameters - **rp** (OpusRepacketizer*) - Required - The repacketizer state to (re)initialize. ### Response - **Returns** (OpusRepacketizer*) - A pointer to the same repacketizer state. ``` -------------------------------- ### opus_repacketizer_get_size Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__repacketizer.html Gets the required size for a repacketizer structure. ```APIDOC ## opus_repacketizer_get_size ### Description Gets the size of an OpusRepacketizer structure in bytes. ### Response - **Returns** (int) - The size in bytes. ``` -------------------------------- ### ope_encoder_deferred_init_with_mapping() Source: https://opus-codec.org/docs/libopusenc_api-0.3/group__encoding.html Performs deferred initialization of the encoder to force an explicit channel mapping. ```APIDOC ## ope_encoder_deferred_init_with_mapping() ### Description Deferred initialization of the encoder to force an explicit channel mapping. This can be used to override the default channel coupling, but using it for regular surround will almost certainly lead to worse quality. ### Parameters - **enc** (OggOpusEnc *) - Encoder - **family** (int) - Mapping family (0 for mono/stereo, 1 for surround) - **streams** (int) - Total number of streams - **coupled_streams** (int) - Number of coupled streams - **mapping** (const unsigned char *) - Channel mapping ### Returns Error code ``` -------------------------------- ### opus_multistream_decoder_get_size() Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__multistream.html Gets the size of an OpusMSDecoder structure in bytes. ```APIDOC ## opus_multistream_decoder_get_size() ### Description Gets the size of an `OpusMSDecoder` structure. ### Parameters - **streams** (int) - The total number of streams coded in the input. Must be no more than 255. - **coupled_streams** (int) - Number streams to decode as coupled (2 channel) streams. Must be no larger than the total number of streams. Additionally, The total number of coded channels (`streams + coupled_streams`) must be no more than 255. ### Returns The size in bytes on success, or a negative error code (see Error codes) on error. ``` -------------------------------- ### opus_repacketizer_create Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__repacketizer.html Allocates and initializes a new repacketizer state. ```APIDOC ## opus_repacketizer_create ### Description Allocates memory and initializes a new repacketizer state. ### Response - **Returns** (OpusRepacketizer*) - A pointer to the newly allocated repacketizer. ``` -------------------------------- ### Set Raw Input Channels Source: https://opus-codec.org/docs/opus-tools/opusenc.html Use --raw-chan to set the number of channels for raw PCM input. Defaults to 2. ```bash --raw-chan _N_ ``` -------------------------------- ### OPUS_GET_SIGNAL Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__encoderctls.html Gets the encoder's configured signal type. ```APIDOC ## OPUS_GET_SIGNAL ### Description Gets the encoder's configured signal type. ### Method GET (Control) ### Endpoint /websites/opus-codec ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **x** (opus_int32 *) - Returns one of the following values: OPUS_AUTO (default) OPUS_SIGNAL_VOICE (Bias thresholds towards choosing LPC or Hybrid modes.) OPUS_SIGNAL_MUSIC (Bias thresholds towards choosing MDCT modes.) ``` -------------------------------- ### OPUS_GET_PREDICTION_DISABLED Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__encoderctls.html Gets the encoder's configured prediction status. ```APIDOC ## OPUS_GET_PREDICTION_DISABLED ### Description Gets the encoder's configured prediction status. ### Method GET (Control) ### Endpoint /websites/opus-codec ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **x** (opus_int32 *) - Returns one of the following values: 0 - Prediction enabled (default). 1 - Prediction disabled. ``` -------------------------------- ### opus_multistream_surround_encoder_init() Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__multistream.html Initializes a previously allocated multistream surround encoder state. ```APIDOC ## opus_multistream_surround_encoder_init() ### Description Initializes a previously allocated multistream surround encoder state. This function is intended for applications that manage their own memory allocation. For more information visit the Opus Website. ### Parameters - **st** (`OpusMSEncoder*`) - Multistream surround encoder state to initialize. - **Fs** (`opus_int32`) - Sampling rate of the input signal (in Hz). - **channels** (`int`) - Number of channels in the input signal. - **mapping_family** (`int`) - The mapping family to use for surround sound. - **streams** (`int*`) - Pointer to store the number of streams. - **coupled_streams** (`int*`) - Pointer to store the number of coupled streams. - **mapping** (`unsigned char*`) - Pointer to store the channel mapping. - **application** (`int`) - The target encoder application. ### Returns OPUS_OK on success, or an error code (see Error codes) on failure. ``` -------------------------------- ### OPUS_GET_LSB_DEPTH Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__encoderctls.html Gets the encoder's configured signal depth. ```APIDOC ## OPUS_GET_LSB_DEPTH ### Description Gets the encoder's configured signal depth. ### Method GET (Control) ### Endpoint /websites/opus-codec ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **x** (opus_int32 *) - Input precision in bits, between 8 and 24 (default: 24). ``` -------------------------------- ### op_test_callbacks Source: https://opus-codec.org/docs/opusfile_api-0.12/group__stream__open__close.html Partially opens a stream using provided callbacks to test for Opus format and load initial headers. Allows querying basic information for the first link but not reading audio or seeking. ```APIDOC ## op_test_callbacks() ### Description Partially open a stream using the given set of callbacks to access it. This tests for Opusness and loads the headers for the first link. It does not seek (although it tests for seekability). You can query a partially open stream for the few pieces of basic information returned by op_serialno(), op_channel_count(), op_head(), and op_tags() (but only for the first link). You may also determine if it is seekable via a call to op_seekable(). You cannot read audio from the stream, seek, get the size or duration, get information from links other than the first one, or even get the total number of links until you finish opening the stream with op_test_open(). If you do not need to do any of these things, you can dispose of it with op_free() instead. This function is provided mostly to simplify porting existing code that used `libvorbisfile`. For new code, you are likely better off using op_test() instead, which is less resource-intensive, requires less data to succeed, and imposes a hard limit on the amount of data it examines (important for unseekable streams, where all such data must be buffered until you are sure of the stream type). ### Method (Implicitly a function call, not an HTTP method) ### Parameters #### Path Parameters (Not applicable) #### Query Parameters (Not applicable) #### Request Body (Not applicable) ### Parameters - **_stream** (void *) - Required - The stream to read from (e.g., a `FILE *`). This value will be passed verbatim as the first argument to all of the callbacks. - **_cb** (const OpusFileCallbacks *) - Required - The callbacks with which to access the stream. read() must be implemented. seek() and tell() may be `NULL`, or may always return -1 to indicate a stream is unseekable, but if seek() is implemented and succeeds on a particular stream, then tell() must also. close() may be `NULL`, but if it is not, it will be called when the `OggOpusFile` is destroyed by op_free(). It will not be called if op_open_callbacks() fails with an error. - **_initial_data** (const unsigned char *) - Required - An initial buffer of data from the start of the stream. Applications can read some number of bytes from the start of the stream to help identify this as an Opus stream, and then provide them here to allow the stream to be tested more thoroughly, even if it is unseekable. - **_initial_bytes** (size_t) - Required - The number of bytes in __initial_data_. If the stream is seekable, its current position (as reported by tell() at the start of this function) must be equal to __initial_bytes_. Otherwise, seeking to absolute positions will generate inconsistent results. - **_error** (int *) - Optional - Returns 0 on success, or a failure code on error. You may pass in `NULL` if you don't want the failure code. See op_open_callbacks() for a full list of failure codes. ### Returns A partially opened `OggOpusFile`, or `NULL` on error. `libopusfile` does _not_ take ownership of the stream if the call fails. The calling application is responsible for closing the stream if this call returns an error. ``` -------------------------------- ### opus_encoder_get_size() Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__encoder.html Gets the size in bytes required for an OpusEncoder structure. ```APIDOC ## opus_encoder_get_size() ### Description Gets the size of an `OpusEncoder` structure. ### Parameters - **channels** (int) - Number of channels. This must be 1 or 2. ### Returns - The size in bytes required for the encoder state. ### Note Since this function does not take the application as input, it will overestimate the size required for OPUS_APPLICATION_RESTRICTED_SILK and OPUS_APPLICATION_RESTRICTED_CELT. That is generally not a problem, except when trying to know the size to use for a copy. ``` -------------------------------- ### op_fdopen Source: https://opus-codec.org/docs/opusfile_api-0.12/group__stream__callbacks.html Opens a stream from an existing file descriptor and populates OpusFileCallbacks. ```APIDOC ## op_fdopen ### Description Opens a stream with fdopen() and fills in a set of callbacks that can be used to access it. ### Parameters #### Path Parameters - **cb** (OpusFileCallbacks*) - Required - The callbacks to use for this file. - **fd** (int) - Required - The file descriptor to open. - **mode** (const char*) - Required - The mode to open the file in. ### Response - **Returns** (void*) - A stream handle to use with the callbacks, or NULL on error. ``` -------------------------------- ### OPUS_GET_QEXT Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__encoderctls.html Gets the encoder's configured quality extension (QEXT). ```APIDOC ## OPUS_GET_QEXT ### Description Gets the encoder's configured quality extension (QEXT). ### Method GET (Control) ### Endpoint /websites/opus-codec ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **x** (opus_int32 *) - The configured quality extension value. ``` -------------------------------- ### Set Album Source: https://opus-codec.org/docs/opus-tools/opusenc.html Use the --album option to set the album or collection title field. ```bash --album _ALBUM_ ``` -------------------------------- ### OPUS_GET_PACKET_LOSS_PERC Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__encoderctls.html Gets the encoder's configured packet loss percentage. ```APIDOC ## OPUS_GET_PACKET_LOSS_PERC ### Description Gets the encoder's configured packet loss percentage. ### Method GET (Control) ### Endpoint /websites/opus-codec ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **x** (opus_int32 *) - Returns the configured loss percentage in the range 0-100, inclusive (default: 0). ``` -------------------------------- ### Attach Album Art Source: https://opus-codec.org/docs/opus-tools/opusenc.html Use the --picture option to attach album art. Accepts a filename or a detailed specification string. ```bash --picture _FILENAME_ | _SPECIFICATION_ ``` ```bash ||||_FILENAME_ ``` ```bash [_TYPE_]|[_MEDIATYPE_]|[_DESCRIPTION_]|[_DIMENSIONS_]|_FILENAME_ ``` -------------------------------- ### OPUS_GET_MAX_BANDWIDTH Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__encoderctls.html Gets the encoder's configured maximum allowed bandpass. ```APIDOC ## OPUS_GET_MAX_BANDWIDTH ### Description Gets the encoder's configured maximum allowed bandpass. ### Method GET (Control) ### Endpoint /websites/opus-codec ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **x** (opus_int32 *) - Allowed values: OPUS_BANDWIDTH_NARROWBAND (4 kHz passband) OPUS_BANDWIDTH_MEDIUMBAND (6 kHz passband) OPUS_BANDWIDTH_WIDEBAND (8 kHz passband) OPUS_BANDWIDTH_SUPERWIDEBAND (12 kHz passband) OPUS_BANDWIDTH_FULLBAND (20 kHz passband (default)) ``` -------------------------------- ### op_fopen Source: https://opus-codec.org/docs/opusfile_api-0.12/group__stream__callbacks.html Opens a file stream and populates OpusFileCallbacks for use with the Opus decoder. ```APIDOC ## op_fopen ### Description Opens a stream with fopen() and fills in a set of callbacks that can be used to access it. This avoids cross-module linking issues on Windows and provides portable 64-bit seeking. ### Parameters #### Path Parameters - **cb** (OpusFileCallbacks*) - Required - The callbacks to use for this file. - **path** (const char*) - Required - The path to the file to open. Must be UTF-8 on Windows. - **mode** (const char*) - Required - The mode to open the file in. ### Response - **Returns** (void*) - A stream handle to use with the callbacks, or NULL on error. ``` -------------------------------- ### Get Decoder Gain Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__decoderctls.html Retrieves the current decoder gain adjustment value. ```c #define OPUS_GET_GAIN(x) ``` -------------------------------- ### ope_get_abi_version() Source: https://opus-codec.org/docs/libopusenc_api-0.3/group__encoding.html Retrieves the Application Binary Interface (ABI) version of the library. ```APIDOC ## ope_get_abi_version() ### Description ABI version for this header. Can be used to check for features at run time. ### Returns An integer representing the ABI version ``` -------------------------------- ### Opus Configuration Constants Source: https://opus-codec.org/docs/opus_api-1.6/opus__defines_8h.html Constants for bitrate, application types, signal types, and bandwidth settings. ```c #define OPUS_AUTO ``` ```c #define OPUS_BITRATE_MAX ``` ```c #define OPUS_APPLICATION_VOIP ``` ```c #define OPUS_APPLICATION_AUDIO ``` ```c #define OPUS_APPLICATION_RESTRICTED_LOWDELAY ``` ```c #define OPUS_APPLICATION_RESTRICTED_SILK 2052 ``` ```c #define OPUS_APPLICATION_RESTRICTED_CELT 2053 ``` ```c #define OPUS_SIGNAL_VOICE 3001 ``` ```c #define OPUS_SIGNAL_MUSIC 3002 ``` ```c #define OPUS_BANDWIDTH_NARROWBAND ``` ```c #define OPUS_BANDWIDTH_MEDIUMBAND ``` ```c #define OPUS_BANDWIDTH_WIDEBAND ``` ```c #define OPUS_BANDWIDTH_SUPERWIDEBAND ``` ```c #define OPUS_BANDWIDTH_FULLBAND ``` -------------------------------- ### ope_encoder_chain_current() Source: https://opus-codec.org/docs/libopusenc_api-0.3/group__encoding.html Ends the current Opus stream and starts a new one within the same file. ```APIDOC ## ope_encoder_chain_current() ### Description Ends the stream and create a new stream within the same file. ### Parameters - **enc** (OggOpusEnc *) - Encoder - **comments** (OggOpusComments *) - Comments associated with the stream ### Returns Error code ``` -------------------------------- ### Opus Decoder Control Macros Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__decoderctls.html Macros for configuring and retrieving settings from the Opus decoder instance. ```APIDOC ## OPUS_GET_GAIN ### Description Gets the decoder's configured gain adjustment. ### Parameters #### Path Parameters - **x** (opus_int32 *) - Required - Amount to scale PCM signal by in Q8 dB units. ## OPUS_SET_GAIN ### Description Configures decoder gain adjustment. Scales the decoded output by a factor specified in Q8 dB units. ### Parameters #### Path Parameters - **x** (opus_int32) - Required - Amount to scale PCM signal by in Q8 dB units. ## OPUS_GET_LAST_PACKET_DURATION ### Description Gets the duration (in samples) of the last packet successfully decoded or concealed. ### Parameters #### Path Parameters - **x** (opus_int32 *) - Required - Number of samples (at current sampling rate). ## OPUS_GET_PITCH ### Description Gets the pitch of the last decoded frame, if available. Returns zero if the last frame was not voiced or pitch was not coded. ### Parameters #### Path Parameters - **x** (opus_int32 *) - Required - Pitch period at 48 kHz (or 0 if not available). ## OPUS_SET_OSCE_BWE ### Description Enables blind bandwidth extension for wideband signals if decoding sampling rate is 48 kHz. ### Parameters #### Path Parameters - **x** (opus_int32) - Required - 1 enables bandwidth extension, 0 disables it. ## OPUS_GET_OSCE_BWE ### Description Gets blind bandwidth extension flag for wideband signals if decoding sampling rate is 48 kHz. ### Parameters #### Path Parameters - **x** (opus_int32 *) - Required - 1 if bwe enabled, 0 if disabled. ## OPUS_SET_IGNORE_EXTENSIONS ### Description If set to 1, the decoder will ignore all extensions found in the padding area. ## OPUS_GET_IGNORE_EXTENSIONS ### Description Gets whether the decoder is ignoring extensions. ``` -------------------------------- ### opus_picture_tag_init() Source: https://opus-codec.org/docs/opusfile_api-0.12/group__header__info.html Initializes an OpusPictureTag structure before use. ```APIDOC ## opus_picture_tag_init() ### Description Initializes an OpusPictureTag structure. This should be called on a freshly allocated structure before attempting to use it. ### Parameters - **pic** (OpusPictureTag*) - Required - The OpusPictureTag structure to initialize. ``` -------------------------------- ### Get Last Packet Duration Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__decoderctls.html Retrieves the duration in samples of the most recently decoded or concealed packet. ```c #define OPUS_GET_LAST_PACKET_DURATION(x) ``` -------------------------------- ### op_url_stream_vcreate() Source: https://opus-codec.org/docs/opusfile_api-0.12/group__stream__callbacks.html Creates a stream that reads from the given URL using a va_list for optional arguments. Requires linking against libopusurl. ```APIDOC ## op_url_stream_vcreate() ### Description Creates a stream that reads from the given URL. This function behaves identically to op_url_stream_create(), except that it takes a va_list instead of a variable number of arguments. It does not call the `va_end` macro, and because it invokes the `va_arg` macro, the value of __ap_ is undefined after the call. ### Parameters - **__cb_** (OpusFileCallbacks *) - Out - The callbacks to use for this stream. If there is an error creating the stream, nothing will be filled in here. - **__url_** (const char *) - The URL to read from. Currently only the , , and schemes are supported. Both and may be disabled at compile time, in which case opening such URLs will always fail. Currently this only supports URIs. IRIs should be converted to UTF-8 and URL-escaped, with internationalized domain names encoded in punycode, before passing them to this function. - **__ap_** (va_list) - In/Out - A list of the optional flags to use. This is a variable-length list of options terminated with `NULL`. ### Returns A stream handle to use with the callbacks, or `NULL` on error. ### Note If you use this function, you must link against `libopusurl`. ``` -------------------------------- ### op_vopen_url() - Open Opus from URL Source: https://opus-codec.org/docs/opusfile_api-0.12/group__stream__open__close.html Opens an Opus stream from a URL using a va_list for options. ```APIDOC ## op_vopen_url() ### Description Opens a stream from a URL. This function behaves identically to op_open_url(), except that it takes a va_list instead of a variable number of arguments. It does not call the `va_end` macro, and because it invokes the `va_arg` macro, the value of __ap_ is undefined after the call. Note: If you use this function, you must link against `libopusurl`. ### Method (Implicitly a function call, not an HTTP method) ### Endpoint N/A (URL) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **__url_** (const char *) - in - The URL to open. Currently only the , , and schemes are supported. Both and may be disabled at compile time, in which case opening such URLs will always fail. Currently this only supports URIs. IRIs should be converted to UTF-8 and URL-escaped, with internationalized domain names encoded in punycode, before passing them to this function. - **__error_** (int *) - out - Returns 0 on success, or a failure code on error. You may pass in `NULL` if you don't want the failure code. See op_open_callbacks() for a full list of failure codes. - **__ap_** (va_list) - in,out - A list of the optional flags to use. This is a variable-length list of options terminated with `NULL`. ### Request Example ```c // Example usage (conceptual) va_list args; // ... initialize va_list with options ... int error; OggOpusFile *ogg_opus_file = op_vopen_url("http://example.com/audio.opus", &error, args); if (ogg_opus_file == NULL) { // Handle error } // va_end(args) should be called by the caller if necessary, but this function does not. ``` ### Response #### Success Response Returns a pointer to a newly opened `OggOpusFile` structure on success. #### Response Example ```c // Assuming 'options_list' is a va_list initialized with options OggOpusFile *ogg_opus_file = op_vopen_url("https://example.com/stream.opus", NULL, options_list); if (ogg_opus_file != NULL) { // Successfully opened from URL } ``` ``` -------------------------------- ### Define OPE_GET_NB_STREAMS Source: https://opus-codec.org/docs/libopusenc_api-0.3/group__encoder__ctl.html Macro to get the number of streams in the Opus stream. This is useful for multi-channel audio. ```c #define OPE_GET_NB_STREAMS(x) \ OPE_GET_NB_STREAMS_REQUEST, ope_check_int_ptr(x) ``` -------------------------------- ### Getting Frame Count Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__repacketizer.html Retrieves the number of Opus frames currently held within the repacketizer state. ```APIDOC ## Getting Frame Count ### Description Returns the total number of frames contained in packet data submitted to the repacketizer state so far. This is useful for determining how many frames are available for extraction or for managing the repacketizer's buffer. ### Function #### `opus_repacketizer_get_nb_frames(OpusRepacketizer *rp)` Return the total number of frames contained in packet data submitted to the repacketizer state so far. **Parameters**: - **rp** (`OpusRepacketizer*`) - Pointer to the `OpusRepacketizer` state. **Return Value**: The total number of frames. ### Request Example ```c // Assuming 'rp' is an initialized OpusRepacketizer state and packets have been added int num_frames = opus_repacketizer_get_nb_frames(rp); // Use num_frames for further processing ``` ``` -------------------------------- ### Include Opus Types and Defines Source: https://opus-codec.org/docs/opus_api-1.6/opus_8h.html Include the necessary header files for Opus types and defines. These are fundamental for using the Opus API. ```c #include "opus_types.h" ``` ```c #include "opus_defines.h" ``` -------------------------------- ### Define OPUS_GET_IN_DTX Macro Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__genericctls.html Macro definition to get the DTX (Discontinuous Transmission) state of the Opus encoder. ```c #define OPUS_GET_IN_DTX(x) ``` -------------------------------- ### libopusfile C API - Opening and Closing Source: https://opus-codec.org/docs/opusfile_api-0.12/index.html Functions for opening and closing Ogg Opus audio streams. ```APIDOC ## Opening and Closing ### Description Provides functions to open and close Ogg Opus audio streams for decoding. ### Functions - `op_open_file()`: Opens an Opus stream from a `FILE *`. - `op_open_callbacks()`: Opens an Opus stream using custom stream I/O callbacks. - `op_open_memory()`: Opens an Opus stream from a memory buffer. - `op_open_url()`: Opens an Opus stream from a URL. - `op_free()`: Closes an opened Opus stream and frees associated resources. ``` -------------------------------- ### opus_multistream_decoder_init() Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__multistream.html Initializes a previously allocated decoder state object. Use this for custom allocators. ```APIDOC ## opus_multistream_decoder_init() ### Description Initialize a previously allocated decoder state object. The memory pointed to by _st_ must be at least the size returned by opus_multistream_encoder_get_size(). This is intended for applications which use their own allocator instead of malloc. To reset a previously initialized state, use the OPUS_RESET_STATE CTL. ### Parameters - **st** (OpusMSEncoder*) - Multistream encoder state to initialize. - **Fs** (opus_int32) - Sampling rate to decode at (in Hz). Must be one of 8000, 12000, 16000, 24000, or 48000. - **channels** (int) - Number of channels to output. Must be at most 255. May differ from coded channels. - **streams** (int) - Total number of streams coded in the input. Must be no more than 255. - **coupled_streams** (int) - Number of streams to decode as coupled (2 channel) streams. Must be no larger than total streams. Total coded channels (`streams + coupled_streams`) must be no more than 255. - **mapping** (const unsigned char[channels]) - Mapping from coded channels to output channels. ### Returns OPUS_OK on success, or an error code on failure. ### See also opus_multistream_decoder_create opus_multistream_deocder_get_size ``` -------------------------------- ### Get Extension Ignoring Status Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__decoderctls.html Retrieves the current status of the decoder's extension ignoring setting. ```c #define OPUS_GET_IGNORE_EXTENSIONS(x) ``` -------------------------------- ### Get Blind Bandwidth Extension Status Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__decoderctls.html Retrieves the current status of the blind bandwidth extension flag. ```c #define OPUS_GET_OSCE_BWE(x) ``` -------------------------------- ### OP_GET_SERVER_INFO Source: https://opus-codec.org/docs/opusfile_api-0.12/group__url__options.html Retrieves information about the streaming server and populates an OpusServerInfo structure. ```APIDOC ## OP_GET_SERVER_INFO ### Description Parses information about the streaming server and returns it. Note that minimal validation is performed; string fields may not be valid UTF-8 and numeric fields may not strictly adhere to expected units. ### Parameters #### Path Parameters - **_info** (OpusServerInfo *) - Required - Pointer to the structure to be filled with server information. Remains unmodified on error. ### Response - **Success** - Fills the structure with available server information. The structure must be freed using opus_server_info_clear() after use. ``` -------------------------------- ### Opus Decoder Initialization Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__decoder.html Functions for creating and initializing the Opus decoder state. ```APIDOC ## opus_decoder_create ### Description Allocates and initializes a new decoder state. ### Parameters - **Fs** (opus_int32) - Required - Sampling rate (8000, 12000, 16000, 24000, or 48000) - **channels** (int) - Required - Number of channels (1 or 2) - **error** (int*) - Required - Pointer to hold the error code ### Response - **OpusDecoder*** - A pointer to the newly created decoder state. --- ## opus_decoder_init ### Description Initializes a previously allocated decoder state. ### Parameters - **st** (OpusDecoder*) - Required - Pointer to the pre-allocated decoder state - **Fs** (opus_int32) - Required - Sampling rate - **channels** (int) - Required - Number of channels ### Response - **int** - Returns OPUS_OK on success. ``` -------------------------------- ### Define OPUS_GET_PHASE_INVERSION_DISABLED Macro Source: https://opus-codec.org/docs/opus_api-1.6/group__opus__genericctls.html Macro definition to get the Opus encoder's configured phase inversion status. ```c #define OPUS_GET_PHASE_INVERSION_DISABLED(x) ```