Opus
IETF low-delay audio codec: API and operations manual
1.0.1
 All Files Functions Typedefs Macros Groups Pages
Macros | Typedefs | Functions
opus_multistream.h File Reference

Opus reference implementation multistream API. More...

#include "opus.h"

Go to the source code of this file.

Macros

#define __opus_check_encstate_ptr(ptr)   ((ptr) + ((ptr) - (OpusEncoder**)(ptr)))
#define __opus_check_decstate_ptr(ptr)   ((ptr) + ((ptr) - (OpusDecoder**)(ptr)))
#define OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST   5120
#define OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST   5122
#define OPUS_MULTISTREAM_GET_ENCODER_STATE(x, y)   OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST, __opus_check_int(x), __opus_check_encstate_ptr(y)
#define OPUS_MULTISTREAM_GET_DECODER_STATE(x, y)   OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST, __opus_check_int(x), __opus_check_decstate_ptr(y)

Typedefs

typedef struct OpusMSEncoder OpusMSEncoder
typedef struct OpusMSDecoder OpusMSDecoder

Functions

OpusMSEncoderopus_multistream_encoder_create (opus_int32 Fs, int channels, int streams, int coupled_streams, const unsigned char *mapping, int application, int *error)
 Allocate and initialize a multistream encoder state object.
int opus_multistream_encoder_init (OpusMSEncoder *st, opus_int32 Fs, int channels, int streams, int coupled_streams, const unsigned char *mapping, int application)
 Initialize an already allocated multistream encoder state.
int opus_multistream_encode (OpusMSEncoder *st, const opus_int16 *pcm, int frame_size, unsigned char *data, opus_int32 max_data_bytes)
 Returns length of the data payload (in bytes) or a negative error code.
int opus_multistream_encode_float (OpusMSEncoder *st, const float *pcm, int frame_size, unsigned char *data, opus_int32 max_data_bytes)
 Returns length of the data payload (in bytes) or a negative error code.
opus_int32 opus_multistream_encoder_get_size (int streams, int coupled_streams)
 Gets the size of an OpusMSEncoder structure.
void opus_multistream_encoder_destroy (OpusMSEncoder *st)
 Deallocate a multstream encoder state.
int opus_multistream_encoder_ctl (OpusMSEncoder *st, int request,...)
 Get or set options on a multistream encoder state.
OpusMSDecoderopus_multistream_decoder_create (opus_int32 Fs, int channels, int streams, int coupled_streams, const unsigned char *mapping, int *error)
 Allocate and initialize a multistream decoder state object.
int opus_multistream_decoder_init (OpusMSDecoder *st, opus_int32 Fs, int channels, int streams, int coupled_streams, const unsigned char *mapping)
 Intialize a previously allocated decoder state object.
int opus_multistream_decode (OpusMSDecoder *st, const unsigned char *data, opus_int32 len, opus_int16 *pcm, int frame_size, int decode_fec)
 Returns the number of samples decoded or a negative error code.
int opus_multistream_decode_float (OpusMSDecoder *st, const unsigned char *data, opus_int32 len, float *pcm, int frame_size, int decode_fec)
 Returns the number of samples decoded or a negative error code.
opus_int32 opus_multistream_decoder_get_size (int streams, int coupled_streams)
 Gets the size of an OpusMSDecoder structure.
int opus_multistream_decoder_ctl (OpusMSDecoder *st, int request,...)
 Get or set options on a multistream decoder state.
void opus_multistream_decoder_destroy (OpusMSDecoder *st)
 Deallocate a multistream decoder state object.

Detailed Description

Opus reference implementation multistream API.


Macro Definition Documentation

#define __opus_check_decstate_ptr (   ptr)    ((ptr) + ((ptr) - (OpusDecoder**)(ptr)))
#define __opus_check_encstate_ptr (   ptr)    ((ptr) + ((ptr) - (OpusEncoder**)(ptr)))
#define OPUS_MULTISTREAM_GET_DECODER_STATE (   x,
 
)    OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST, __opus_check_int(x), __opus_check_decstate_ptr(y)
#define OPUS_MULTISTREAM_GET_DECODER_STATE_REQUEST   5122
#define OPUS_MULTISTREAM_GET_ENCODER_STATE (   x,
 
)    OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST, __opus_check_int(x), __opus_check_encstate_ptr(y)
#define OPUS_MULTISTREAM_GET_ENCODER_STATE_REQUEST   5120

Typedef Documentation

typedef struct OpusMSDecoder OpusMSDecoder
typedef struct OpusMSEncoder OpusMSEncoder

Function Documentation

int opus_multistream_decode ( OpusMSDecoder st,
const unsigned char *  data,
opus_int32  len,
opus_int16 pcm,
int  frame_size,
int  decode_fec 
)

Returns the number of samples decoded or a negative error code.

Parameters:
stDecoder state
dataInput payload. Use a NULL pointer to indicate packet loss
lenNumber of bytes in payload
pcmOutput signal, samples interleaved in channel order . length is frame_size*channels
frame_sizeNumber of samples per frame of input signal
decode_fecFlag (0/1) to request that any in-band forward error correction data be decoded. If no such data is available the frame is decoded as if it were lost.
int opus_multistream_decode_float ( OpusMSDecoder st,
const unsigned char *  data,
opus_int32  len,
float *  pcm,
int  frame_size,
int  decode_fec 
)

Returns the number of samples decoded or a negative error code.

Parameters:
stDecoder state
dataInput payload buffer. Use a NULL pointer to indicate packet loss
lenNumber of payload bytes in data
pcmBuffer for the output signal (interleaved iin channel order). length is frame_size*channels
frame_sizeNumber of samples per frame of input signal
decode_fecFlag (0/1) to request that any in-band forward error correction data be decoded. If no such data is available the frame is decoded as if it were lost.
OpusMSDecoder* opus_multistream_decoder_create ( opus_int32  Fs,
int  channels,
int  streams,
int  coupled_streams,
const unsigned char *  mapping,
int *  error 
)

Allocate and initialize a multistream decoder state object.

Call opus_multistream_decoder_destroy() to release this object when finished.

Parameters:
FsSampling rate to decode at (Hz)
channelsNumber of channels to decode
streamsTotal number of coded streams in the multistream
coupled_streamsNumber of coupled (stereo) streams in the multistream
mappingStream to channel mapping table
errorError code
int opus_multistream_decoder_ctl ( OpusMSDecoder st,
int  request,
  ... 
)

Get or set options on a multistream decoder state.

void opus_multistream_decoder_destroy ( OpusMSDecoder st)

Deallocate a multistream decoder state object.

opus_int32 opus_multistream_decoder_get_size ( int  streams,
int  coupled_streams 
)

Gets the size of an OpusMSDecoder structure.

Returns:
size
Parameters:
streamsTotal number of coded streams
coupled_streamsNumber of coupled (stereo) streams
int opus_multistream_decoder_init ( OpusMSDecoder st,
opus_int32  Fs,
int  channels,
int  streams,
int  coupled_streams,
const unsigned char *  mapping 
)

Intialize a previously allocated decoder state object.

Parameters:
stEncoder state
FsSample rate of input signal (Hz)
channelsNumber of channels in the input signal
streamsTotal number of coded streams
coupled_streamsNumber of coupled (stereo) streams
mappingStream to channel mapping table
int opus_multistream_encode ( OpusMSEncoder st,
const opus_int16 pcm,
int  frame_size,
unsigned char *  data,
opus_int32  max_data_bytes 
)

Returns length of the data payload (in bytes) or a negative error code.

Parameters:
stEncoder state
pcmInput signal as interleaved samples. Length is frame_size*channels
frame_sizeNumber of samples per frame of input signal
dataOutput buffer for the compressed payload (no more than max_data_bytes long)
max_data_bytesAllocated memory for payload; don't use for controlling bitrate
int opus_multistream_encode_float ( OpusMSEncoder st,
const float *  pcm,
int  frame_size,
unsigned char *  data,
opus_int32  max_data_bytes 
)

Returns length of the data payload (in bytes) or a negative error code.

Parameters:
stEncoder state
pcmInput signal interleaved in channel order. length is frame_size*channels
frame_sizeNumber of samples per frame of input signal
dataOutput buffer for the compressed payload (no more than max_data_bytes long)
max_data_bytesAllocated memory for payload; don't use for controlling bitrate
OpusMSEncoder* opus_multistream_encoder_create ( opus_int32  Fs,
int  channels,
int  streams,
int  coupled_streams,
const unsigned char *  mapping,
int  application,
int *  error 
)

Allocate and initialize a multistream encoder state object.

Call opus_multistream_encoder_destroy() to release this object when finished.

Parameters:
FsSampling rate of input signal (Hz)
channelsNumber of channels in the input signal
streamsTotal number of streams to encode from the input
coupled_streamsNumber of coupled (stereo) streams to encode
mappingEncoded mapping between channels and streams
applicationCoding mode (OPUS_APPLICATION_VOIP/OPUS_APPLICATION_AUDIO)
errorError code
int opus_multistream_encoder_ctl ( OpusMSEncoder st,
int  request,
  ... 
)

Get or set options on a multistream encoder state.

void opus_multistream_encoder_destroy ( OpusMSEncoder st)

Deallocate a multstream encoder state.

opus_int32 opus_multistream_encoder_get_size ( int  streams,
int  coupled_streams 
)

Gets the size of an OpusMSEncoder structure.

Returns:
size
Parameters:
streamsTotal number of coded streams
coupled_streamsNumber of coupled (stereo) streams
int opus_multistream_encoder_init ( OpusMSEncoder st,
opus_int32  Fs,
int  channels,
int  streams,
int  coupled_streams,
const unsigned char *  mapping,
int  application 
)

Initialize an already allocated multistream encoder state.

Parameters:
stEncoder state
FsSampling rate of input signal (Hz)
channelsNumber of channels in the input signal
streamsTotal number of streams to encode from the input
coupled_streamsNumber of coupled (stereo) streams to encode
mappingEncoded mapping between channels and streams
applicationCoding mode (OPUS_APPLICATION_VOIP/OPUS_APPLICATION_AUDIO)
For more information visit the Opus Website.