Opus audio codec (RFC 6716): API and operations manual
| 1.6.1

Loading...
Searching...
No Matches
opus.h File Reference

Opus reference implementation API. More...

`#include "opus_types.h"`
`#include "opus_defines.h"`
Include dependency graph for opus.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Typedefs
typedef struct OpusEncoder | OpusEncoder
| Opus encoder state.
typedef struct OpusDecoder | OpusDecoder
| Opus decoder state.
typedef struct OpusDREDDecoder | OpusDREDDecoder
| Opus DRED decoder.
typedef struct OpusDRED | OpusDRED
| Opus DRED state.
typedef struct OpusRepacketizer | OpusRepacketizer

## Functions
int | opus_encoder_get_size (int channels)
| Gets the size of an `OpusEncoder` structure.
OpusEncoder * | opus_encoder_create (opus_int32 Fs, int channels, int application, int *error)
| Allocates and initializes an encoder state.
int | opus_encoder_init (OpusEncoder *st, opus_int32 Fs, int channels, int application)
| Initializes a previously allocated encoder state The memory pointed to by st must be at least the size returned by opus_encoder_get_size().
opus_int32 | opus_encode (OpusEncoder *st, const opus_int16 *pcm, int frame_size, unsigned char *data, opus_int32 max_data_bytes)
| Encodes an Opus frame.
opus_int32 | opus_encode24 (OpusEncoder *st, const opus_int32 *pcm, int frame_size, unsigned char *data, opus_int32 max_data_bytes)
| Encodes an Opus frame.
opus_int32 | opus_encode_float (OpusEncoder *st, const float *pcm, int frame_size, unsigned char *data, opus_int32 max_data_bytes)
| Encodes an Opus frame from floating point input.
void | opus_encoder_destroy (OpusEncoder *st)
| Frees an `OpusEncoder` allocated by opus_encoder_create().
int | opus_encoder_ctl (OpusEncoder *st, int request,...)
| Perform a CTL function on an Opus encoder.
int | opus_decoder_get_size (int channels)
| Gets the size of an `OpusDecoder` structure.
OpusDecoder * | opus_decoder_create (opus_int32 Fs, int channels, int *error)
| Allocates and initializes a decoder state.
int | opus_decoder_init (OpusDecoder *st, opus_int32 Fs, int channels)
| Initializes a previously allocated decoder state.
int | opus_decode (OpusDecoder *st, const unsigned char *data, opus_int32 len, opus_int16 *pcm, int frame_size, int decode_fec)
| Decode an Opus packet.
int | opus_decode24 (OpusDecoder *st, const unsigned char *data, opus_int32 len, opus_int32 *pcm, int frame_size, int decode_fec)
| Decode an Opus packet.
int | opus_decode_float (OpusDecoder *st, const unsigned char *data, opus_int32 len, float *pcm, int frame_size, int decode_fec)
| Decode an Opus packet with floating point output.
int | opus_decoder_ctl (OpusDecoder *st, int request,...)
| Perform a CTL function on an Opus decoder.
void | opus_decoder_destroy (OpusDecoder *st)
| Frees an `OpusDecoder` allocated by opus_decoder_create().
int | opus_dred_decoder_get_size (void)
| Gets the size of an `OpusDREDDecoder` structure.
OpusDREDDecoder * | opus_dred_decoder_create (int *error)
| Allocates and initializes an OpusDREDDecoder state.
int | opus_dred_decoder_init (OpusDREDDecoder *dec)
| Initializes an `OpusDREDDecoder` state.
void | opus_dred_decoder_destroy (OpusDREDDecoder *dec)
| Frees an `OpusDREDDecoder` allocated by opus_dred_decoder_create().
int | opus_dred_decoder_ctl (OpusDREDDecoder *dred_dec, int request,...)
| Perform a CTL function on an Opus DRED decoder.
int | opus_dred_get_size (void)
| Gets the size of an `OpusDRED` structure.
OpusDRED * | opus_dred_alloc (int *error)
| Allocates and initializes a DRED state.
void | opus_dred_free (OpusDRED *dec)
| Frees an `OpusDRED` allocated by opus_dred_create().
int | opus_dred_parse (OpusDREDDecoder *dred_dec, OpusDRED *dred, const unsigned char *data, opus_int32 len, opus_int32 max_dred_samples, opus_int32 sampling_rate, int *dred_end, int defer_processing)
| Decode an Opus DRED packet.
int | opus_dred_process (OpusDREDDecoder *dred_dec, const OpusDRED *src, OpusDRED *dst)
| Finish decoding an Opus DRED packet.
int | opus_decoder_dred_decode (OpusDecoder *st, const OpusDRED *dred, opus_int32 dred_offset, opus_int16 *pcm, opus_int32 frame_size)
| Decode audio from an Opus DRED packet with 16-bit output.
int | opus_decoder_dred_decode24 (OpusDecoder *st, const OpusDRED *dred, opus_int32 dred_offset, opus_int32 *pcm, opus_int32 frame_size)
| Decode audio from an Opus DRED packet with 24-bit output.
int | opus_decoder_dred_decode_float (OpusDecoder *st, const OpusDRED *dred, opus_int32 dred_offset, float *pcm, opus_int32 frame_size)
| Decode audio from an Opus DRED packet with floating point output.
int | opus_packet_parse (const unsigned char *data, opus_int32 len, unsigned char *out_toc, const unsigned char *frames[48], opus_int16 size[48], int *payload_offset)
| Parse an opus packet into one or more frames.
int | opus_packet_get_bandwidth (const unsigned char *data)
| Gets the bandwidth of an Opus packet.
int | opus_packet_get_samples_per_frame (const unsigned char *data, opus_int32 Fs)
| Gets the number of samples per frame from an Opus packet.
int | opus_packet_get_nb_channels (const unsigned char *data)
| Gets the number of channels from an Opus packet.
int | opus_packet_get_nb_frames (const unsigned char packet[], opus_int32 len)
| Gets the number of frames in an Opus packet.
int | opus_packet_get_nb_samples (const unsigned char packet[], opus_int32 len, opus_int32 Fs)
| Gets the number of samples of an Opus packet.
int | opus_packet_has_lbrr (const unsigned char packet[], opus_int32 len)
| Checks whether an Opus packet has LBRR.
int | opus_decoder_get_nb_samples (const OpusDecoder *dec, const unsigned char packet[], opus_int32 len)
| Gets the number of samples of an Opus packet.
void | opus_pcm_soft_clip (float *pcm, int frame_size, int channels, float *softclip_mem)
| Applies soft-clipping to bring a float signal within the [-1,1] range.
int | opus_repacketizer_get_size (void)
| Gets the size of an `OpusRepacketizer` structure.
OpusRepacketizer * | opus_repacketizer_init (OpusRepacketizer *rp)
| (Re)initializes a previously allocated repacketizer state.
OpusRepacketizer * | opus_repacketizer_create (void)
| Allocates memory and initializes the new repacketizer with opus_repacketizer_init().
void | opus_repacketizer_destroy (OpusRepacketizer *rp)
| Frees an `OpusRepacketizer` allocated by opus_repacketizer_create().
int | opus_repacketizer_cat (OpusRepacketizer *rp, const unsigned char *data, opus_int32 len)
| Add a packet to the current repacketizer state.
opus_int32 | opus_repacketizer_out_range (OpusRepacketizer *rp, int begin, int end, unsigned char *data, opus_int32 maxlen)
| Construct a new packet from data previously submitted to the repacketizer state via opus_repacketizer_cat().
int | opus_repacketizer_get_nb_frames (OpusRepacketizer *rp)
| Return the total number of frames contained in packet data submitted to the repacketizer state so far via opus_repacketizer_cat() since the last call to opus_repacketizer_init() or opus_repacketizer_create().
opus_int32 | opus_repacketizer_out (OpusRepacketizer *rp, unsigned char *data, opus_int32 maxlen)
| Construct a new packet from data previously submitted to the repacketizer state via opus_repacketizer_cat().
int | opus_packet_pad (unsigned char *data, opus_int32 len, opus_int32 new_len)
| Pads a given Opus packet to a larger size (possibly changing the TOC sequence).
opus_int32 | opus_packet_unpad (unsigned char *data, opus_int32 len)
| Remove all padding from a given Opus packet and rewrite the TOC sequence to minimize space usage.
int | opus_multistream_packet_pad (unsigned char *data, opus_int32 len, opus_int32 new_len, int nb_streams)
| Pads a given Opus multi-stream packet to a larger size (possibly changing the TOC sequence).
opus_int32 | opus_multistream_packet_unpad (unsigned char *data, opus_int32 len, int nb_streams)
| Remove all padding from a given Opus multi-stream packet and rewrite the TOC sequence to minimize space usage.

## Detailed Description

Opus reference implementation API.