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