as_mix_p.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. * Copyright (c) 2017 Actions Semi Co., Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. * Author: jpl<jianpingliao@actions-semi.com>
  16. *
  17. * Change log:
  18. * 2019/12/16: Created by jpl.
  19. */
  20. #ifndef __AS_AS_MIX_P__
  21. #define __AS_AS_MIX_P__
  22. typedef struct {
  23. int sample_rate; /* reserverd */
  24. } as_mix_p_init_t;
  25. //typedef struct {
  26. // /* [OUTPUT] global memory block length array, 3 blocks at maximum */
  27. // int global_buf_len[3];
  28. // /* [OUTPUT] share memory block length array, 3 blocks at maximum */
  29. // int share_buf_len[3];
  30. // /* [INPUT] extended parameters */
  31. // void* param; //here is (as_mix_p_init_t *)&as_mix_p_open_t.as_mix_p_init
  32. //} as_mem_info_t;
  33. typedef struct {
  34. as_mix_p_init_t as_mix_p_init;
  35. as_mem_info_t as_mem_info;
  36. /*! [INPUT] global memory block address array */
  37. void *global_buf_addr[3];
  38. /*! [INPUT] share memory block address array */
  39. void *share_buf_addr[3];
  40. } as_mix_p_open_t;
  41. #define MAX_CHANNEL_AS_MIX_P_INOUT 2
  42. #define MAX_CHANNEL_MIX_SRC_IN 1
  43. /*!
  44. * \brief
  45. * mix processing input/output structure
  46. */
  47. typedef struct {
  48. /*! [INPUT] input/output pcm array.
  49. * For interweaved pcm, set channels as 2, pcm_in_out[0] as pcm buffer address, and pcm_in_out[1] as NULL
  50. */
  51. void *pcm_in_out[MAX_CHANNEL_AS_MIX_P_INOUT];
  52. /*! [INPUT] mixed source pcm address, only support 1 path */
  53. void *mix_src_in[MAX_CHANNEL_MIX_SRC_IN];
  54. /*! [INPUT] input pcm channels */
  55. int channels;
  56. /*! [INPUT] input pcm samples (pairs) */
  57. int samples;
  58. /*! [INPUT] input pcm sample bits, 16 or 32 */
  59. int sample_bits;
  60. /*! [INPUT] input pcm fraction bits */
  61. int frac_bits;
  62. } as_mix_p_pcm_t;
  63. /*!
  64. * \brief
  65. * mix ops error code
  66. */
  67. typedef enum {
  68. /*! unexpected error */
  69. AS_MIX_P_RET_UNEXPECTED = -3,
  70. /*! not enough memory */
  71. AS_MIX_P_RET_OUTOFMEMORY,
  72. /*! unsupported format */
  73. AS_MIX_P_RET_UNSUPPORTED,
  74. /*! no error */
  75. AS_MIX_P_RET_OK,
  76. /*! data underflow */
  77. AS_MIX_P_RET_DATAUNDERFLOW,
  78. } as_mix_p_ret_t;
  79. /*!
  80. * \brief
  81. * mix ops command
  82. */
  83. typedef enum {
  84. /* open, with argument structure as_mix_p_open_t */
  85. AS_MIX_P_CMD_OPEN = 0,
  86. /* close */
  87. AS_MIX_P_CMD_CLOSE,
  88. /** get status */
  89. AS_MIX_P_CMD_GET_STATUS,
  90. /** frame process, with argument structure as_mix_p_pcm_t */
  91. AS_MIX_P_CMD_FRAME_PROCESS,
  92. /** get memory require size(bytes) */
  93. AS_MIX_P_CMD_MEM_REQUIRE,
  94. /** get codec verison */
  95. AS_MIX_P_CMD_GET_VERSION,
  96. } as_mix_p_ex_ops_cmd_t;
  97. /**
  98. * @brief as mix operation
  99. *
  100. * This routine provides as mix operation
  101. *
  102. * @param hnd handle of as mix
  103. * @param cmd operation cmd, type of as_dae_ex_ops_cmd_t
  104. * for AS_MIX_P_CMD_MEM_REQUIRE, args type is as_mem_info_t* in audio_codec.h
  105. * for AS_MIX_P_CMD_OPEN, args type is as_mix_p_open_t*
  106. * for AS_MIX_P_CMD_FRAME_PROCESS, args type is as_mix_p_pcm_t*
  107. * @param args args of mix parama addr
  108. *
  109. * @return type of as_mix_p_ret_t;
  110. */
  111. int as_mix_p_ops(void *hnd, as_mix_p_ex_ops_cmd_t cmd, unsigned int args);
  112. #endif /* __AS_AS_MIX_P__ */