cubuffer_c.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. /***************************************************************************\
  2. *
  3. * (C) copyright Fraunhofer - IIS (2001)
  4. * All Rights Reserved
  5. *
  6. * $Header: /cvs/root/winamp/aacdec/incs/mp4dec_helpers/cubuffer_c.h,v 1.3 2012/05/08 20:16:50 audiodsp Exp $
  7. * project : MPEG-4 Audio Decoder
  8. * contents/description: composition unit module public interface
  9. *
  10. * This software and/or program is protected by copyright law and
  11. * international treaties. Any reproduction or distribution of this
  12. * software and/or program, or any portion of it, may result in severe
  13. * civil and criminal penalties, and will be prosecuted to the maximum
  14. * extent possible under law.
  15. *
  16. \***************************************************************************/
  17. #ifndef __CUBUFFER_C_H__
  18. #define __CUBUFFER_C_H__
  19. #include "mp4dec_helpers/err_code.h"
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. typedef enum {
  24. CUBUFFER_MAXCHANNELS = 100,
  25. CUBUFFER_MAXSAMPLESPERCHANNEL = 8192,
  26. CUBUFFER_MAXANCBYTES = 65536
  27. } __cubuffer_constants;
  28. typedef enum {
  29. CUBUFFER_PCMTYPE_FLOAT = 0x55,
  30. CUBUFFER_PCMTYPE_INT32,
  31. CUBUFFER_PCMTYPE_INT24,
  32. /* CUBUFFER_PCMTYPE_INT20, */
  33. CUBUFFER_PCMTYPE_INT16
  34. /* ,CUBUFFER_PCMTYPE_INT8 */
  35. } CUBUFFER_PCMTYPE;
  36. typedef enum {
  37. ANCDATA_IS_INVALID = 0x00, /* default after calloc */
  38. ANCDATA_IS_COMPLETE_MP2FRAME,
  39. ANCDATA_IS_MP2ANCILLARYDATA,
  40. ANCDATA_IS_MP3ANCILLARYDATA,
  41. ANCDATA_IS_MP3SCF,
  42. ANCDATA_IS_MPEGS_AU,
  43. ANCDATA_IS_AAC_EXT_DRC,
  44. ANCDATA_IS_AAC_EXT_SAC,
  45. ANCDATA_IS_AAC_EXT_LDSAC,
  46. ANCDATA_IS_AAC_EXT_SAOC,
  47. ANCDATA_IS_AAC_EXT_SCESBR,
  48. ANCDATA_IS_AAC_EXT_CPESBR,
  49. ANCDATA_IS_AAC_EXT_SCESBRCRC,
  50. ANCDATA_IS_AAC_EXT_CPESBRCRC,
  51. ANCDATA_IS_AAC_ELD_SCESBR,
  52. ANCDATA_IS_AAC_ELD_CPESBR,
  53. ANCDATA_IS_AAC_ELD_SCESBRCRC,
  54. ANCDATA_IS_AAC_ELD_CPESBRCRC,
  55. ANCDATA_IS_AAC_EXT_FILLDATA, /* is always 10100101 */
  56. ANCDATA_IS_AAC_EXT_DATAELEMENT_ANCDATA,
  57. ANCDATA_IS_AAC_EXT_DATAELEMENT_DEFAULT,
  58. ANCDATA_IS_AAC_EXT_FIL,
  59. ANCDATA_IS_AAC_EXT_DEFAULT,
  60. ANCDATA_IS_AAC_DSE_TAG0 = 0x80,
  61. ANCDATA_IS_AAC_DSE_TAG1,
  62. ANCDATA_IS_AAC_DSE_TAG2,
  63. ANCDATA_IS_AAC_DSE_TAG3,
  64. ANCDATA_IS_AAC_DSE_TAG4,
  65. ANCDATA_IS_AAC_DSE_TAG5,
  66. ANCDATA_IS_AAC_DSE_TAG6,
  67. ANCDATA_IS_AAC_DSE_TAG7,
  68. ANCDATA_IS_AAC_DSE_TAG8,
  69. ANCDATA_IS_AAC_DSE_TAG9,
  70. ANCDATA_IS_AAC_DSE_TAG10,
  71. ANCDATA_IS_AAC_DSE_TAG11,
  72. ANCDATA_IS_AAC_DSE_TAG12,
  73. ANCDATA_IS_AAC_DSE_TAG13,
  74. ANCDATA_IS_AAC_DSE_TAG14,
  75. ANCDATA_IS_AAC_DSE_TAG15,
  76. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG0 = 0x90,
  77. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG1,
  78. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG2,
  79. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG3,
  80. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG4,
  81. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG5,
  82. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG6,
  83. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG7,
  84. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG8,
  85. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG9,
  86. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG10,
  87. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG11,
  88. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG12,
  89. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG13,
  90. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG14,
  91. ANCDATA_IS_AAC_PCE_COMMENTFIELD_TAG15,
  92. ANCDATA_IS_INCOMPLETE = 0x0fd,
  93. BUFFER_IS_TOOSMALL_WITH_CLIPPED_DATA = 0xfe,
  94. BUFFER_IS_TOOSMALL_NOMORE_DATA = 0x0ff
  95. } __cubuffer_ancDataBufTags;
  96. typedef enum {
  97. CUBUFFER_CHANNEL_IS_INVALID = 0x0000, /* default after init/calloc */ /* todo: we shouldn't name this INVALID, but DEFAULT or NOT_MAPPED or so ... */
  98. CUBUFFER_CHANNEL_IS_NOTMAPPED = 0x0001, /* a valid pcm channel is here, but could not be mapped to a valid position */
  99. CUBUFFER_CHANNEL_IS_ELSEWHERE, /* position is out of z-plane */
  100. CUBUFFER_CHANNEL_IS_CENTER = 0x0008,
  101. CUBUFFER_CHANNEL_IS_REARCENTER,
  102. CUBUFFER_CHANNEL_IS_LEFT0 = 0x0010,
  103. CUBUFFER_CHANNEL_IS_LEFT1,
  104. CUBUFFER_CHANNEL_IS_LEFT2,
  105. CUBUFFER_CHANNEL_IS_LEFT3,
  106. CUBUFFER_CHANNEL_IS_LEFT4,
  107. CUBUFFER_CHANNEL_IS_LEFT5,
  108. CUBUFFER_CHANNEL_IS_LEFT6,
  109. CUBUFFER_CHANNEL_IS_LEFT7,
  110. CUBUFFER_CHANNEL_IS_LEFT8,
  111. CUBUFFER_CHANNEL_IS_LEFT9,
  112. CUBUFFER_CHANNEL_IS_LEFT10,
  113. CUBUFFER_CHANNEL_IS_LEFT11,
  114. CUBUFFER_CHANNEL_IS_LEFT12,
  115. CUBUFFER_CHANNEL_IS_LEFT13,
  116. CUBUFFER_CHANNEL_IS_LEFT14,
  117. CUBUFFER_CHANNEL_IS_LEFT15,
  118. CUBUFFER_CHANNEL_IS_LEFTSIDE0 = 0x0020,
  119. CUBUFFER_CHANNEL_IS_LEFTSIDE1,
  120. CUBUFFER_CHANNEL_IS_LEFTSIDE2,
  121. CUBUFFER_CHANNEL_IS_LEFTSIDE3,
  122. CUBUFFER_CHANNEL_IS_LEFTSIDE4,
  123. CUBUFFER_CHANNEL_IS_LEFTSIDE5,
  124. CUBUFFER_CHANNEL_IS_LEFTSIDE6,
  125. CUBUFFER_CHANNEL_IS_LEFTSIDE7,
  126. CUBUFFER_CHANNEL_IS_LEFTSIDE8,
  127. CUBUFFER_CHANNEL_IS_LEFTSIDE9,
  128. CUBUFFER_CHANNEL_IS_LEFTSIDE10,
  129. CUBUFFER_CHANNEL_IS_LEFTSIDE11,
  130. CUBUFFER_CHANNEL_IS_LEFTSIDE12,
  131. CUBUFFER_CHANNEL_IS_LEFTSIDE13,
  132. CUBUFFER_CHANNEL_IS_LEFTSIDE14,
  133. CUBUFFER_CHANNEL_IS_LEFTSIDE15,
  134. CUBUFFER_CHANNEL_IS_LEFTBACK0 = 0x0030,
  135. CUBUFFER_CHANNEL_IS_LEFTBACK1,
  136. CUBUFFER_CHANNEL_IS_LEFTBACK2,
  137. CUBUFFER_CHANNEL_IS_LEFTBACK3,
  138. CUBUFFER_CHANNEL_IS_LEFTBACK4,
  139. CUBUFFER_CHANNEL_IS_LEFTBACK5,
  140. CUBUFFER_CHANNEL_IS_LEFTBACK6,
  141. CUBUFFER_CHANNEL_IS_LEFTBACK7,
  142. CUBUFFER_CHANNEL_IS_LEFTBACK8,
  143. CUBUFFER_CHANNEL_IS_LEFTBACK9,
  144. CUBUFFER_CHANNEL_IS_LEFTBACK10,
  145. CUBUFFER_CHANNEL_IS_LEFTBACK11,
  146. CUBUFFER_CHANNEL_IS_LEFTBACK12,
  147. CUBUFFER_CHANNEL_IS_LEFTBACK13,
  148. CUBUFFER_CHANNEL_IS_LEFTBACK14,
  149. CUBUFFER_CHANNEL_IS_LEFTBACK15,
  150. CUBUFFER_CHANNEL_IS_RIGHT0 = 0x0050,
  151. CUBUFFER_CHANNEL_IS_RIGHT1,
  152. CUBUFFER_CHANNEL_IS_RIGHT2,
  153. CUBUFFER_CHANNEL_IS_RIGHT3,
  154. CUBUFFER_CHANNEL_IS_RIGHT4,
  155. CUBUFFER_CHANNEL_IS_RIGHT5,
  156. CUBUFFER_CHANNEL_IS_RIGHT6,
  157. CUBUFFER_CHANNEL_IS_RIGHT7,
  158. CUBUFFER_CHANNEL_IS_RIGHT8,
  159. CUBUFFER_CHANNEL_IS_RIGHT9,
  160. CUBUFFER_CHANNEL_IS_RIGHT10,
  161. CUBUFFER_CHANNEL_IS_RIGHT11,
  162. CUBUFFER_CHANNEL_IS_RIGHT12,
  163. CUBUFFER_CHANNEL_IS_RIGHT13,
  164. CUBUFFER_CHANNEL_IS_RIGHT14,
  165. CUBUFFER_CHANNEL_IS_RIGHT15,
  166. CUBUFFER_CHANNEL_IS_RIGHTSIDE0 = 0x0060,
  167. CUBUFFER_CHANNEL_IS_RIGHTSIDE1,
  168. CUBUFFER_CHANNEL_IS_RIGHTSIDE2,
  169. CUBUFFER_CHANNEL_IS_RIGHTSIDE3,
  170. CUBUFFER_CHANNEL_IS_RIGHTSIDE4,
  171. CUBUFFER_CHANNEL_IS_RIGHTSIDE5,
  172. CUBUFFER_CHANNEL_IS_RIGHTSIDE6,
  173. CUBUFFER_CHANNEL_IS_RIGHTSIDE7,
  174. CUBUFFER_CHANNEL_IS_RIGHTSIDE8,
  175. CUBUFFER_CHANNEL_IS_RIGHTSIDE9,
  176. CUBUFFER_CHANNEL_IS_RIGHTSIDE10,
  177. CUBUFFER_CHANNEL_IS_RIGHTSIDE11,
  178. CUBUFFER_CHANNEL_IS_RIGHTSIDE12,
  179. CUBUFFER_CHANNEL_IS_RIGHTSIDE13,
  180. CUBUFFER_CHANNEL_IS_RIGHTSIDE14,
  181. CUBUFFER_CHANNEL_IS_RIGHTSIDE15,
  182. CUBUFFER_CHANNEL_IS_RIGHTBACK0 = 0x0070,
  183. CUBUFFER_CHANNEL_IS_RIGHTBACK1,
  184. CUBUFFER_CHANNEL_IS_RIGHTBACK2,
  185. CUBUFFER_CHANNEL_IS_RIGHTBACK3,
  186. CUBUFFER_CHANNEL_IS_RIGHTBACK4,
  187. CUBUFFER_CHANNEL_IS_RIGHTBACK5,
  188. CUBUFFER_CHANNEL_IS_RIGHTBACK6,
  189. CUBUFFER_CHANNEL_IS_RIGHTBACK7,
  190. CUBUFFER_CHANNEL_IS_RIGHTBACK8,
  191. CUBUFFER_CHANNEL_IS_RIGHTBACK9,
  192. CUBUFFER_CHANNEL_IS_RIGHTBACK10,
  193. CUBUFFER_CHANNEL_IS_RIGHTBACK11,
  194. CUBUFFER_CHANNEL_IS_RIGHTBACK12,
  195. CUBUFFER_CHANNEL_IS_RIGHTBACK13,
  196. CUBUFFER_CHANNEL_IS_RIGHTBACK14,
  197. CUBUFFER_CHANNEL_IS_RIGHTBACK15,
  198. CUBUFFER_CHANNEL_IS_SUB0 = 0x0090,
  199. CUBUFFER_CHANNEL_IS_SUB1,
  200. CUBUFFER_CHANNEL_IS_SUB2,
  201. CUBUFFER_CHANNEL_IS_SUB3,
  202. CUBUFFER_CHANNEL_IS_SUB4,
  203. CUBUFFER_CHANNEL_IS_SUB5,
  204. CUBUFFER_CHANNEL_IS_SUB6,
  205. CUBUFFER_CHANNEL_IS_SUB7,
  206. CUBUFFER_CHANNEL_IS_SUB8,
  207. CUBUFFER_CHANNEL_IS_SUB9,
  208. CUBUFFER_CHANNEL_IS_SUB10,
  209. CUBUFFER_CHANNEL_IS_SUB11,
  210. CUBUFFER_CHANNEL_IS_SUB12,
  211. CUBUFFER_CHANNEL_IS_SUB13,
  212. CUBUFFER_CHANNEL_IS_SUB14,
  213. CUBUFFER_CHANNEL_IS_SUB15,
  214. CUBUFFER_CHANNELMAPPING_LAST_ELEMENT
  215. } __cubuffer_channelMappingTagTypes;
  216. typedef enum {
  217. CUBUFFER_INVALID_VALUE = -1,
  218. __cubuffer_flags_start = 10000,
  219. CUBUFFER_VALIDCHANNELS,
  220. CUBUFFER_CHANNELSMAPPED,
  221. CUBUFFER_VALIDSAMPLES,
  222. CUBUFFER_SAMPLERATE,
  223. CUBUFFER_NROFLAYERS,
  224. CUBUFFER_CURRENTBITRATE,
  225. CUBUFFER_AVGBITRATE,
  226. CUBUFFER_DECODERDELAY,
  227. /* CUBUFFER_TIMESTAMP, */
  228. CUBUFFER_PCMTYPE_PROP,
  229. CUBUFFER_HAS_SBR,
  230. CUBUFFER_HAS_PS,
  231. CUBUFFER_HAS_EBCC,
  232. CUBUFFER_HAS_MPEG_SURROUND,
  233. CUBUFFER_HAS_BLINDUPMIX,
  234. /* CUBUFFER_HAS_IMPLICIT, */
  235. /* CUBUFFER_CONFIGCHANGED, */
  236. CUBUFFER_WAS_CONCEALED,
  237. CUBUFFER_TDL_GAINREDUCTION,
  238. CUBUFFER_IS_LOSSLESS,
  239. CUBUFFER_HAS_BEEP,
  240. CUBUFFER_HAS_SBRSYNCPOINT,
  241. /* special property: warning/message. All warnings and messages are or'd with CUBUFFER_MESSAGE */
  242. CUBUFFER_MESSAGE = 0x8000000,
  243. __cubuffer_flags_end
  244. } __cubuffer_properties;
  245. #if defined(WIN32) || defined(WIN64)
  246. #pragma pack(push, 8)
  247. #endif
  248. /* Opaque declaration of cubuffer handle */
  249. struct CCompositionUnit;
  250. typedef struct CCompositionUnit* CCompositionUnitPtr;
  251. /* mandatory interface */
  252. CCompositionUnitPtr MP4AUDIODECAPI CCompositionUnit_Create(
  253. const unsigned int channels,
  254. const unsigned int samplesPerChannel,
  255. const unsigned int samplingRate,
  256. const unsigned int sizeAncData,
  257. const CUBUFFER_PCMTYPE cutype
  258. );
  259. CCompositionUnitPtr MP4AUDIODECAPI CCompositionUnit_CreateExt(
  260. const unsigned int channels,
  261. const unsigned int samplesPerChannel,
  262. const unsigned int samplingRate,
  263. const unsigned int sizeAncData,
  264. const CUBUFFER_PCMTYPE pcmtype,
  265. void* pcmBuf,
  266. const unsigned int pcmBufSize
  267. );
  268. MP4_RESULT MP4AUDIODECAPI CCompositionUnit_Destroy(CCompositionUnitPtr *self);
  269. MP4_RESULT MP4AUDIODECAPI CCompositionUnit_Reset(CCompositionUnitPtr self);
  270. /* for signalling channel mapping of the (interleaved) pcm output channels */
  271. MP4_RESULT MP4AUDIODECAPI CCompositionUnit_GetChannelMapping(CCompositionUnitPtr self, const unsigned int channelNr, unsigned int* tag);
  272. MP4_RESULT MP4AUDIODECAPI CCompositionUnit_GetInvChannelMapping(CCompositionUnitPtr self, const unsigned int tagType, unsigned int* channel);
  273. /* anc data handling */
  274. MP4_RESULT MP4AUDIODECAPI CCompositionUnit_GetAncDataCount(CCompositionUnitPtr self, unsigned int* nFields, unsigned int* nBytes);
  275. MP4_RESULT MP4AUDIODECAPI CCompositionUnit_GetAncDataByPos(CCompositionUnitPtr self, const unsigned int nr, unsigned char** ptr, unsigned int* size, unsigned int* tag);
  276. /* retrieve cu-buffer parameters */
  277. MP4_RESULT MP4AUDIODECAPI CCompositionUnit_GetChannels(CCompositionUnitPtr self, unsigned int* nchannels);
  278. MP4_RESULT MP4AUDIODECAPI CCompositionUnit_GetSamplesPerChannel(CCompositionUnitPtr self, unsigned int* samplesPerChannel);
  279. MP4_RESULT MP4AUDIODECAPI CCompositionUnit_GetSamplingRate(CCompositionUnitPtr self, unsigned int* fs);
  280. MP4_RESULT MP4AUDIODECAPI CCompositionUnit_GetPcmPtr(CCompositionUnitPtr self, void* buf);
  281. MP4_RESULT MP4AUDIODECAPI CCompositionUnit_GetProperty(CCompositionUnitPtr self, const unsigned int prop, int* value);
  282. MP4_RESULT MP4AUDIODECAPI CCompositionUnit_GetNextMessage(CCompositionUnitPtr self, int* value);
  283. #if defined(WIN32) || defined(WIN64)
  284. #pragma pack(pop)
  285. #endif
  286. #ifdef __cplusplus
  287. }
  288. #endif
  289. #endif /* __CUBUFFER_C_H__ */