FFmpeg
Macros | Functions | Variables
iamf.c File Reference
#include <limits.h>
#include <stddef.h>
#include <stdint.h>
#include "avassert.h"
#include "error.h"
#include "iamf.h"
#include "log.h"
#include "mem.h"
#include "opt.h"

Go to the source code of this file.

Macros

#define IAMF_ADD_FUNC_TEMPLATE(parent_type, parent_name, child_type, child_name, suffix)
 
#define FLAGS   AV_OPT_FLAG_ENCODING_PARAM
 
#define OFFSET(x)   offsetof(AVIAMFMixGain, x)
 
#define OFFSET(x)   offsetof(AVIAMFDemixingInfo, x)
 
#define OFFSET(x)   offsetof(AVIAMFReconGain, x)
 
#define OFFSET(x)   offsetof(AVIAMFParamDefinition, x)
 
#define OFFSET(x)   offsetof(AVIAMFLayer, x)
 
#define OFFSET(x)   offsetof(AVIAMFAudioElement, x)
 
#define OFFSET(x)   offsetof(AVIAMFSubmixElement, x)
 
#define OFFSET(x)   offsetof(AVIAMFSubmixLayout, x)
 
#define OFFSET(x)   offsetof(AVIAMFSubmix, x)
 
#define OFFSET(x)   offsetof(AVIAMFMixPresentation, x)
 

Functions

static const AVClassparam_definition_child_iterate (void **opaque)
 
const AVClassav_iamf_param_definition_get_class (void)
 
AVIAMFParamDefinitionav_iamf_param_definition_alloc (enum AVIAMFParamDefinitionType type, unsigned int nb_subblocks, size_t *out_size)
 Allocates memory for AVIAMFParamDefinition, plus an array of. More...
 
static const AVClassaudio_element_child_iterate (void **opaque)
 
const AVClassav_iamf_audio_element_get_class (void)
 
AVIAMFAudioElementav_iamf_audio_element_alloc (void)
 Allocates a AVIAMFAudioElement, and initializes its fields with default values. More...
 
void av_iamf_audio_element_free (AVIAMFAudioElement **paudio_element)
 Free an AVIAMFAudioElement and all its contents. More...
 
static void * submix_element_child_next (void *obj, void *prev)
 
static const AVClasssubmix_element_child_iterate (void **opaque)
 
static void * submix_presentation_child_next (void *obj, void *prev)
 
static const AVClasssubmix_presentation_child_iterate (void **opaque)
 
static const AVClassmix_presentation_child_iterate (void **opaque)
 
const AVClassav_iamf_mix_presentation_get_class (void)
 
AVIAMFMixPresentationav_iamf_mix_presentation_alloc (void)
 Allocates a AVIAMFMixPresentation, and initializes its fields with default values. More...
 
void av_iamf_mix_presentation_free (AVIAMFMixPresentation **pmix_presentation)
 Free an AVIAMFMixPresentation and all its contents. More...
 

Variables

static const AVOption mix_gain_options []
 
static const AVClass mix_gain_class
 
static const AVOption demixing_info_options []
 
static const AVClass demixing_info_class
 
static const AVOption recon_gain_options []
 
static const AVClass recon_gain_class
 
static const AVOption param_definition_options []
 
static const AVClass param_definition_class
 
static const AVOptionArrayDef demixing_matrix_def = { .size_max = (255 + 255) * 255, .sep = '|' }
 
static const AVOption layer_options []
 
static const AVClass layer_class
 
static const AVOption audio_element_options []
 
static const AVClass audio_element_class
 
static const AVOption submix_element_options []
 
static const AVClass element_class
 
static const AVOption submix_layout_options []
 
static const AVClass layout_class
 
static const AVOption submix_presentation_options []
 
static const AVClass submix_class
 
static const AVOption mix_presentation_options []
 
static const AVClass mix_presentation_class
 

Macro Definition Documentation

◆ IAMF_ADD_FUNC_TEMPLATE

#define IAMF_ADD_FUNC_TEMPLATE (   parent_type,
  parent_name,
  child_type,
  child_name,
  suffix 
)
Value:
child_type *av_iamf_ ## parent_name ## _add_ ## child_name(parent_type *parent_name) \
{ \
child_type **child_name ## suffix, *child_name; \
if (parent_name->nb_## child_name ## suffix == UINT_MAX) \
return NULL; \
\
child_name ## suffix = av_realloc_array(parent_name->child_name ## suffix, \
parent_name->nb_## child_name ## suffix + 1, \
sizeof(*parent_name->child_name ## suffix)); \
if (!child_name ## suffix) \
return NULL; \
\
parent_name->child_name ## suffix = child_name ## suffix; \
\
child_name = parent_name->child_name ## suffix[parent_name->nb_## child_name ## suffix] \
= av_mallocz(sizeof(*child_name)); \
if (!child_name) \
return NULL; \
\
child_name->av_class = &child_name ## _class; \
av_opt_set_defaults(child_name); \
parent_name->nb_## child_name ## suffix++; \
\
return child_name; \
}

Definition at line 32 of file iamf.c.

◆ FLAGS

#define FLAGS   AV_OPT_FLAG_ENCODING_PARAM

Definition at line 60 of file iamf.c.

◆ OFFSET [1/10]

#define OFFSET (   x)    offsetof(AVIAMFMixGain, x)

Definition at line 489 of file iamf.c.

◆ OFFSET [2/10]

#define OFFSET (   x)    offsetof(AVIAMFDemixingInfo, x)

Definition at line 489 of file iamf.c.

◆ OFFSET [3/10]

#define OFFSET (   x)    offsetof(AVIAMFReconGain, x)

Definition at line 489 of file iamf.c.

◆ OFFSET [4/10]

#define OFFSET (   x)    offsetof(AVIAMFParamDefinition, x)

Definition at line 489 of file iamf.c.

◆ OFFSET [5/10]

#define OFFSET (   x)    offsetof(AVIAMFLayer, x)

Definition at line 489 of file iamf.c.

◆ OFFSET [6/10]

#define OFFSET (   x)    offsetof(AVIAMFAudioElement, x)

Definition at line 489 of file iamf.c.

◆ OFFSET [7/10]

#define OFFSET (   x)    offsetof(AVIAMFSubmixElement, x)

Definition at line 489 of file iamf.c.

◆ OFFSET [8/10]

#define OFFSET (   x)    offsetof(AVIAMFSubmixLayout, x)

Definition at line 489 of file iamf.c.

◆ OFFSET [9/10]

#define OFFSET (   x)    offsetof(AVIAMFSubmix, x)

Definition at line 489 of file iamf.c.

◆ OFFSET [10/10]

#define OFFSET (   x)    offsetof(AVIAMFMixPresentation, x)

Definition at line 489 of file iamf.c.

Function Documentation

◆ param_definition_child_iterate()

static const AVClass* param_definition_child_iterate ( void **  opaque)
static

Definition at line 122 of file iamf.c.

◆ audio_element_child_iterate()

static const AVClass* audio_element_child_iterate ( void **  opaque)
static

Definition at line 300 of file iamf.c.

◆ submix_element_child_next()

static void* submix_element_child_next ( void *  obj,
void *  prev 
)
static

Definition at line 378 of file iamf.c.

◆ submix_element_child_iterate()

static const AVClass* submix_element_child_iterate ( void **  opaque)
static

Definition at line 387 of file iamf.c.

◆ submix_presentation_child_next()

static void* submix_presentation_child_next ( void *  obj,
void *  prev 
)
static

Definition at line 446 of file iamf.c.

◆ submix_presentation_child_iterate()

static const AVClass* submix_presentation_child_iterate ( void **  opaque)
static

Definition at line 455 of file iamf.c.

◆ mix_presentation_child_iterate()

static const AVClass* mix_presentation_child_iterate ( void **  opaque)
static

Definition at line 498 of file iamf.c.

Variable Documentation

◆ mix_gain_options

const AVOption mix_gain_options[]
static
Initial value:
= {
{ "subblock_duration", "set subblock_duration", OFFSET(subblock_duration), AV_OPT_TYPE_UINT, {.i64 = 1 }, 1, UINT_MAX, FLAGS },
{ "animation_type", "set animation_type", OFFSET(animation_type), AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, 2, FLAGS },
{ "start_point_value", "set start_point_value", OFFSET(start_point_value), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
{ "end_point_value", "set end_point_value", OFFSET(end_point_value), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
{ "control_point_value", "set control_point_value", OFFSET(control_point_value), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, -128.0, 128.0, FLAGS },
{ "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 },
{ NULL },
}

Definition at line 66 of file iamf.c.

◆ mix_gain_class

const AVClass mix_gain_class
static
Initial value:
= {
.class_name = "AVIAMFMixGain",
.item_name = av_default_item_name,
.option = mix_gain_options,
}

Definition at line 76 of file iamf.c.

Referenced by av_iamf_param_definition_alloc(), and param_definition_child_iterate().

◆ demixing_info_options

const AVOption demixing_info_options[]
static
Initial value:
= {
{ "subblock_duration", "set subblock_duration", OFFSET(subblock_duration), AV_OPT_TYPE_UINT, {.i64 = 1 }, 1, UINT_MAX, FLAGS },
{ "dmixp_mode", "set dmixp_mode", OFFSET(dmixp_mode), AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, 6, FLAGS },
{ NULL },
}

Definition at line 85 of file iamf.c.

◆ demixing_info_class

const AVClass demixing_info_class
static
Initial value:
= {
.class_name = "AVIAMFDemixingInfo",
.item_name = av_default_item_name,
}

Definition at line 91 of file iamf.c.

Referenced by av_iamf_param_definition_alloc(), and param_definition_child_iterate().

◆ recon_gain_options

const AVOption recon_gain_options[]
static
Initial value:
= {
{ "subblock_duration", "set subblock_duration", OFFSET(subblock_duration), AV_OPT_TYPE_UINT, {.i64 = 1 }, 1, UINT_MAX, FLAGS },
{ NULL },
}

Definition at line 100 of file iamf.c.

◆ recon_gain_class

const AVClass recon_gain_class
static
Initial value:
= {
.class_name = "AVIAMFReconGain",
.item_name = av_default_item_name,
.option = recon_gain_options,
}

Definition at line 105 of file iamf.c.

Referenced by av_iamf_param_definition_alloc(), and param_definition_child_iterate().

◆ param_definition_options

const AVOption param_definition_options[]
static
Initial value:
= {
{ "parameter_id", "set parameter_id", OFFSET(parameter_id), AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, UINT_MAX, FLAGS },
{ "parameter_rate", "set parameter_rate", OFFSET(parameter_rate), AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, UINT_MAX, FLAGS },
{ "duration", "set duration", OFFSET(duration), AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, UINT_MAX, FLAGS },
{ "constant_subblock_duration", "set constant_subblock_duration", OFFSET(constant_subblock_duration), AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, UINT_MAX, FLAGS },
{ NULL },
}

Definition at line 114 of file iamf.c.

◆ param_definition_class

const AVClass param_definition_class
static
Initial value:
= {
.class_name = "AVIAMFParamDefinition",
.item_name = av_default_item_name,
.child_class_iterate = param_definition_child_iterate,
}

Definition at line 146 of file iamf.c.

Referenced by av_iamf_param_definition_alloc(), av_iamf_param_definition_get_class(), submix_element_child_iterate(), and submix_presentation_child_iterate().

◆ demixing_matrix_def

const AVOptionArrayDef demixing_matrix_def = { .size_max = (255 + 255) * 255, .sep = '|' }
static

Definition at line 242 of file iamf.c.

◆ layer_options

const AVOption layer_options[]
static

Definition at line 246 of file iamf.c.

◆ layer_class

const AVClass layer_class
static
Initial value:
= {
.class_name = "AVIAMFLayer",
.item_name = av_default_item_name,
.option = layer_options,
}

Definition at line 279 of file iamf.c.

Referenced by audio_element_child_iterate().

◆ audio_element_options

const AVOption audio_element_options[]
static
Initial value:
= {
{ "audio_element_type", "set audio_element_type", OFFSET(audio_element_type), AV_OPT_TYPE_INT,
{ "channel", NULL, 0, AV_OPT_TYPE_CONST,
{ .i64 = AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL }, .unit = "audio_element_type" },
{ "scene", NULL, 0, AV_OPT_TYPE_CONST,
{ .i64 = AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE }, .unit = "audio_element_type" },
{ "default_w", "set default_w", OFFSET(default_w), AV_OPT_TYPE_UINT, {.i64 = 0 }, 0, 10, FLAGS },
{ NULL },
}

Definition at line 288 of file iamf.c.

◆ audio_element_class

const AVClass audio_element_class
static
Initial value:
= {
.class_name = "AVIAMFAudioElement",
.item_name = av_default_item_name,
.child_class_iterate = audio_element_child_iterate,
}

Definition at line 313 of file iamf.c.

Referenced by av_iamf_audio_element_alloc(), and av_iamf_audio_element_get_class().

◆ submix_element_options

const AVOption submix_element_options[]
static
Initial value:
= {
{ "headphones_rendering_mode", "Headphones rendering mode", OFFSET(headphones_rendering_mode), AV_OPT_TYPE_INT,
AV_IAMF_HEADPHONES_MODE_STEREO, AV_IAMF_HEADPHONES_MODE_BINAURAL, FLAGS, .unit = "headphones_rendering_mode" },
{ "stereo", NULL, 0, AV_OPT_TYPE_CONST,
{ .i64 = AV_IAMF_HEADPHONES_MODE_STEREO }, .unit = "headphones_rendering_mode" },
{ "binaural", NULL, 0, AV_OPT_TYPE_CONST,
{ .i64 = AV_IAMF_HEADPHONES_MODE_BINAURAL }, .unit = "headphones_rendering_mode" },
{ "default_mix_gain", "Default mix gain", OFFSET(default_mix_gain), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0, FLAGS },
{ "annotations", "Annotations", OFFSET(annotations), AV_OPT_TYPE_DICT, { .str = NULL }, 0, 0, FLAGS },
{ NULL },
}

Definition at line 365 of file iamf.c.

◆ element_class

const AVClass element_class
static
Initial value:
= {
.class_name = "AVIAMFSubmixElement",
.item_name = av_default_item_name,
.child_class_iterate = submix_element_child_iterate,
}

Definition at line 400 of file iamf.c.

Referenced by submix_presentation_child_iterate().

◆ submix_layout_options

const AVOption submix_layout_options[]
static
Initial value:
= {
{ "layout_type", "Layout type", OFFSET(layout_type), AV_OPT_TYPE_INT,
{ "loudspeakers", NULL, 0, AV_OPT_TYPE_CONST,
{ .i64 = AV_IAMF_SUBMIX_LAYOUT_TYPE_LOUDSPEAKERS }, .unit = "layout_type" },
{ "binaural", NULL, 0, AV_OPT_TYPE_CONST,
{ .i64 = AV_IAMF_SUBMIX_LAYOUT_TYPE_BINAURAL }, .unit = "layout_type" },
{ "sound_system", "Sound System", OFFSET(sound_system), AV_OPT_TYPE_CHLAYOUT, { .str = NULL }, 0, 0, FLAGS },
{ "integrated_loudness", "Integrated loudness", OFFSET(integrated_loudness), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0, FLAGS },
{ "digital_peak", "Digital peak", OFFSET(digital_peak), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0, FLAGS },
{ "true_peak", "True peak", OFFSET(true_peak), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0, FLAGS },
{ "dialog_anchored_loudness", "Anchored loudness (Dialog)", OFFSET(dialogue_anchored_loudness), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0, FLAGS },
{ "album_anchored_loudness", "Anchored loudness (Album)", OFFSET(album_anchored_loudness), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0, FLAGS },
{ NULL },
}

Definition at line 413 of file iamf.c.

◆ layout_class

const AVClass layout_class
static
Initial value:
= {
.class_name = "AVIAMFSubmixLayout",
.item_name = av_default_item_name,
}

Definition at line 430 of file iamf.c.

Referenced by submix_presentation_child_iterate().

◆ submix_presentation_options

const AVOption submix_presentation_options[]
static
Initial value:
= {
{ "default_mix_gain", "Default mix gain", OFFSET(default_mix_gain), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, -128.0, 128.0, FLAGS },
{ NULL },
}

Definition at line 441 of file iamf.c.

◆ submix_class

const AVClass submix_class
static
Initial value:
= {
.class_name = "AVIAMFSubmix",
.item_name = av_default_item_name,
.child_class_iterate = submix_presentation_child_iterate,
}

Definition at line 479 of file iamf.c.

Referenced by mix_presentation_child_iterate().

◆ mix_presentation_options

const AVOption mix_presentation_options[]
static
Initial value:
= {
{ "annotations", "set annotations", OFFSET(annotations), AV_OPT_TYPE_DICT, {.str = NULL }, 0, 0, FLAGS },
{ NULL },
}

Definition at line 490 of file iamf.c.

◆ mix_presentation_class

const AVClass mix_presentation_class
static
Initial value:
= {
.class_name = "AVIAMFMixPresentation",
.item_name = av_default_item_name,
.child_class_iterate = mix_presentation_child_iterate,
}

Definition at line 511 of file iamf.c.

Referenced by av_iamf_mix_presentation_alloc(), and av_iamf_mix_presentation_get_class().

audio_element_options
static const AVOption audio_element_options[]
Definition: iamf.c:288
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:501
submix_presentation_child_next
static void * submix_presentation_child_next(void *obj, void *prev)
Definition: iamf.c:446
mix_gain_options
static const AVOption mix_gain_options[]
Definition: iamf.c:66
AV_IAMF_HEADPHONES_MODE_STEREO
@ AV_IAMF_HEADPHONES_MODE_STEREO
The referenced Audio Element shall be rendered to stereo loudspeakers.
Definition: iamf.h:436
submix_element_child_next
static void * submix_element_child_next(void *obj, void *prev)
Definition: iamf.c:378
AV_OPT_TYPE_RATIONAL
@ AV_OPT_TYPE_RATIONAL
Underlying C type is AVRational.
Definition: opt.h:280
recon_gain_options
static const AVOption recon_gain_options[]
Definition: iamf.c:100
submix_presentation_options
static const AVOption submix_presentation_options[]
Definition: iamf.c:441
FLAGS
#define FLAGS
Definition: iamf.c:60
duration
int64_t duration
Definition: movenc.c:65
av_realloc_array
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
Definition: mem.c:217
av_mallocz
#define av_mallocz(s)
Definition: tableprint_vlc.h:31
AV_IAMF_HEADPHONES_MODE_BINAURAL
@ AV_IAMF_HEADPHONES_MODE_BINAURAL
The referenced Audio Element shall be rendered with a binaural renderer.
Definition: iamf.h:440
if
if(ret)
Definition: filter_design.txt:179
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
submix_element_options
static const AVOption submix_element_options[]
Definition: iamf.c:365
AV_OPT_TYPE_DICT
@ AV_OPT_TYPE_DICT
Underlying C type is AVDictionary*.
Definition: opt.h:290
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:242
submix_presentation_child_iterate
static const AVClass * submix_presentation_child_iterate(void **opaque)
Definition: iamf.c:455
demixing_info_options
static const AVOption demixing_info_options[]
Definition: iamf.c:85
param_definition_options
static const AVOption param_definition_options[]
Definition: iamf.c:114
AV_OPT_TYPE_UINT
@ AV_OPT_TYPE_UINT
Underlying C type is unsigned int.
Definition: opt.h:335
AV_OPT_TYPE_CHLAYOUT
@ AV_OPT_TYPE_CHLAYOUT
Underlying C type is AVChannelLayout.
Definition: opt.h:331
param_definition_child_iterate
static const AVClass * param_definition_child_iterate(void **opaque)
Definition: iamf.c:122
OFFSET
#define OFFSET(x)
Definition: iamf.c:489
AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE
@ AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE
Definition: iamf.h:349
submix_layout_options
static const AVOption submix_layout_options[]
Definition: iamf.c:413
submix_element_child_iterate
static const AVClass * submix_element_child_iterate(void **opaque)
Definition: iamf.c:387
mix_presentation_child_iterate
static const AVClass * mix_presentation_child_iterate(void **opaque)
Definition: iamf.c:498
suffix
const char * suffix
Definition: checkasm.c:361
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
AV_IAMF_SUBMIX_LAYOUT_TYPE_BINAURAL
@ AV_IAMF_SUBMIX_LAYOUT_TYPE_BINAURAL
The layout is binaural.
Definition: iamf.h:508
AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL
@ AV_IAMF_AUDIO_ELEMENT_TYPE_CHANNEL
Definition: iamf.h:348
audio_element_child_iterate
static const AVClass * audio_element_child_iterate(void **opaque)
Definition: iamf.c:300
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
mix_presentation_options
static const AVOption mix_presentation_options[]
Definition: iamf.c:490
layer_options
static const AVOption layer_options[]
Definition: iamf.c:246