Go to the documentation of this file.
36 for (
int i = 0;
i <
s->nb_streams;
i++)
37 if (
s->streams[
i]->id ==
id)
47 unsigned skip_samples,
unsigned discard_padding,
51 int ret, audio_substream_id;
53 if (id_in_bitstream) {
54 unsigned explicit_audio_substream_id;
58 audio_substream_id = explicit_audio_substream_id;
72 if (skip_samples || discard_padding) {
77 AV_WL32A(side_data + 4, discard_padding);
83 memcpy(side_data,
c->mix,
c->mix_size);
89 memcpy(side_data,
c->demix,
c->demix_size);
95 memcpy(side_data,
c->recon,
c->recon_size);
111 unsigned int duration, constant_subblock_duration;
112 unsigned int nb_subblocks;
113 unsigned int parameter_id;
114 size_t out_param_size;
134 av_log(
s,
AV_LOG_VERBOSE,
"Non existant parameter_id %d referenced in a parameter block. Ignoring\n",
148 if (constant_subblock_duration == 0)
151 nb_subblocks =
duration / constant_subblock_duration;
171 for (
int i = 0;
i < nb_subblocks;
i++) {
173 unsigned int subblock_duration = constant_subblock_duration;
178 switch (param->
type) {
196 mix->subblock_duration = subblock_duration;
214 if (layer->
flags & AV_IAMF_LAYER_FLAG_RECON_GAIN) {
216 unsigned int bitcount = 7 + 5 * !!(recon_gain_flags & 0x80);
217 recon_gain_flags = (recon_gain_flags & 0x7F) | ((recon_gain_flags & 0xFF00) >> 1);
218 for (
int j = 0; j < bitcount; j++) {
219 if (recon_gain_flags & (1 << j))
235 av_log(
s,
level,
"Underread in parameter_block_obu. %d bytes left at the end\n",
len);
238 switch (param->
type) {
242 c->mix_size = out_param_size;
246 c->demix = out_param;
247 c->demix_size = out_param_size;
251 c->recon = out_param;
252 c->recon_size = out_param_size;
276 unsigned skip_samples, discard_padding;
287 &skip_samples, &discard_padding);
288 if (len < 0 || obu_size > max_size ||
len > INT_MAX -
read) {
297 skip_samples, discard_padding,
#define AV_LOG_WARNING
Something somehow does not look correct.
unsigned int nb_layers
Number of layers, or channel groups, in the Audio Element.
#define AV_EF_EXPLODE
abort decoding on minor error detection
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))
static int mix(int c0, int c1)
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
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.
enum AVIAMFParamDefinitionType type
Parameters type.
#define AV_LOG_VERBOSE
Detailed information.
Parameters as defined in section 3.6.1 of IAMF.
int ff_iamf_read_packet(AVFormatContext *s, IAMFDemuxContext *c, AVIOContext *pb, int max_size, AVPacket *pkt)
@ AV_PKT_DATA_IAMF_RECON_GAIN_INFO_PARAM
IAMF Recon Gain Info Parameter Data associated with the audio frame.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
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
Recon Gain Info Parameter Data as defined in section 3.8.3 of IAMF.
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)
@ AV_IAMF_PARAMETER_DEFINITION_RECON_GAIN
Subblocks are of struct type AVIAMFReconGain.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_IAMF_ANIMATION_TYPE_BEZIER
static AVStream * find_stream_by_id(AVFormatContext *s, int id)
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.
unsigned int ffio_read_leb(AVIOContext *s)
Read a unsigned integer coded as a variable number of up to eight little-endian bytes,...
Demixing Info Parameter Data as defined in section 3.8.2 of IAMF.
unsigned int duration
The accumulated duration of all blocks in this parameter definition, in units of 1 / parameter_rate.
A layer defining a Channel Layout in the Audio Element.
@ AV_IAMF_ANIMATION_TYPE_LINEAR
const AVIAMFAudioElement * celement
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
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)
unsigned int subblock_duration
Duration for the given subblock, in units of 1 / parameter_rate.
unsigned int subblock_duration
Duration for the given subblock, in units of 1 / parameter_rate.
static AVRational av_make_q(int num, int den)
Create an AVRational.
static const uint8_t header[24]
int avio_r8(AVIOContext *s)
unsigned int constant_subblock_duration
The duration of every subblock in the case where all subblocks, with the optional exception of the la...
Information on how to combine one or more audio streams, as defined in section 3.6 of IAMF.
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
Ensures that the requested seekback buffer size will be available.
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
Mix Gain Parameter Data as defined in section 3.8.1 of IAMF.
#define i(width, name, range_min, range_max)
unsigned int parameter_id
Identifier for the paremeter substream.
static int param_definition(const IAMFContext *iamf, const IAMFParamDefinition *param_def, AVIOContext *dyn_bc, void *log_ctx)
unsigned int nb_subblocks
Number of subblocks in the array.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
unsigned int avio_rb16(AVIOContext *s)
#define AV_INPUT_BUFFER_PADDING_SIZE
int index
stream index in AVFormatContext
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
Allocate new information of a packet.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
static av_const int sign_extend(int val, unsigned bits)
@ AV_PKT_DATA_SKIP_SAMPLES
Recommmends skipping the specified number of samples.
@ AV_IAMF_PARAMETER_DEFINITION_MIX_GAIN
Subblocks are of struct type AVIAMFMixGain.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
unsigned int dmixp_mode
Pre-defined combination of demixing parameters.
unsigned int flags
A bitmask which may contain a combination of AV_IAMF_LAYER_FLAG_* flags.
This structure stores compressed data.
unsigned int parameter_rate
Sample rate for the paremeter substream.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static int parameter_block_obu(AVFormatContext *s, IAMFDemuxContext *c, AVIOContext *pbc, int len)
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...
@ AV_PKT_DATA_IAMF_MIX_GAIN_PARAM
IAMF Mix Gain Parameter Data associated with the audio frame.
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.
void ff_iamf_read_deinit(IAMFDemuxContext *c)
@ AV_IAMF_PARAMETER_DEFINITION_DEMIXING
Subblocks are of struct type AVIAMFDemixingInfo.
@ AV_PKT_DATA_IAMF_DEMIXING_INFO_PARAM
IAMF Demixing Info Parameter Data associated with the audio frame.