FFmpeg
Loading...
Searching...
No Matches
isom.c
Go to the documentation of this file.
1/*
2 * ISO Media common code
3 * Copyright (c) 2001 Fabrice Bellard
4 * Copyright (c) 2002 Francois Revol <revol@free.fr>
5 * Copyright (c) 2006 Baptiste Coudurier <baptiste.coudurier@free.fr>
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#include "avformat.h"
25#include "demux.h"
26#include "internal.h"
27#include "isom.h"
31
32/* http://www.mp4ra.org */
33/* ordered by muxing preference */
35 { AV_CODEC_ID_MOV_TEXT , 0x08 },
36 { AV_CODEC_ID_MPEG4 , 0x20 },
37 { AV_CODEC_ID_H264 , 0x21 },
38 { AV_CODEC_ID_HEVC , 0x23 },
39 { AV_CODEC_ID_VVC , 0x33 },
40 { AV_CODEC_ID_AAC , 0x40 },
41 { AV_CODEC_ID_MP4ALS , 0x40 }, /* 14496-3 ALS */
42 { AV_CODEC_ID_MPEG2VIDEO , 0x61 }, /* MPEG-2 Main */
43 { AV_CODEC_ID_MPEG2VIDEO , 0x60 }, /* MPEG-2 Simple */
44 { AV_CODEC_ID_MPEG2VIDEO , 0x62 }, /* MPEG-2 SNR */
45 { AV_CODEC_ID_MPEG2VIDEO , 0x63 }, /* MPEG-2 Spatial */
46 { AV_CODEC_ID_MPEG2VIDEO , 0x64 }, /* MPEG-2 High */
47 { AV_CODEC_ID_MPEG2VIDEO , 0x65 }, /* MPEG-2 422 */
48 { AV_CODEC_ID_AAC , 0x66 }, /* MPEG-2 AAC Main */
49 { AV_CODEC_ID_AAC , 0x67 }, /* MPEG-2 AAC Low */
50 { AV_CODEC_ID_AAC , 0x68 }, /* MPEG-2 AAC SSR */
51 { AV_CODEC_ID_MP3 , 0x69 }, /* 13818-3 */
52 { AV_CODEC_ID_MP2 , 0x69 }, /* 11172-3 */
53 { AV_CODEC_ID_MPEG1VIDEO , 0x6A }, /* 11172-2 */
54 { AV_CODEC_ID_MP3 , 0x6B }, /* 11172-3 */
55 { AV_CODEC_ID_MJPEG , 0x6C }, /* 10918-1 */
56 { AV_CODEC_ID_PNG , 0x6D },
57 { AV_CODEC_ID_JPEG2000 , 0x6E }, /* 15444-1 */
58 { AV_CODEC_ID_VC1 , 0xA3 },
59 { AV_CODEC_ID_DIRAC , 0xA4 },
60 { AV_CODEC_ID_AC3 , 0xA5 },
61 { AV_CODEC_ID_EAC3 , 0xA6 },
62 { AV_CODEC_ID_DTS , 0xA9 }, /* mp4ra.org */
63 { AV_CODEC_ID_OPUS , 0xAD }, /* mp4ra.org */
64 { AV_CODEC_ID_VP9 , 0xB1 }, /* mp4ra.org */
65 { AV_CODEC_ID_TSCC2 , 0xD0 }, /* nonstandard, camtasia uses it */
66 { AV_CODEC_ID_EVRC , 0xD1 }, /* nonstandard, pvAuthor uses it */
67 { AV_CODEC_ID_VORBIS , 0xDD }, /* nonstandard, gpac uses it */
68 { AV_CODEC_ID_DVD_SUBTITLE, 0xE0 }, /* nonstandard, see unsupported-embedded-subs-2.mp4 */
69 { AV_CODEC_ID_QCELP , 0xE1 },
72 { AV_CODEC_ID_NONE , 0 },
73};
74
76 { AV_CODEC_ID_MOV_TEXT, MKTAG('t', 'e', 'x', 't') },
77 { AV_CODEC_ID_MOV_TEXT, MKTAG('t', 'x', '3', 'g') },
78 { AV_CODEC_ID_EIA_608, MKTAG('c', '6', '0', '8') },
79 { AV_CODEC_ID_NONE, 0 },
80};
81
83 { AV_CODEC_ID_BIN_DATA, MKTAG('g', 'p', 'm', 'd') },
86 { AV_CODEC_ID_ITUT_T35, MKTAG('i', 't', '3', '5') },
87 { AV_CODEC_ID_NONE, 0 },
88};
89
90/* map numeric codes from mdhd atom to ISO 639 */
91/* cf. QTFileFormat.pdf p253, qtff.pdf p205 */
92/* http://developer.apple.com/documentation/mac/Text/Text-368.html */
93/* deprecated by putting the code as 3*5 bits ASCII */
94static const char mov_mdhd_language_map[][4] = {
95 "eng", /* 0 English */
96 "fra", /* 1 French */
97 "ger", /* 2 German */
98 "ita", /* 3 Italian */
99 "dut", /* 4 Dutch */
100 "sve", /* 5 Swedish */
101 "spa", /* 6 Spanish */
102 "dan", /* 7 Danish */
103 "por", /* 8 Portuguese */
104 "nor", /* 9 Norwegian */
105 "heb", /* 10 Hebrew */
106 "jpn", /* 11 Japanese */
107 "ara", /* 12 Arabic */
108 "fin", /* 13 Finnish */
109 "gre", /* 14 Greek */
110 "ice", /* 15 Icelandic */
111 "mlt", /* 16 Maltese */
112 "tur", /* 17 Turkish */
113 "hr ", /* 18 Croatian */
114 "chi", /* 19 Traditional Chinese */
115 "urd", /* 20 Urdu */
116 "hin", /* 21 Hindi */
117 "tha", /* 22 Thai */
118 "kor", /* 23 Korean */
119 "lit", /* 24 Lithuanian */
120 "pol", /* 25 Polish */
121 "hun", /* 26 Hungarian */
122 "est", /* 27 Estonian */
123 "lav", /* 28 Latvian */
124 "smi", /* 29 Sami */
125 "fo ", /* 30 Faroese */
126 "per", /* 31 Farsi */
127 "rus", /* 32 Russian */
128 "chi", /* 33 Simplified Chinese */
129 "", /* 34 Flemish */
130 "iri", /* 35 Irish */
131 "alb", /* 36 Albanian */
132 "ron", /* 37 Romanian */
133 "ces", /* 38 Czech */
134 "slk", /* 39 Slovak */
135 "slv", /* 40 Slovenian */
136 "yid", /* 41 Yiddish */
137 "sr ", /* 42 Serbian */
138 "mac", /* 43 Macedonian */
139 "bul", /* 44 Bulgarian */
140 "ukr", /* 45 Ukrainian */
141 "bel", /* 46 Belarusian */
142 "uzb", /* 47 Uzbek */
143 "kaz", /* 48 Kazakh */
144 "aze", /* 49 Azerbaijani */
145 "aze", /* 50 AzerbaijanAr */
146 "arm", /* 51 Armenian */
147 "geo", /* 52 Georgian */
148 "mol", /* 53 Moldavian */
149 "kir", /* 54 Kirghiz */
150 "tgk", /* 55 Tajiki */
151 "tuk", /* 56 Turkmen */
152 "mon", /* 57 Mongolian */
153 "", /* 58 MongolianCyr */
154 "pus", /* 59 Pashto */
155 "kur", /* 60 Kurdish */
156 "kas", /* 61 Kashmiri */
157 "snd", /* 62 Sindhi */
158 "tib", /* 63 Tibetan */
159 "nep", /* 64 Nepali */
160 "san", /* 65 Sanskrit */
161 "mar", /* 66 Marathi */
162 "ben", /* 67 Bengali */
163 "asm", /* 68 Assamese */
164 "guj", /* 69 Gujarati */
165 "pa ", /* 70 Punjabi */
166 "ori", /* 71 Oriya */
167 "mal", /* 72 Malayalam */
168 "kan", /* 73 Kannada */
169 "tam", /* 74 Tamil */
170 "tel", /* 75 Telugu */
171 "sin", /* 76 Sinhala */
172 "bur", /* 77 Burmese */
173 "khm", /* 78 Khmer */
174 "lao", /* 79 Lao */
175 "vie", /* 80 Vietnamese */
176 "ind", /* 81 Indonesian */
177 "tgl", /* 82 Tagalog */
178 "may", /* 83 MalayRoman */
179 "may", /* 84 MalayArabic */
180 "amh", /* 85 Amharic */
181 "tir", /* 86 Galla */
182 "orm", /* 87 Oromo */
183 "som", /* 88 Somali */
184 "swa", /* 89 Swahili */
185 "kin", /* 90 Kinyarwanda */
186 "run", /* 91 Rundi */
187 "nya", /* 92 Nyanja */
188 "mlg", /* 93 Malagasy */
189 "epo", /* 94 Esperanto */
190 "", /* 95 */
191 "", /* 96 */
192 "", /* 97 */
193 "", /* 98 */
194 "", /* 99 */
195 "", /* 100 */
196 "", /* 101 */
197 "", /* 102 */
198 "", /* 103 */
199 "", /* 104 */
200 "", /* 105 */
201 "", /* 106 */
202 "", /* 107 */
203 "", /* 108 */
204 "", /* 109 */
205 "", /* 110 */
206 "", /* 111 */
207 "", /* 112 */
208 "", /* 113 */
209 "", /* 114 */
210 "", /* 115 */
211 "", /* 116 */
212 "", /* 117 */
213 "", /* 118 */
214 "", /* 119 */
215 "", /* 120 */
216 "", /* 121 */
217 "", /* 122 */
218 "", /* 123 */
219 "", /* 124 */
220 "", /* 125 */
221 "", /* 126 */
222 "", /* 127 */
223 "wel", /* 128 Welsh */
224 "baq", /* 129 Basque */
225 "cat", /* 130 Catalan */
226 "lat", /* 131 Latin */
227 "que", /* 132 Quechua */
228 "grn", /* 133 Guarani */
229 "aym", /* 134 Aymara */
230 "tat", /* 135 Tatar */
231 "uig", /* 136 Uighur */
232 "dzo", /* 137 Dzongkha */
233 "jav", /* 138 JavaneseRom */
234};
235
236int ff_mov_iso639_to_lang(const char lang[4], int mp4)
237{
238 int i, code = 0;
239
240 /* old way, only for QT? */
241 for (i = 0; lang[0] && !mp4 && i < FF_ARRAY_ELEMS(mov_mdhd_language_map); i++) {
242 if (!strcmp(lang, mov_mdhd_language_map[i]))
243 return i;
244 }
245 /* XXX:can we do that in mov too? */
246 if (!mp4)
247 return -1;
248 /* handle undefined as such */
249 if (lang[0] == '\0')
250 lang = "und";
251 /* 5 bits ASCII */
252 for (i = 0; i < 3; i++) {
253 uint8_t c = lang[i];
254 c -= 0x60;
255 if (c > 0x1f)
256 return -1;
257 code <<= 5;
258 code |= c;
259 }
260 return code;
261}
262
263int ff_mov_lang_to_iso639(unsigned code, char to[4])
264{
265 int i;
266 memset(to, 0, 4);
267 /* is it the mangled iso code? */
268 /* see http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt */
269 if (code >= 0x400 && code != 0x7fff) {
270 for (i = 2; i >= 0; i--) {
271 to[i] = 0x60 + (code & 0x1f);
272 code >>= 5;
273 }
274 return 1;
275 }
276 /* old fashion apple lang code */
278 return 0;
280 return 0;
281 memcpy(to, mov_mdhd_language_map[code], 4);
282 return 1;
283}
284
286{
287 int len = 0;
288 int count = 4;
289 while (count--) {
290 int c = avio_r8(pb);
291 len = (len << 7) | (c & 0x7f);
292 if (!(c & 0x80))
293 break;
294 }
295 return len;
296}
297
298int ff_mp4_read_descr(void *logctx, AVIOContext *pb, int *tag)
299{
300 int len;
301 *tag = avio_r8(pb);
303 av_log(logctx, AV_LOG_TRACE, "MPEG-4 description: tag=0x%02x len=%d\n", *tag, len);
304 return len;
305}
306
308{
309 int flags;
310 if (es_id) *es_id = avio_rb16(pb);
311 else avio_rb16(pb);
312 flags = avio_r8(pb);
313 if (flags & 0x80) //streamDependenceFlag
314 avio_rb16(pb);
315 if (flags & 0x40) { //URL_Flag
316 int len = avio_r8(pb);
317 avio_skip(pb, len);
318 }
319 if (flags & 0x20) //OCRstreamFlag
320 avio_rb16(pb);
321}
322
323static const AVCodecTag mp4_audio_types[] = {
324 { AV_CODEC_ID_MP3ON4, AOT_PS }, /* old mp3on4 draft */
325 { AV_CODEC_ID_MP3ON4, AOT_L1 }, /* layer 1 */
326 { AV_CODEC_ID_MP3ON4, AOT_L2 }, /* layer 2 */
327 { AV_CODEC_ID_MP3ON4, AOT_L3 }, /* layer 3 */
328 { AV_CODEC_ID_MP4ALS, AOT_ALS }, /* MPEG-4 ALS */
330};
331
333{
334 enum AVCodecID codec_id;
335 int len, tag;
336 int ret;
337 int object_type_id = avio_r8(pb);
338 avio_r8(pb); /* stream type */
339 avio_rb24(pb); /* buffer size db */
340 avio_rb32(pb); /* rc_max_rate */
341
342 st->codecpar->bit_rate = avio_rb32(pb); /* avg bitrate */
343
344 codec_id= ff_codec_get_id(ff_mp4_obj_type, object_type_id);
345 if (codec_id)
347 av_log(logctx, AV_LOG_TRACE, "esds object type id 0x%02x\n", object_type_id);
348 len = ff_mp4_read_descr(logctx, pb, &tag);
350 av_log(logctx, AV_LOG_TRACE, "Specific MPEG-4 header len=%d\n", len);
351 /* As per 14496-3:2009 9.D.2.2, No decSpecificInfo is defined
352 for MPEG-1 Audio or MPEG-2 Audio; MPEG-2 AAC excluded. */
353 if (object_type_id == 0x69 || object_type_id == 0x6b)
354 return 0;
355 if (!len || (uint64_t)len > (1<<30))
356 return AVERROR_INVALIDDATA;
357 if ((ret = ff_get_extradata(logctx, st->codecpar, pb, len)) < 0)
358 return ret;
359 if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
360 MPEG4AudioConfig cfg = {0};
362 st->codecpar->extradata_size, 1, logctx);
363 if (ret < 0)
364 return ret;
365 if (cfg.channels != st->codecpar->ch_layout.nb_channels) {
368 st->codecpar->ch_layout.nb_channels = cfg.channels;
369 }
370 if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4
371 st->codecpar->sample_rate = ff_mpa_freq_tab[cfg.sampling_index];
372 else if (cfg.ext_sample_rate)
373 st->codecpar->sample_rate = cfg.ext_sample_rate;
374 else
375 st->codecpar->sample_rate = cfg.sample_rate;
376 switch (cfg.object_type) {
377 case AOT_AAC_MAIN:
378 case AOT_AAC_LC:
379 case AOT_AAC_SSR:
380 case AOT_AAC_LTP:
381 case AOT_ER_AAC_LC:
382 case AOT_ER_AAC_LD:
383 case AOT_ER_AAC_ELD:
384 case AOT_USAC:
385 st->codecpar->frame_size = cfg.frame_length;
386 break;
387 }
388 av_log(logctx, AV_LOG_TRACE, "mp4a config channels %d obj %d ext obj %d "
389 "sample rate %d ext sample rate %d frame_length %d\n", cfg.channels,
390 cfg.object_type, cfg.ext_object_type,
391 cfg.sample_rate, cfg.ext_sample_rate,
392 cfg.frame_length);
394 cfg.object_type)))
396 }
397 }
398 return 0;
399}
400
405
407 { AV_CH_LAYOUT_MONO, (100<<16) | 1}, // kCAFChannelLayoutTag_Mono
408 { AV_CH_LAYOUT_STEREO, (101<<16) | 2}, // kCAFChannelLayoutTag_Stereo
409 { AV_CH_LAYOUT_STEREO, (102<<16) | 2}, // kCAFChannelLayoutTag_StereoHeadphones
410 { AV_CH_LAYOUT_2_1, (131<<16) | 3}, // kCAFChannelLayoutTag_ITU_2_1
411 { AV_CH_LAYOUT_QUAD, (132<<16) | 4}, // kCAFChannelLayoutTag_ITU_2_2
412 { AV_CH_LAYOUT_2_2, (132<<16) | 4}, // kCAFChannelLayoutTag_ITU_2_2
413 { AV_CH_LAYOUT_QUAD, (108<<16) | 4}, // kCAFChannelLayoutTag_Quadraphonic
414 { AV_CH_LAYOUT_SURROUND, (113<<16) | 3}, // kCAFChannelLayoutTag_MPEG_3_0_A
415 { AV_CH_LAYOUT_4POINT0, (115<<16) | 4}, // kCAFChannelLayoutTag_MPEG_4_0_A
416 { AV_CH_LAYOUT_5POINT0_BACK, (117<<16) | 5}, // kCAFChannelLayoutTag_MPEG_5_0_A
417 { AV_CH_LAYOUT_5POINT0, (117<<16) | 5}, // kCAFChannelLayoutTag_MPEG_5_0_A
418 { AV_CH_LAYOUT_5POINT1_BACK, (121<<16) | 6}, // kCAFChannelLayoutTag_MPEG_5_1_A
419 { AV_CH_LAYOUT_5POINT1, (121<<16) | 6}, // kCAFChannelLayoutTag_MPEG_5_1_A
420 { AV_CH_LAYOUT_7POINT1, (128<<16) | 8}, // kCAFChannelLayoutTag_MPEG_7_1_C
421 { AV_CH_LAYOUT_7POINT1_WIDE, (126<<16) | 8}, // kCAFChannelLayoutTag_MPEG_7_1_A
422 { AV_CH_LAYOUT_5POINT1_BACK|AV_CH_LAYOUT_STEREO_DOWNMIX, (130<<16) | 8}, // kCAFChannelLayoutTag_SMPTE_DTV
423 { AV_CH_LAYOUT_2POINT1, (133<<16) | 3}, // kCAFChannelLayoutTag_DVD_4
424 { AV_CH_LAYOUT_2_1|AV_CH_LOW_FREQUENCY, (134<<16) | 4}, // kCAFChannelLayoutTag_DVD_5
425 { AV_CH_LAYOUT_QUAD|AV_CH_LOW_FREQUENCY, (135<<16) | 4}, // kCAFChannelLayoutTag_DVD_6
426 { AV_CH_LAYOUT_2_2|AV_CH_LOW_FREQUENCY, (135<<16) | 4}, // kCAFChannelLayoutTag_DVD_6
427 { AV_CH_LAYOUT_3POINT1, (136<<16) | 4}, // kCAFChannelLayoutTag_DVD_10
428 { AV_CH_LAYOUT_4POINT1, (137<<16) | 5}, // kCAFChannelLayoutTag_DVD_11
429 { 0, 0},
430};
431
432void ff_mov_write_chan(AVIOContext *pb, int64_t channel_layout)
433{
435 uint32_t layout_tag = 0;
436
437 for (layouts = mov_channel_layout; layouts->channel_layout; layouts++)
438 if (channel_layout == layouts->channel_layout) {
439 layout_tag = layouts->layout_tag;
440 break;
441 }
442
443 if (layout_tag) {
444 avio_wb32(pb, layout_tag); // mChannelLayoutTag
445 avio_wb32(pb, 0); // mChannelBitmap
446 } else {
447 avio_wb32(pb, 0x10000); // kCAFChannelLayoutTag_UseChannelBitmap
448 avio_wb32(pb, channel_layout);
449 }
450 avio_wb32(pb, 0); // mNumberChannelDescriptions
451}
452
455 "caption" },
457 "commentary" },
459 "description" },
461 "dub" },
463 "forced-subtitle" },
464 { 0, NULL }
465};
466
468 { "urn:mpeg:dash:role:2011", dash_role_map },
469 { 0, NULL }
470};
Main libavformat public API header.
#define AV_DISPOSITION_HEARING_IMPAIRED
The stream is intended for hearing impaired audiences.
Definition avformat.h:678
#define AV_DISPOSITION_COMMENT
The stream is a commentary track.
Definition avformat.h:659
#define AV_DISPOSITION_CAPTIONS
The subtitle stream contains captions, providing a transcription and possibly a translation of audio.
Definition avformat.h:712
#define AV_DISPOSITION_DUB
The stream is not in original language.
Definition avformat.h:649
#define AV_DISPOSITION_FORCED
Track should be used during playback by default.
Definition avformat.h:674
#define AV_DISPOSITION_VISUAL_IMPAIRED
The stream is intended for visually impaired audiences.
Definition avformat.h:682
#define AV_DISPOSITION_DESCRIPTIONS
The subtitle stream contains a textual description of the video content.
Definition avformat.h:718
void avio_wb32(AVIOContext *s, unsigned int val)
Definition aviobuf.c:368
unsigned int avio_rb16(AVIOContext *s)
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition aviobuf.c:321
unsigned int avio_rb24(AVIOContext *s)
unsigned int avio_rb32(AVIOContext *s)
int avio_r8(AVIOContext *s)
Definition aviobuf.c:611
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define i(width, name, range_min, range_max)
Definition cbs_h264.c:63
Public libavutil channel layout APIs header.
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
int ff_get_extradata(void *logctx, AVCodecParameters *par, AVIOContext *pb, int size)
Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end which is always set to 0 and f...
static CheckasmConfig cfg
Definition checkasm.c:74
int ret
Definition ffplay.c:391
#define AV_CH_LAYOUT_2POINT1
#define AV_CH_LAYOUT_QUAD
#define AV_CH_LAYOUT_4POINT0
#define AV_CH_LAYOUT_5POINT0
#define AV_CH_LAYOUT_7POINT1
#define AV_CH_LAYOUT_STEREO_DOWNMIX
#define AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_2_2
#define AV_CH_LAYOUT_SURROUND
#define AV_CH_LAYOUT_7POINT1_WIDE
#define AV_CH_LAYOUT_5POINT0_BACK
#define AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_5POINT1
#define AV_CH_LAYOUT_4POINT1
#define AV_CH_LAYOUT_2_1
#define AV_CH_LAYOUT_3POINT1
#define AV_CH_LAYOUT_5POINT1_BACK
#define AV_CH_LOW_FREQUENCY
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition codec_id.h:47
@ AV_CODEC_ID_DIRAC
Definition codec_id.h:166
@ AV_CODEC_ID_VORBIS
Definition codec_id.h:464
@ AV_CODEC_ID_PNG
Definition codec_id.h:111
@ AV_CODEC_ID_EAC3
Definition codec_id.h:499
@ AV_CODEC_ID_DVD_SUBTITLE
Definition codec_id.h:572
@ AV_CODEC_ID_MP4ALS
Definition codec_id.h:504
@ AV_CODEC_ID_H264
Definition codec_id.h:77
@ AV_CODEC_ID_NONE
Definition codec_id.h:48
@ AV_CODEC_ID_EVRC
Definition codec_id.h:530
@ AV_CODEC_ID_JPEG2000
Definition codec_id.h:138
@ AV_CODEC_ID_VVC
Definition codec_id.h:247
@ AV_CODEC_ID_VC1
Definition codec_id.h:120
@ AV_CODEC_ID_EIA_608
Definition codec_id.h:582
@ AV_CODEC_ID_MP2
Definition codec_id.h:459
@ AV_CODEC_ID_DTS
Definition codec_id.h:463
@ AV_CODEC_ID_HEVC
Definition codec_id.h:223
@ AV_CODEC_ID_BIN_DATA
Definition codec_id.h:613
@ AV_CODEC_ID_AAC
Definition codec_id.h:461
@ AV_CODEC_ID_QCELP
Definition codec_id.h:483
@ AV_CODEC_ID_AC3
Definition codec_id.h:462
@ AV_CODEC_ID_MP3ON4
Definition codec_id.h:473
@ AV_CODEC_ID_TSCC2
Definition codec_id.h:213
@ AV_CODEC_ID_MPEG4
Definition codec_id.h:62
@ AV_CODEC_ID_MJPEG
Definition codec_id.h:57
@ AV_CODEC_ID_MPEG4SYSTEMS
FAKE codec to indicate a MPEG-4 Systems stream (only used by libavformat)
Definition codec_id.h:624
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition codec_id.h:460
@ AV_CODEC_ID_VP9
Definition codec_id.h:217
@ AV_CODEC_ID_MPEG1VIDEO
Definition codec_id.h:51
@ AV_CODEC_ID_OPUS
Definition codec_id.h:519
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
Definition codec_id.h:52
@ AV_CODEC_ID_ITUT_T35
Definition codec_id.h:617
@ AV_CODEC_ID_MOV_TEXT
Definition codec_id.h:577
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition error.h:61
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition log.h:236
void ff_mp4_parse_es_descr(AVIOContext *pb, int *es_id)
Definition isom.c:307
int ff_mp4_read_descr_len(AVIOContext *pb)
Definition isom.c:285
int ff_mp4_read_dec_config_descr(void *logctx, AVStream *st, AVIOContext *pb)
Definition isom.c:332
int ff_mp4_read_descr(void *logctx, AVIOContext *pb, int *tag)
Definition isom.c:298
const AVCodecTag ff_mp4_obj_type[]
Definition isom.c:34
int ff_mov_iso639_to_lang(const char lang[4], int mp4)
Definition isom.c:236
static const char mov_mdhd_language_map[][4]
Definition isom.c:94
int ff_mov_lang_to_iso639(unsigned code, char to[4])
Definition isom.c:263
static const struct MP4TrackKindValueMapping dash_role_map[]
Definition isom.c:453
static const AVCodecTag mp4_audio_types[]
Definition isom.c:323
void ff_mov_write_chan(AVIOContext *pb, int64_t channel_layout)
Definition isom.c:432
const AVCodecTag ff_codec_movdata_tags[]
Definition isom.c:82
const struct MP4TrackKindMapping ff_mov_track_kind_table[]
Definition isom.c:467
static const MovChannelLayout mov_channel_layout[]
Definition isom.c:406
const AVCodecTag ff_codec_movsubtitle_tags[]
Definition isom.c:75
#define MOV_MP4_DBGI_TAG
Definition isom.h:513
#define MOV_MP4_DJMD_TAG
Definition isom.h:512
#define MP4DecSpecificDescrTag
Definition isom.h:417
const char * to
Definition webvttdec.c:37
enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
Definition utils.c:143
#define MKTAG(a, b, c, d)
Definition macros.h:55
enum MovChannelLayoutTag * layouts
Definition mov_chan.c:335
uint32_t tag
Definition movenc.c:2157
int avpriv_mpeg4audio_get_config2(MPEG4AudioConfig *c, const uint8_t *buf, int size, int sync_extension, void *logctx)
Parse MPEG-4 systems extradata from a raw buffer to retrieve audio configuration.
Definition mpeg4audio.c:230
@ AOT_ALS
Y Audio LosslesS.
Definition mpeg4audio.h:108
@ AOT_L3
Y Layer 3.
Definition mpeg4audio.h:106
@ AOT_AAC_LTP
Y Long Term Prediction.
Definition mpeg4audio.h:77
@ AOT_ER_AAC_LD
N Error Resilient Low Delay.
Definition mpeg4audio.h:95
@ AOT_ER_AAC_ELD
N Error Resilient Enhanced Low Delay.
Definition mpeg4audio.h:111
@ AOT_ER_AAC_LC
N Error Resilient Low Complexity.
Definition mpeg4audio.h:89
@ AOT_L2
Y Layer 2.
Definition mpeg4audio.h:105
@ AOT_USAC
Y Unified Speech and Audio Coding.
Definition mpeg4audio.h:114
@ AOT_L1
Y Layer 1.
Definition mpeg4audio.h:104
@ AOT_AAC_SSR
N (code in SoC repo) Scalable Sample Rate.
Definition mpeg4audio.h:76
@ AOT_AAC_LC
Y Low Complexity.
Definition mpeg4audio.h:75
@ AOT_NULL
Definition mpeg4audio.h:72
@ AOT_PS
N Parametric Stereo.
Definition mpeg4audio.h:101
@ AOT_AAC_MAIN
Y Main.
Definition mpeg4audio.h:74
mpeg audio layer common tables.
const uint16_t ff_mpa_freq_tab[3]
#define FF_ARRAY_ELEMS(a)
const uint8_t * code
Definition spdifenc.c:433
enum AVChannelOrder order
Channel order used in this layout.
int nb_channels
Number of channels in this layout.
int extradata_size
Size of the extradata content in bytes.
Definition codec_par.h:75
int frame_size
Audio frame size, if known.
Definition codec_par.h:227
AVChannelLayout ch_layout
The channel layout and number of channels.
Definition codec_par.h:207
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition codec_par.h:99
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition codec_par.h:71
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition codec_par.h:57
int sample_rate
The number of audio samples per second.
Definition codec_par.h:213
Bytestream IO Context.
Definition avio.h:160
Stream structure.
Definition avformat.h:768
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition avformat.h:791
uint32_t layout_tag
Definition isom.c:403
int64_t channel_layout
Definition isom.c:402
#define av_log(a,...)
enum AVCodecID codec_id
int len
static double c[64]