Defines | Typedefs | Functions

opus_multistream.h File Reference

Opus reference implementation multistream API. More...

#include "opus.h"

Go to the source code of this file.

Defines

#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, 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, 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, int 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, int 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, 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, unsigned char *mapping)
 Intialize a previously allocated decoder state object.
int opus_multistream_decode (OpusMSDecoder *st, const unsigned char *data, int 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, int 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.


Define 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,
  y 
)    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,
  y 
)    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,
int  len,
opus_int16 pcm,
int  frame_size,
int  decode_fec 
)

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

Parameters:
st Decoder state
data Input payload. Use a NULL pointer to indicate packet loss
len Number of bytes in payload
pcm Output signal, samples interleaved in channel order . length is frame_size*channels
frame_size Number of samples per frame of input signal
decode_fec Flag (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,
int  len,
float *  pcm,
int  frame_size,
int  decode_fec 
)

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

Parameters:
st Decoder state
data Input payload buffer. Use a NULL pointer to indicate packet loss
len Number of payload bytes in data
pcm Buffer for the output signal (interleaved iin channel order). length is frame_size*channels
frame_size Number of samples per frame of input signal
decode_fec Flag (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,
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:
Fs Sampling rate to decode at (Hz)
channels Number of channels to decode
streams Total number of coded streams in the multistream
coupled_streams Number of coupled (stereo) streams in the multistream
mapping Stream to channel mapping table
error Error 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:
streams Total number of coded streams
coupled_streams Number of coupled (stereo) streams
int opus_multistream_decoder_init ( OpusMSDecoder st,
opus_int32  Fs,
int  channels,
int  streams,
int  coupled_streams,
unsigned char *  mapping 
)

Intialize a previously allocated decoder state object.

Parameters:
st Encoder state
Fs Sample rate of input signal (Hz)
channels Number of channels in the input signal
streams Total number of coded streams
coupled_streams Number of coupled (stereo) streams
mapping Stream to channel mapping table
int opus_multistream_encode ( OpusMSEncoder st,
const opus_int16 pcm,
int  frame_size,
unsigned char *  data,
int  max_data_bytes 
)

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

Parameters:
st Encoder state
pcm Input signal as interleaved samples. Length is frame_size*channels
frame_size Number of samples per frame of input signal
data Output buffer for the compressed payload (no more than max_data_bytes long)
max_data_bytes Allocated 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,
int  max_data_bytes 
)

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

Parameters:
st Encoder state
pcm Input signal interleaved in channel order. length is frame_size*channels
frame_size Number of samples per frame of input signal
data Output buffer for the compressed payload (no more than max_data_bytes long)
max_data_bytes Allocated memory for payload; don't use for controlling bitrate
OpusMSEncoder* opus_multistream_encoder_create ( opus_int32  Fs,
int  channels,
int  streams,
int  coupled_streams,
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:
Fs Sampling rate of input signal (Hz)
channels Number of channels in the input signal
streams Total number of streams to encode from the input
coupled_streams Number of coupled (stereo) streams to encode
mapping Encoded mapping between channels and streams
application Coding mode (OPUS_APPLICATION_VOIP/OPUS_APPLICATION_AUDIO)
error Error 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:
streams Total number of coded streams
coupled_streams Number of coupled (stereo) streams
int opus_multistream_encoder_init ( OpusMSEncoder st,
opus_int32  Fs,
int  channels,
int  streams,
int  coupled_streams,
unsigned char *  mapping,
int  application 
)

Initialize an already allocated multistream encoder state.

Parameters:
st Encoder state
Fs Sampling rate of input signal (Hz)
channels Number of channels in the input signal
streams Total number of streams to encode from the input
coupled_streams Number of coupled (stereo) streams to encode
mapping Encoded mapping between channels and streams
application Coding mode (OPUS_APPLICATION_VOIP/OPUS_APPLICATION_AUDIO)
 All Files Functions Typedefs Defines