Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
sbc.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "sbc_encoder.h"
#include "oi_codec_sbc.h"
#include "oi_status.h"

Go to the source code of this file.

Data Structures

struct  sbc_encoder
 SBC encoder. More...
struct  sbc_encoder_init_param
 Encoder initialization parameters. More...
struct  sbc_decoder
 SBC decoder. More...

Enumerations

enum  sbc_ch_mode { SBC_CH_MODE_MONO , SBC_CH_MODE_DUAL_CHANNEL , SBC_CH_MODE_STEREO , SBC_CH_MODE_JOINT_STEREO }
 SBC channel mode. More...
enum  sbc_alloc_mthd { SBC_ALLOC_MTHD_LOUDNESS , SBC_ALLOC_MTHD_SNR }
 SBC allocation method. More...

Functions

int sbc_setup_encoder (struct sbc_encoder *encoder, struct sbc_encoder_init_param *param)
 Setup encoder.
uint32_t sbc_encode (struct sbc_encoder *encoder, const void *in_data, void *out_data)
 Encode a frame.
int sbc_frame_samples (struct sbc_encoder *encoder)
 Return the number of PCM samples in a frame.
int sbc_frame_bytes (struct sbc_encoder *encoder)
 Return the number of PCM bytes in a frame.
int sbc_frame_encoded_bytes (struct sbc_encoder *encoder)
 Return the encoded size of one frame.
int sbc_setup_decoder (struct sbc_decoder *decoder)
 Setup the SBC decoder.
int sbc_decode (struct sbc_decoder *decoder, const void **in_data, uint32_t *in_size, void *out_data, uint32_t *out_size)
 Decode a frame.

Enumeration Type Documentation

◆ sbc_alloc_mthd

SBC allocation method.

Enumerator
SBC_ALLOC_MTHD_LOUDNESS 

Loudness allocation method.

SBC_ALLOC_MTHD_SNR 

SNR allocation method.

◆ sbc_ch_mode

SBC channel mode.

Enumerator
SBC_CH_MODE_MONO 

Mono channel.

SBC_CH_MODE_DUAL_CHANNEL 

Dual channel.

SBC_CH_MODE_STEREO 

Stereo channel.

SBC_CH_MODE_JOINT_STEREO 

Joint stereo channel.

Function Documentation

◆ sbc_decode()

int sbc_decode ( struct sbc_decoder * decoder,
const void ** in_data,
uint32_t * in_size,
void * out_data,
uint32_t * out_size )

Decode a frame.

Parameters
decoderHandle of the decoder.
in_dataInput bitstream, it is increased after decode one frame
in_sizeInput data size in bytes, it is decreased after decode one frame
out_dataOutput PCM samples
out_sizeOutput data size in bytes
Returns
Zero on success or (negative) error code otherwise.

◆ sbc_encode()

uint32_t sbc_encode ( struct sbc_encoder * encoder,
const void * in_data,
void * out_data )

Encode a frame.

Parameters
encoderHandle of the encoder.
in_dataInput PCM samples.
out_dataEncoded SBC frame.
Returns
The encoded size of the frame in bytes.

◆ sbc_frame_bytes()

int sbc_frame_bytes ( struct sbc_encoder * encoder)

Return the number of PCM bytes in a frame.

Parameters
encoderHandle of the encoder.
Returns
Number of PCM bytes or (negative) error code otherwise

◆ sbc_frame_encoded_bytes()

int sbc_frame_encoded_bytes ( struct sbc_encoder * encoder)

Return the encoded size of one frame.

Parameters
encoderHandle of the encoder.
Returns
The encoded size of one frame in bytes or (negative) error code otherwise.

◆ sbc_frame_samples()

int sbc_frame_samples ( struct sbc_encoder * encoder)

Return the number of PCM samples in a frame.

Parameters
encoderHandle of the encoder.
Returns
Number of PCM samples or (negative) error code otherwise.

◆ sbc_setup_decoder()

int sbc_setup_decoder ( struct sbc_decoder * decoder)

Setup the SBC decoder.

Parameters
decoderHandle of the decoder.
Returns
Zero on success or (negative) error code otherwise.

◆ sbc_setup_encoder()

int sbc_setup_encoder ( struct sbc_encoder * encoder,
struct sbc_encoder_init_param * param )

Setup encoder.

Parameters
encoderHandle of the encoder.
paramThe parameters to initialize encoder sbc_encoder_init_param.
Returns
Zero on success or (negative) error code otherwise.