Functions | |
| cy_rslt_t | cy_audio_sw_codec_init (cy_audio_sw_codec_operation_t codec_operation, void *codec_config, cy_audio_sw_codec_t *handle) |
| Initializes the software codec for either decoding and encoding. | |
| cy_rslt_t | cy_audio_sw_codec_encode (cy_audio_sw_codec_t handle, uint8_t *in_pcm_buff, uint32_t *in_pcm_data_len, uint8_t *out_buff, uint32_t *outbuf_len) |
| Encodes the input PCM data and returns the encoded data. | |
| cy_rslt_t | cy_audio_sw_codec_decode (cy_audio_sw_codec_t handle, uint8_t *in_encoded_buff, uint32_t *in_encoded_data_len, uint8_t *out_buff, uint32_t *outbuf_len) |
| Decodes the encoded data and returns the PCM data. | |
| cy_rslt_t | cy_audio_sw_codec_get_encoder_recommended_inbuf_size (cy_audio_sw_codec_t handle, uint32_t *recommended_in_size) |
| Get the recommended size of the input buffer for the codec encode operation configured. | |
| cy_rslt_t | cy_audio_sw_codec_get_encoder_recommended_outbuf_size (cy_audio_sw_codec_t handle, uint32_t in_size, uint32_t *recommended_out_size) |
| Get the recommended size of the output buffer for the codec encoding operation configured. | |
| cy_rslt_t | cy_audio_sw_codec_get_decoder_recommended_outbuf_size (cy_audio_sw_codec_t handle, cy_audio_sw_codec_stream_info_t *stream_info, uint32_t *recommended_out_size) |
| Get the recommended size of the output buffer for the codec decoding operation configured. | |
| cy_rslt_t | cy_audio_sw_codec_decode_stream_info_header (cy_audio_sw_codec_t handle, uint8_t *in_encoded_buff, uint32_t *in_encoded_data_len, cy_audio_sw_codec_stream_info_t *stream_info) |
| Parse the header information from the input encoded data, used with decoder. | |
| cy_rslt_t | cy_audio_sw_codec_deinit (cy_audio_sw_codec_t *handle) |
| Deinit the software codec instance. | |
| cy_rslt_t cy_audio_sw_codec_init | ( | cy_audio_sw_codec_operation_t | codec_operation, |
| void * | codec_config, | ||
| cy_audio_sw_codec_t * | handle | ||
| ) |
Initializes the software codec for either decoding and encoding.
| [in] | codec_operation | Codec operation to be done (either encode / decode) |
| [in] | codec_config | Codec configuration parameter. 1) If the codec_operation refers to CY_AUDIO_CODEC_OPERATION_ENCODE, then the codec_config should corresponds to cy_audio_sw_codec_encode_config_t 2) If the codec_operation refers to CY_AUDIO_CODEC_OPERATION_DECODE, then the codec_config should corresponds to cy_audio_sw_codec_decode_config_t 3) For MP3 decoding this paramater is unused, config will be parsed from the MP3 header and provides 16bit(bitwidth) output data always |
| [out] | handle | Pointer to store the audio software codec instance |
| cy_rslt_t cy_audio_sw_codec_encode | ( | cy_audio_sw_codec_t | handle, |
| uint8_t * | in_pcm_buff, | ||
| uint32_t * | in_pcm_data_len, | ||
| uint8_t * | out_buff, | ||
| uint32_t * | outbuf_len | ||
| ) |
Encodes the input PCM data and returns the encoded data.
| [in] | handle | Handle to the software codec instance |
| [in] | in_pcm_buff | Pointer to input PCM data buffer. |
| [in,out] | in_pcm_data_len | 1) Length of the input data referred by in_pcm_buff. 2) Once the API returns, return number of bytes processed/accepted successfully in the codec-mw as part of processing. |
| [in] | out_buff | Pointer to output encoded buffer |
| [in,out] | outbuf_len | 1) Length of the output buffer. 2) Once the API returns, return number of bytes filled in the out_buff will be returned in the outbuf_len pointer. |
| cy_rslt_t cy_audio_sw_codec_decode | ( | cy_audio_sw_codec_t | handle, |
| uint8_t * | in_encoded_buff, | ||
| uint32_t * | in_encoded_data_len, | ||
| uint8_t * | out_buff, | ||
| uint32_t * | outbuf_len | ||
| ) |
Decodes the encoded data and returns the PCM data.
| [in] | handle | Handle to the software codec instance |
| [in] | in_encoded_buff | Pointer to input encoded data. |
| [in] | in_encoded_data_len | 1) Length of the input data referred by in_encoded_data_len. 2) Once the API returns, return number of bytes processed/accepted successfully in the codec-mw as part of processing. |
| [in] | out_buff | Pointer to output PCM data |
| [in,out] | outbuf_len | 1) Length of the output buffer. 2) Once the API returns, return number of bytes filled in the output buffer will be returned in the outbuf_len pointer. |
| cy_rslt_t cy_audio_sw_codec_get_encoder_recommended_inbuf_size | ( | cy_audio_sw_codec_t | handle, |
| uint32_t * | recommended_in_size | ||
| ) |
Get the recommended size of the input buffer for the codec encode operation configured.
| [in] | handle | Handle to the software codec instance |
| [out] | recommended_in_size | Recommended Input buffer size |
| cy_rslt_t cy_audio_sw_codec_get_encoder_recommended_outbuf_size | ( | cy_audio_sw_codec_t | handle, |
| uint32_t | in_size, | ||
| uint32_t * | recommended_out_size | ||
| ) |
Get the recommended size of the output buffer for the codec encoding operation configured.
Input buffer size is provided to get the corresponding output buffer recommendation
| [in] | handle | Handle to the software codec instance |
| [in] | in_size | Input buffer size corresponding to the output buffer size |
| [out] | recommended_out_size | Recommended Output buffer size |
| cy_rslt_t cy_audio_sw_codec_get_decoder_recommended_outbuf_size | ( | cy_audio_sw_codec_t | handle, |
| cy_audio_sw_codec_stream_info_t * | stream_info, | ||
| uint32_t * | recommended_out_size | ||
| ) |
Get the recommended size of the output buffer for the codec decoding operation configured.
| [in] | handle | Handle to the software codec instance |
| [in] | stream_info | Information about decoded stream. |
| [out] | recommended_out_size | Recommended Output buffer size |
| cy_rslt_t cy_audio_sw_codec_decode_stream_info_header | ( | cy_audio_sw_codec_t | handle, |
| uint8_t * | in_encoded_buff, | ||
| uint32_t * | in_encoded_data_len, | ||
| cy_audio_sw_codec_stream_info_t * | stream_info | ||
| ) |
Parse the header information from the input encoded data, used with decoder.
This API can be used by the application to know the stream information, so that 'cy_audio_sw_codec_get_decoder_recommended_outbuf_size' can give the right output size for 'cy_audio_sw_codec_decode' api.
| [in] | handle | Handle to the software codec instance |
| [in] | in_encoded_buff | Pointer to input encoded data. |
| [in,out] | in_encoded_data_len | 1) Length of the input data referred by in_encoded_data_len. 2) Once the API returns, return number of bytes processed/accepted successfully in the codec-mw as part of processing. |
| [out] | stream_info | Information about decoded stream |
an error code on failure,
| cy_rslt_t cy_audio_sw_codec_deinit | ( | cy_audio_sw_codec_t * | handle | ) |
Deinit the software codec instance.
| [out] | handle | Address of the Handle to audio software codec instance created by the cy_audio_sw_codec_init() API.Once API returns cy_audio_sw_codec_t handle will be reset to NULL. |