avutil/iamf: add an AVOption for AVIAMFLayer.demixing_matrix

Plus a length field, to fulfill the requirements of AV_OPT_TYPE_FLAG_ARRAY options.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer
2025-12-27 17:05:51 -03:00
parent d28250eada
commit a6e5fa3fbb
4 changed files with 15 additions and 5 deletions

View File

@@ -2,6 +2,9 @@ The last version increases of all libraries were on 2025-03-28
API changes, most recent first:
2025-12-29 - xxxxxxxxxx - lavu 60.21.100 - iamf.h
Add nb_demixing_matrix to AVIAMFLayer
2025-12-xx - xxxxxxxxxx - lavc 62.23.100 - coedc_id.h
Add AV_CODEC_ID_JPEGXS.

View File

@@ -239,6 +239,8 @@ AVIAMFParamDefinition *av_iamf_param_definition_alloc(enum AVIAMFParamDefinition
//
// Audio Element
//
static const AVOptionArrayDef demixing_matrix_def = { .def = "0|0", .size_max = (255 + 255) * 255, .sep = '|' };
#undef OFFSET
#define OFFSET(x) offsetof(AVIAMFLayer, x)
static const AVOption layer_options[] = {
@@ -269,6 +271,8 @@ static const AVOption layer_options[] = {
{ .i64 = AV_IAMF_AMBISONICS_MODE_MONO }, .unit = "ambisonics_mode" },
{ "projection", NULL, 0, AV_OPT_TYPE_CONST,
{ .i64 = AV_IAMF_AMBISONICS_MODE_PROJECTION }, .unit = "ambisonics_mode" },
{ "demixing_matrix", "set demixing_matrix", OFFSET(demixing_matrix), AV_OPT_TYPE_RATIONAL | AV_OPT_TYPE_FLAG_ARRAY,
{ .arr = &demixing_matrix_def }, -1.0, 1.0, FLAGS },
{ NULL },
};

View File

@@ -330,14 +330,17 @@ typedef struct AVIAMFLayer {
/**
* Demixing matrix as defined in section 3.6.3 of IAMF.
*
* The length of the array is ch_layout.nb_channels multiplied by the sum of
* the amount of streams in the group plus the amount of streams in the group
* that are stereo.
*
* May be set only if @ref ambisonics_mode == AV_IAMF_AMBISONICS_MODE_PROJECTION,
* must be NULL otherwise.
*/
AVRational *demixing_matrix;
/**
* The length of the Demixing matrix array. Must be ch_layout.nb_channels multiplied
* by the sum of the amount of streams in the group plus the amount of streams in
* the group that are stereo.
*/
unsigned int nb_demixing_matrix;
} AVIAMFLayer;

View File

@@ -79,7 +79,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 60
#define LIBAVUTIL_VERSION_MINOR 20
#define LIBAVUTIL_VERSION_MINOR 21
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \