FFmpeg
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"
28 #include "libavcodec/mpeg4audio.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_AAC , 0x40 },
40  { AV_CODEC_ID_MP4ALS , 0x40 }, /* 14496-3 ALS */
41  { AV_CODEC_ID_MPEG2VIDEO , 0x61 }, /* MPEG-2 Main */
42  { AV_CODEC_ID_MPEG2VIDEO , 0x60 }, /* MPEG-2 Simple */
43  { AV_CODEC_ID_MPEG2VIDEO , 0x62 }, /* MPEG-2 SNR */
44  { AV_CODEC_ID_MPEG2VIDEO , 0x63 }, /* MPEG-2 Spatial */
45  { AV_CODEC_ID_MPEG2VIDEO , 0x64 }, /* MPEG-2 High */
46  { AV_CODEC_ID_MPEG2VIDEO , 0x65 }, /* MPEG-2 422 */
47  { AV_CODEC_ID_AAC , 0x66 }, /* MPEG-2 AAC Main */
48  { AV_CODEC_ID_AAC , 0x67 }, /* MPEG-2 AAC Low */
49  { AV_CODEC_ID_AAC , 0x68 }, /* MPEG-2 AAC SSR */
50  { AV_CODEC_ID_MP3 , 0x69 }, /* 13818-3 */
51  { AV_CODEC_ID_MP2 , 0x69 }, /* 11172-3 */
52  { AV_CODEC_ID_MPEG1VIDEO , 0x6A }, /* 11172-2 */
53  { AV_CODEC_ID_MP3 , 0x6B }, /* 11172-3 */
54  { AV_CODEC_ID_MJPEG , 0x6C }, /* 10918-1 */
55  { AV_CODEC_ID_PNG , 0x6D },
56  { AV_CODEC_ID_JPEG2000 , 0x6E }, /* 15444-1 */
57  { AV_CODEC_ID_VC1 , 0xA3 },
58  { AV_CODEC_ID_DIRAC , 0xA4 },
59  { AV_CODEC_ID_AC3 , 0xA5 },
60  { AV_CODEC_ID_EAC3 , 0xA6 },
61  { AV_CODEC_ID_DTS , 0xA9 }, /* mp4ra.org */
62  { AV_CODEC_ID_OPUS , 0xAD }, /* mp4ra.org */
63  { AV_CODEC_ID_VP9 , 0xB1 }, /* mp4ra.org */
64  { AV_CODEC_ID_FLAC , 0xC1 }, /* nonstandard, update when there is a standard value */
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 },
70  { AV_CODEC_ID_MPEG4SYSTEMS, 0x01 },
71  { AV_CODEC_ID_MPEG4SYSTEMS, 0x02 },
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') },
84  { AV_CODEC_ID_NONE, 0 },
85 };
86 
87 /* map numeric codes from mdhd atom to ISO 639 */
88 /* cf. QTFileFormat.pdf p253, qtff.pdf p205 */
89 /* http://developer.apple.com/documentation/mac/Text/Text-368.html */
90 /* deprecated by putting the code as 3*5 bits ASCII */
91 static const char mov_mdhd_language_map[][4] = {
92  "eng", /* 0 English */
93  "fra", /* 1 French */
94  "ger", /* 2 German */
95  "ita", /* 3 Italian */
96  "dut", /* 4 Dutch */
97  "sve", /* 5 Swedish */
98  "spa", /* 6 Spanish */
99  "dan", /* 7 Danish */
100  "por", /* 8 Portuguese */
101  "nor", /* 9 Norwegian */
102  "heb", /* 10 Hebrew */
103  "jpn", /* 11 Japanese */
104  "ara", /* 12 Arabic */
105  "fin", /* 13 Finnish */
106  "gre", /* 14 Greek */
107  "ice", /* 15 Icelandic */
108  "mlt", /* 16 Maltese */
109  "tur", /* 17 Turkish */
110  "hr ", /* 18 Croatian */
111  "chi", /* 19 Traditional Chinese */
112  "urd", /* 20 Urdu */
113  "hin", /* 21 Hindi */
114  "tha", /* 22 Thai */
115  "kor", /* 23 Korean */
116  "lit", /* 24 Lithuanian */
117  "pol", /* 25 Polish */
118  "hun", /* 26 Hungarian */
119  "est", /* 27 Estonian */
120  "lav", /* 28 Latvian */
121  "smi", /* 29 Sami */
122  "fo ", /* 30 Faroese */
123  "per", /* 31 Farsi */
124  "rus", /* 32 Russian */
125  "chi", /* 33 Simplified Chinese */
126  "", /* 34 Flemish */
127  "iri", /* 35 Irish */
128  "alb", /* 36 Albanian */
129  "ron", /* 37 Romanian */
130  "ces", /* 38 Czech */
131  "slk", /* 39 Slovak */
132  "slv", /* 40 Slovenian */
133  "yid", /* 41 Yiddish */
134  "sr ", /* 42 Serbian */
135  "mac", /* 43 Macedonian */
136  "bul", /* 44 Bulgarian */
137  "ukr", /* 45 Ukrainian */
138  "bel", /* 46 Belarusian */
139  "uzb", /* 47 Uzbek */
140  "kaz", /* 48 Kazakh */
141  "aze", /* 49 Azerbaijani */
142  "aze", /* 50 AzerbaijanAr */
143  "arm", /* 51 Armenian */
144  "geo", /* 52 Georgian */
145  "mol", /* 53 Moldavian */
146  "kir", /* 54 Kirghiz */
147  "tgk", /* 55 Tajiki */
148  "tuk", /* 56 Turkmen */
149  "mon", /* 57 Mongolian */
150  "", /* 58 MongolianCyr */
151  "pus", /* 59 Pashto */
152  "kur", /* 60 Kurdish */
153  "kas", /* 61 Kashmiri */
154  "snd", /* 62 Sindhi */
155  "tib", /* 63 Tibetan */
156  "nep", /* 64 Nepali */
157  "san", /* 65 Sanskrit */
158  "mar", /* 66 Marathi */
159  "ben", /* 67 Bengali */
160  "asm", /* 68 Assamese */
161  "guj", /* 69 Gujarati */
162  "pa ", /* 70 Punjabi */
163  "ori", /* 71 Oriya */
164  "mal", /* 72 Malayalam */
165  "kan", /* 73 Kannada */
166  "tam", /* 74 Tamil */
167  "tel", /* 75 Telugu */
168  "sin", /* 76 Sinhala */
169  "bur", /* 77 Burmese */
170  "khm", /* 78 Khmer */
171  "lao", /* 79 Lao */
172  "vie", /* 80 Vietnamese */
173  "ind", /* 81 Indonesian */
174  "tgl", /* 82 Tagalog */
175  "may", /* 83 MalayRoman */
176  "may", /* 84 MalayArabic */
177  "amh", /* 85 Amharic */
178  "tir", /* 86 Galla */
179  "orm", /* 87 Oromo */
180  "som", /* 88 Somali */
181  "swa", /* 89 Swahili */
182  "kin", /* 90 Kinyarwanda */
183  "run", /* 91 Rundi */
184  "nya", /* 92 Nyanja */
185  "mlg", /* 93 Malagasy */
186  "epo", /* 94 Esperanto */
187  "", /* 95 */
188  "", /* 96 */
189  "", /* 97 */
190  "", /* 98 */
191  "", /* 99 */
192  "", /* 100 */
193  "", /* 101 */
194  "", /* 102 */
195  "", /* 103 */
196  "", /* 104 */
197  "", /* 105 */
198  "", /* 106 */
199  "", /* 107 */
200  "", /* 108 */
201  "", /* 109 */
202  "", /* 110 */
203  "", /* 111 */
204  "", /* 112 */
205  "", /* 113 */
206  "", /* 114 */
207  "", /* 115 */
208  "", /* 116 */
209  "", /* 117 */
210  "", /* 118 */
211  "", /* 119 */
212  "", /* 120 */
213  "", /* 121 */
214  "", /* 122 */
215  "", /* 123 */
216  "", /* 124 */
217  "", /* 125 */
218  "", /* 126 */
219  "", /* 127 */
220  "wel", /* 128 Welsh */
221  "baq", /* 129 Basque */
222  "cat", /* 130 Catalan */
223  "lat", /* 131 Latin */
224  "que", /* 132 Quechua */
225  "grn", /* 133 Guarani */
226  "aym", /* 134 Aymara */
227  "tat", /* 135 Tatar */
228  "uig", /* 136 Uighur */
229  "dzo", /* 137 Dzongkha */
230  "jav", /* 138 JavaneseRom */
231 };
232 
233 int ff_mov_iso639_to_lang(const char lang[4], int mp4)
234 {
235  int i, code = 0;
236 
237  /* old way, only for QT? */
238  for (i = 0; lang[0] && !mp4 && i < FF_ARRAY_ELEMS(mov_mdhd_language_map); i++) {
239  if (!strcmp(lang, mov_mdhd_language_map[i]))
240  return i;
241  }
242  /* XXX:can we do that in mov too? */
243  if (!mp4)
244  return -1;
245  /* handle undefined as such */
246  if (lang[0] == '\0')
247  lang = "und";
248  /* 5 bits ASCII */
249  for (i = 0; i < 3; i++) {
250  uint8_t c = lang[i];
251  c -= 0x60;
252  if (c > 0x1f)
253  return -1;
254  code <<= 5;
255  code |= c;
256  }
257  return code;
258 }
259 
260 int ff_mov_lang_to_iso639(unsigned code, char to[4])
261 {
262  int i;
263  memset(to, 0, 4);
264  /* is it the mangled iso code? */
265  /* see http://www.geocities.com/xhelmboyx/quicktime/formats/mp4-layout.txt */
266  if (code >= 0x400 && code != 0x7fff) {
267  for (i = 2; i >= 0; i--) {
268  to[i] = 0x60 + (code & 0x1f);
269  code >>= 5;
270  }
271  return 1;
272  }
273  /* old fashion apple lang code */
275  return 0;
276  if (!mov_mdhd_language_map[code][0])
277  return 0;
278  memcpy(to, mov_mdhd_language_map[code], 4);
279  return 1;
280 }
281 
283 {
284  int len = 0;
285  int count = 4;
286  while (count--) {
287  int c = avio_r8(pb);
288  len = (len << 7) | (c & 0x7f);
289  if (!(c & 0x80))
290  break;
291  }
292  return len;
293 }
294 
296 {
297  int len;
298  *tag = avio_r8(pb);
300  av_log(fc, AV_LOG_TRACE, "MPEG-4 description: tag=0x%02x len=%d\n", *tag, len);
301  return len;
302 }
303 
304 void ff_mp4_parse_es_descr(AVIOContext *pb, int *es_id)
305 {
306  int flags;
307  if (es_id) *es_id = avio_rb16(pb);
308  else avio_rb16(pb);
309  flags = avio_r8(pb);
310  if (flags & 0x80) //streamDependenceFlag
311  avio_rb16(pb);
312  if (flags & 0x40) { //URL_Flag
313  int len = avio_r8(pb);
314  avio_skip(pb, len);
315  }
316  if (flags & 0x20) //OCRstreamFlag
317  avio_rb16(pb);
318 }
319 
320 static const AVCodecTag mp4_audio_types[] = {
321  { AV_CODEC_ID_MP3ON4, AOT_PS }, /* old mp3on4 draft */
322  { AV_CODEC_ID_MP3ON4, AOT_L1 }, /* layer 1 */
323  { AV_CODEC_ID_MP3ON4, AOT_L2 }, /* layer 2 */
324  { AV_CODEC_ID_MP3ON4, AOT_L3 }, /* layer 3 */
325  { AV_CODEC_ID_MP4ALS, AOT_ALS }, /* MPEG-4 ALS */
327 };
328 
330 {
331  enum AVCodecID codec_id;
332  int len, tag;
333  int ret;
334  int object_type_id = avio_r8(pb);
335  avio_r8(pb); /* stream type */
336  avio_rb24(pb); /* buffer size db */
337  avio_rb32(pb); /* rc_max_rate */
338 
339  st->codecpar->bit_rate = avio_rb32(pb); /* avg bitrate */
340 
341  codec_id= ff_codec_get_id(ff_mp4_obj_type, object_type_id);
342  if (codec_id)
343  st->codecpar->codec_id = codec_id;
344  av_log(fc, AV_LOG_TRACE, "esds object type id 0x%02x\n", object_type_id);
345  len = ff_mp4_read_descr(fc, pb, &tag);
346  if (tag == MP4DecSpecificDescrTag) {
347  av_log(fc, AV_LOG_TRACE, "Specific MPEG-4 header len=%d\n", len);
348  /* As per 14496-3:2009 9.D.2.2, No decSpecificInfo is defined
349  for MPEG-1 Audio or MPEG-2 Audio; MPEG-2 AAC excluded. */
350  if (object_type_id == 0x69 || object_type_id == 0x6b)
351  return 0;
352  if (!len || (uint64_t)len > (1<<30))
353  return AVERROR_INVALIDDATA;
354  if ((ret = ff_get_extradata(fc, st->codecpar, pb, len)) < 0)
355  return ret;
356  if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
357  MPEG4AudioConfig cfg = {0};
359  st->codecpar->extradata_size, 1, fc);
360  if (ret < 0)
361  return ret;
364  if (cfg.object_type == 29 && cfg.sampling_index < 3) // old mp3on4
366  else if (cfg.ext_sample_rate)
368  else
369  st->codecpar->sample_rate = cfg.sample_rate;
370  av_log(fc, AV_LOG_TRACE, "mp4a config channels %d obj %d ext obj %d "
371  "sample rate %d ext sample rate %d\n", cfg.channels,
372  cfg.object_type, cfg.ext_object_type,
373  cfg.sample_rate, cfg.ext_sample_rate);
375  cfg.object_type)))
377  }
378  }
379  return 0;
380 }
381 
382 typedef struct MovChannelLayout {
383  int64_t channel_layout;
384  uint32_t layout_tag;
386 
388  { AV_CH_LAYOUT_MONO, (100<<16) | 1}, // kCAFChannelLayoutTag_Mono
389  { AV_CH_LAYOUT_STEREO, (101<<16) | 2}, // kCAFChannelLayoutTag_Stereo
390  { AV_CH_LAYOUT_STEREO, (102<<16) | 2}, // kCAFChannelLayoutTag_StereoHeadphones
391  { AV_CH_LAYOUT_2_1, (131<<16) | 3}, // kCAFChannelLayoutTag_ITU_2_1
392  { AV_CH_LAYOUT_QUAD, (132<<16) | 4}, // kCAFChannelLayoutTag_ITU_2_2
393  { AV_CH_LAYOUT_2_2, (132<<16) | 4}, // kCAFChannelLayoutTag_ITU_2_2
394  { AV_CH_LAYOUT_QUAD, (108<<16) | 4}, // kCAFChannelLayoutTag_Quadraphonic
395  { AV_CH_LAYOUT_SURROUND, (113<<16) | 3}, // kCAFChannelLayoutTag_MPEG_3_0_A
396  { AV_CH_LAYOUT_4POINT0, (115<<16) | 4}, // kCAFChannelLayoutTag_MPEG_4_0_A
397  { AV_CH_LAYOUT_5POINT0_BACK, (117<<16) | 5}, // kCAFChannelLayoutTag_MPEG_5_0_A
398  { AV_CH_LAYOUT_5POINT0, (117<<16) | 5}, // kCAFChannelLayoutTag_MPEG_5_0_A
399  { AV_CH_LAYOUT_5POINT1_BACK, (121<<16) | 6}, // kCAFChannelLayoutTag_MPEG_5_1_A
400  { AV_CH_LAYOUT_5POINT1, (121<<16) | 6}, // kCAFChannelLayoutTag_MPEG_5_1_A
401  { AV_CH_LAYOUT_7POINT1, (128<<16) | 8}, // kCAFChannelLayoutTag_MPEG_7_1_C
402  { AV_CH_LAYOUT_7POINT1_WIDE, (126<<16) | 8}, // kCAFChannelLayoutTag_MPEG_7_1_A
403  { AV_CH_LAYOUT_5POINT1_BACK|AV_CH_LAYOUT_STEREO_DOWNMIX, (130<<16) | 8}, // kCAFChannelLayoutTag_SMPTE_DTV
404  { AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY, (133<<16) | 3}, // kCAFChannelLayoutTag_DVD_4
405  { AV_CH_LAYOUT_2_1|AV_CH_LOW_FREQUENCY, (134<<16) | 4}, // kCAFChannelLayoutTag_DVD_5
406  { AV_CH_LAYOUT_QUAD|AV_CH_LOW_FREQUENCY, (135<<16) | 4}, // kCAFChannelLayoutTag_DVD_6
407  { AV_CH_LAYOUT_2_2|AV_CH_LOW_FREQUENCY, (135<<16) | 4}, // kCAFChannelLayoutTag_DVD_6
408  { AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY, (136<<16) | 4}, // kCAFChannelLayoutTag_DVD_10
409  { AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY, (137<<16) | 5}, // kCAFChannelLayoutTag_DVD_11
410  { 0, 0},
411 };
412 
413 void ff_mov_write_chan(AVIOContext *pb, int64_t channel_layout)
414 {
415  const MovChannelLayout *layouts;
416  uint32_t layout_tag = 0;
417 
418  for (layouts = mov_channel_layout; layouts->channel_layout; layouts++)
419  if (channel_layout == layouts->channel_layout) {
420  layout_tag = layouts->layout_tag;
421  break;
422  }
423 
424  if (layout_tag) {
425  avio_wb32(pb, layout_tag); // mChannelLayoutTag
426  avio_wb32(pb, 0); // mChannelBitmap
427  } else {
428  avio_wb32(pb, 0x10000); // kCAFChannelLayoutTag_UseChannelBitmap
429  avio_wb32(pb, channel_layout);
430  }
431  avio_wb32(pb, 0); // mNumberChannelDescriptions
432 }
433 
434 static const struct MP4TrackKindValueMapping dash_role_map[] = {
436  "caption" },
438  "commentary" },
440  "description" },
442  "dub" },
444  "forced-subtitle" },
445  { 0, NULL }
446 };
447 
449  { "urn:mpeg:dash:role:2011", dash_role_map },
450  { 0, NULL }
451 };
AV_CODEC_ID_EIA_608
@ AV_CODEC_ID_EIA_608
Definition: codec_id.h:536
AVCodecParameters::extradata
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: codec_par.h:75
AV_CH_LAYOUT_5POINT0_BACK
#define AV_CH_LAYOUT_5POINT0_BACK
Definition: channel_layout.h:216
AV_CODEC_ID_AC3
@ AV_CODEC_ID_AC3
Definition: codec_id.h:429
ff_mp4_obj_type
const AVCodecTag ff_mp4_obj_type[]
Definition: isom.c:34
layouts
enum MovChannelLayoutTag * layouts
Definition: mov_chan.c:330
MovChannelLayout::layout_tag
uint32_t layout_tag
Definition: isom.c:384
AOT_PS
@ AOT_PS
N Parametric Stereo.
Definition: mpeg4audio.h:101
AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_MONO
Definition: channel_layout.h:204
AV_CODEC_ID_DIRAC
@ AV_CODEC_ID_DIRAC
Definition: codec_id.h:166
AV_CODEC_ID_MP3ON4
@ AV_CODEC_ID_MP3ON4
Definition: codec_id.h:440
AOT_L1
@ AOT_L1
Y Layer 1.
Definition: mpeg4audio.h:104
AV_CODEC_ID_MPEG4
@ AV_CODEC_ID_MPEG4
Definition: codec_id.h:62
ff_mp4_read_dec_config_descr
int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb)
Definition: isom.c:329
fc
#define fc(width, name, range_min, range_max)
Definition: cbs_av1.c:551
AV_CODEC_ID_FLAC
@ AV_CODEC_ID_FLAC
Definition: codec_id.h:438
AVChannelLayout::order
enum AVChannelOrder order
Channel order used in this layout.
Definition: channel_layout.h:295
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:300
AV_CODEC_ID_BIN_DATA
@ AV_CODEC_ID_BIN_DATA
Definition: codec_id.h:566
ff_mov_lang_to_iso639
int ff_mov_lang_to_iso639(unsigned code, char to[4])
Definition: isom.c:260
ff_get_extradata
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...
Definition: demux_utils.c:355
MPEG4AudioConfig
Definition: mpeg4audio.h:32
mpeg4audio.h
MP4DecSpecificDescrTag
#define MP4DecSpecificDescrTag
Definition: isom.h:332
AV_DISPOSITION_FORCED
#define AV_DISPOSITION_FORCED
Track should be used during playback by default.
Definition: avformat.h:859
AV_CODEC_ID_MP3
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition: codec_id.h:427
AV_CH_LAYOUT_STEREO
#define AV_CH_LAYOUT_STEREO
Definition: channel_layout.h:205
AV_CH_LAYOUT_QUAD
#define AV_CH_LAYOUT_QUAD
Definition: channel_layout.h:213
MovChannelLayout::channel_layout
int64_t channel_layout
Definition: isom.c:383
ff_mp4_parse_es_descr
void ff_mp4_parse_es_descr(AVIOContext *pb, int *es_id)
Definition: isom.c:304
avio_rb32
unsigned int avio_rb32(AVIOContext *s)
Definition: aviobuf.c:790
AV_LOG_TRACE
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition: log.h:206
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
AVCodecTag
Definition: internal.h:50
AV_CH_LOW_FREQUENCY
#define AV_CH_LOW_FREQUENCY
Definition: channel_layout.h:161
AV_CODEC_ID_MPEG4SYSTEMS
@ AV_CODEC_ID_MPEG4SYSTEMS
FAKE codec to indicate a MPEG-4 Systems stream (only used by libavformat)
Definition: codec_id.h:573
avpriv_mpeg4audio_get_config2
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:165
AV_CHANNEL_ORDER_UNSPEC
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
Definition: channel_layout.h:106
AV_CODEC_ID_VP9
@ AV_CODEC_ID_VP9
Definition: codec_id.h:218
AV_CODEC_ID_MP2
@ AV_CODEC_ID_MP2
Definition: codec_id.h:426
AV_CH_LAYOUT_STEREO_DOWNMIX
#define AV_CH_LAYOUT_STEREO_DOWNMIX
Definition: channel_layout.h:231
to
const char * to
Definition: webvttdec.c:35
mov_channel_layout
static const MovChannelLayout mov_channel_layout[]
Definition: isom.c:387
codec_id
enum AVCodecID codec_id
Definition: vaapi_decode.c:371
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:77
AV_CH_LAYOUT_2_1
#define AV_CH_LAYOUT_2_1
Definition: channel_layout.h:207
AV_CODEC_ID_PNG
@ AV_CODEC_ID_PNG
Definition: codec_id.h:111
AVFormatContext
Format I/O context.
Definition: avformat.h:1213
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1108
MovChannelLayout
Definition: isom.c:382
NULL
#define NULL
Definition: coverity.c:32
isom.h
AV_CODEC_ID_MOV_TEXT
@ AV_CODEC_ID_MOV_TEXT
Definition: codec_id.h:531
AV_DISPOSITION_COMMENT
#define AV_DISPOSITION_COMMENT
The stream is a commentary track.
Definition: avformat.h:844
AV_CODEC_ID_DVD_SUBTITLE
@ AV_CODEC_ID_DVD_SUBTITLE
Definition: codec_id.h:526
MPEG4AudioConfig::sampling_index
int sampling_index
Definition: mpeg4audio.h:34
AV_CH_LAYOUT_5POINT1
#define AV_CH_LAYOUT_5POINT1
Definition: channel_layout.h:215
mov_mdhd_language_map
static const char mov_mdhd_language_map[][4]
Definition: isom.c:91
ff_mp4_read_descr
int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag)
Definition: isom.c:295
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:212
AV_CODEC_ID_MP4ALS
@ AV_CODEC_ID_MP4ALS
Definition: codec_id.h:471
ff_codec_movdata_tags
const AVCodecTag ff_codec_movdata_tags[]
Definition: isom.c:82
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
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:177
AV_CODEC_ID_MPEG1VIDEO
@ AV_CODEC_ID_MPEG1VIDEO
Definition: codec_id.h:51
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: codec_id.h:47
AV_CODEC_ID_EAC3
@ AV_CODEC_ID_EAC3
Definition: codec_id.h:466
AVCodecParameters::extradata_size
int extradata_size
Size of the extradata content in bytes.
Definition: codec_par.h:79
AV_CODEC_ID_AAC
@ AV_CODEC_ID_AAC
Definition: codec_id.h:428
AV_CODEC_ID_QCELP
@ AV_CODEC_ID_QCELP
Definition: codec_id.h:450
AV_DISPOSITION_CAPTIONS
#define AV_DISPOSITION_CAPTIONS
The subtitle stream contains captions, providing a transcription and possibly a translation of audio.
Definition: avformat.h:897
AVIOContext
Bytestream IO Context.
Definition: avio.h:162
avio_rb24
unsigned int avio_rb24(AVIOContext *s)
Definition: aviobuf.c:783
ff_codec_get_id
enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
Definition: utils.c:144
AOT_L2
@ AOT_L2
Y Layer 2.
Definition: mpeg4audio.h:105
AV_CODEC_ID_DTS
@ AV_CODEC_ID_DTS
Definition: codec_id.h:430
dash_role_map
static const struct MP4TrackKindValueMapping dash_role_map[]
Definition: isom.c:434
AV_CODEC_ID_OPUS
@ AV_CODEC_ID_OPUS
Definition: codec_id.h:486
AV_DISPOSITION_DUB
#define AV_DISPOSITION_DUB
The stream is not in original language.
Definition: avformat.h:834
ff_mov_iso639_to_lang
int ff_mov_iso639_to_lang(const char lang[4], int mp4)
Definition: isom.c:233
AV_DISPOSITION_HEARING_IMPAIRED
#define AV_DISPOSITION_HEARING_IMPAIRED
The stream is intended for hearing impaired audiences.
Definition: avformat.h:863
avio_wb32
void avio_wb32(AVIOContext *s, unsigned int val)
Definition: aviobuf.c:394
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:632
AV_CH_LAYOUT_5POINT1_BACK
#define AV_CH_LAYOUT_5POINT1_BACK
Definition: channel_layout.h:217
MPEG4AudioConfig::ext_object_type
int ext_object_type
Definition: mpeg4audio.h:38
ff_mp4_read_descr_len
int ff_mp4_read_descr_len(AVIOContext *pb)
Definition: isom.c:282
MPEG4AudioConfig::channels
int channels
Definition: mpeg4audio.h:42
AV_CODEC_ID_TSCC2
@ AV_CODEC_ID_TSCC2
Definition: codec_id.h:214
AV_CH_LAYOUT_5POINT0
#define AV_CH_LAYOUT_5POINT0
Definition: channel_layout.h:214
AV_CODEC_ID_MJPEG
@ AV_CODEC_ID_MJPEG
Definition: codec_id.h:57
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:48
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
code
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
Definition: filter_design.txt:178
AV_CODEC_ID_EVRC
@ AV_CODEC_ID_EVRC
Definition: codec_id.h:497
AV_CH_LAYOUT_7POINT1
#define AV_CH_LAYOUT_7POINT1
Definition: channel_layout.h:226
AV_CODEC_ID_HEVC
@ AV_CODEC_ID_HEVC
Definition: codec_id.h:224
AV_CH_LAYOUT_7POINT1_WIDE
#define AV_CH_LAYOUT_7POINT1_WIDE
Definition: channel_layout.h:227
AV_CODEC_ID_VC1
@ AV_CODEC_ID_VC1
Definition: codec_id.h:120
demux.h
len
int len
Definition: vorbis_enc_data.h:426
AV_CODEC_ID_JPEG2000
@ AV_CODEC_ID_JPEG2000
Definition: codec_id.h:138
AOT_NULL
@ AOT_NULL
Definition: mpeg4audio.h:74
MPEG4AudioConfig::ext_sample_rate
int ext_sample_rate
Definition: mpeg4audio.h:40
MP4TrackKindValueMapping
Definition: isom.h:413
mp4_audio_types
static const AVCodecTag mp4_audio_types[]
Definition: isom.c:320
AV_DISPOSITION_VISUAL_IMPAIRED
#define AV_DISPOSITION_VISUAL_IMPAIRED
The stream is intended for visually impaired audiences.
Definition: avformat.h:867
tag
uint32_t tag
Definition: movenc.c:1646
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:948
AV_CH_LAYOUT_SURROUND
#define AV_CH_LAYOUT_SURROUND
Definition: channel_layout.h:208
avio_rb16
unsigned int avio_rb16(AVIOContext *s)
Definition: aviobuf.c:775
avformat.h
AV_DISPOSITION_DESCRIPTIONS
#define AV_DISPOSITION_DESCRIPTIONS
The subtitle stream contains a textual description of the video content.
Definition: avformat.h:903
MPEG4AudioConfig::object_type
int object_type
Definition: mpeg4audio.h:33
channel_layout.h
ff_mpa_freq_tab
const uint16_t ff_mpa_freq_tab[3]
Definition: mpegaudiotabs.h:37
ff_codec_movsubtitle_tags
const AVCodecTag ff_codec_movsubtitle_tags[]
Definition: isom.c:75
mpegaudiodata.h
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:347
AOT_ALS
@ AOT_ALS
Y Audio LosslesS.
Definition: mpeg4audio.h:108
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:61
AV_CH_LAYOUT_4POINT0
#define AV_CH_LAYOUT_4POINT0
Definition: channel_layout.h:210
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
AVCodecParameters::bit_rate
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
Definition: codec_par.h:90
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
ff_mov_track_kind_table
const struct MP4TrackKindMapping ff_mov_track_kind_table[]
Definition: isom.c:448
MKTAG
#define MKTAG(a, b, c, d)
Definition: macros.h:55
AV_CODEC_ID_VORBIS
@ AV_CODEC_ID_VORBIS
Definition: codec_id.h:431
ff_mov_write_chan
void ff_mov_write_chan(AVIOContext *pb, int64_t channel_layout)
Definition: isom.c:413
AOT_L3
@ AOT_L3
Y Layer 3.
Definition: mpeg4audio.h:106
AV_CODEC_ID_MPEG2VIDEO
@ AV_CODEC_ID_MPEG2VIDEO
preferred ID for MPEG-1/2 video decoding
Definition: codec_id.h:52
AV_CH_LAYOUT_2_2
#define AV_CH_LAYOUT_2_2
Definition: channel_layout.h:212
MP4TrackKindMapping
Definition: isom.h:418
MPEG4AudioConfig::sample_rate
int sample_rate
Definition: mpeg4audio.h:35