csi_audio_enc.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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_ENC_H__
  10. #define __CSI_AUDIO_ENC_H__
  11. #include <unistd.h>
  12. #include <stdint.h>
  13. #include <stdbool.h>
  14. #include "csi_audio_common.h"
  15. #define CSI_AUDIO_ENC_VERSION_MAJOR 0
  16. #define CSI_AUDIO_ENC_VERSION_MINOR 1
  17. typedef struct csi_aenc_chn_attr
  18. {
  19. PAYLOAD_TYPE_E type;
  20. uint32_t numperfrm;
  21. uint32_t buffersize;
  22. }csi_aenc_chn_attr_s;
  23. typedef struct csi_aec_frame {
  24. csi_audio_frame_s refframe;
  25. bool valid;
  26. bool sysbind;
  27. }csi_aec_frame_s;
  28. typedef struct csi_aenc_encode {
  29. PAYLOAD_TYPE_E type;
  30. uint32_t maxfrmlen;
  31. char name[16];
  32. int32_t (*openencoder)(void *encoderattr,void **encoder);
  33. int32_t (*encoderfrm)(void *encoder,const csi_audio_frame_s *data,uint8_t *outbuf,uint32_t *outlen);
  34. int32_t (*closeencoder)(void *encoder);
  35. }csi_aenc_encode_s;
  36. int32_t csi_adec_get_version(csi_api_version_u *version);
  37. int32_t csi_aenc_createchn(int32_t aechn,const csi_aenc_chn_attr_s attr);
  38. int32_t csi_aenc_destroychn(int32_t aechn);
  39. int32_t csi_aenc_sendframe(int32_t aechn,const csi_audio_frame_s *frm,const csi_aec_frame_s *aecfrm);
  40. int32_t csi_aenc_getstream(int32_t aechn,csi_audio_stream_s *stream,int32_t timeout);
  41. int32_t csi_aenc_releasestream(int32_t aechn,const csi_audio_stream_s *stream);
  42. int32_t csi_aenc_getfd(int32_t aechn);
  43. int32_t csi_aenc_registerencoder(int32_t handle,csi_aenc_encode_s *encoder);
  44. int32_t csi_aenc_unregisterencoder(int32_t handle);
  45. int32_t csi_aenc_savefile(int32_t aechn,csi_audio_save_file_info_s *savefileinfo);
  46. int32_t csi_aenc_queryfilestatus(int32_t aechn,csi_audio_file_status_s *filestatus);
  47. int32_t csi_aec_getstreambufinfo(int32_t aechn,uint32_t *physaddr,uint32_t *size);
  48. #endif