Maestro Audio Framework v 1.7
NXP Semiconductors
Loading...
Searching...
No Matches
codec_interface.c File Reference

This file contains the CCI decoder interface APIs definitions. More...

#include "audio_cfg.h"
#include "codec_interface.h"
#include <stdio.h>

Functions

int32_t codec_get_io_frame_size (audio_stream_type_t stream_type, int32_t *in_size, int32_t *out_size)
 codec get input/output frame size in bytes.
 
int32_t codec_get_mem_info (audio_stream_type_t stream_type)
 codec get memory information function.
 
int32_t codec_init (audio_stream_type_t stream_type, int32_t *memory[], int32_t *callback_fn[], int32_t *user_data)
 codec initialization function.
 
int32_t codec_decode (audio_stream_type_t stream_type, int32_t *memory[], int32_t *sample_produced, int32_t *buf_out)
 codec decoding function.
 
int32_t codec_get_pcm_samples (audio_stream_type_t stream_type, int32_t *memory[], int32_t *sample_produced, int32_t *buf_out)
 codec get pcm samples function.
 
int32_t codec_reset (audio_stream_type_t stream_type, int32_t *memory[])
 codec reset function.
 
int32_t codec_seek (audio_stream_type_t stream_type, int32_t *memory[], int32_t byte_to_seek)
 codec seek function.
 

Variables

const codec_interface_function_table_t g_codec_function_table [STREAM_TYPE_COUNT]
 Global table with function pointers for different codecs.
 

Function Documentation

◆ codec_get_io_frame_size()

int32_t codec_get_io_frame_size ( audio_stream_type_t stream_type,
int32_t * in_size,
int32_t * out_size )
Parameters
[in]stream_typeAudio Stream Type.
[out]in_sizeInput Frame Size.
[out]out_sizeOutput Frame Size.
Return values
0when actual input/output frame size in bytes of the codec is get through in_size, out_size pointers
CODEC_UNSUPPORTED_FUNCTIONIf this function is not supported for streamtype.

◆ codec_get_mem_info()

int32_t codec_get_mem_info ( audio_stream_type_t stream_type)
Parameters
[in]stream_typeAudio Stream Type.
Return values
intSize of the codec.
CODEC_UNSUPPORTED_FUNCTIONIf this function is not supported for streamtype.

◆ codec_init()

int32_t codec_init ( audio_stream_type_t stream_type,
int32_t * memory[],
int32_t * callback_fn[],
int32_t * user_data )
Parameters
[in]stream_typeAudio Stream Type.
[in]memoryThis is pointer to the decoder memory.
[in]callback_fnThis is pointer to the decoder callback functions.
[in]user_dataThis is pointer to the user specific data.
Return values
CODEC_SUCCESSif codec initializes successfully.
CODEC_INIT_ERRORif codec fails to initialize.
CODEC_UNSUPPORTED_FUNCTIONIf this function is not supported for streamtype

◆ codec_decode()

int32_t codec_decode ( audio_stream_type_t stream_type,
int32_t * memory[],
int32_t * sample_produced,
int32_t * buf_out )
Parameters
[in]stream_typeAudio Stream Type.
[in]memoryThis is pointer to the decoder memory.
[in]sample_producedThis is pointer to the samples produced by the codec.
[in]buf_outThis is pointer to the decoder output pcm buffer.
Return values
CODEC_SUCCESSif codec decodes frame successfully.
CODEC_DECODE_ERRORif codec fails to decode frame.
CODEC_END_OF_DECODEif decoding of input file is done.
CODEC_UNSUPPORTED_FUNCTIONIf this function is not supported for streamtype

◆ codec_get_pcm_samples()

int32_t codec_get_pcm_samples ( audio_stream_type_t stream_type,
int32_t * memory[],
int32_t * sample_produced,
int32_t * buf_out )
Parameters
[in]stream_typeAudio Stream Type.
[in]memoryThis is pointer to the decoder memory.
[in]sample_producedThis is pointer to the samples produced by the codec.
[in]buf_outThis is pointer to the user specific data.
Return values
int32_tIt returns number of samples got from the codec.

◆ codec_reset()

int32_t codec_reset ( audio_stream_type_t stream_type,
int32_t * memory[] )
Parameters
[in]stream_typeAudio Stream Type.
[in]memoryThis is pointer to the decoder memory.
Return values
CODEC_SUCCESSif codec resets successfully.
CODEC_RESET_ERRORif codec fails to reset.
CODEC_UNSUPPORTED_FUNCTIONIf this function is not supported for streamtype

◆ codec_seek()

int32_t codec_seek ( audio_stream_type_t stream_type,
int32_t * memory[],
int32_t byte_to_seek )
Parameters
[in]stream_typeAudio Stream Type.
[in]memoryPointer to decoder memory allocated based on codec_get_mem_info() and passed in by caller.
[in]byte_to_seekNumber of bytes to seek.
Return values
int32_tframe boundary align offset.
CODEC_UNSUPPORTED_FUNCTIONIf this function is not supported for streamtype