FFmpeg
iamf_reader.c
Go to the documentation of this file.
1 /*
2  * Immersive Audio Model and Formats demuxing utils
3  * Copyright (c) 2024 James Almer <jamrial@gmail.com>
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "libavutil/avassert.h"
23 #include "libavutil/intreadwrite.h"
24 #include "libavutil/log.h"
25 #include "libavutil/mem.h"
26 #include "libavcodec/mathops.h"
27 #include "libavcodec/packet.h"
28 #include "avformat.h"
29 #include "avio_internal.h"
30 #include "iamf.h"
31 #include "iamf_parse.h"
32 #include "iamf_reader.h"
33 
35 {
36  for (int i = 0; i < s->nb_streams; i++)
37  if (s->streams[i]->id == id)
38  return s->streams[i];
39 
40  av_log(s, AV_LOG_ERROR, "Invalid stream id %d\n", id);
41  return NULL;
42 }
43 
45  AVIOContext *pb, AVPacket *pkt,
46  int len, enum IAMF_OBU_Type type,
47  unsigned skip_samples, unsigned discard_padding,
48  int id_in_bitstream)
49 {
50  AVStream *st;
51  int ret, audio_substream_id;
52 
53  if (id_in_bitstream) {
54  unsigned explicit_audio_substream_id;
55  int64_t pos = avio_tell(pb);
56  explicit_audio_substream_id = ffio_read_leb(pb);
57  len -= avio_tell(pb) - pos;
58  audio_substream_id = explicit_audio_substream_id;
59  } else
60  audio_substream_id = type - IAMF_OBU_IA_AUDIO_FRAME_ID0;
61 
62  st = find_stream_by_id(s, audio_substream_id);
63  if (!st)
64  return AVERROR_INVALIDDATA;
65 
66  ret = av_get_packet(pb, pkt, len);
67  if (ret < 0)
68  return ret;
69  if (ret != len)
70  return AVERROR_INVALIDDATA;
71 
72  if (skip_samples || discard_padding) {
73  uint8_t *side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_SKIP_SAMPLES, 10);
74  if (!side_data)
75  return AVERROR(ENOMEM);
76  AV_WL32A(side_data, skip_samples);
77  AV_WL32A(side_data + 4, discard_padding);
78  }
79  if (c->mix) {
80  uint8_t *side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_IAMF_MIX_GAIN_PARAM, c->mix_size);
81  if (!side_data)
82  return AVERROR(ENOMEM);
83  memcpy(side_data, c->mix, c->mix_size);
84  }
85  if (c->demix) {
86  uint8_t *side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_IAMF_DEMIXING_INFO_PARAM, c->demix_size);
87  if (!side_data)
88  return AVERROR(ENOMEM);
89  memcpy(side_data, c->demix, c->demix_size);
90  }
91  if (c->recon) {
92  uint8_t *side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_IAMF_RECON_GAIN_INFO_PARAM, c->recon_size);
93  if (!side_data)
94  return AVERROR(ENOMEM);
95  memcpy(side_data, c->recon, c->recon_size);
96  }
97 
98  pkt->stream_index = st->index;
99  return 0;
100 }
101 
103  AVIOContext *pbc, int len)
104 {
106  const AVIAMFParamDefinition *param;
107  AVIAMFParamDefinition *out_param = NULL;
108  FFIOContext b;
109  AVIOContext *pb;
110  uint8_t *buf;
111  unsigned int duration, constant_subblock_duration;
112  unsigned int total_duration = 0;
113  unsigned int nb_subblocks;
114  unsigned int parameter_id;
115  size_t out_param_size;
116  int ret;
117 
118  buf = av_malloc(len);
119  if (!buf)
120  return AVERROR(ENOMEM);
121 
122  ret = avio_read(pbc, buf, len);
123  if (ret != len) {
124  if (ret >= 0)
126  goto fail;
127  }
128 
129  ffio_init_context(&b, buf, len, 0, NULL, NULL, NULL, NULL);
130  pb = &b.pub;
131 
132  parameter_id = ffio_read_leb(pb);
133  param_definition = ff_iamf_get_param_definition(&c->iamf, parameter_id);
134  if (!param_definition) {
135  av_log(s, AV_LOG_VERBOSE, "Non existant parameter_id %d referenced in a parameter block. Ignoring\n",
136  parameter_id);
137  ret = 0;
138  goto fail;
139  }
140 
141  param = param_definition->param;
142  if (!param_definition->mode) {
143  duration = ffio_read_leb(pb);
144  if (!duration) {
146  goto fail;
147  }
148  constant_subblock_duration = ffio_read_leb(pb);
149  if (constant_subblock_duration == 0)
150  nb_subblocks = ffio_read_leb(pb);
151  else {
152  nb_subblocks = duration / constant_subblock_duration;
153  total_duration = duration;
154  }
155  } else {
156  duration = param->duration;
157  constant_subblock_duration = param->constant_subblock_duration;
158  nb_subblocks = param->nb_subblocks;
159  }
160 
161  out_param = av_iamf_param_definition_alloc(param->type, nb_subblocks, &out_param_size);
162  if (!out_param) {
163  ret = AVERROR(ENOMEM);
164  goto fail;
165  }
166 
167  out_param->parameter_id = param->parameter_id;
168  out_param->type = param->type;
169  out_param->parameter_rate = param->parameter_rate;
170  out_param->duration = duration;
171  out_param->constant_subblock_duration = constant_subblock_duration;
172  out_param->nb_subblocks = nb_subblocks;
173 
174  for (int i = 0; i < nb_subblocks; i++) {
175  void *subblock = av_iamf_param_definition_get_subblock(out_param, i);
176  unsigned int subblock_duration = constant_subblock_duration;
177 
178  if (!param_definition->mode && !constant_subblock_duration) {
179  subblock_duration = ffio_read_leb(pb);
180  total_duration += subblock_duration;
181  } else if (i == nb_subblocks - 1)
182  subblock_duration = duration - i * constant_subblock_duration;
183 
184  switch (param->type) {
186  AVIAMFMixGain *mix = subblock;
187 
188  mix->animation_type = ffio_read_leb(pb);
189  if (mix->animation_type > AV_IAMF_ANIMATION_TYPE_BEZIER) {
190  ret = 0;
191  av_free(out_param);
192  goto fail;
193  }
194 
195  mix->start_point_value = av_make_q(sign_extend(avio_rb16(pb), 16), 1 << 8);
196  if (mix->animation_type >= AV_IAMF_ANIMATION_TYPE_LINEAR)
197  mix->end_point_value = av_make_q(sign_extend(avio_rb16(pb), 16), 1 << 8);
198  if (mix->animation_type == AV_IAMF_ANIMATION_TYPE_BEZIER) {
199  mix->control_point_value = av_make_q(sign_extend(avio_rb16(pb), 16), 1 << 8);
200  mix->control_point_relative_time = av_make_q(avio_r8(pb), 1 << 8);
201  }
202  mix->subblock_duration = subblock_duration;
203  break;
204  }
206  AVIAMFDemixingInfo *demix = subblock;
207 
208  demix->dmixp_mode = avio_r8(pb) >> 5;
209  demix->subblock_duration = subblock_duration;
210  break;
211  }
213  AVIAMFReconGain *recon = subblock;
214  const IAMFAudioElement *audio_element = param_definition->audio_element;
215  const AVIAMFAudioElement *element = audio_element->celement;
216 
217  av_assert0(audio_element && element);
218  for (int i = 0; i < element->nb_layers; i++) {
219  const AVIAMFLayer *layer = element->layers[i];
220  if (layer->flags & AV_IAMF_LAYER_FLAG_RECON_GAIN) {
221  unsigned int recon_gain_flags = ffio_read_leb(pb);
222  unsigned int bitcount = 7 + 5 * !!(recon_gain_flags & 0x80);
223  recon_gain_flags = (recon_gain_flags & 0x7F) | ((recon_gain_flags & 0xFF00) >> 1);
224  for (int j = 0; j < bitcount; j++) {
225  if (recon_gain_flags & (1 << j))
226  recon->recon_gain[i][j] = avio_r8(pb);
227  }
228  }
229  }
230  recon->subblock_duration = subblock_duration;
231  break;
232  }
233  default:
234  av_assert0(0);
235  }
236  }
237 
238  len -= avio_tell(pb);
239  if (len) {
240  int level = (s->error_recognition & AV_EF_EXPLODE) ? AV_LOG_ERROR : AV_LOG_WARNING;
241  av_log(s, level, "Underread in parameter_block_obu. %d bytes left at the end\n", len);
242  }
243 
244  if (!param_definition->mode && !constant_subblock_duration && total_duration != duration) {
245  av_log(s, AV_LOG_ERROR, "Invalid duration in parameter block\n");
247  goto fail;
248  }
249 
250  switch (param->type) {
252  av_free(c->mix);
253  c->mix = out_param;
254  c->mix_size = out_param_size;
255  break;
257  av_free(c->demix);
258  c->demix = out_param;
259  c->demix_size = out_param_size;
260  break;
262  av_free(c->recon);
263  c->recon = out_param;
264  c->recon_size = out_param_size;
265  break;
266  default:
267  av_assert0(0);
268  }
269 
270  ret = 0;
271 fail:
272  if (ret < 0)
273  av_free(out_param);
274  av_free(buf);
275 
276  return ret;
277 }
278 
280  AVIOContext *pb, int max_size, AVPacket *pkt)
281 {
282  int read = 0;
283 
284  while (1) {
286  enum IAMF_OBU_Type type;
287  unsigned obu_size;
288  unsigned skip_samples, discard_padding;
289  int ret, len, size, start_pos;
290 
292  if (ret < 0)
293  return ret;
295  if (size < 0)
296  return size;
297 
298  len = ff_iamf_parse_obu_header(header, size, &obu_size, &start_pos, &type,
299  &skip_samples, &discard_padding);
300  if (len < 0 || obu_size > max_size || len > INT_MAX - read) {
301  av_log(s, AV_LOG_ERROR, "Failed to read obu\n");
302  return len < 0 ? len : AVERROR_INVALIDDATA;
303  }
304  avio_seek(pb, -(size - start_pos), SEEK_CUR);
305 
306  read += len;
308  ret = audio_frame_obu(s, c, pb, pkt, obu_size, type,
309  skip_samples, discard_padding,
311  if (ret < 0)
312  return ret;
313  return read;
314  } else if (type == IAMF_OBU_IA_PARAMETER_BLOCK) {
315  ret = parameter_block_obu(s, c, pb, obu_size);
316  if (ret < 0)
317  return ret;
318  } else if (type == IAMF_OBU_IA_TEMPORAL_DELIMITER) {
319  av_freep(&c->mix);
320  c->mix_size = 0;
321  av_freep(&c->demix);
322  c->demix_size = 0;
323  av_freep(&c->recon);
324  c->recon_size = 0;
325  } else {
326  int64_t offset = avio_skip(pb, obu_size);
327  if (offset < 0)
328  return offset;
329  }
330  max_size -= len;
331  if (max_size < 0)
332  return AVERROR_INVALIDDATA;
333  if (!max_size)
334  break;
335  }
336 
337  return read;
338 }
339 
341 {
342  IAMFContext *const iamf = &c->iamf;
343 
345 
346  av_freep(&c->mix);
347  c->mix_size = 0;
348  av_freep(&c->demix);
349  c->demix_size = 0;
350  av_freep(&c->recon);
351  c->recon_size = 0;
352 }
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:215
AVIAMFAudioElement::nb_layers
unsigned int nb_layers
Number of layers, or channel groups, in the Audio Element.
Definition: iamf.h:368
level
uint8_t level
Definition: svq3.c:205
AV_EF_EXPLODE
#define AV_EF_EXPLODE
abort decoding on minor error detection
Definition: defs.h:51
ffio_init_context
void ffio_init_context(FFIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, const uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
Definition: aviobuf.c:50
mix
static int mix(int c0, int c1)
Definition: 4xm.c:716
AVERROR
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 sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
av_iamf_param_definition_alloc
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.
Definition: iamf.c:159
AVIAMFAudioElement::layers
AVIAMFLayer ** layers
Definition: iamf.h:359
int64_t
long long int64_t
Definition: coverity.c:34
AVIAMFParamDefinition::type
enum AVIAMFParamDefinitionType type
Parameters type.
Definition: iamf.h:213
b
#define b
Definition: input.c:41
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:225
AVIAMFParamDefinition
Parameters as defined in section 3.6.1 of IAMF.
Definition: iamf.h:193
iamf_parse.h
ff_iamf_get_param_definition
static IAMFParamDefinition * ff_iamf_get_param_definition(const IAMFContext *iamf, unsigned int parameter_id)
Definition: iamf.h:185
FFIOContext
Definition: avio_internal.h:28
av_malloc
#define av_malloc(s)
Definition: tableprint_vlc.h:30
ff_iamf_read_packet
int ff_iamf_read_packet(AVFormatContext *s, IAMFDemuxContext *c, AVIOContext *pb, int max_size, AVPacket *pkt)
Definition: iamf_reader.c:279
AV_PKT_DATA_IAMF_RECON_GAIN_INFO_PARAM
@ AV_PKT_DATA_IAMF_RECON_GAIN_INFO_PARAM
IAMF Recon Gain Info Parameter Data associated with the audio frame.
Definition: packet.h:320
IAMFParamDefinition
Definition: iamf.h:121
fail
#define fail()
Definition: checkasm.h:193
avio_tell
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:494
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
IAMF_OBU_IA_PARAMETER_BLOCK
@ IAMF_OBU_IA_PARAMETER_BLOCK
Definition: iamf.h:41
AVIAMFReconGain
Recon Gain Info Parameter Data as defined in section 3.8.3 of IAMF.
Definition: iamf.h:148
audio_frame_obu
static int audio_frame_obu(AVFormatContext *s, const IAMFDemuxContext *c, AVIOContext *pb, AVPacket *pkt, int len, enum IAMF_OBU_Type type, unsigned skip_samples, unsigned discard_padding, int id_in_bitstream)
Definition: iamf_reader.c:44
AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN
@ AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN
Subblocks are of struct type AVIAMFReconGain.
Definition: iamf.h:181
avassert.h
pkt
AVPacket * pkt
Definition: movenc.c:60
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:209
duration
int64_t duration
Definition: movenc.c:65
AV_IAMF_ANIMATION_TYPE_BEZIER
@ AV_IAMF_ANIMATION_TYPE_BEZIER
Definition: iamf.h:69
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
find_stream_by_id
static AVStream * find_stream_by_id(AVFormatContext *s, int id)
Definition: iamf_reader.c:34
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
ffio_read_leb
unsigned int ffio_read_leb(AVIOContext *s)
Read a unsigned integer coded as a variable number of up to eight little-endian bytes,...
Definition: aviobuf.c:927
AVFormatContext
Format I/O context.
Definition: avformat.h:1300
AVIAMFDemixingInfo
Demixing Info Parameter Data as defined in section 3.8.2 of IAMF.
Definition: iamf.h:128
NULL
#define NULL
Definition: coverity.c:32
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
mathops.h
AV_IAMF_ANIMATION_TYPE_LINEAR
@ AV_IAMF_ANIMATION_TYPE_LINEAR
Definition: iamf.h:68
IAMFAudioElement::celement
const AVIAMFAudioElement * celement
Definition: iamf.h:90
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
ff_iamf_parse_obu_header
int ff_iamf_parse_obu_header(const uint8_t *buf, int buf_size, unsigned *obu_size, int *start_pos, enum IAMF_OBU_Type *type, unsigned *skip_samples, unsigned *discard_padding)
Definition: iamf_parse.c:1020
IAMFAudioElement
Definition: iamf.h:89
AVIAMFReconGain::subblock_duration
unsigned int subblock_duration
Duration for the given subblock, in units of 1 / parameter_rate.
Definition: iamf.h:156
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
AVIAMFDemixingInfo::subblock_duration
unsigned int subblock_duration
Duration for the given subblock, in units of 1 / parameter_rate.
Definition: iamf.h:136
ff_iamf_uninit_context
void ff_iamf_uninit_context(IAMFContext *c)
Definition: iamf.c:159
size
int size
Definition: twinvq_data.h:10344
av_make_q
static AVRational av_make_q(int num, int den)
Create an AVRational.
Definition: rational.h:71
AV_WL32A
#define AV_WL32A(p, v)
Definition: intreadwrite.h:571
IAMFContext
Definition: iamf.h:128
header
static const uint8_t header[24]
Definition: sdr2.c:68
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:603
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
AVIAMFAudioElement
Information on how to combine one or more audio streams, as defined in section 3.6 of IAMF.
Definition: iamf.h:356
ffio_ensure_seekback
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
Ensures that the requested seekback buffer size will be available.
Definition: aviobuf.c:1023
offset
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 offset
Definition: writing_filters.txt:86
AVIAMFMixGain
Mix Gain Parameter Data as defined in section 3.8.1 of IAMF.
Definition: iamf.h:77
log.h
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AVIAMFParamDefinition::parameter_id
unsigned int parameter_id
Identifier for the paremeter substream.
Definition: iamf.h:218
avio_internal.h
packet.h
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
param_definition
static int param_definition(const IAMFContext *iamf, const IAMFParamDefinition *param_def, AVIOContext *dyn_bc, void *log_ctx)
Definition: iamf_writer.c:607
len
int len
Definition: vorbis_enc_data.h:426
IAMF_OBU_IA_AUDIO_FRAME
@ IAMF_OBU_IA_AUDIO_FRAME
Definition: iamf.h:43
AVIAMFParamDefinition::nb_subblocks
unsigned int nb_subblocks
Number of subblocks in the array.
Definition: iamf.h:208
av_get_packet
int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
Allocate and read the payload of a packet and initialize its fields with default values.
Definition: utils.c:91
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:748
avio_seek
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:231
avio_rb16
unsigned int avio_rb16(AVIOContext *s)
Definition: aviobuf.c:746
pos
unsigned int pos
Definition: spdifenc.c:414
avformat.h
IAMF_OBU_IA_AUDIO_FRAME_ID0
@ IAMF_OBU_IA_AUDIO_FRAME_ID0
Definition: iamf.h:44
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
IAMF_OBU_Type
IAMF_OBU_Type
Definition: iamf.h:37
AVStream::index
int index
stream index in AVFormatContext
Definition: avformat.h:754
av_packet_new_side_data
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
Allocate new information of a packet.
Definition: packet.c:232
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:612
sign_extend
static av_const int sign_extend(int val, unsigned bits)
Definition: mathops.h:131
AV_PKT_DATA_SKIP_SAMPLES
@ AV_PKT_DATA_SKIP_SAMPLES
Recommmends skipping the specified number of samples.
Definition: packet.h:153
AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN
@ AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN
Subblocks are of struct type AVIAMFMixGain.
Definition: iamf.h:173
AVPacket::stream_index
int stream_index
Definition: packet.h:541
MAX_IAMF_OBU_HEADER_SIZE
#define MAX_IAMF_OBU_HEADER_SIZE
Definition: iamf.h:34
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:318
AVIAMFDemixingInfo::dmixp_mode
unsigned int dmixp_mode
Pre-defined combination of demixing parameters.
Definition: iamf.h:140
mem.h
AVIAMFLayer::flags
unsigned int flags
A bitmask which may contain a combination of AV_IAMF_LAYER_FLAG_* flags.
Definition: iamf.h:302
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
AVPacket
This structure stores compressed data.
Definition: packet.h:516
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
iamf.h
AVIAMFParamDefinition::parameter_rate
unsigned int parameter_rate
Sample rate for the paremeter substream.
Definition: iamf.h:222
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
IAMF_OBU_IA_TEMPORAL_DELIMITER
@ IAMF_OBU_IA_TEMPORAL_DELIMITER
Definition: iamf.h:42
IAMFDemuxContext
Definition: iamf_reader.h:32
parameter_block_obu
static int parameter_block_obu(AVFormatContext *s, IAMFDemuxContext *c, AVIOContext *pbc, int len)
Definition: iamf_reader.c:102
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
AV_PKT_DATA_IAMF_MIX_GAIN_PARAM
@ AV_PKT_DATA_IAMF_MIX_GAIN_PARAM
IAMF Mix Gain Parameter Data associated with the audio frame.
Definition: packet.h:304
read
static uint32_t BS_FUNC() read(BSCTX *bc, unsigned int n)
Return n bits from the buffer, n has to be in the 0-32 range.
Definition: bitstream_template.h:231
iamf_reader.h
ff_iamf_read_deinit
void ff_iamf_read_deinit(IAMFDemuxContext *c)
Definition: iamf_reader.c:340
AV_IAMF_PARAMETER_DEFINITION_DEMIXING
@ AV_IAMF_PARAMETER_DEFINITION_DEMIXING
Subblocks are of struct type AVIAMFDemixingInfo.
Definition: iamf.h:177
IAMF_OBU_IA_AUDIO_FRAME_ID17
@ IAMF_OBU_IA_AUDIO_FRAME_ID17
Definition: iamf.h:61
AV_PKT_DATA_IAMF_DEMIXING_INFO_PARAM
@ AV_PKT_DATA_IAMF_DEMIXING_INFO_PARAM
IAMF Demixing Info Parameter Data associated with the audio frame.
Definition: packet.h:312