123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876 |
- /*
- * Copyright (c) 2017 Actions Semi Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * Author: jpl<jianpingliao@actions-semi.com>
- *
- * Change log:
- * 2019/12/16: Created by jpl.
- */
- #ifndef __AS_AUDIO_CODEC_H__
- #define __AS_AUDIO_CODEC_H__
- #include <stdint.h>
- #include "al_storage_io.h"
- #include "lib_a1_ape_p.h"
- #include "lib_a1_fla_p.h"
- #include "lib_a1_wav_e.h"
- #include "lib_a1_wav_p.h"
- #include "lib_a1_w13_p.h"
- /**
- * @defgroup arithmetic_codec_apis arithmetic codec APIs
- * @ingroup mem_managers
- * @{
- */
- /*!
- * \brief
- * maximum audio output channels
- */
- #define MAX_CHANNEL_OUT 2
- /*!
- * \brief
- * audio (decoder) pcm output structure
- */
- typedef struct
- {
- /*! [OUTPUT] address of pcm buffer of each channel */
- void *pcm[MAX_CHANNEL_OUT];
- /*! [OUTPUT] number of pcm channels */
- int channels;
- /*! [OUTPUT] number of pcm samples of each channel */
- int samples;
- /*! [OUTPUT] number of pcm sample bits, 16/24/32 */
- int sample_bits;
- /*! [OUTPUT] number of pcm sample fraction bits */
- int frac_bits;
- } asout_pcm_t;
- /*!
- * \brief
- * maximum audio input channels
- */
- #define MAX_CHANNEL_IN 4
- /*!
- * \brief
- * audio (encoder) pcm input structure
- */
- typedef struct
- {
- /*! [INPUT] address of pcm buffer of each channel */
- void *pcm[MAX_CHANNEL_IN];
- /*! [INPUT] number of pcm channels */
- int channels;
- /*! [INPUT] number of pcm samples of each channel */
- int samples;
- /*! [INPUT] number of pcm sample bits, 16/24/32 */
- int sample_bits;
- /*! [INPUT] number of pcm sample fraction bits */
- int frac_bits;
- } asin_pcm_t;
- #if 0 /* see ext/actions/include/media/media_type.h */
- typedef enum
- {
- UNSUPPORT_TYPE = 0,
- MP3_TYPE,
- WMA_TYPE,
- WAV_TYPE, // 3
- FLAC_TYPE,
- APE_TYPE,
- AAC_TYPE, // 6
- OGG_TYPE,
- ACT_TYPE,
- AMR_TYPE, // 9
- SBC_TYPE,
- MSBC_TYPE,
- OPUS_TYPE, // 12
- AAX_TYPE,
- AA_TYPE,
- CVSD_TYPE, // 15
- SPEEX_TYPE,
- // raw pcm format
- PCM_TYPE, // 17
- } as_type_t;
- #endif
- /*******************************************************************************
- * actions decoder
- ******************************************************************************/
- /*!
- * \brief
- * music information by audio decoder
- */
- typedef struct
- {
- /*! [OUTPUT]: music format, see enum as_type_t */
- int as_type;
- /*! [OUTPUT]: total time in ms */
- int total_time;
- /*! [OUTPUT]: average bitrate in kbps */
- int avg_bitrate;
- /*! [OUTPUT]: sample rate in kHz */
- int sample_rate;
- /*! [OUTPUT]: sample rate in Hz */
- int sample_rate_hz;
- /*! [OUTPUT]: number of channels */
- int channels;
- /*! [OUTPUT]: sample bits */
- int bps;
- /*! [OUTPUT]: number of samples per block */
- int block_size;
- /*! [OUTPUT]: number of samples per frame, mp3 frame/wma packet/ogg page */
- int frame_size;
- /*! [OUTPUT]: sub format */
- int sub_format;
- /*! [OUTPUT]: file length in bytes */
- unsigned int file_len;
- /*! [OUTPUT]: file header lenght inbytes */
- unsigned int file_hdr_len;
- /*! address of data buffer used internally in library */
- void *data_buf_addr;
- /*! length of data buffer used internally in library */
- int data_buf_len;
- /*! [INPUT]: drm flag, indicate file is encrypted or not. 1-encrypted, 0-not encrypted,
- * may used in AA, AAX format.
- */
- int drm_flag;
- /*! [INPUT]: address of drm secret key buffer, required when drm_flag=1 */
- void *key_buf;
- /*! [INPUT]: storage io handle, see struct storage_io_s */
- void *storage_io;
- /*! [INPUT]: decoder specific buffer */
- void *buf;
- /*! [INPUT]: decode mode
- * 1) if used as tts, set to 0x0abcd, no matter what format
- * 2) for aac format, 0 stands for locall file decoding, while 1 is BT stream decoding.
- */
- int decode_mode;
- /*! [INPUT] global memory block address array */
- void *global_buf_addr[3];
- /*! [INPUT] global memory block length array */
- int global_buf_len[3];
- /*! [INPUT] share memory block address array */
- void *share_buf_addr[3];
- /*! [INPUT] share memory block length array */
- int share_buf_len[3];
- /*! [INPUT]: expected pcm sample bits of decode output (16/24/32). 16 by default */
- int set_pcm_out_bits;
- /*[INPUT]: 0: accurate seek, but slower; 1: quick seek, but bigger deviation */
- int seek_mode;
- /*! [INPUT]: extended parameter, whichi is decoder specific */
- void *param;
- } as_dec_t;
- typedef struct
- {
- /* [OUTPUT] global memory block length array, 3 blocks at maximum */
- int global_buf_len[3];
- /* [OUTPUT] share memory block length array, 3 blocks at maximum */
- int share_buf_len[3];
- /* [INPUT] extended parameters
- * for encoder: passed address of structure as_enc_t.
- */
- void* param;
- } as_mem_info_t;
- /*!
- * \brief
- * music break point information by audio decoder
- * For WAV/MP3/WMA, bp_time_offset and bp_file_offset should be consistent.
- */
- typedef struct
- {
- /*! break point time in ms. when used in seeking, it stands for the target time */
- int bp_time_offset;
- /*! break point file positon in bytes */
- unsigned int bp_file_offset;
- /*! auxiliary information for resuming break point */
- int bp_info_ext;
- } as_bp_info_t;
- /*!
- * \brief
- * decoding frame information by audio decoder
- */
- typedef struct
- {
- /* start address of current frame data */
- void *addr;
- /* length of current frame data */
- int len;
- /* bit width of data unit */
- int sample_size;
- /* status of current frame, like data lost status when decoding BT stream */
- int status;
- } as_dec_frame_info_t;
- /*!
- * \brief
- * decoding information by audio decoder
- */
- typedef struct
- {
- /*! [OUTPUT]: decoder status. 0: normal, otherwise error */
- int status;
- /*! [OUTPUT]: current decoding time in ms */
- int cur_time;
- /*! [OUTPUT]: current decoding bitrate in kbps */
- int cur_bitrate;
- /*! [OUTPUT]: current energy */
- int cur_energy;
- /*! [OUTPUT]: address of decoding output pcm structure. set by caller, filled by decoder */
- asout_pcm_t *aout;
- /*! [OUTPUT]: current decoding file positon in bytes */
- unsigned int cur_file_offset;
- /*! [OUTPUT]: length of decoding consumed data in bytes */
- int bytes_used;
- /*! [OUTPUT]: break point infomation corresponding to current decoding time */
- as_bp_info_t as_bp_info;
- /*! [OUTPUT]: reserved */
- void *param;
- } as_decode_info_t;
- /** as decoder cmd */
- typedef enum
- {
- /** decoder open */
- AD_CMD_OPEN = 0,
- /** decoder close */
- AD_CMD_CLOSE,
- /** get media info */
- AD_CMD_MEDIA_INFO,
- /** reset chunk */
- AD_CMD_CHUNK_RESET,
- /** decode frame */
- AD_CMD_FRAME_DECODE,
- /** chunk seek */
- AD_CMD_CHUNK_SEEK,
- /*set output channel, such as sbc*/
- AD_CMD_CHANNEL_SET,
- /** get memory require size(bytes) */
- AD_CMD_MEM_REQUIRE,
- /** parser frame */
- AD_CMD_FRAME_PARSE,
- /** get codec verison */
- AD_CMD_GET_VERSION,
- /** get codec err info */
- AD_CMD_GET_ERROR_INFO,
- /*drm init*/
- AD_CMD_DRM_INIT,
- } asdec_ex_ops_cmd_t;
- /** audio decoder return state */
- typedef enum
- {
- /** unexpected state */
- AD_RET_UNEXPECTED = -3,
- /** outof memory state */
- AD_RET_OUTOFMEMORY,
- /** unsupported state */
- AD_RET_UNSUPPORTED,
- /** ok state */
- AD_RET_OK,
- /** data underflow state */
- AD_RET_DATAUNDERFLOW,
- } asdec_ret_t;
- /** audio decoder ops prototype */
- typedef int (*as_decoder_ops_t)(void *hnd, asdec_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief check real audio format
- *
- * This routine provides checking audio format
- *
- * @param storage_io pointer of storage io
- * @extension buffer (require 8 bytes) to store format extension, all lower case, like mp3, wav, flac, etc.
- *
- * @return 0 if succeed, others failed
- */
- int as_decoder_format_check(void *storage_io, char extension[8]);
- /**
- * @brief aac decoder operation
- *
- * This routine provides aac decoder operation
- *
- * @param hnd handle of aac decoder
- * @param cmd operation cmd, type of asdec_ex_ops_cmd_t
- * @param args args of decoder parama addr
- *
- * @return type of asdec_ret_t
- */
- int as_decoder_ops_aac(void *hnd, asdec_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief act decoder operation
- *
- * This routine provides act decoder operation
- *
- * @param hnd handle of act decoder
- * @param cmd operation cmd, type of asdec_ex_ops_cmd_t
- * @param args args of decoder parama addr
- *
- * @return type of asdec_ret_t
- */
- int as_decoder_ops_act(void *hnd, asdec_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief ape decoder operation
- *
- * This routine provides ape decoder operation
- *
- * @param hnd handle of ape decoder
- * @param cmd operation cmd, type of asdec_ex_ops_cmd_t
- * @param args args of decoder parama addr
- *
- * @return type of asdec_ret_t
- */
- int as_decoder_ops_ape(void *hnd, asdec_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief cvsd decoder operation
- *
- * This routine provides cvsd decoder operation
- *
- * @param hnd handle of cvsd decoder
- * @param cmd operation cmd, type of asdec_ex_ops_cmd_t
- * @param args args of decoder parama addr
- *
- * @return type of asdec_ret_t
- */
- int as_decoder_ops_cvsd(void *hnd, asdec_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief flac decoder operation
- *
- * This routine provides flac decoder operation
- *
- * @param hnd handle of flac decoder
- * @param cmd operation cmd, type of asdec_ex_ops_cmd_t
- * @param args args of decoder parama addr
- *
- * @return type of asdec_ret_t
- */
- int as_decoder_ops_flac(void *hnd, asdec_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief mp3 decoder operation
- *
- * This routine provides mp3 decoder operation
- *
- * @param hnd handle of mp3 decoder
- * @param cmd operation cmd, type of asdec_ex_ops_cmd_t
- * @param args args of decoder parama addr
- *
- * @return type of asdec_ret_t
- */
- int as_decoder_ops_mp3(void *hnd, asdec_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief pcm decoder operation
- *
- * This routine provides pcm decoder operation
- *
- * @param hnd handle of pcm decoder
- * @param cmd operation cmd, type of asdec_ex_ops_cmd_t
- * @param args args of decoder parama addr
- *
- * @return type of asdec_ret_t
- */
- int as_decoder_ops_pcm(void *hnd, asdec_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief sbc decoder operation
- *
- * This routine provides sbc decoder operation
- *
- * @param hnd handle of sbc decoder
- * @param cmd operation cmd, type of asdec_ex_ops_cmd_t
- * @param args args of decoder parama addr
- *
- * @return type of asdec_ret_t
- */
- int as_decoder_ops_sbc(void *hnd, asdec_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief wav decoder operation
- *
- * This routine provides wav decoder operation
- *
- * @param hnd handle of wav decoder
- * @param cmd operation cmd, type of asdec_ex_ops_cmd_t
- * @param args args of decoder parama addr
- *
- * @return type of asdec_ret_t
- */
- int as_decoder_ops_wav(void *hnd, asdec_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief wma decoder operation
- *
- * This routine provides wma decoder operation
- *
- * @param hnd handle of wma decoder
- * @param cmd operation cmd, type of asdec_ex_ops_cmd_t
- * @param args args of decoder parama addr
- *
- * @return type of asdec_ret_t
- */
- int as_decoder_ops_wma(void *hnd, asdec_ex_ops_cmd_t cmd, unsigned int args);
- /*******************************************************************************
- * actions encoder
- ******************************************************************************/
- /*!
- * \brief
- * encoding configuration provided to audio encoder
- */
- typedef struct
- {
- /*! [INPUT]: sample rate in Hz */
- int sample_rate;
- /*! [INPUT]: input pcm channels */
- int channels;
- /*! [INPUT]: output encoding channels. the same as channels by default */
- int channels_out;
- /*! [INPUT]: target bitrate */
- int bitrate;
- /*! [INPUT]: encoding sub format
- * For wav: 0-LPCM, 1-ADPCM
- * For sbc: 0-sbc, 1-msbc
- */
- int audio_format;
- /*! [INPUT]: chunk time interval in ms per encoding frame. if set 0, no limit */
- int chunk_time;
- /*! [OUTPUT]: input pcm buffer length of each channel per frame in bytes */
- int block_size;
- /*! [OUTPUT]: output encoded data length per frame in bytes */
- int block_enc_size_max;
- /*! [INPUT] global memory block address array */
- void *global_buf_addr[3];
- /*! [INPUT] global memory block length array */
- int global_buf_len[3];
- /*! [INPUT] share memory block address array */
- void *share_buf_addr[3];
- /*! [INPUT] share memory block length array */
- int share_buf_len[3];
- /* [INPUT]: input pcm sample bits. 16/24/32, 16 by default */
- int sample_bits;
- /*! [INPUT]: encoder specific parameters */
- void *param;
- } as_enc_t;
- /*!
- * \brief
- * encoding information by audio encoder
- */
- typedef struct
- {
- /*! [OUTPUT]: encoding status. 0-normal, otherwise error */
- int status;
- /*! [OUTPUT]: current encoding time in ms*/
- int cur_time;
- /*! [INPUT]: current encoding energy */
- int cur_energy;
- /*! [INPUT]: slient flag */
- int silence_flag;
- /*! [INPUT]: address of input pcm structure */
- asin_pcm_t *ain;
- /*! [INPUT]: address of output encoded data. set by caller, filled by encoder */
- void *aout;
- /*! [OUTPUT]: length of output encoded data in bytes */
- int bytes_used;
- /* [OUTPUT]: length of remain non-encoded data in bytes */
- int bytes_remain;
- /*![OUTPUT]: reserved */
- void *param;
- } as_encode_info_t;
- typedef struct
- {
- /*![OUTPUT]: address of header buffer */
- void *hdr_buf;
- /*![OUTPUT]: length of header buffer */
- int hdr_len;
- } as_enc_fhdr_t;
- /*
- * opus encoder specific parameter
- */
- typedef struct {
- /*! [INPUT]: application mode: 2048 (VOIP), 2049 (AUDIO), 2051 (RESTRICTED_LOWDELAY)*/
- int application;
- /*! [INPUT]: comlexity, range 0~10 */
- int complexity;
- /*! [INPUT]: vbr flag. 1: variable bitrate; 0: constant bitrate*/
- int vbr;
- } as_enc_opus_param_t;
- /** audio encorder cmd */
- typedef enum
- {
- /** open encoder library */
- AE_CMD_OPEN = 0,
- /** close encoder library */
- AE_CMD_CLOSE,
- /** decoder frame */
- AE_CMD_FRAME_ENCODE,
- /** get memory require size(bytes) */
- AE_CMD_MEM_REQUIRE,
- /**get codec verison**/
- AE_CMD_GET_VERSION,
- /**get encoded file header**/
- AE_CMD_GET_FHDR,
- } asenc_ex_ops_cmd_t;
- /** audio decoder state */
- typedef enum
- {
- /** unkown expected */
- AE_RET_UNEXPECTED = -7,
- /** load library failed */
- AE_RET_LIBLOAD_ERROR,
- /** load error library */
- AE_RET_LIB_ERROR,
- /** encoder error */
- AE_RET_ENCODER_ERROR,
- /** sample rate error */
- AE_RET_FS_ERROR,
- /** out of memory*/
- AE_RET_OUTOFMEMORY,
- /** format not support*/
- AE_RET_UNSUPPORTED,
- /** success */
- AE_RET_OK,
- /** data over flow*/
- AE_RET_DATAOVERFLOW,
- /** out of data */
- AE_RET_OUTOFDATA,
- } asenc_ret_t;
- /** audio encoder ops prototype */
- typedef int (*as_encoder_ops_t)(void *hnd, asenc_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief cvsd encoder operation
- *
- * This routine provides cvsd encoder operation
- *
- * @param hnd handle of cvsd encoder
- * @param cmd operation cmd, type of asenc_ex_ops_cmd_t
- * @param args args of encoder parama addr
- *
- * @return type of asenc_ret_t
- */
- int as_encoder_ops_cvsd(void *hnd, asenc_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief mp3 encoder operation
- *
- * This routine provides mp3 encoder operation
- *
- * @param hnd handle of mp3 encoder
- * @param cmd operation cmd, type of asenc_ex_ops_cmd_t
- * @param args args of encoder parama addr
- *
- * @return type of asenc_ret_t
- */
- int as_encoder_ops_mp2(void *hnd, asenc_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief opus encoder operation
- *
- * This routine provides opus encoder operation
- *
- * @param hnd handle of opus encoder
- * @param cmd operation cmd, type of asenc_ex_ops_cmd_t
- * @param args args of encoder parama addr
- *
- * @return type of asenc_ret_t
- */
- int as_encoder_ops_opus(void *hnd, asenc_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief pcm encoder operation
- *
- * This routine provides pcm encoder operation
- *
- * @param hnd handle of pcm encoder
- * @param cmd operation cmd, type of asenc_ex_ops_cmd_t
- * @param args args of encoder parama addr
- *
- * @return type of asenc_ret_t
- */
- int as_encoder_ops_pcm(void *hnd, asenc_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief sbc encoder operation
- *
- * This routine provides sbc encoder operation
- *
- * @param hnd handle of sbc encoder
- * @param cmd operation cmd, type of asenc_ex_ops_cmd_t
- * @param args args of encoder parama addr
- *
- * @return type of asenc_ret_t
- */
- int as_encoder_ops_sbc(void *hnd, asenc_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief wav encoder operation
- *
- * This routine provides wav encoder operation
- *
- * @param hnd handle of wav encoder
- * @param cmd operation cmd, type of asenc_ex_ops_cmd_t
- * @param args args of encoder parama addr
- *
- * @return type of asenc_ret_t
- */
- int as_encoder_ops_wav(void *hnd, asenc_ex_ops_cmd_t cmd, unsigned int args);
- /*******************************************************************************
- * actions parser
- ******************************************************************************/
- /*!
- * \brief
- * audio parser ops error code
- */
- typedef enum
- {
- /*! unexpected error */
- AP_RET_UNEXPECTED = -3,
- /*! not enough memory */
- AP_RET_OUTOFMEMORY,
- /*! unsupported format */
- AP_RET_UNSUPPORTED,
- /*! no error */
- AP_RET_OK = 0,
- /*! end of file */
- AP_RET_ENDFILE
- } asparse_ret_t;
- /** audio parser cmd */
- typedef enum
- {
- AP_CMD_OPEN = 0,
- AP_CMD_CLOSE,
- AP_CMD_PARSER_HEADER,
- AP_CMD_GET_CHUNK,
- AP_CMD_SEEK,
- AP_CMD_EX_OPS,
- AP_CMD_FORCE_ENDFILE,
- } asparse_ex_ops_cmd_t;
- /*!
- * \brief
- * parser cmd AP_CMD_OPEN argument
- */
- typedef struct
- {
- /* provided to access the raw stream */
- storage_io_t *storage_io;
- /* TYPE: struct acts_ringbuf, which store request/feedback from codec */
- void *evtbuf;
- } asparse_param_t;
- /*!
- * \brief
- * music information by audio parser, and argument of cmd AP_CMD_PARSER_HEADER
- */
- typedef struct
- {
- /*! [OUTPUT]: format extension, upper case, like "COOK" */
- char extension[8];
- /*! [OUTPUT]: maximum chunk size in bytes */
- int max_chunksize;
- /*! [OUTPUT]: total time in milliseconds */
- int total_time;
- /*! [OUTPUT]: average bitrate in kbps */
- int avg_bitrate;
- /*! [OUTPUT]: sample rate in Hz */
- int sample_rate;
- /*! [OUTPUT]: channels */
- int channels;
- /*! [OUTPUT]: parser specific information */
- void *buf;
- int buf_len;
- /*![OUTPUT] file head length*/
- int hdr_len;
- /*![OUTPUT] bit width*/
- int sample_bits;
- } asparse_info_t;
- /*!
- * \brief
- * parser cmd AP_CMD_GET_CHUNK argument
- */
- typedef struct
- {
- /* chunk buffer */
- uint8_t *outbuf;
- uint16_t chunk_bytes;
- int16_t chunk_rest;
- /* chunk seek information */
- int32_t chunk_start_time;
- int32_t chunk_start_offset;
- } asparse_bs_info_t;
- /*!
- * \brief
- * parser cmd AP_CMD_SEEK argument
- */
- typedef struct
- {
- /* decide the seek possiton */
- int32_t time_offset;
- int32_t origin;
- /* store the feedback of parser lib according to the seek position */
- int32_t chunk_start_time;
- /* used to accelerate the seeking speed
- * >= 0, valid file offset, can be used to speed up seeking
- * <0, invalid file offset
- */
- int32_t file_offset_for_time_offset; /* measured in bytes */
- } asparse_seek_info_t;
- #define AP_SEEK_SET 0
- #define AP_SEEK_CUR 1
- #define AP_SEEK_END 2
- #define AP_TELL_CUR 0
- #define AP_TELL_END 1
- /** audio parser ops prototype */
- typedef int (*as_parser_ops_t)(void *hnd, asparse_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief ape parser operation
- *
- * This routine provides ape parser operation
- *
- * @param hnd handle of ape parser
- * @param cmd operation cmd, type of asparse_ex_ops_cmd_t
- * @param args args of parser parama addr
- *
- * @return type of asparse_ret_t
- */
- int as_parser_ops_ape(void *hnd, asparse_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief flac parser operation
- *
- * This routine provides flac parser operation
- *
- * @param hnd handle of flac parser
- * @param cmd operation cmd, type of asparse_ex_ops_cmd_t
- * @param args args of parser parama addr
- *
- * @return type of asparse_ret_t
- */
- int as_parser_ops_flac(void *hnd, asparse_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief mp3 parser operation
- *
- * This routine provides mp3 parser operation
- *
- * @param hnd handle of mp3 parser
- * @param cmd operation cmd, type of asparse_ex_ops_cmd_t
- * @param args args of parser parama addr
- *
- * @return type of asparse_ret_t
- */
- int as_parser_ops_mp3(void *hnd, asparse_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief wav parser operation
- *
- * This routine provides wav parser operation
- *
- * @param hnd handle of wav parser
- * @param cmd operation cmd, type of asparse_ex_ops_cmd_t
- * @param args args of parser parama addr
- *
- * @return type of asparse_ret_t
- */
- int as_parser_ops_wav(void *hnd, asparse_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief wma parser operation
- *
- * This routine provides wma parser operation
- *
- * @param hnd handle of wma parser
- * @param cmd operation cmd, type of asparse_ex_ops_cmd_t
- * @param args args of parser parama addr
- *
- * @return type of asparse_ret_t
- */
- int as_parser_ops_wma(void *hnd, asparse_ex_ops_cmd_t cmd, unsigned int args);
- /**
- * @brief aac parser operation
- *
- * This routine provides aac parser operation
- *
- * @param hnd handle of aac parser
- * @param cmd operation cmd, type of asparse_ex_ops_cmd_t
- * @param args args of parser parama addr
- *
- * @return type of asparse_ret_t
- */
- int as_parser_ops_a13(void *hnd, asparse_ex_ops_cmd_t cmd, unsigned int args);
- #endif /* __AS_AUDIO_CODEC_H__ */
|