nrfxlib API 0.1.0
Loading...
Searching...
No Matches

◆ LC3DecodeSessionOpen()

LC3DecoderHandle_t LC3DecodeSessionOpen ( uint16_t  sampleRate,
uint8_t  bitsPerSample,
LC3FrameSize_t  frameSize,
uint8_t *  buffer,
uint16_t *  bufferSize,
int32_t *  result 
)

#include <lc3/codec/inc/LC3API.h>

Opens and initializes an LC3 Decoder session.

This function initializes the LC3 decoder in preparation for decoding one stream of audio. It allocates the memory needed for the session's processing, including any used for tracking progress from frame to frame, and initializes the allocated memory.

A non-NULL handle to the decoder session is returned when successful. The handle value is passed to future calls of LC3DecodeSessionData() and LC3DecodeSessionClose() for this session.

This function can allocate its own memory or take a user-provided buffer. It can also return the amount of memory needed without initializing. These memory options are performed in the following ways:

bufferSize = NULL: Allocates memory needed. The buffer parameter may be NULL.

*bufferSize < memory required by decoder: Sets bufferSize's referenced value to the total memory required and returns LC3_RESULT_INSUFFICIENT_RESOURCES. The caller can then call this function again with a buffer of at least bufferSize's referenced value. A size of 0 will always trigger this condition. The buffer parameter may be NULL.

*bufferSize >= memory required by decoder: Uses the user-provided buffer. bufferSize's referenced value is set to the amount of memory used by the decoder. The buffer parameter may not be NULL.

Parameters
[in]sampleRateOutput PCM sample rate in Hz.
[in]bitsPerSampleOutput PCM bits per sample.
[in]frameSizeFrame size of 7.5 or 10 msec.
[in]bufferPointer to a memory buffer.
[in,out]bufferSizeSize of the memory buffer passed in, number of bytes used returned.
[out]resultPointer to an LC3 Return Code integer value.
Returns
Non-NULL LC3DecoderHandle_t on success or NULL on failure.