Go to the documentation of this file.
32 #define IAMF_ADD_FUNC_TEMPLATE(parent_type, parent_name, child_type, child_name, suffix) \
33 child_type *av_iamf_ ## parent_name ## _add_ ## child_name(parent_type *parent_name) \
35 child_type **child_name ## suffix, *child_name; \
37 if (parent_name->nb_## child_name ## suffix == UINT_MAX) \
40 child_name ## suffix = av_realloc_array(parent_name->child_name ## suffix, \
41 parent_name->nb_## child_name ## suffix + 1, \
42 sizeof(*parent_name->child_name ## suffix)); \
43 if (!child_name ## suffix) \
46 parent_name->child_name ## suffix = child_name ## suffix; \
48 child_name = parent_name->child_name ## suffix[parent_name->nb_## child_name ## suffix] \
49 = av_mallocz(sizeof(*child_name)); \
53 child_name->av_class = &child_name ## _class; \
54 av_opt_set_defaults(child_name); \
55 parent_name->nb_## child_name ## suffix++; \
60 #define FLAGS AV_OPT_FLAG_ENCODING_PARAM
65 #define OFFSET(x) offsetof(AVIAMFMixGain, x)
72 {
"control_point_relative_time",
"set control_point_relative_time",
OFFSET(control_point_relative_time),
AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, 0.0, 1.0,
FLAGS },
84 #define OFFSET(x) offsetof(AVIAMFDemixingInfo, x)
99 #define OFFSET(x) offsetof(AVIAMFReconGain, x)
113 #define OFFSET(x) offsetof(AVIAMFParamDefinition, x)
118 {
"constant_subblock_duration",
"set constant_subblock_duration",
OFFSET(constant_subblock_duration),
AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, UINT_MAX,
FLAGS },
124 uintptr_t
i = (uintptr_t)*opaque;
142 *opaque = (
void*)(
i + 1);
160 unsigned int nb_subblocks,
size_t *
out_size)
163 struct MixGainStruct {
171 struct ReconGainStruct {
175 size_t subblocks_offset, subblock_size;
181 subblocks_offset = offsetof(
struct MixGainStruct, m);
185 subblocks_offset = offsetof(
struct DemixStruct, d);
189 subblocks_offset = offsetof(
struct ReconGainStruct,
r);
196 size = subblocks_offset;
197 if (nb_subblocks > (SIZE_MAX -
size) / subblock_size)
199 size += subblock_size * nb_subblocks;
213 for (
int i = 0;
i < nb_subblocks;
i++) {
243 #define OFFSET(x) offsetof(AVIAMFLayer, x)
247 {.i64 = 0 }, 0, AV_IAMF_LAYER_FLAG_RECON_GAIN,
FLAGS, .unit =
"flags" },
249 {.i64 = AV_IAMF_LAYER_FLAG_RECON_GAIN }, INT_MIN, INT_MAX,
FLAGS, .unit =
"flags"},
251 {.i64 = 0 }, 0, (1 << 6) - 1,
FLAGS, .unit =
"output_gain_flags" },
253 {.i64 = 1 << 5 }, INT_MIN, INT_MAX,
FLAGS, .unit =
"output_gain_flags"},
255 {.i64 = 1 << 4 }, INT_MIN, INT_MAX,
FLAGS, .unit =
"output_gain_flags"},
257 {.i64 = 1 << 3 }, INT_MIN, INT_MAX,
FLAGS, .unit =
"output_gain_flags"},
259 {.i64 = 1 << 2 }, INT_MIN, INT_MAX,
FLAGS, .unit =
"output_gain_flags"},
261 {.i64 = 1 << 1 }, INT_MIN, INT_MAX,
FLAGS, .unit =
"output_gain_flags"},
263 {.i64 = 1 << 0 }, INT_MIN, INT_MAX,
FLAGS, .unit =
"output_gain_flags"},
283 #define OFFSET(x) offsetof(AVIAMFAudioElement, x)
298 uintptr_t
i = (uintptr_t)*opaque;
305 *opaque = (
void*)(
i + 1);
331 return audio_element;
360 #define OFFSET(x) offsetof(AVIAMFSubmixElement, x)
362 {
"headphones_rendering_mode",
"Headphones rendering mode",
OFFSET(headphones_rendering_mode),
AV_OPT_TYPE_INT,
385 uintptr_t
i = (uintptr_t)*opaque;
392 *opaque = (
void*)(
i + 1);
408 #define OFFSET(x) offsetof(AVIAMFSubmixLayout, x)
421 {
"dialog_anchored_loudness",
"Anchored loudness (Dialog)",
OFFSET(dialogue_anchored_loudness),
AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0,
FLAGS },
436 #define OFFSET(x) offsetof(AVIAMFSubmix, x)
453 uintptr_t
i = (uintptr_t)*opaque;
471 *opaque = (
void*)(
i + 1);
485 #define OFFSET(x) offsetof(AVIAMFMixPresentation, x)
496 uintptr_t
i = (uintptr_t)*opaque;
503 *opaque = (
void*)(
i + 1);
524 if (mix_presentation) {
529 return mix_presentation;
538 if (!mix_presentation)
550 for (
int j = 0; j < sub_mix->
nb_layouts; j++) {
static const AVOption audio_element_options[]
AVIAMFSubmixElement ** elements
Array of submix elements.
@ AV_IAMF_SUBMIX_LAYOUT_TYPE_LOUDSPEAKERS
The layout follows the loudspeaker sound system convention of ITU-2051-3.
unsigned int nb_layers
Number of layers, or channel groups, in the Audio Element.
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
AVIAMFSubmixLayout ** layouts
Array of submix layouts.
static const AVClass element_class
static void * submix_presentation_child_next(void *obj, void *prev)
static const AVOption mix_gain_options[]
AVIAMFParamDefinition * av_iamf_param_definition_alloc(enum AVIAMFParamDefinitionType type, unsigned int nb_subblocks, size_t *out_size)
Allocates memory for AVIAMFParamDefinition, plus an array of.
unsigned int nb_submixes
Number of submixes in the presentation.
static const AVClass submix_class
enum AVIAMFParamDefinitionType type
Parameters type.
@ AV_IAMF_HEADPHONES_MODE_STEREO
The referenced Audio Element shall be rendered to stereo loudspeakers.
void av_iamf_mix_presentation_free(AVIAMFMixPresentation **pmix_presentation)
Free an AVIAMFMixPresentation and all its contents.
static const AVClass demixing_info_class
static void * submix_element_child_next(void *obj, void *prev)
Parameters as defined in section 3.6.1 of IAMF.
@ AV_OPT_TYPE_RATIONAL
Underlying C type is AVRational.
static const AVOption recon_gain_options[]
Submix layout as defined in section 3.7.6 of IAMF.
void av_iamf_audio_element_free(AVIAMFAudioElement **paudio_element)
Free an AVIAMFAudioElement and all its contents.
void av_opt_free(void *obj)
Free all allocated objects in obj.
AVIAMFAudioElement * av_iamf_audio_element_alloc(void)
Allocates a AVIAMFAudioElement, and initializes its fields with default values.
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
static const AVOption submix_presentation_options[]
Recon Gain Info Parameter Data as defined in section 3.8.3 of IAMF.
@ AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN
Subblocks are of struct type AVIAMFReconGain.
static const AVClass mix_presentation_class
static av_always_inline void * av_iamf_param_definition_get_subblock(const AVIAMFParamDefinition *par, unsigned int idx)
Get the subblock at the specified.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
const AVClass * av_iamf_param_definition_get_class(void)
@ AV_IAMF_HEADPHONES_MODE_BINAURAL
The referenced Audio Element shall be rendered with a binaural renderer.
Demixing Info Parameter Data as defined in section 3.8.2 of IAMF.
#define LIBAVUTIL_VERSION_INT
static double output_gain(double lin_slope, double ratio, double thres, double knee, double knee_start, double knee_stop, double range, int mode)
Describe the class of an AVClass context structure.
static const AVOption submix_element_options[]
@ AV_OPT_TYPE_DICT
Underlying C type is AVDictionary*.
const char * av_default_item_name(void *ptr)
Return the context name.
A layer defining a Channel Layout in the Audio Element.
static const AVClass * submix_presentation_child_iterate(void **opaque)
static const AVOption demixing_info_options[]
static const AVOption param_definition_options[]
size_t subblocks_offset
Offset in bytes from the start of this struct, at which the subblocks array is located.
@ AV_IAMF_AMBISONICS_MODE_MONO
@ AV_OPT_TYPE_UINT
Underlying C type is unsigned int.
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
Submix layout as defined in section 3.7 of IAMF.
static const AVClass layout_class
AVIAMFMixPresentation * av_iamf_mix_presentation_alloc(void)
Allocates a AVIAMFMixPresentation, and initializes its fields with default values.
Information on how to combine one or more audio streams, as defined in section 3.6 of IAMF.
Mix Gain Parameter Data as defined in section 3.8.1 of IAMF.
const AVClass * av_iamf_audio_element_get_class(void)
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel layout
#define i(width, name, range_min, range_max)
AVRational * demixing_matrix
Demixing matrix as defined in section 3.6.3 of IAMF.
static const AVClass * param_definition_child_iterate(void **opaque)
Information on how to render and mix one or more AVIAMFAudioElement to generate the final audio outpu...
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
unsigned int nb_subblocks
Number of subblocks in the array.
@ AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE
unsigned int nb_layouts
Number of layouts in the submix.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static const AVOption submix_layout_options[]
static const AVClass * submix_element_child_iterate(void **opaque)
#define IAMF_ADD_FUNC_TEMPLATE(parent_type, parent_name, child_type, child_name, suffix)
static const AVClass * mix_presentation_child_iterate(void **opaque)
const AVClass * av_iamf_mix_presentation_get_class(void)
static const AVClass mix_gain_class
static const AVClass layer_class
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN
Subblocks are of struct type AVIAMFMixGain.
static const AVClass audio_element_class
unsigned int nb_elements
Number of elements in the submix.
AVIAMFParamDefinition * demixing_info
Demixing information used to reconstruct a scalable channel audio representation.
AVIAMFParamDefinition * output_mix_config
Information required for post-processing the mixed audio signal to generate the audio signal for play...
AVIAMFParamDefinitionType
@ AV_IAMF_SUBMIX_LAYOUT_TYPE_BINAURAL
The layout is binaural.
@ AV_IAMF_AMBISONICS_MODE_PROJECTION
AVIAMFParamDefinition * element_mix_config
Information required required for applying any processing to the referenced and rendered Audio Elemen...
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
Submix element as defined in section 3.7 of IAMF.
#define flags(name, subs,...)
@ AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL
size_t subblock_size
Size in bytes of each element in the subblocks array.
static const AVClass recon_gain_class
AVIAMFParamDefinition * recon_gain_info
Recon gain information used to reconstruct a scalable channel audio representation.
static const AVClass * audio_element_child_iterate(void **opaque)
AVIAMFSubmix ** submixes
Array of submixes.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
static const AVOption mix_presentation_options[]
static const AVClass param_definition_class
@ AV_IAMF_PARAMETER_DEFINITION_DEMIXING
Subblocks are of struct type AVIAMFDemixingInfo.
static const AVOption layer_options[]