csi_audio_dec.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (C) 2021 Alibaba Group Holding Limited
  3. * Author: fuqian.zxr <fuqian.zxr@alibaba-inc.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #ifndef __CSI_AUDIO_DEC_H__
  10. #define __CSI_AUDIO_DEC_H__
  11. #include "csi_audio_common.h"
  12. #define CSI_AUDIO_DEC_VERSION_MAJOR 0
  13. #define CSI_AUDIO_DEC_VERSION_MINOR 1
  14. typedef enum csi_adec_mode {
  15. ADEC_MODE_PACK = 0,
  16. ADEC_MODE_STREAM,
  17. ADEC_MODE_BUTT
  18. }csi_adec_mode_e;
  19. typedef struct csi_adec_ch_attr {
  20. PAYLOAD_TYPE_E type;
  21. uint32_t bufsize;
  22. csi_adec_mode_e mode;
  23. void *value;
  24. }csi_adec_ch_attr_s;
  25. typedef struct csi_adec_decoder {
  26. PAYLOAD_TYPE_E type;
  27. char name[16];
  28. int32_t (*openendecoder)(void *decoderattr,void **decoder);
  29. int32_t (*decoderfrm)(void *decoder,uint8_t **inbuf,int32_t leftbyte,uint16_t *outbuf,uint32_t *outlen,uint32_t *chns);
  30. int32_t (*getfrminfo)(void *decoder,void *info);
  31. int32_t (*closedecoder)(void *decoder);
  32. int32_t (*resetdecoder)(void *decoder);
  33. }csi_adec_decoder_s;
  34. typedef struct csi_audio_frame_info {
  35. csi_audio_frame_s *frame;
  36. uint32_t id;
  37. }csi_audio_frame_info_s;
  38. int32_t csi_adec_get_version(csi_api_version_u *version);
  39. int32_t csi_adec_create(int32_t adchn,csi_adec_ch_attr_s);
  40. int32_t csi_adec_destroy(int32_t adchn);
  41. int32_t csi_adec_sendstream(int32_t adchn,const csi_audio_stream_s *stream, bool block);
  42. int32_t csi_adec_clearchnbuf(int32_t adchn);
  43. int32_t csi_adec_registerdecoder(int32_t handle,csi_adec_decoder_s *decoder);
  44. int32_t csi_adec_unregisterdecoder(int32_t hanbdle);
  45. int32_t csi_adec_getframe(int32_t adchn,csi_audio_frame_info_s *frameinfo,bool block);
  46. int32_t csi_adec_releaseframe(int32_t adchn,csi_audio_frame_info_s *frameinfo);
  47. int32_t csi_adec_sendendofstream(int adchn,bool instant);
  48. #endif