Contains common codec interface APIs definitions.
More...
#include "error.h"
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
|
enum | audio_stream_type_t {
STREAM_TYPE_UNKNOWN = 0
,
STREAM_TYPE_MP3
,
STREAM_TYPE_PCM
,
STREAM_TYPE_MSADPCM
,
STREAM_TYPE_IMAADPCM
,
STREAM_TYPE_OPUS
,
STREAM_TYPE_OGG_OPUS
,
STREAM_TYPE_AAC
,
STREAM_TYPE_FLAC
,
STREAM_TYPE_COUNT
} |
| Enum Stream type structure This enum is used as an input to all CCI functions and is used as the index into the function table. More...
|
|
enum | codec_error_code_t {
CODEC_UNSUPPORTED_FUNCTION = -1
,
CODEC_SUCCESS = 0
,
CODEC_INIT_ERROR
,
CODEC_DECODE_ERROR
,
CODEC_END_OF_DECODE
,
CODEC_RESET_ERROR
,
CODEC_SEEK_ERROR
,
CODEC_MORE_DATA_REQUIRED
,
CODEC_METADATA_FILETYPE_FAILED
,
CODEC_METADATA_NOT_FOUND
,
CODEC_METADATA_UNSUPPORTED_FILE
,
CODEC_FILE_OPEN_ERROR
,
CODEC_FSEEK_FAILED
,
CODEC_MEDIA_READ_ERROR
,
CODEC_BROKEN_FRAME
,
CODEC_MEMORY_EXCEED
,
CODEC_UNSUPPORTED_FILE
} |
| Error codes used by CCI. More...
|
|
enum | codec_media_sub_type_t {
MEDIA_SUBTYPE_UNKNOWN = 0
,
MEDIA_SUBTYPE_NONE
,
MEDIA_SUBTYPE_ADTS
,
MEDIA_SUBTYPE_M4A
,
MEDIA_SUBTYPE_ADIF
,
MEDIA_SUBTYPE_COUNT
} |
| codec media sub type structure More...
|
|
|
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.
|
|
◆ audio_stream_type_t
- Warning
- do not change the order of this enum or wrong functions will be called
Enumerator |
---|
STREAM_TYPE_UNKNOWN | 0 = stream type is unknown
|
STREAM_TYPE_MP3 | 1 = stream type is MP3
|
STREAM_TYPE_PCM | 2 = stream type is PCM
|
STREAM_TYPE_MSADPCM | 3 = stream type is MSADPCM (WAV)
|
STREAM_TYPE_IMAADPCM | 4 = stream type is IMAADPCM (WAV)
|
STREAM_TYPE_OPUS | 5 = stream type is OPUS
|
STREAM_TYPE_OGG_OPUS | 6 = stream type is OGG OPUS
|
STREAM_TYPE_AAC | 7 = stream type is AAC
|
STREAM_TYPE_FLAC | 8 = stream type is FLAC
|
STREAM_TYPE_COUNT | count of stream type
|
◆ codec_error_code_t
Enumerator |
---|
CODEC_UNSUPPORTED_FUNCTION | -1 = codec unsupported function
|
CODEC_SUCCESS | 0 = codec function execute succesfully
|
CODEC_INIT_ERROR | 1 = Init fails
|
CODEC_DECODE_ERROR | 2 = Decode fails
|
CODEC_END_OF_DECODE | 3 = End of decode
|
CODEC_RESET_ERROR | 4 = Reset fails
|
CODEC_SEEK_ERROR | 5 = Seek fails
|
CODEC_MORE_DATA_REQUIRED | 6 = More data requires
|
CODEC_METADATA_FILETYPE_FAILED | 7 = codec metadata extraction fails
|
CODEC_METADATA_NOT_FOUND | 8 = codec metadata not found
|
CODEC_METADATA_UNSUPPORTED_FILE | 9 = unsupported metadata
|
CODEC_FILE_OPEN_ERROR | 10 = file open fails
|
CODEC_FSEEK_FAILED | 11 = file seek fails
|
CODEC_MEDIA_READ_ERROR | 12 = codec media read fails
|
CODEC_BROKEN_FRAME | 13 = codec broken frame
|
CODEC_MEMORY_EXCEED | 14 = codec memory exceed
|
CODEC_UNSUPPORTED_FILE | 15 = codec unsupported file
|
◆ codec_media_sub_type_t
Enumerator |
---|
MEDIA_SUBTYPE_UNKNOWN | 0 = unknown media sub type
|
MEDIA_SUBTYPE_NONE | 1 = there is no sub type
|
MEDIA_SUBTYPE_ADTS | 2 = ADTS sub type of aac
|
MEDIA_SUBTYPE_M4A | 3 = M4A media sub type
|
MEDIA_SUBTYPE_ADIF | 4 = ADIF media sub type
|
MEDIA_SUBTYPE_COUNT | count of sub types
|
◆ 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_type | Audio Stream Type. |
[out] | in_size | Input Frame Size. |
[out] | out_size | Output Frame Size. |
- Return values
-
0 | when actual input/output frame size in bytes of the codec is get through in_size, out_size pointers |
CODEC_UNSUPPORTED_FUNCTION | If this function is not supported for streamtype. |
◆ codec_get_mem_info()
- Parameters
-
[in] | stream_type | Audio Stream Type. |
- Return values
-
int | Size of the codec. |
CODEC_UNSUPPORTED_FUNCTION | If 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_type | Audio Stream Type. |
[in] | memory | This is pointer to the decoder memory. |
[in] | callback_fn | This is pointer to the decoder callback functions. |
[in] | user_data | This is pointer to the user specific data. |
- Return values
-
CODEC_SUCCESS | if codec initializes successfully. |
CODEC_INIT_ERROR | if codec fails to initialize. |
CODEC_UNSUPPORTED_FUNCTION | If 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_type | Audio Stream Type. |
[in] | memory | This is pointer to the decoder memory. |
[in] | sample_produced | This is pointer to the samples produced by the codec. |
[in] | buf_out | This is pointer to the decoder output pcm buffer. |
- Return values
-
CODEC_SUCCESS | if codec decodes frame successfully. |
CODEC_DECODE_ERROR | if codec fails to decode frame. |
CODEC_END_OF_DECODE | if decoding of input file is done. |
CODEC_UNSUPPORTED_FUNCTION | If 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_type | Audio Stream Type. |
[in] | memory | This is pointer to the decoder memory. |
[in] | sample_produced | This is pointer to the samples produced by the codec. |
[in] | buf_out | This is pointer to the user specific data. |
- Return values
-
int32_t | It returns number of samples got from the codec. |
◆ codec_reset()
- Parameters
-
[in] | stream_type | Audio Stream Type. |
[in] | memory | This is pointer to the decoder memory. |
- Return values
-
CODEC_SUCCESS | if codec resets successfully. |
CODEC_RESET_ERROR | if codec fails to reset. |
CODEC_UNSUPPORTED_FUNCTION | If 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_type | Audio Stream Type. |
[in] | memory | Pointer to decoder memory allocated based on codec_get_mem_info() and passed in by caller. |
[in] | byte_to_seek | Number of bytes to seek. |
- Return values
-
int32_t | frame boundary align offset. |
CODEC_UNSUPPORTED_FUNCTION | If this function is not supported for streamtype |