43 int nb_audio_elements = 0, nb_mix_presentations = 0;
46 for (
int i = 0;
i <
s->nb_streams;
i++) {
48 (
s->streams[
i]->codecpar->codec_tag !=
MKTAG(
'm',
'p',
'4',
'a') &&
49 s->streams[
i]->codecpar->codec_tag !=
MKTAG(
'O',
'p',
'u',
's') &&
50 s->streams[
i]->codecpar->codec_tag !=
MKTAG(
'f',
'L',
'a',
'C') &&
51 s->streams[
i]->codecpar->codec_tag !=
MKTAG(
'i',
'p',
'c',
'm'))) {
57 if (
s->streams[
i]->codecpar->ch_layout.nb_channels > 2) {
62 for (
int j = 0; j <
i; j++) {
63 if (
s->streams[
i]->id ==
s->streams[j]->id) {
70 if (
s->nb_stream_groups <= 1) {
75 for (
int i = 0;
i <
s->nb_stream_groups;
i++) {
81 nb_mix_presentations++;
83 if ((nb_audio_elements < 1 || nb_audio_elements > 2) || nb_mix_presentations < 1) {
85 "one IAMF_MIX_PRESENTATION stream groups\n");
89 for (
int i = 0;
i <
s->nb_stream_groups;
i++) {
99 for (
int i = 0;
i <
s->nb_stream_groups;
i++) {
109 c->first_stream_id =
s->streams[0]->id;
125 c->first_stream_id =
s->streams[0]->id;
136 if (st->
id ==
c->first_stream_id)
140 if (!ret && !
pkt->size)
141 c->update_extradata = 1;
191 .p.extensions =
"iamf",
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
#define i(width, name, range_min, range_max)
const char * avcodec_get_name(enum AVCodecID id)
Get the name of a codec.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int ff_iamf_write_descriptors(const IAMFContext *iamf, AVIOContext *pb, void *log_ctx)
int ff_iamf_write_audio_frame(const IAMFContext *iamf, AVIOContext *pb, unsigned audio_substream_id, const AVPacket *pkt)
int ff_iamf_add_mix_presentation(IAMFContext *iamf, const AVStreamGroup *stg, void *log_ctx)
int ff_iamf_add_audio_element(IAMFContext *iamf, const AVStreamGroup *stg, void *log_ctx)
int ff_iamf_write_parameter_blocks(const IAMFContext *iamf, AVIOContext *pb, const AVPacket *pkt, void *log_ctx)
static void iamf_deinit(AVFormatContext *s)
static int iamf_write_header(AVFormatContext *s)
static int iamf_write_packet(AVFormatContext *s, AVPacket *pkt)
static int iamf_write_trailer(AVFormatContext *s)
static const AVCodecTag iamf_codec_tags[]
static int iamf_init(AVFormatContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define MKTAG(a, b, c, d)
This structure stores compressed data.
enum AVStreamGroupParamsType type
Group type.
int id
Format-specific stream ID.
int64_t descriptors_offset