iamf.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. /*
  2. * Immersive Audio Model and Formats helper functions and defines
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #ifndef AVUTIL_IAMF_H
  21. #define AVUTIL_IAMF_H
  22. /**
  23. * @file
  24. * Immersive Audio Model and Formats API header
  25. * @see <a href="https://aomediacodec.github.io/iamf/">Immersive Audio Model and Formats</a>
  26. */
  27. #include <stdint.h>
  28. #include <stddef.h>
  29. #include "attributes.h"
  30. #include "avassert.h"
  31. #include "channel_layout.h"
  32. #include "dict.h"
  33. #include "rational.h"
  34. /**
  35. * @defgroup lavu_iamf_params Parameter Definition
  36. * @{
  37. * Parameters as defined in section 3.6.1 and 3.8 of IAMF.
  38. * @}
  39. * @defgroup lavu_iamf_audio Audio Element
  40. * @{
  41. * Audio Elements as defined in section 3.6 of IAMF.
  42. * @}
  43. * @defgroup lavu_iamf_mix Mix Presentation
  44. * @{
  45. * Mix Presentations as defined in section 3.7 of IAMF.
  46. * @}
  47. *
  48. * @}
  49. * @addtogroup lavu_iamf_params
  50. * @{
  51. */
  52. enum AVIAMFAnimationType {
  53. AV_IAMF_ANIMATION_TYPE_STEP,
  54. AV_IAMF_ANIMATION_TYPE_LINEAR,
  55. AV_IAMF_ANIMATION_TYPE_BEZIER,
  56. };
  57. /**
  58. * Mix Gain Parameter Data as defined in section 3.8.1 of IAMF.
  59. *
  60. * @note This struct's size is not a part of the public ABI.
  61. */
  62. typedef struct AVIAMFMixGain {
  63. const AVClass *av_class;
  64. /**
  65. * Duration for the given subblock, in units of
  66. * 1 / @ref AVIAMFParamDefinition.parameter_rate "parameter_rate".
  67. * It must not be 0.
  68. */
  69. unsigned int subblock_duration;
  70. /**
  71. * The type of animation applied to the parameter values.
  72. */
  73. enum AVIAMFAnimationType animation_type;
  74. /**
  75. * Parameter value that is applied at the start of the subblock.
  76. * Applies to all defined Animation Types.
  77. *
  78. * Valid range of values is -128.0 to 128.0
  79. */
  80. AVRational start_point_value;
  81. /**
  82. * Parameter value that is applied at the end of the subblock.
  83. * Applies only to AV_IAMF_ANIMATION_TYPE_LINEAR and
  84. * AV_IAMF_ANIMATION_TYPE_BEZIER Animation Types.
  85. *
  86. * Valid range of values is -128.0 to 128.0
  87. */
  88. AVRational end_point_value;
  89. /**
  90. * Parameter value of the middle control point of a quadratic Bezier
  91. * curve, i.e., its y-axis value.
  92. * Applies only to AV_IAMF_ANIMATION_TYPE_BEZIER Animation Type.
  93. *
  94. * Valid range of values is -128.0 to 128.0
  95. */
  96. AVRational control_point_value;
  97. /**
  98. * Parameter value of the time of the middle control point of a
  99. * quadratic Bezier curve, i.e., its x-axis value.
  100. * Applies only to AV_IAMF_ANIMATION_TYPE_BEZIER Animation Type.
  101. *
  102. * Valid range of values is 0.0 to 1.0
  103. */
  104. AVRational control_point_relative_time;
  105. } AVIAMFMixGain;
  106. /**
  107. * Demixing Info Parameter Data as defined in section 3.8.2 of IAMF.
  108. *
  109. * @note This struct's size is not a part of the public ABI.
  110. */
  111. typedef struct AVIAMFDemixingInfo {
  112. const AVClass *av_class;
  113. /**
  114. * Duration for the given subblock, in units of
  115. * 1 / @ref AVIAMFParamDefinition.parameter_rate "parameter_rate".
  116. * It must not be 0.
  117. */
  118. unsigned int subblock_duration;
  119. /**
  120. * Pre-defined combination of demixing parameters.
  121. */
  122. unsigned int dmixp_mode;
  123. } AVIAMFDemixingInfo;
  124. /**
  125. * Recon Gain Info Parameter Data as defined in section 3.8.3 of IAMF.
  126. *
  127. * @note This struct's size is not a part of the public ABI.
  128. */
  129. typedef struct AVIAMFReconGain {
  130. const AVClass *av_class;
  131. /**
  132. * Duration for the given subblock, in units of
  133. * 1 / @ref AVIAMFParamDefinition.parameter_rate "parameter_rate".
  134. * It must not be 0.
  135. */
  136. unsigned int subblock_duration;
  137. /**
  138. * Array of gain values to be applied to each channel for each layer
  139. * defined in the Audio Element referencing the parent Parameter Definition.
  140. * Values for layers where the AV_IAMF_LAYER_FLAG_RECON_GAIN flag is not set
  141. * are undefined.
  142. *
  143. * Channel order is: FL, C, FR, SL, SR, TFL, TFR, BL, BR, TBL, TBR, LFE
  144. */
  145. uint8_t recon_gain[6][12];
  146. } AVIAMFReconGain;
  147. enum AVIAMFParamDefinitionType {
  148. /**
  149. * Subblocks are of struct type AVIAMFMixGain
  150. */
  151. AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN,
  152. /**
  153. * Subblocks are of struct type AVIAMFDemixingInfo
  154. */
  155. AV_IAMF_PARAMETER_DEFINITION_DEMIXING,
  156. /**
  157. * Subblocks are of struct type AVIAMFReconGain
  158. */
  159. AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN,
  160. };
  161. /**
  162. * Parameters as defined in section 3.6.1 of IAMF.
  163. *
  164. * The struct is allocated by av_iamf_param_definition_alloc() along with an
  165. * array of subblocks, its type depending on the value of type.
  166. * This array is placed subblocks_offset bytes after the start of this struct.
  167. *
  168. * @note This struct's size is not a part of the public ABI.
  169. */
  170. typedef struct AVIAMFParamDefinition {
  171. const AVClass *av_class;
  172. /**
  173. * Offset in bytes from the start of this struct, at which the subblocks
  174. * array is located.
  175. */
  176. size_t subblocks_offset;
  177. /**
  178. * Size in bytes of each element in the subblocks array.
  179. */
  180. size_t subblock_size;
  181. /**
  182. * Number of subblocks in the array.
  183. */
  184. unsigned int nb_subblocks;
  185. /**
  186. * Parameters type. Determines the type of the subblock elements.
  187. */
  188. enum AVIAMFParamDefinitionType type;
  189. /**
  190. * Identifier for the paremeter substream.
  191. */
  192. unsigned int parameter_id;
  193. /**
  194. * Sample rate for the paremeter substream. It must not be 0.
  195. */
  196. unsigned int parameter_rate;
  197. /**
  198. * The accumulated duration of all blocks in this parameter definition,
  199. * in units of 1 / @ref parameter_rate.
  200. *
  201. * May be 0, in which case all duration values should be specified in
  202. * another parameter definition referencing the same parameter_id.
  203. */
  204. unsigned int duration;
  205. /**
  206. * The duration of every subblock in the case where all subblocks, with
  207. * the optional exception of the last subblock, have equal durations.
  208. *
  209. * Must be 0 if subblocks have different durations.
  210. */
  211. unsigned int constant_subblock_duration;
  212. } AVIAMFParamDefinition;
  213. const AVClass *av_iamf_param_definition_get_class(void);
  214. /**
  215. * Allocates memory for AVIAMFParamDefinition, plus an array of {@code nb_subblocks}
  216. * amount of subblocks of the given type and initializes the variables. Can be
  217. * freed with a normal av_free() call.
  218. *
  219. * @param size if non-NULL, the size in bytes of the resulting data array is written here.
  220. */
  221. AVIAMFParamDefinition *av_iamf_param_definition_alloc(enum AVIAMFParamDefinitionType type,
  222. unsigned int nb_subblocks, size_t *size);
  223. /**
  224. * Get the subblock at the specified {@code idx}. Must be between 0 and nb_subblocks - 1.
  225. *
  226. * The @ref AVIAMFParamDefinition.type "param definition type" defines
  227. * the struct type of the returned pointer.
  228. */
  229. static av_always_inline void*
  230. av_iamf_param_definition_get_subblock(const AVIAMFParamDefinition *par, unsigned int idx)
  231. {
  232. av_assert0(idx < par->nb_subblocks);
  233. return (void *)((uint8_t *)par + par->subblocks_offset + idx * par->subblock_size);
  234. }
  235. /**
  236. * @}
  237. * @addtogroup lavu_iamf_audio
  238. * @{
  239. */
  240. enum AVIAMFAmbisonicsMode {
  241. AV_IAMF_AMBISONICS_MODE_MONO,
  242. AV_IAMF_AMBISONICS_MODE_PROJECTION,
  243. };
  244. /**
  245. * Recon gain information for the layer is present in AVIAMFReconGain
  246. */
  247. #define AV_IAMF_LAYER_FLAG_RECON_GAIN (1 << 0)
  248. /**
  249. * A layer defining a Channel Layout in the Audio Element.
  250. *
  251. * When @ref AVIAMFAudioElement.audio_element_type "the parent's Audio Element type"
  252. * is AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL, this corresponds to an Scalable Channel
  253. * Layout layer as defined in section 3.6.2 of IAMF.
  254. * For AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE, it is an Ambisonics channel
  255. * layout as defined in section 3.6.3 of IAMF.
  256. *
  257. * @note The struct should be allocated with av_iamf_audio_element_add_layer()
  258. * and its size is not a part of the public ABI.
  259. */
  260. typedef struct AVIAMFLayer {
  261. const AVClass *av_class;
  262. AVChannelLayout ch_layout;
  263. /**
  264. * A bitmask which may contain a combination of AV_IAMF_LAYER_FLAG_* flags.
  265. */
  266. unsigned int flags;
  267. /**
  268. * Output gain channel flags as defined in section 3.6.2 of IAMF.
  269. *
  270. * This field is defined only if @ref AVIAMFAudioElement.audio_element_type
  271. * "the parent's Audio Element type" is AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL,
  272. * must be 0 otherwise.
  273. */
  274. unsigned int output_gain_flags;
  275. /**
  276. * Output gain as defined in section 3.6.2 of IAMF.
  277. *
  278. * Must be 0 if @ref output_gain_flags is 0.
  279. */
  280. AVRational output_gain;
  281. /**
  282. * Ambisonics mode as defined in section 3.6.3 of IAMF.
  283. *
  284. * This field is defined only if @ref AVIAMFAudioElement.audio_element_type
  285. * "the parent's Audio Element type" is AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE.
  286. *
  287. * If AV_IAMF_AMBISONICS_MODE_MONO, channel_mapping is defined implicitly
  288. * (Ambisonic Order) or explicitly (Custom Order with ambi channels) in
  289. * @ref ch_layout.
  290. * If AV_IAMF_AMBISONICS_MODE_PROJECTION, @ref demixing_matrix must be set.
  291. */
  292. enum AVIAMFAmbisonicsMode ambisonics_mode;
  293. /**
  294. * Demixing matrix as defined in section 3.6.3 of IAMF.
  295. *
  296. * The length of the array is ch_layout.nb_channels multiplied by the sum of
  297. * the amount of streams in the group plus the amount of streams in the group
  298. * that are stereo.
  299. *
  300. * May be set only if @ref ambisonics_mode == AV_IAMF_AMBISONICS_MODE_PROJECTION,
  301. * must be NULL otherwise.
  302. */
  303. AVRational *demixing_matrix;
  304. } AVIAMFLayer;
  305. enum AVIAMFAudioElementType {
  306. AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL,
  307. AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE,
  308. };
  309. /**
  310. * Information on how to combine one or more audio streams, as defined in
  311. * section 3.6 of IAMF.
  312. *
  313. * @note The struct should be allocated with av_iamf_audio_element_alloc()
  314. * and its size is not a part of the public ABI.
  315. */
  316. typedef struct AVIAMFAudioElement {
  317. const AVClass *av_class;
  318. AVIAMFLayer **layers;
  319. /**
  320. * Number of layers, or channel groups, in the Audio Element.
  321. * There may be 6 layers at most, and for @ref audio_element_type
  322. * AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE, there may be exactly 1.
  323. *
  324. * Set by av_iamf_audio_element_add_layer(), must not be
  325. * modified by any other code.
  326. */
  327. unsigned int nb_layers;
  328. /**
  329. * Demixing information used to reconstruct a scalable channel audio
  330. * representation.
  331. * The @ref AVIAMFParamDefinition.type "type" must be
  332. * AV_IAMF_PARAMETER_DEFINITION_DEMIXING.
  333. */
  334. AVIAMFParamDefinition *demixing_info;
  335. /**
  336. * Recon gain information used to reconstruct a scalable channel audio
  337. * representation.
  338. * The @ref AVIAMFParamDefinition.type "type" must be
  339. * AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN.
  340. */
  341. AVIAMFParamDefinition *recon_gain_info;
  342. /**
  343. * Audio element type as defined in section 3.6 of IAMF.
  344. */
  345. enum AVIAMFAudioElementType audio_element_type;
  346. /**
  347. * Default weight value as defined in section 3.6 of IAMF.
  348. */
  349. unsigned int default_w;
  350. } AVIAMFAudioElement;
  351. const AVClass *av_iamf_audio_element_get_class(void);
  352. /**
  353. * Allocates a AVIAMFAudioElement, and initializes its fields with default values.
  354. * No layers are allocated. Must be freed with av_iamf_audio_element_free().
  355. *
  356. * @see av_iamf_audio_element_add_layer()
  357. */
  358. AVIAMFAudioElement *av_iamf_audio_element_alloc(void);
  359. /**
  360. * Allocate a layer and add it to a given AVIAMFAudioElement.
  361. * It is freed by av_iamf_audio_element_free() alongside the rest of the parent
  362. * AVIAMFAudioElement.
  363. *
  364. * @return a pointer to the allocated layer.
  365. */
  366. AVIAMFLayer *av_iamf_audio_element_add_layer(AVIAMFAudioElement *audio_element);
  367. /**
  368. * Free an AVIAMFAudioElement and all its contents.
  369. *
  370. * @param audio_element pointer to pointer to an allocated AVIAMFAudioElement.
  371. * upon return, *audio_element will be set to NULL.
  372. */
  373. void av_iamf_audio_element_free(AVIAMFAudioElement **audio_element);
  374. /**
  375. * @}
  376. * @addtogroup lavu_iamf_mix
  377. * @{
  378. */
  379. enum AVIAMFHeadphonesMode {
  380. /**
  381. * The referenced Audio Element shall be rendered to stereo loudspeakers.
  382. */
  383. AV_IAMF_HEADPHONES_MODE_STEREO,
  384. /**
  385. * The referenced Audio Element shall be rendered with a binaural renderer.
  386. */
  387. AV_IAMF_HEADPHONES_MODE_BINAURAL,
  388. };
  389. /**
  390. * Submix element as defined in section 3.7 of IAMF.
  391. *
  392. * @note The struct should be allocated with av_iamf_submix_add_element()
  393. * and its size is not a part of the public ABI.
  394. */
  395. typedef struct AVIAMFSubmixElement {
  396. const AVClass *av_class;
  397. /**
  398. * The id of the Audio Element this submix element references.
  399. */
  400. unsigned int audio_element_id;
  401. /**
  402. * Information required required for applying any processing to the
  403. * referenced and rendered Audio Element before being summed with other
  404. * processed Audio Elements.
  405. * The @ref AVIAMFParamDefinition.type "type" must be
  406. * AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN.
  407. */
  408. AVIAMFParamDefinition *element_mix_config;
  409. /**
  410. * Default mix gain value to apply when there are no AVIAMFParamDefinition
  411. * with @ref element_mix_config "element_mix_config's"
  412. * @ref AVIAMFParamDefinition.parameter_id "parameter_id" available for a
  413. * given audio frame.
  414. */
  415. AVRational default_mix_gain;
  416. /**
  417. * A value that indicates whether the referenced channel-based Audio Element
  418. * shall be rendered to stereo loudspeakers or spatialized with a binaural
  419. * renderer when played back on headphones.
  420. * If the Audio Element is not of @ref AVIAMFAudioElement.audio_element_type
  421. * "type" AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL, then this field is undefined.
  422. */
  423. enum AVIAMFHeadphonesMode headphones_rendering_mode;
  424. /**
  425. * A dictionary of strings describing the submix in different languages.
  426. * Must have the same amount of entries as
  427. * @ref AVIAMFMixPresentation.annotations "the mix's annotations", stored
  428. * in the same order, and with the same key strings.
  429. *
  430. * @ref AVDictionaryEntry.key "key" is a string conforming to BCP-47 that
  431. * specifies the language for the string stored in
  432. * @ref AVDictionaryEntry.value "value".
  433. */
  434. AVDictionary *annotations;
  435. } AVIAMFSubmixElement;
  436. enum AVIAMFSubmixLayoutType {
  437. /**
  438. * The layout follows the loudspeaker sound system convention of ITU-2051-3.
  439. */
  440. AV_IAMF_SUBMIX_LAYOUT_TYPE_LOUDSPEAKERS = 2,
  441. /**
  442. * The layout is binaural.
  443. */
  444. AV_IAMF_SUBMIX_LAYOUT_TYPE_BINAURAL = 3,
  445. };
  446. /**
  447. * Submix layout as defined in section 3.7.6 of IAMF.
  448. *
  449. * @note The struct should be allocated with av_iamf_submix_add_layout()
  450. * and its size is not a part of the public ABI.
  451. */
  452. typedef struct AVIAMFSubmixLayout {
  453. const AVClass *av_class;
  454. enum AVIAMFSubmixLayoutType layout_type;
  455. /**
  456. * Channel layout matching one of Sound Systems A to J of ITU-2051-3, plus
  457. * 7.1.2ch and 3.1.2ch
  458. * If layout_type is not AV_IAMF_SUBMIX_LAYOUT_TYPE_LOUDSPEAKERS, this field
  459. * is undefined.
  460. */
  461. AVChannelLayout sound_system;
  462. /**
  463. * The program integrated loudness information, as defined in
  464. * ITU-1770-4.
  465. */
  466. AVRational integrated_loudness;
  467. /**
  468. * The digital (sampled) peak value of the audio signal, as defined
  469. * in ITU-1770-4.
  470. */
  471. AVRational digital_peak;
  472. /**
  473. * The true peak of the audio signal, as defined in ITU-1770-4.
  474. */
  475. AVRational true_peak;
  476. /**
  477. * The Dialogue loudness information, as defined in ITU-1770-4.
  478. */
  479. AVRational dialogue_anchored_loudness;
  480. /**
  481. * The Album loudness information, as defined in ITU-1770-4.
  482. */
  483. AVRational album_anchored_loudness;
  484. } AVIAMFSubmixLayout;
  485. /**
  486. * Submix layout as defined in section 3.7 of IAMF.
  487. *
  488. * @note The struct should be allocated with av_iamf_mix_presentation_add_submix()
  489. * and its size is not a part of the public ABI.
  490. */
  491. typedef struct AVIAMFSubmix {
  492. const AVClass *av_class;
  493. /**
  494. * Array of submix elements.
  495. *
  496. * Set by av_iamf_submix_add_element(), must not be modified by any
  497. * other code.
  498. */
  499. AVIAMFSubmixElement **elements;
  500. /**
  501. * Number of elements in the submix.
  502. *
  503. * Set by av_iamf_submix_add_element(), must not be modified by any
  504. * other code.
  505. */
  506. unsigned int nb_elements;
  507. /**
  508. * Array of submix layouts.
  509. *
  510. * Set by av_iamf_submix_add_layout(), must not be modified by any
  511. * other code.
  512. */
  513. AVIAMFSubmixLayout **layouts;
  514. /**
  515. * Number of layouts in the submix.
  516. *
  517. * Set by av_iamf_submix_add_layout(), must not be modified by any
  518. * other code.
  519. */
  520. unsigned int nb_layouts;
  521. /**
  522. * Information required for post-processing the mixed audio signal to
  523. * generate the audio signal for playback.
  524. * The @ref AVIAMFParamDefinition.type "type" must be
  525. * AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN.
  526. */
  527. AVIAMFParamDefinition *output_mix_config;
  528. /**
  529. * Default mix gain value to apply when there are no AVIAMFParamDefinition
  530. * with @ref output_mix_config "output_mix_config's"
  531. * @ref AVIAMFParamDefinition.parameter_id "parameter_id" available for a
  532. * given audio frame.
  533. */
  534. AVRational default_mix_gain;
  535. } AVIAMFSubmix;
  536. /**
  537. * Information on how to render and mix one or more AVIAMFAudioElement to generate
  538. * the final audio output, as defined in section 3.7 of IAMF.
  539. *
  540. * @note The struct should be allocated with av_iamf_mix_presentation_alloc()
  541. * and its size is not a part of the public ABI.
  542. */
  543. typedef struct AVIAMFMixPresentation {
  544. const AVClass *av_class;
  545. /**
  546. * Array of submixes.
  547. *
  548. * Set by av_iamf_mix_presentation_add_submix(), must not be modified
  549. * by any other code.
  550. */
  551. AVIAMFSubmix **submixes;
  552. /**
  553. * Number of submixes in the presentation.
  554. *
  555. * Set by av_iamf_mix_presentation_add_submix(), must not be modified
  556. * by any other code.
  557. */
  558. unsigned int nb_submixes;
  559. /**
  560. * A dictionary of strings describing the mix in different languages.
  561. * Must have the same amount of entries as every
  562. * @ref AVIAMFSubmixElement.annotations "Submix element annotations",
  563. * stored in the same order, and with the same key strings.
  564. *
  565. * @ref AVDictionaryEntry.key "key" is a string conforming to BCP-47
  566. * that specifies the language for the string stored in
  567. * @ref AVDictionaryEntry.value "value".
  568. */
  569. AVDictionary *annotations;
  570. } AVIAMFMixPresentation;
  571. const AVClass *av_iamf_mix_presentation_get_class(void);
  572. /**
  573. * Allocates a AVIAMFMixPresentation, and initializes its fields with default
  574. * values. No submixes are allocated.
  575. * Must be freed with av_iamf_mix_presentation_free().
  576. *
  577. * @see av_iamf_mix_presentation_add_submix()
  578. */
  579. AVIAMFMixPresentation *av_iamf_mix_presentation_alloc(void);
  580. /**
  581. * Allocate a submix and add it to a given AVIAMFMixPresentation.
  582. * It is freed by av_iamf_mix_presentation_free() alongside the rest of the
  583. * parent AVIAMFMixPresentation.
  584. *
  585. * @return a pointer to the allocated submix.
  586. */
  587. AVIAMFSubmix *av_iamf_mix_presentation_add_submix(AVIAMFMixPresentation *mix_presentation);
  588. /**
  589. * Allocate a submix element and add it to a given AVIAMFSubmix.
  590. * It is freed by av_iamf_mix_presentation_free() alongside the rest of the
  591. * parent AVIAMFSubmix.
  592. *
  593. * @return a pointer to the allocated submix.
  594. */
  595. AVIAMFSubmixElement *av_iamf_submix_add_element(AVIAMFSubmix *submix);
  596. /**
  597. * Allocate a submix layout and add it to a given AVIAMFSubmix.
  598. * It is freed by av_iamf_mix_presentation_free() alongside the rest of the
  599. * parent AVIAMFSubmix.
  600. *
  601. * @return a pointer to the allocated submix.
  602. */
  603. AVIAMFSubmixLayout *av_iamf_submix_add_layout(AVIAMFSubmix *submix);
  604. /**
  605. * Free an AVIAMFMixPresentation and all its contents.
  606. *
  607. * @param mix_presentation pointer to pointer to an allocated AVIAMFMixPresentation.
  608. * upon return, *mix_presentation will be set to NULL.
  609. */
  610. void av_iamf_mix_presentation_free(AVIAMFMixPresentation **mix_presentation);
  611. /**
  612. * @}
  613. */
  614. #endif /* AVUTIL_IAMF_H */