68 unsigned len,
const char *key)
72 short current, total = 0;
78 snprintf(buf,
sizeof(buf),
"%d", current);
80 snprintf(buf,
sizeof(buf),
"%d/%d", current, total);
88 unsigned len,
const char *key)
97 snprintf(buf,
sizeof(buf),
"%d",
avio_r8(pb));
105 unsigned len,
const char *key)
109 snprintf(buf,
sizeof(buf),
"%d",
avio_r8(pb));
117 unsigned len,
const char *key)
135 0x00C4,0x00C5,0x00C7,0x00C9,0x00D1,0x00D6,0x00DC,0x00E1,
136 0x00E0,0x00E2,0x00E4,0x00E3,0x00E5,0x00E7,0x00E9,0x00E8,
137 0x00EA,0x00EB,0x00ED,0x00EC,0x00EE,0x00EF,0x00F1,0x00F3,
138 0x00F2,0x00F4,0x00F6,0x00F5,0x00FA,0x00F9,0x00FB,0x00FC,
139 0x2020,0x00B0,0x00A2,0x00A3,0x00A7,0x2022,0x00B6,0x00DF,
140 0x00AE,0x00A9,0x2122,0x00B4,0x00A8,0x2260,0x00C6,0x00D8,
141 0x221E,0x00B1,0x2264,0x2265,0x00A5,0x00B5,0x2202,0x2211,
142 0x220F,0x03C0,0x222B,0x00AA,0x00BA,0x03A9,0x00E6,0x00F8,
143 0x00BF,0x00A1,0x00AC,0x221A,0x0192,0x2248,0x2206,0x00AB,
144 0x00BB,0x2026,0x00A0,0x00C0,0x00C3,0x00D5,0x0152,0x0153,
145 0x2013,0x2014,0x201C,0x201D,0x2018,0x2019,0x00F7,0x25CA,
146 0x00FF,0x0178,0x2044,0x20AC,0x2039,0x203A,0xFB01,0xFB02,
147 0x2021,0x00B7,0x201A,0x201E,0x2030,0x00C2,0x00CA,0x00C1,
148 0x00CB,0x00C8,0x00CD,0x00CE,0x00CF,0x00CC,0x00D3,0x00D4,
149 0xF8FF,0x00D2,0x00DA,0x00DB,0x00D9,0x0131,0x02C6,0x02DC,
150 0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7,
154 char *dst,
int dstlen)
157 char *end = dst+dstlen-1;
160 for (i = 0; i <
len; i++) {
228 char language[4] = { 0 };
229 char buf[200], place[100];
230 uint16_t langcode = 0;
231 double longitude, latitude, altitude;
232 const char *key =
"location";
234 if (len < 4 + 2 + 1 + 1 + 4 + 4 + 4) {
254 "loci too short (%u bytes left, need at least %d)\n", len, 12);
262 snprintf(buf,
sizeof(buf),
"%+08.4f%+09.4f", latitude, longitude);
267 if (*language && strcmp(language,
"und")) {
269 snprintf(key2,
sizeof(key2),
"%s-%s", key, language);
279 char *str, key2[32], language[4] = {0};
280 const char *key =
NULL;
281 uint16_t langcode = 0;
282 uint32_t data_type = 0, str_size, str_size_alloc;
287 case MKTAG(
'@',
'P',
'R',
'M'): key =
"premiere_version"; raw = 1;
break;
288 case MKTAG(
'@',
'P',
'R',
'Q'): key =
"quicktime_version"; raw = 1;
break;
289 case MKTAG(
'X',
'M',
'P',
'_'):
290 if (c->
export_xmp) { key =
"xmp"; raw = 1; }
break;
291 case MKTAG(
'a',
'A',
'R',
'T'): key =
"album_artist";
break;
292 case MKTAG(
'a',
'k',
'I',
'D'): key =
"account_type";
294 case MKTAG(
'a',
'p',
'I',
'D'): key =
"account_id";
break;
295 case MKTAG(
'c',
'a',
't',
'g'): key =
"category";
break;
296 case MKTAG(
'c',
'p',
'i',
'l'): key =
"compilation";
298 case MKTAG(
'c',
'p',
'r',
't'): key =
"copyright";
break;
299 case MKTAG(
'd',
'e',
's',
'c'): key =
"description";
break;
300 case MKTAG(
'd',
'i',
's',
'k'): key =
"disc";
302 case MKTAG(
'e',
'g',
'i',
'd'): key =
"episode_uid";
304 case MKTAG(
'g',
'n',
'r',
'e'): key =
"genre";
306 case MKTAG(
'h',
'd',
'v',
'd'): key =
"hd_video";
308 case MKTAG(
'k',
'e',
'y',
'w'): key =
"keywords";
break;
309 case MKTAG(
'l',
'd',
'e',
's'): key =
"synopsis";
break;
310 case MKTAG(
'l',
'o',
'c',
'i'):
312 case MKTAG(
'p',
'c',
's',
't'): key =
"podcast";
314 case MKTAG(
'p',
'g',
'a',
'p'): key =
"gapless_playback";
316 case MKTAG(
'p',
'u',
'r',
'd'): key =
"purchase_date";
break;
317 case MKTAG(
'r',
't',
'n',
'g'): key =
"rating";
319 case MKTAG(
's',
'o',
'a',
'a'): key =
"sort_album_artist";
break;
320 case MKTAG(
's',
'o',
'a',
'l'): key =
"sort_album";
break;
321 case MKTAG(
's',
'o',
'a',
'r'): key =
"sort_artist";
break;
322 case MKTAG(
's',
'o',
'c',
'o'): key =
"sort_composer";
break;
323 case MKTAG(
's',
'o',
'n',
'm'): key =
"sort_name";
break;
324 case MKTAG(
's',
'o',
's',
'n'): key =
"sort_show";
break;
325 case MKTAG(
's',
't',
'i',
'k'): key =
"media_type";
327 case MKTAG(
't',
'r',
'k',
'n'): key =
"track";
329 case MKTAG(
't',
'v',
'e',
'n'): key =
"episode_id";
break;
330 case MKTAG(
't',
'v',
'e',
's'): key =
"episode_sort";
332 case MKTAG(
't',
'v',
'n',
'n'): key =
"network";
break;
333 case MKTAG(
't',
'v',
's',
'h'): key =
"show";
break;
334 case MKTAG(
't',
'v',
's',
'n'): key =
"season_number";
336 case MKTAG(0xa9,
'A',
'R',
'T'): key =
"artist";
break;
337 case MKTAG(0xa9,
'P',
'R',
'D'): key =
"producer";
break;
338 case MKTAG(0xa9,
'a',
'l',
'b'): key =
"album";
break;
339 case MKTAG(0xa9,
'a',
'u',
't'): key =
"artist";
break;
340 case MKTAG(0xa9,
'c',
'h',
'p'): key =
"chapter";
break;
341 case MKTAG(0xa9,
'c',
'm',
't'): key =
"comment";
break;
342 case MKTAG(0xa9,
'c',
'o',
'm'): key =
"composer";
break;
343 case MKTAG(0xa9,
'c',
'p',
'y'): key =
"copyright";
break;
344 case MKTAG(0xa9,
'd',
'a',
'y'): key =
"date";
break;
345 case MKTAG(0xa9,
'd',
'i',
'r'): key =
"director";
break;
346 case MKTAG(0xa9,
'd',
'i',
's'): key =
"disclaimer";
break;
347 case MKTAG(0xa9,
'e',
'd',
'1'): key =
"edit_date";
break;
348 case MKTAG(0xa9,
'e',
'n',
'c'): key =
"encoder";
break;
349 case MKTAG(0xa9,
'f',
'm',
't'): key =
"original_format";
break;
350 case MKTAG(0xa9,
'g',
'e',
'n'): key =
"genre";
break;
351 case MKTAG(0xa9,
'g',
'r',
'p'): key =
"grouping";
break;
352 case MKTAG(0xa9,
'h',
's',
't'): key =
"host_computer";
break;
353 case MKTAG(0xa9,
'i',
'n',
'f'): key =
"comment";
break;
354 case MKTAG(0xa9,
'l',
'y',
'r'): key =
"lyrics";
break;
355 case MKTAG(0xa9,
'm',
'a',
'k'): key =
"make";
break;
356 case MKTAG(0xa9,
'm',
'o',
'd'): key =
"model";
break;
357 case MKTAG(0xa9,
'n',
'a',
'm'): key =
"title";
break;
358 case MKTAG(0xa9,
'o',
'p',
'e'): key =
"original_artist";
break;
359 case MKTAG(0xa9,
'p',
'r',
'd'): key =
"producer";
break;
360 case MKTAG(0xa9,
'p',
'r',
'f'): key =
"performers";
break;
361 case MKTAG(0xa9,
'r',
'e',
'q'): key =
"playback_requirements";
break;
362 case MKTAG(0xa9,
's',
'r',
'c'): key =
"original_source";
break;
363 case MKTAG(0xa9,
's',
't',
'3'): key =
"subtitle";
break;
364 case MKTAG(0xa9,
's',
'w',
'r'): key =
"encoder";
break;
365 case MKTAG(0xa9,
't',
'o',
'o'): key =
"encoder";
break;
366 case MKTAG(0xa9,
't',
'r',
'k'): key =
"track";
break;
367 case MKTAG(0xa9,
'u',
'r',
'l'): key =
"URL";
break;
368 case MKTAG(0xa9,
'w',
'r',
'n'): key =
"warning";
break;
369 case MKTAG(0xa9,
'w',
'r',
't'): key =
"composer";
break;
370 case MKTAG(0xa9,
'x',
'y',
'z'): key =
"location";
break;
376 if (tag ==
MKTAG(
'd',
'a',
't',
'a')) {
379 str_size = data_size - 16;
382 if (atom.
type ==
MKTAG(
'c',
'o',
'v',
'r')) {
396 str_size = atom.
size;
399 snprintf(tmp_key, 5,
"%.4s", (
char*)&atom.
type);
409 str_size_alloc = (raw ? str_size : str_size * 2) + 1;
415 parse(c, pb, str_size, key);
417 if (!raw && (data_type == 3 || (data_type == 0 && (langcode < 0x400 || langcode == 0x7fff)))) {
429 if (*language && strcmp(language,
"und")) {
430 snprintf(key2,
sizeof(key2),
"%s-%s", key, language);
436 key, str, (
char*)&atom.
type, str_size_alloc, atom.
size);
445 int i, nb_chapters, str_len,
version;
449 if ((atom.
size -= 5) < 0)
458 for (i = 0; i < nb_chapters; i++) {
465 if ((atom.
size -= 9+str_len) < 0)
477 #define MIN_DATA_ENTRY_BOX_SIZE 12 493 entries >= UINT_MAX /
sizeof(*sc->
drefs))
502 for (i = 0; i < entries; i++) {
514 if (dref->
type ==
MKTAG(
'a',
'l',
'i',
's') && size > 150) {
516 uint16_t volume_len,
len;
523 volume_len =
FFMIN(volume_len, 27);
527 dref->
volume[volume_len] = 0;
533 len =
FFMIN(len, 63);
550 for (type = 0; type != -1 &&
avio_tell(pb) < next; ) {
569 if (len > volume_len && !strncmp(dref->
path, dref->
volume, volume_len)) {
571 memmove(dref->
path, dref->
path+volume_len, len);
575 for (j = len - 1; j >= 0; j--) {
576 if (dref->
path[j] == 0)
581 for (j = 0; j <
len; j++)
582 if (dref->
path[j] ==
':' || dref->
path[j] == 0)
585 }
else if (type == 0) {
597 for (j = 0; j <
len; j++)
598 if (dref->
dir[j] ==
':')
639 if (type ==
MKTAG(
'v',
'i',
'd',
'e'))
641 else if (type ==
MKTAG(
's',
'o',
'u',
'n'))
643 else if (type ==
MKTAG(
'm',
'1',
'a',
' '))
645 else if ((type ==
MKTAG(
's',
'u',
'b',
'p')) || (type ==
MKTAG(
'c',
'l',
'c',
'p')))
652 title_size = atom.
size - 24;
653 if (title_size > 0) {
663 title_str[title_size] = 0;
665 int off = (!c->
isom && title_str[0] == title_size - 1);
705 int ac3info, acmod, lfeon, bsmod;
717 bsmod = (ac3info >> 14) & 0x7;
718 acmod = (ac3info >> 11) & 0x7;
719 lfeon = (ac3info >> 10) & 0x1;
728 #if FF_API_LAVF_AVCTX 730 st->codec->audio_service_type = *ast;
741 int eac3info, acmod, lfeon, bsmod;
757 bsmod = (eac3info >> 12) & 0x1f;
758 acmod = (eac3info >> 9) & 0x7;
759 lfeon = (eac3info >> 8) & 0x1;
768 #if FF_API_LAVF_AVCTX 770 st->codec->audio_service_type = *ast;
820 "sample aspect ratio already set to %d:%d, ignoring 'pasp' atom (%d:%d)\n",
823 }
else if (den != 0) {
844 char minor_ver_str[11];
845 char* comp_brands_str;
851 if (strcmp(type,
"qt "))
856 snprintf(minor_ver_str,
sizeof(minor_ver_str),
"%"PRIu32
"", minor_ver);
859 comp_brand_size = atom.
size - 8;
860 if (comp_brand_size < 0)
862 comp_brands_str =
av_malloc(comp_brand_size + 1);
863 if (!comp_brands_str)
871 comp_brands_str[comp_brand_size] = 0;
902 struct tm *ptm, tmbuf;
906 if (strftime(buffer,
sizeof(buffer),
"%Y-%m-%d %H:%M:%S", ptm))
916 char language[4] = {0};
918 time_t creation_time;
958 time_t creation_time;
1003 if ((uint64_t)atom.
size > (1<<30))
1034 if (little_endian == 1) {
1058 char color_parameter_type[5] = { 0 };
1059 uint16_t color_primaries, color_trc, color_matrix;
1069 if (strncmp(color_parameter_type,
"nclx", 4) &&
1070 strncmp(color_parameter_type,
"nclc", 4)) {
1072 color_parameter_type);
1081 "%s: pri %"PRIu16
" trc %"PRIu16
" matrix %"PRIu16
"",
1082 color_parameter_type, color_primaries, color_trc, color_matrix);
1084 if (!strncmp(color_parameter_type,
"nclx", 4)) {
1102 }
else if (!strncmp(color_parameter_type,
"nclc", 4)) {
1104 switch (color_primaries) {
1113 switch (color_trc) {
1119 switch (color_matrix) {
1134 unsigned mov_field_order;
1143 if ((mov_field_order & 0xFF00) == 0x0100)
1145 else if ((mov_field_order & 0xFF00) == 0x0200) {
1146 switch (mov_field_order & 0xFF) {
1177 if (size > INT_MAX || (uint64_t)atom.
size > INT_MAX)
1204 if ((uint64_t)atom.
size > (1<<30))
1218 }
else if (atom.
size > 8) {
1239 if ((uint64_t)atom.
size > (1<<30))
1242 if (atom.
size >= 10) {
1248 if (type ==
MKTAG(
'f',
'i',
'e',
'l') && size == atom.
size)
1274 if (atom.
size >= (1<<28) || atom.
size < 7)
1278 if ((profile_level & 0xf0) != 0xc0)
1307 if (atom.
size <= 40)
1311 if ((uint64_t)atom.
size > (1<<30))
1332 unsigned int i, entries;
1346 if (entries >= UINT_MAX/
sizeof(int64_t))
1354 if (atom.
type ==
MKTAG(
's',
't',
'c',
'o'))
1357 else if (atom.
type ==
MKTAG(
'c',
'o',
'6',
'4'))
1390 ((format & 0xFFFF) ==
'm' + (
's' << 8) ||
1391 (format & 0xFFFF) ==
'T' + (
'S' << 8)))
1398 format && format !=
MKTAG(
'm',
'p',
'4',
's')) {
1420 unsigned int color_depth,
len, j;
1421 int color_greyscale;
1449 if (!memcmp(codec_name,
"Planar Y'CbCr 8-bit 4:2:0", 25))
1453 !memcmp(codec_name,
"Sorenson H263", 13))
1465 if ((color_depth == 2) || (color_depth == 4) || (color_depth == 8)) {
1467 unsigned int color_start, color_count, color_end;
1468 unsigned char r,
g,
b;
1470 if (color_greyscale) {
1471 int color_index, color_dec;
1474 color_count = 1 << color_depth;
1476 color_dec = 256 / (color_count - 1);
1477 for (j = 0; j < color_count; j++) {
1478 r = g = b = color_index;
1479 sc->
palette[j] = (r << 16) | (g << 8) | (
b);
1480 color_index -= color_dec;
1481 if (color_index < 0)
1484 }
else if (color_table_id) {
1487 color_count = 1 << color_depth;
1488 if (color_depth == 2)
1490 else if (color_depth == 4)
1495 for (j = 0; j < color_count; j++) {
1496 r = color_table[j * 3 + 0];
1497 g = color_table[j * 3 + 1];
1498 b = color_table[j * 3 + 2];
1499 sc->
palette[j] = (r << 16) | (g << 8) | (
b);
1506 if ((color_start <= 255) && (color_end <= 255)) {
1507 for (j = color_start; j <= color_end; j++) {
1519 sc->
palette[j] = (r << 16) | (g << 8) | (
b);
1530 int bits_per_sample,
flags;
1553 }
else if (version == 2) {
1568 if (version == 0 || (version == 1 && sc->
audio_cid != -2)) {
1616 if (bits_per_sample) {
1641 y = (ycbcr >> 16) & 0xFF;
1642 cr = (ycbcr >> 8) & 0xFF;
1645 b = av_clip_uint8(1.164 * (y - 16) + 2.018 * (cb - 128));
1646 g = av_clip_uint8(1.164 * (y - 16) - 0.813 * (cr - 128) - 0.391 * (cb - 128));
1647 r = av_clip_uint8(1.164 * (y - 16) + 1.596 * (cr - 128));
1649 return (r << 16) | (g << 8) | b;
1654 char buf[256] = {0};
1662 snprintf(buf,
sizeof(buf),
"size: %dx%d\n",
1666 for (i = 0; i < 16; i++) {
1667 uint32_t yuv =
AV_RB32(src + i * 4);
1670 av_strlcatf(buf,
sizeof(buf),
"%06"PRIx32
"%s", rgba, i != 15 ?
", " :
"");
1673 if (
av_strlcat(buf,
"\n",
sizeof(buf)) >=
sizeof(buf))
1717 #if CONFIG_DV_DEMUXER 1776 int codec_tag,
int format,
1782 (codec_tag ==
AV_RL32(
"hvc1") ||
1783 codec_tag ==
AV_RL32(
"hev1") ||
1784 (codec_tag != format &&
1788 : codec_tag !=
MKTAG(
'j',
'p',
'e',
'g'))))) {
1805 int pseudo_stream_id;
1812 for (pseudo_stream_id = 0;
1814 pseudo_stream_id++) {
1817 int ret, dref_id = 1;
1829 "invalid size %"PRId64
" in stsd\n", size);
1843 "size=%"PRId64
" format=0x%08x codec_type=%d\n",
1867 }
else if (a.
size > 0)
1912 "Duplicate stsd found in this track.\n");
1954 unsigned int i, entries;
1970 if (entries >= UINT_MAX /
sizeof(*sc->
stsc_data))
1976 for (i = 0; i < entries && !pb->
eof_reached; i++) {
1999 return index + 1 < count;
2019 unsigned i, entries;
2029 if (entries >= UINT_MAX /
sizeof(*sc->
stps_data))
2035 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2052 unsigned int i, entries;
2071 if (entries >= UINT_MAX /
sizeof(
int))
2078 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2095 unsigned int i, entries, sample_size, field_size, num_bytes;
2108 if (atom.
type ==
MKTAG(
's',
't',
's',
'z')) {
2126 if (field_size != 4 && field_size != 8 && field_size != 16 && field_size != 32) {
2133 if (entries >= UINT_MAX /
sizeof(
int) || entries >= (UINT_MAX - 4) / field_size)
2139 num_bytes = (entries*field_size+4)>>3;
2156 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2175 unsigned int i, entries;
2177 int64_t total_sample_count=0;
2193 if (entries >= UINT_MAX /
sizeof(*sc->
stts_data))
2201 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2202 int sample_duration;
2207 if (sample_count < 0) {
2215 sample_count, sample_duration);
2217 duration+=(int64_t)sample_duration*sample_count;
2218 total_sample_count+=sample_count;
2237 unsigned int i, entries;
2254 if (entries >= UINT_MAX /
sizeof(*sc->
ctts_data))
2260 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2284 unsigned int i, entries;
2286 uint32_t grouping_type;
2296 if (grouping_type !=
MKTAG(
'r',
'a',
'p',
' '))
2304 if (entries >= UINT_MAX /
sizeof(*sc->
rap_group))
2310 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2323 int64_t current_offset;
2324 int64_t current_dts = 0;
2325 unsigned int stts_index = 0;
2326 unsigned int stsc_index = 0;
2327 unsigned int stss_index = 0;
2328 unsigned int stps_index = 0;
2330 uint64_t stream_size = 0;
2342 unsigned int current_sample = 0;
2343 unsigned int stts_sample = 0;
2344 unsigned int sample_size;
2346 unsigned int rap_group_index = 0;
2347 unsigned int rap_group_sample = 0;
2386 if (rap_group_present && rap_group_index < sc->rap_group_count) {
2389 if (++rap_group_sample == sc->
rap_group[rap_group_index].
count) {
2390 rap_group_sample = 0;
2400 e->
pos = current_offset;
2402 e->
size = sample_size;
2405 av_log(mov->
fc,
AV_LOG_TRACE,
"AVIndex stream %d, sample %d, offset %"PRIx64
", dts %"PRId64
", " 2406 "size %d, distance %d, keyframe %d\n", st->
index, current_sample,
2407 current_offset, current_dts, sample_size, distance, keyframe);
2410 current_offset += sample_size;
2411 stream_size += sample_size;
2425 unsigned chunk_samples, total = 0;
2429 unsigned count, chunk_count;
2442 count = (chunk_samples+samples-1) / samples;
2444 count = (chunk_samples+1023) / 1024;
2451 total += chunk_count * count;
2473 while (chunk_samples > 0) {
2475 unsigned size, samples;
2479 "Zero bytes per frame, but %d samples per frame",
2493 samples =
FFMIN(1024, chunk_samples);
2503 e->
pos = current_offset;
2509 "size %d, duration %d\n", st->
index, i, current_offset, current_dts,
2512 current_offset +=
size;
2513 current_dts += samples;
2514 chunk_samples -= samples;
2526 char filename[1024];
2531 src_path = strrchr(src,
'/');
2538 for (i = 0, l = strlen(ref->
path) - 1; l >= 0; l--)
2539 if (ref->
path[l] ==
'/') {
2547 if (i == ref->
nlvl_to - 1 && src_path - src <
sizeof(filename)) {
2548 memcpy(filename, src, src_path - src);
2549 filename[src_path -
src] = 0;
2571 if (!st)
return AVERROR(ENOMEM);
2574 if (!sc)
return AVERROR(ENOMEM);
2607 "stream %d, error opening alias: path='%s', dir='%s', " 2608 "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n",
2613 "Skipped opening external track: " 2614 "stream %d, alias: path='%s', dir='%s', " 2615 "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d." 2616 "Set enable_drefs to allow this.\n",
2640 #if CONFIG_H261_DECODER 2643 #if CONFIG_H263_DECODER 2646 #if CONFIG_MPEG4_DECODER 2683 for (i = 0; i < 2; i++) {
2695 if (len < 12 || len - 12 > end -
avio_tell(pb))
2699 if (tag ==
MKTAG(
'n',
'a',
'm',
'e'))
2701 else if (tag ==
MKTAG(
'd',
'a',
't',
'a') && len > 4) {
2742 if (len > atom.
size)
2745 if (tag ==
MKTAG(
'm',
'e',
'a',
'n') && len > 12) {
2752 domain_len =
avio_get_str(pb, len, domain,
sizeof(domain));
2754 if (!strcmp(domain,
"org.hydrogenaudio.replaygain"))
2760 "Unhandled or malformed custom metadata of size %"PRId64
"\n", atom.
size);
2766 while (atom.
size > 8) {
2769 if (tag ==
MKTAG(
'h',
'd',
'l',
'r')) {
2783 int64_t disp_transform[2];
2784 int display_matrix[3][3];
2823 for (i = 0; i < 3; i++) {
2831 sc->
width = width >> 16;
2832 sc->
height = height >> 16;
2835 if (display_matrix[0][0] != (1 << 16) ||
2836 display_matrix[1][1] != (1 << 16) ||
2837 display_matrix[2][2] != (1 << 30) ||
2838 display_matrix[0][1] || display_matrix[0][2] ||
2839 display_matrix[1][0] || display_matrix[1][2] ||
2840 display_matrix[2][0] || display_matrix[2][1]) {
2848 for (i = 0; i < 3; i++)
2849 for (j = 0; j < 3; j++)
2857 for (i = 0; i < 2; i++)
2859 (int64_t) width * display_matrix[0][i] +
2860 (int64_t) height * display_matrix[1][i] +
2861 ((int64_t) display_matrix[2][i] << 16);
2864 if (disp_transform[0] > 0 && disp_transform[1] > 0)
2866 ((
double) disp_transform[0] * height) /
2867 ((
double) disp_transform[1] * width), INT_MAX);
2876 int flags, track_id, i;
2977 int data_offset = 0;
2978 unsigned entries, first_sample_flags = frag->
flags;
3028 for (i = 0; i < entries && !pb->
eof_reached; i++) {
3029 unsigned sample_size = frag->
size;
3030 int sample_flags = i ? frag->
flags : first_sample_flags;
3031 unsigned sample_duration = frag->
duration;
3053 offset, dts, sample_size, distance, keyframe);
3055 dts += sample_duration;
3056 offset += sample_size;
3083 if (atom.
type !=
MKTAG(
'm',
'd',
'a',
't')) {
3097 long cmov_len, moov_len;
3111 cmov_len = atom.
size - 6 * 4;
3123 goto free_and_return;
3125 if (uncompress (moov_data, (uLongf *) &moov_len, (
const Bytef *)cmov_data, cmov_len) != Z_OK)
3126 goto free_and_return;
3128 goto free_and_return;
3130 atom.
size = moov_len;
3156 if ((uint64_t)edit_count*12+8 > atom.
size)
3159 for (i=0; i<edit_count; i++){
3170 if (i == 0 && time >= -1) {
3177 "a/v desync might occur, patch welcome\n");
3250 int64_t total_size = 0;
3255 atom.
size = INT64_MAX;
3260 if (atom.
size >= 8) {
3264 av_log(c->
fc,
AV_LOG_TRACE,
"type: %08x '%.4s' parent:'%.4s' sz: %"PRId64
" %"PRId64
" %"PRId64
"\n",
3281 for (i = 0; mov_default_parse_table[i].
type; i++)
3282 if (mov_default_parse_table[i].
type == a.
type) {
3297 int err =
parse(c, pb, a);
3310 else if (left < 0) {
3312 "overread end of atom '%.4s' by %"PRId64
" bytes\n",
3313 (
char*)&a.
type, -left);
3318 total_size += a.
size;
3321 if (total_size < atom.
size && atom.
size < 0x7ffff)
3329 unsigned int offset;
3337 if ((offset + 8) > (
unsigned int)p->
buf_size)
3342 case MKTAG(
'j',
'P',
' ',
' '):
3343 case MKTAG(
'm',
'o',
'o',
'v'):
3344 case MKTAG(
'm',
'd',
'a',
't'):
3345 case MKTAG(
'p',
'n',
'o',
't'):
3346 case MKTAG(
'u',
'd',
't',
'a'):
3347 case MKTAG(
'f',
't',
'y',
'p'):
3350 case MKTAG(
'e',
'd',
'i',
'w'):
3351 case MKTAG(
'w',
'i',
'd',
'e'):
3352 case MKTAG(
'f',
'r',
'e',
'e'):
3353 case MKTAG(
'j',
'u',
'n',
'k'):
3354 case MKTAG(
'p',
'i',
'c',
't'):
3356 case MKTAG(0x82,0x82,0x7f,0x7d):
3357 case MKTAG(
's',
'k',
'i',
'p'):
3358 case MKTAG(
'u',
'u',
'i',
'd'):
3359 case MKTAG(
'p',
'r',
'f',
'l'):
3408 if (len > sample->
size-2)
3410 title_len = 2*len + 1;
3423 else if (ch == 0xfffe)
3427 if (len == 1 || len == 2)
3456 if (sc->
pb && sc->
pb != s->
pb)
3497 atom.
size = INT64_MAX;
3580 int64_t best_dts = INT64_MAX;
3591 ((msc->
pb != s->
pb && dts < best_dts) || (msc->
pb == s->
pb &&
3594 sample = current_sample;
3614 if (extradata_size > 0 && extradata) {
3620 memcpy(side, extradata, extradata_size);
3671 #if CONFIG_DV_DEMUXER 3704 av_log(s,
AV_LOG_TRACE,
"stream %d, pts %"PRId64
", dts %"PRId64
", pos 0x%"PRIx64
", duration %"PRId64
"\n",
3735 if (sample < 0 && st->nb_index_entries && timestamp < st->index_entries[0].timestamp)
3779 if (sample_time < 0)
3782 st = s->
streams[stream_index];
3794 if (stream_index == i)
3821 #define OFFSET(x) offsetof(MOVContext, x) 3822 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM 3824 {
"seek_streams_individually",
3825 "Seek each stream individually to the to the closest point",
3828 {
"export_all",
"Export unrecognized metadata entries",
OFFSET(export_all),
3830 {
"export_xmp",
"Export full XMP metadata",
OFFSET(export_xmp),
3832 {
"enable_drefs",
"Enable external track support.",
OFFSET(enable_drefs),
3845 .
name =
"mov,mp4,m4a,3gp,3g2,mj2",
3849 .extensions =
"mov,mp4,m4a,3gp,3g2,mj2",
int itunes_metadata
metadata are itunes style
also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B
static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int(* io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
A callback for opening new IO streams.
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
enum AVFieldOrder field_order
Video only.
static int mov_read_esds(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom)
enum AVColorTransferCharacteristic color_trc
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int64_t avio_size(AVIOContext *s)
Get the filesize.
static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
unsigned int rap_group_count
void ff_mp4_parse_es_descr(AVIOContext *pb, int *es_id)
static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_change_extradata(MOVStreamContext *sc, AVPacket *pkt)
int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Add an index entry into a sorted list.
#define MOV_TFHD_DEFAULT_DURATION
static AVIndexEntry * mov_find_next_sample(AVFormatContext *s, AVStream **st)
static int mov_read_chpl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
unsigned int samples_per_frame
static void mov_build_index(MOVContext *mov, AVStream *st)
static ColorEntry color_table[]
#define AV_LOG_WARNING
Something somehow does not look correct.
uint64_t base_data_offset
int64_t pos
byte position in stream, -1 if unknown
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 ...
static int mov_metadata_gnre(MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
SMPTE ST 432-1 D65 (2010)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
int index
stream index in AVFormatContext
av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (%s)\, len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic ? ac->func_descr_generic :ac->func_descr)
#define MOV_TRUN_SAMPLE_CTS
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define AVIO_FLAG_READ
read-only
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
int event_flags
Flags for the user to detect events happening on the file.
static const uint8_t ff_qt_default_palette_256[256 *3]
int16_t audio_cid
stsd audio compression id
#define PUT_UTF8(val, tmp, PUT_BYTE)
Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
AVPacketSideData * side_data
An array of side data that applies to the whole stream (i.e.
unsigned int avio_rb16(AVIOContext *s)
int(* parse)(MOVContext *ctx, AVIOContext *pb, MOVAtom atom)
static int mov_get_stsc_samples(MOVStreamContext *sc, int index)
static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a UTF-16 string from pb and convert it to UTF-8.
enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags)
Compute codec id for 'lpcm' tag.
static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
functionally identical to above
int found_moov
'moov' atom has been found
static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom)
enum AVColorSpace color_space
#define MOV_TFHD_DEFAULT_BASE_IS_MOOF
const char * av_color_space_name(enum AVColorSpace space)
Macro definitions for various function/variable attributes.
#define AV_DICT_DONT_STRDUP_KEY
Take ownership of a key that's been allocated with av_malloc() and children.
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
#define MOV_TKHD_FLAG_ENABLED
int isom
1 if file is ISO Media (mp4/3gp)
int found_mdat
'mdat' atom has been found
static int mov_read_smi(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_probe(AVProbeData *p)
static int mov_read_header(AVFormatContext *s)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc, int64_t size)
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static int mov_read_moov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static const AVOption mov_options[]
static av_always_inline double av_int2double(uint64_t i)
Reinterpret a 64-bit integer as a double.
Opaque data information usually continuous.
unsigned int sample_count
const AVCodecTag ff_codec_movvideo_tags[]
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
unsigned int avio_rb32(AVIOContext *s)
int dts_shift
dts shift when ctts is negative
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
int id
Format-specific stream ID.
enum AVStreamParseType need_parsing
AVInputFormat ff_mov_demuxer
static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb)
int nb_side_data
The number of elements in the AVStream.side_data array.
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
#define AV_CH_LOW_FREQUENCY
AVStream ** streams
A list of all streams in the file.
static int mov_metadata_int8_no_padding(MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
static int mov_read_wfex(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
static int mov_skip_multiple_stsd(MOVContext *c, AVIOContext *pb, int codec_tag, int format, int64_t size)
static int mov_open_dref(AVFormatContext *s, AVIOContext **pb, char *src, MOVDref *ref)
int flags
Flags modifying the (de)muxer behaviour.
int av_reallocp(void *ptr, size_t size)
Allocate or reallocate a block of memory.
#define MOV_TRUN_SAMPLE_SIZE
#define AVERROR_EOF
End of file.
bitstream reader API header.
static av_cold int read_close(AVFormatContext *ctx)
#define AV_LOG_VERBOSE
Detailed information.
static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
uint64_t avio_rb64(AVIOContext *s)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int ff_replaygain_export(AVStream *st, AVDictionary *metadata)
Parse replaygain tags and export them as per-stream side data.
enum AVCodecID video_codec_id
Forced video codec_id.
uint64_t channel_layout
Audio only.
#define MOV_TFHD_DEFAULT_SIZE
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int64_t time_offset
time offset of the first edit list entry
static int mov_read_custom(MOVContext *c, AVIOContext *pb, MOVAtom atom)
unsigned int keyframe_count
static const uint8_t ff_qt_default_palette_4[4 *3]
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
const uint16_t avpriv_ac3_channel_layout_tab[8]
Map audio coding mode (acmod) to channel layout mask.
static int mov_read_fiel(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_rewrite_dvd_sub_extradata(AVStream *st)
int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb)
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
static void mov_parse_stsd_subtitle(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc, int64_t size)
AVCodecID
Identify the syntax and semantics of the bitstream.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
AVDictionary * metadata
Metadata that applies to the whole file.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
static int mov_read_pasp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_replaygain(MOVContext *c, AVIOContext *pb, int64_t size)
unsigned int avio_rl32(AVIOContext *s)
static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
enum AVColorPrimaries color_primaries
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
preferred ID for decoding MPEG audio layer 1, 2 or 3
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
enum AVMediaType codec_type
General type of the encoded data.
static void mov_metadata_creation_time(AVDictionary **metadata, time_t time)
also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
enum AVPacketSideDataType type
const AVCodecTag ff_codec_wav_tags[]
#define MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES
int min_distance
Minimum distance between this and the previous keyframe, used to avoid unneeded searching.
const AVCodecTag ff_codec_movsubtitle_tags[]
#define MIN_DATA_ENTRY_BOX_SIZE
static struct tm * gmtime_r(const time_t *clock, struct tm *result)
int flags
A combination of AV_PKT_FLAG values.
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
int extradata_size
Size of the extradata content in bytes.
int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
int avio_r8(AVIOContext *s)
static float distance(float x, float y, int band)
static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int bit_rate
The average bitrate of the encoded data (in bits per second).
int buf_size
Size of buf except extra allocated bytes.
static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp, int flags)
static int mov_metadata_track_or_disc_number(MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
int block_align
Audio only.
static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
audio channel layout utility functions
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
unsigned int avio_rb24(AVIOContext *s)
char filename[1024]
input or output filename
static int mov_read_chap(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
#define AV_TIME_BASE
Internal time base represented as integer.
const AVCodecTag ff_codec_bmp_tags[]
static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() and children.
ITU-R BT2020 non-constant luminance system.
static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
internal header for RIFF based (de)muxers do NOT include this in end user applications ...
static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_tfdt(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define MOV_TRUN_SAMPLE_DURATION
uint8_t * av_stream_new_side_data(AVStream *stream, enum AVPacketSideDataType type, int size)
Allocate new information from stream.
enum AVColorRange color_range
Video only.
static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
static int mov_read_close(AVFormatContext *s)
static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
This function reads atom content and puts data in extradata without tag nor size unlike mov_read_extr...
int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, int64_t size)
Read 'chan' tag from the input stream.
the normal 2^n-1 "JPEG" YUV ranges
static int read_header(FFV1Context *f)
if(ac->has_optimized_func)
int64_t duration
duration of the longest track
int ff_mov_lang_to_iso639(unsigned code, char to[4])
static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len)
#define AVERROR_PATCHWELCOME
Not yet implemented in Libav, patches welcome.
DVDemuxContext * dv_demux
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags)
static const uint32_t mac_to_unicode[128]
static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define MP4DecConfigDescrTag
const AVCodecTag ff_codec_movaudio_tags[]
functionally identical to above
static void mov_read_chapters(AVFormatContext *s)
AVIOContext * pb
I/O context.
static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc)
static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define MOV_TRUN_FIRST_SAMPLE_FLAGS
static int mov_read_ilst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int read_packet(AVFormatContext *ctx, AVPacket *pkt)
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Describe the class of an AVClass context structure.
rational number numerator/denominator
MOVFragment fragment
current fragment in moof atom
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
int64_t track_end
used for dts generation in fragmented movie files
static const uint8_t ff_qt_default_palette_16[16 *3]
static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc)
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len, char *dst, int dstlen)
#define MOV_TFHD_DEFAULT_FLAGS
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
#define MOV_TRUN_SAMPLE_FLAGS
This structure contains the data a format has to probe a file.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVFormatContext * dv_fctx
size_t av_strlcat(char *dst, const char *src, size_t size)
Append the string src to the string dst, but to a total length of no more than size - 1 bytes...
static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom)
unsigned * stps_data
partial sync sample for mpeg-2 open gop
the normal 219*2^(n-8) "MPEG" YUV ranges
static int mov_read_mdat(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_metadata_int8_bypass_padding(MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
int64_t duration
Decoding: duration of the stream, in stream time base.
int sample_rate
Audio only.
int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag)
static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
An strf atom is a BITMAPINFOHEADER struct.
unsigned int bytes_per_frame
#define FF_DISABLE_DEPRECATION_WARNINGS
#define MOV_TFHD_BASE_DATA_OFFSET
int ffio_init_context(AVIOContext *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, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen)
static const MOVParseTableEntry mov_default_parse_table[]
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
int error_recognition
Error recognition; higher values will detect more errors but may misdetect some more or less valid pa...
static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int disposition
AV_DISPOSITION_* bit field.
static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom)
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
static int mov_codec_id(AVStream *st, uint32_t format)
int64_t nb_frames
number of frames in this stream if known or 0
static int mov_metadata_loci(MOVContext *c, AVIOContext *pb, unsigned len)
static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
unsigned int index_entries_allocated_size
static int mov_stsc_index_valid(int index, int count)
static int mov_finalize_stsd_codec(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc)
int eof_reached
true if eof reached
#define FF_ENABLE_DEPRECATION_WARNINGS
as in Berlin toast format
int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int size)
void * priv_data
Format private data.
static const AVClass mov_class
int bits_per_coded_sample
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
#define MOV_TRUN_DATA_OFFSET
int64_t next_root_atom
offset of the next root atom
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
static int mov_read_dvc1(MOVContext *c, AVIOContext *pb, MOVAtom atom)
also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
static void * av_mallocz_array(size_t nmemb, size_t size)
int pseudo_stream_id
-1 means demux all ids
int ffindex
AVStream index.
uint8_t ** extradata
extradata array (and size) for multiple stsd
static int mov_read_trex(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVCodecParameters * codecpar
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a string from pb into buf.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size)
Allocate new information of a packet.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented...
#define MKTAG(a, b, c, d)
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
const char *const ff_id3v1_genre_str[ID3v1_GENRE_MAX+1]
ID3v1 genres.
This structure stores compressed data.
static int mov_read_sbgp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
AVPacket attached_pic
For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet will contain the attached pictu...
#define AV_NOPTS_VALUE
Undefined timestamp value.
static uint32_t yuv_to_rgba(uint32_t ycbcr)
#define MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.