69 unsigned len,
const char *key)
73 short current, total = 0;
79 snprintf(buf,
sizeof(buf),
"%d", current);
81 snprintf(buf,
sizeof(buf),
"%d/%d", current, total);
89 unsigned len,
const char *key)
103 unsigned len,
const char *key)
112 unsigned len,
const char *key)
128 0x00C4,0x00C5,0x00C7,0x00C9,0x00D1,0x00D6,0x00DC,0x00E1,
129 0x00E0,0x00E2,0x00E4,0x00E3,0x00E5,0x00E7,0x00E9,0x00E8,
130 0x00EA,0x00EB,0x00ED,0x00EC,0x00EE,0x00EF,0x00F1,0x00F3,
131 0x00F2,0x00F4,0x00F6,0x00F5,0x00FA,0x00F9,0x00FB,0x00FC,
132 0x2020,0x00B0,0x00A2,0x00A3,0x00A7,0x2022,0x00B6,0x00DF,
133 0x00AE,0x00A9,0x2122,0x00B4,0x00A8,0x2260,0x00C6,0x00D8,
134 0x221E,0x00B1,0x2264,0x2265,0x00A5,0x00B5,0x2202,0x2211,
135 0x220F,0x03C0,0x222B,0x00AA,0x00BA,0x03A9,0x00E6,0x00F8,
136 0x00BF,0x00A1,0x00AC,0x221A,0x0192,0x2248,0x2206,0x00AB,
137 0x00BB,0x2026,0x00A0,0x00C0,0x00C3,0x00D5,0x0152,0x0153,
138 0x2013,0x2014,0x201C,0x201D,0x2018,0x2019,0x00F7,0x25CA,
139 0x00FF,0x0178,0x2044,0x20AC,0x2039,0x203A,0xFB01,0xFB02,
140 0x2021,0x00B7,0x201A,0x201E,0x2030,0x00C2,0x00CA,0x00C1,
141 0x00CB,0x00C8,0x00CD,0x00CE,0x00CF,0x00CC,0x00D3,0x00D4,
142 0xF8FF,0x00D2,0x00DA,0x00DB,0x00D9,0x0131,0x02C6,0x02DC,
143 0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7,
147 char *dst,
int dstlen)
150 char *
end = dst+dstlen-1;
153 for (i = 0; i <
len; i++) {
155 if (c < 0x80 && p < end)
208 char language[4] = { 0 };
209 char buf[200], place[100];
210 uint16_t langcode = 0;
211 double longitude, latitude, altitude;
212 const char *key =
"location";
214 if (len < 4 + 2 + 1 + 1 + 4 + 4 + 4) {
241 snprintf(buf,
sizeof(buf),
"%+08.4f%+09.4f", latitude, longitude);
246 if (*language && strcmp(language,
"und")) {
248 snprintf(key2,
sizeof(key2),
"%s-%s", key, language);
258 char key2[32], language[4] = {0};
260 const char *key =
NULL;
261 uint16_t langcode = 0;
262 uint32_t data_type = 0, str_size, str_size_alloc;
267 case MKTAG(
'@',
'P',
'R',
'M'): key =
"premiere_version"; raw = 1;
break;
268 case MKTAG(
'@',
'P',
'R',
'Q'): key =
"quicktime_version"; raw = 1;
break;
269 case MKTAG(
'X',
'M',
'P',
'_'):
270 if (c->
export_xmp) { key =
"xmp"; raw = 1; }
break;
271 case MKTAG(
'a',
'A',
'R',
'T'): key =
"album_artist";
break;
272 case MKTAG(
'a',
'k',
'I',
'D'): key =
"account_type";
274 case MKTAG(
'a',
'p',
'I',
'D'): key =
"account_id";
break;
275 case MKTAG(
'c',
'a',
't',
'g'): key =
"category";
break;
276 case MKTAG(
'c',
'p',
'i',
'l'): key =
"compilation";
278 case MKTAG(
'c',
'p',
'r',
't'): key =
"copyright";
break;
279 case MKTAG(
'd',
'e',
's',
'c'): key =
"description";
break;
280 case MKTAG(
'd',
'i',
's',
'k'): key =
"disc";
282 case MKTAG(
'e',
'g',
'i',
'd'): key =
"episode_uid";
284 case MKTAG(
'g',
'n',
'r',
'e'): key =
"genre";
286 case MKTAG(
'h',
'd',
'v',
'd'): key =
"hd_video";
288 case MKTAG(
'k',
'e',
'y',
'w'): key =
"keywords";
break;
289 case MKTAG(
'l',
'd',
'e',
's'): key =
"synopsis";
break;
290 case MKTAG(
'l',
'o',
'c',
'i'):
292 case MKTAG(
'p',
'c',
's',
't'): key =
"podcast";
294 case MKTAG(
'p',
'g',
'a',
'p'): key =
"gapless_playback";
296 case MKTAG(
'p',
'u',
'r',
'd'): key =
"purchase_date";
break;
297 case MKTAG(
'r',
't',
'n',
'g'): key =
"rating";
299 case MKTAG(
's',
'o',
'a',
'a'): key =
"sort_album_artist";
break;
300 case MKTAG(
's',
'o',
'a',
'l'): key =
"sort_album";
break;
301 case MKTAG(
's',
'o',
'a',
'r'): key =
"sort_artist";
break;
302 case MKTAG(
's',
'o',
'c',
'o'): key =
"sort_composer";
break;
303 case MKTAG(
's',
'o',
'n',
'm'): key =
"sort_name";
break;
304 case MKTAG(
's',
'o',
's',
'n'): key =
"sort_show";
break;
305 case MKTAG(
's',
't',
'i',
'k'): key =
"media_type";
307 case MKTAG(
't',
'r',
'k',
'n'): key =
"track";
309 case MKTAG(
't',
'v',
'e',
'n'): key =
"episode_id";
break;
310 case MKTAG(
't',
'v',
'e',
's'): key =
"episode_sort";
312 case MKTAG(
't',
'v',
'n',
'n'): key =
"network";
break;
313 case MKTAG(
't',
'v',
's',
'h'): key =
"show";
break;
314 case MKTAG(
't',
'v',
's',
'n'): key =
"season_number";
316 case MKTAG(0xa9,
'A',
'R',
'T'): key =
"artist";
break;
317 case MKTAG(0xa9,
'P',
'R',
'D'): key =
"producer";
break;
318 case MKTAG(0xa9,
'a',
'l',
'b'): key =
"album";
break;
319 case MKTAG(0xa9,
'a',
'u',
't'): key =
"artist";
break;
320 case MKTAG(0xa9,
'c',
'h',
'p'): key =
"chapter";
break;
321 case MKTAG(0xa9,
'c',
'm',
't'): key =
"comment";
break;
322 case MKTAG(0xa9,
'c',
'o',
'm'): key =
"composer";
break;
323 case MKTAG(0xa9,
'c',
'p',
'y'): key =
"copyright";
break;
324 case MKTAG(0xa9,
'd',
'a',
'y'): key =
"date";
break;
325 case MKTAG(0xa9,
'd',
'i',
'r'): key =
"director";
break;
326 case MKTAG(0xa9,
'd',
'i',
's'): key =
"disclaimer";
break;
327 case MKTAG(0xa9,
'e',
'd',
'1'): key =
"edit_date";
break;
328 case MKTAG(0xa9,
'e',
'n',
'c'): key =
"encoder";
break;
329 case MKTAG(0xa9,
'f',
'm',
't'): key =
"original_format";
break;
330 case MKTAG(0xa9,
'g',
'e',
'n'): key =
"genre";
break;
331 case MKTAG(0xa9,
'g',
'r',
'p'): key =
"grouping";
break;
332 case MKTAG(0xa9,
'h',
's',
't'): key =
"host_computer";
break;
333 case MKTAG(0xa9,
'i',
'n',
'f'): key =
"comment";
break;
334 case MKTAG(0xa9,
'l',
'y',
'r'): key =
"lyrics";
break;
335 case MKTAG(0xa9,
'm',
'a',
'k'): key =
"make";
break;
336 case MKTAG(0xa9,
'm',
'o',
'd'): key =
"model";
break;
337 case MKTAG(0xa9,
'n',
'a',
'm'): key =
"title";
break;
338 case MKTAG(0xa9,
'o',
'p',
'e'): key =
"original_artist";
break;
339 case MKTAG(0xa9,
'p',
'r',
'd'): key =
"producer";
break;
340 case MKTAG(0xa9,
'p',
'r',
'f'): key =
"performers";
break;
341 case MKTAG(0xa9,
'r',
'e',
'q'): key =
"playback_requirements";
break;
342 case MKTAG(0xa9,
's',
'r',
'c'): key =
"original_source";
break;
343 case MKTAG(0xa9,
's',
't',
'3'): key =
"subtitle";
break;
344 case MKTAG(0xa9,
's',
'w',
'r'): key =
"encoder";
break;
345 case MKTAG(0xa9,
't',
'o',
'o'): key =
"encoder";
break;
346 case MKTAG(0xa9,
't',
'r',
'k'): key =
"track";
break;
347 case MKTAG(0xa9,
'u',
'r',
'l'): key =
"URL";
break;
348 case MKTAG(0xa9,
'w',
'r',
'n'): key =
"warning";
break;
349 case MKTAG(0xa9,
'w',
'r',
't'): key =
"composer";
break;
350 case MKTAG(0xa9,
'x',
'y',
'z'): key =
"location";
break;
356 if (tag ==
MKTAG(
'd',
'a',
't',
'a') && data_size <= atom.
size) {
359 str_size = data_size - 16;
362 if (atom.
type ==
MKTAG(
'c',
'o',
'v',
'r')) {
372 if (str_size > atom.
size) {
382 str_size = atom.
size;
391 if (atom.
size < 0 || str_size >= INT_MAX/2)
395 str_size_alloc = (raw ? str_size : str_size * 2) + 1;
401 parse(c, pb, str_size, key);
403 if (!raw && (data_type == 3 || (data_type == 0 && (langcode < 0x400 || langcode == 0x7fff)))) {
415 if (*language && strcmp(language,
"und")) {
416 snprintf(key2,
sizeof(key2),
"%s-%s", key, language);
422 key, str, (
char*)&atom.
type, str_size_alloc, atom.
size);
431 int i, nb_chapters, str_len,
version;
435 if ((atom.
size -= 5) < 0)
444 for (i = 0; i < nb_chapters; i++) {
451 if ((atom.
size -= 9+str_len) < 0)
463 #define MIN_DATA_ENTRY_BOX_SIZE 12
478 entries >= UINT_MAX /
sizeof(*sc->
drefs))
499 if (dref->
type ==
MKTAG(
'a',
'l',
'i',
's') && size > 150) {
501 uint16_t volume_len,
len;
508 volume_len =
FFMIN(volume_len, 27);
512 dref->
volume[volume_len] = 0;
518 len =
FFMIN(len, 63);
535 for (type = 0; type != -1 &&
avio_tell(pb) < next; ) {
543 if (type == 2 || type == 18) {
556 if (len > volume_len && !strncmp(dref->
path, dref->
volume, volume_len)) {
558 memmove(dref->
path, dref->
path+volume_len, len);
561 for (j = 0; j <
len; j++)
562 if (dref->
path[j] ==
':')
565 }
else if (type == 0) {
577 for (j = 0; j <
len; j++)
578 if (dref->
dir[j] ==
':')
614 if (type ==
MKTAG(
'v',
'i',
'd',
'e'))
616 else if (type ==
MKTAG(
's',
'o',
'u',
'n'))
618 else if (type ==
MKTAG(
'm',
'1',
'a',
' '))
620 else if ((type ==
MKTAG(
's',
'u',
'b',
'p')) || (type ==
MKTAG(
'c',
'l',
'c',
'p')))
627 title_size = atom.
size - 24;
628 if (title_size > 0) {
638 title_str[title_size] = 0;
640 int off = (!c->
isom && title_str[0] == title_size - 1);
680 int ac3info, acmod, lfeon, bsmod;
692 bsmod = (ac3info >> 14) & 0x7;
693 acmod = (ac3info >> 11) & 0x7;
694 lfeon = (ac3info >> 10) & 0x1;
695 st->
codec->
channels = ((
int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon;
712 int eac3info, acmod, lfeon, bsmod;
728 bsmod = (eac3info >> 12) & 0x1f;
729 acmod = (eac3info >> 9) & 0x7;
730 lfeon = (eac3info >> 8) & 0x1;
791 "sample aspect ratio already set to %d:%d, ignoring 'pasp' atom (%d:%d)\n",
794 }
else if (den != 0) {
815 char* comp_brands_str;
821 if (strcmp(type,
"qt "))
828 comp_brand_size = atom.
size - 8;
829 if (comp_brand_size < 0)
831 comp_brands_str =
av_malloc(comp_brand_size + 1);
832 if (!comp_brands_str)
840 comp_brands_str[comp_brand_size] = 0;
876 "read the mfra (may be a live ismv)\n");
880 "seekable, can not look for mfra\n");
892 struct tm *ptm, tmbuf;
894 if(time >= 2082844800)
899 if (strftime(buffer,
sizeof(buffer),
"%Y-%m-%d %H:%M:%S", ptm))
909 char language[4] = {0};
911 int64_t creation_time;
951 int64_t creation_time;
1002 if (little_endian == 1) {
1026 char color_parameter_type[5] = { 0 };
1037 if (strncmp(color_parameter_type,
"nclx", 4) &&
1038 strncmp(color_parameter_type,
"nclc", 4)) {
1040 color_parameter_type);
1049 "%s: pri %d trc %d matrix %d",
1050 color_parameter_type, color_primaries, color_trc, color_matrix);
1052 if (!strncmp(color_parameter_type,
"nclx", 4)) {
1072 }
else if (!strncmp(color_parameter_type,
"nclc", 4)) {
1074 switch (color_primaries) {
1080 switch (color_trc) {
1085 switch (color_matrix) {
1099 unsigned mov_field_order;
1108 if ((mov_field_order & 0xFF00) == 0x0100)
1110 else if ((mov_field_order & 0xFF00) == 0x0200) {
1111 switch (mov_field_order & 0xFF) {
1134 if (size > INT_MAX || (uint64_t)atom.
size > INT_MAX)
1148 int64_t result = atom.
size;
1157 }
else if (err < atom.
size) {
1171 uint64_t original_size;
1245 codec->
width = 1440;
1257 uint64_t original_size;
1262 if (atom.
size == 16) {
1267 if (length == atom.
size) {
1269 switch (range_value) {
1310 if ((uint64_t)atom.
size > (1<<30))
1321 }
else if (atom.
size > 8) {
1342 if ((uint64_t)atom.
size > (1<<30))
1345 if (atom.
size >= 10) {
1351 if (type ==
MKTAG(
'f',
'i',
'e',
'l') && size == atom.
size)
1376 if (atom.
size >= (1<<28) || atom.
size < 7)
1380 if ((profile_level & 0xf0) != 0xc0)
1404 if (atom.
size <= 40)
1408 if ((uint64_t)atom.
size > (1<<30))
1424 unsigned int i, entries;
1448 if (atom.
type ==
MKTAG(
's',
't',
'c',
'o'))
1451 else if (atom.
type ==
MKTAG(
'c',
'o',
'6',
'4'))
1484 ((format & 0xFFFF) ==
'm' + (
's' << 8) ||
1485 (format & 0xFFFF) ==
'T' + (
'S' << 8)))
1492 format && format !=
MKTAG(
'm',
'p',
'4',
's')) {
1516 unsigned int color_depth,
len, j;
1517 int color_greyscale;
1545 if (!memcmp(codec_name,
"Planar Y'CbCr 8-bit 4:2:0", 25)) {
1552 !memcmp(codec_name,
"Sorenson H263", 13))
1567 if ((color_depth == 2) || (color_depth == 4) || (color_depth == 8)) {
1569 unsigned int color_start, color_count, color_end;
1570 unsigned char a,
r,
g,
b;
1572 if (color_greyscale) {
1573 int color_index, color_dec;
1576 color_count = 1 << color_depth;
1578 color_dec = 256 / (color_count - 1);
1579 for (j = 0; j < color_count; j++) {
1580 r = g = b = color_index;
1581 sc->
palette[j] = (0xFF
U << 24) | (r << 16) | (g << 8) | (b);
1582 color_index -= color_dec;
1583 if (color_index < 0)
1586 }
else if (color_table_id) {
1589 color_count = 1 << color_depth;
1590 if (color_depth == 2)
1592 else if (color_depth == 4)
1597 for (j = 0; j < color_count; j++) {
1598 r = color_table[j * 3 + 0];
1599 g = color_table[j * 3 + 1];
1600 b = color_table[j * 3 + 2];
1601 sc->
palette[j] = (0xFF
U << 24) | (r << 16) | (g << 8) | (b);
1608 if ((color_start <= 255) && (color_end <= 255)) {
1609 for (j = color_start; j <= color_end; j++) {
1620 sc->
palette[j] = (a << 24 ) | (r << 16) | (g << 8) | (b);
1631 int bits_per_sample,
flags;
1650 (compatible_brands && strstr(compatible_brands->
value,
"qt "))) {
1657 }
else if (version == 2) {
1715 if (bits_per_sample) {
1740 y = (ycbcr >> 16) & 0xFF;
1741 cr = (ycbcr >> 8) & 0xFF;
1744 b = av_clip_uint8((1164 * (y - 16) + 2018 * (cb - 128)) / 1000);
1745 g = av_clip_uint8((1164 * (y - 16) - 813 * (cr - 128) - 391 * (cb - 128)) / 1000);
1746 r = av_clip_uint8((1164 * (y - 16) + 1596 * (cr - 128) ) / 1000);
1748 return (r << 16) | (g << 8) | b;
1753 char buf[256] = {0};
1761 snprintf(buf,
sizeof(buf),
"size: %dx%d\n",
1765 for (i = 0; i < 16; i++) {
1766 uint32_t yuv =
AV_RB32(src + i * 4);
1769 av_strlcatf(buf,
sizeof(buf),
"%06"PRIx32
"%s", rgba, i != 15 ?
", " :
"");
1772 if (
av_strlcat(buf,
"\n",
sizeof(buf)) >=
sizeof(buf))
1793 if ((
int)size != size)
1818 if (format ==
AV_RB32(
"name") && (int64_t)size >= (int64_t)len + 18) {
1820 if (str_size > 0 && size >= (
int)str_size + 26) {
1821 char *reel_name =
av_malloc(str_size + 1);
1825 reel_name[str_size] = 0;
1827 if (*reel_name == 0) {
1852 #if CONFIG_DV_DEMUXER
1922 int codec_tag,
int format,
1928 (codec_tag != format &&
1930 : codec_tag !=
MKTAG(
'j',
'p',
'e',
'g')))) {
1939 if ( codec_tag ==
AV_RL32(
"avc1") ||
1940 codec_tag ==
AV_RL32(
"hvc1") ||
1952 int pseudo_stream_id;
1959 for (pseudo_stream_id = 0;
1961 pseudo_stream_id++) {
1964 int ret, dref_id = 1;
1974 }
else if (size <= 7){
1989 (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff,
2013 }
else if (a.
size > 0)
2038 unsigned int i, entries;
2062 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2080 unsigned i, entries;
2098 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2115 unsigned int i, entries;
2138 if (entries >= UINT_MAX /
sizeof(
int))
2146 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2163 unsigned int i, entries, sample_size, field_size, num_bytes;
2176 if (atom.
type ==
MKTAG(
's',
't',
's',
'z')) {
2195 if (field_size != 4 && field_size != 8 && field_size != 16 && field_size != 32) {
2202 if (entries >= (UINT_MAX - 4) / field_size)
2212 num_bytes = (entries*field_size+4)>>3;
2229 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2248 unsigned int i, entries;
2250 int64_t total_sample_count=0;
2272 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2273 int sample_duration;
2279 if (sample_count < 0) {
2287 sample_count, sample_duration);
2291 && sample_count == 1
2292 && total_sample_count > 100
2293 && sample_duration/10 > duration / total_sample_count)
2294 sample_duration = duration / total_sample_count;
2295 duration+=(int64_t)sample_duration*sample_count;
2296 total_sample_count+=sample_count;
2325 unsigned int i, entries;
2340 if (entries >= UINT_MAX /
sizeof(*sc->
ctts_data))
2347 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2357 if (
FFABS(duration) > (1<<28) && i+2<entries) {
2382 unsigned int i, entries;
2384 uint32_t grouping_type;
2394 if (grouping_type !=
MKTAG(
'r',
'a',
'p',
' '))
2410 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2423 int64_t current_offset;
2424 int64_t current_dts = 0;
2425 unsigned int stts_index = 0;
2426 unsigned int stsc_index = 0;
2427 unsigned int stss_index = 0;
2428 unsigned int stps_index = 0;
2430 uint64_t stream_size = 0;
2434 int64_t empty_duration = 0;
2439 if (i == 0 && e->
time == -1) {
2443 edit_start_index = 1;
2444 }
else if (i == edit_start_index && e->
time >= 0) {
2445 start_time = e->
time;
2451 "a/v desync might occur, patch welcome\n");
2454 if ((empty_duration || start_time) && mov->
time_scale > 0) {
2472 unsigned int current_sample = 0;
2473 unsigned int stts_sample = 0;
2474 unsigned int sample_size;
2476 unsigned int rap_group_index = 0;
2477 unsigned int rap_group_sample = 0;
2478 int64_t last_dts = 0;
2479 int64_t dts_correction = 0;
2484 last_dts = current_dts;
2531 if (rap_group_present && rap_group_index < sc->rap_group_count) {
2534 if (++rap_group_sample == sc->
rap_group[rap_group_index].
count) {
2535 rap_group_sample = 0;
2541 && !rap_group_present
2550 e->
pos = current_offset;
2552 e->
size = sample_size;
2555 av_log(mov->
fc,
AV_LOG_TRACE,
"AVIndex stream %d, sample %d, offset %"PRIx64
", dts %"PRId64
", "
2556 "size %d, distance %d, keyframe %d\n", st->
index, current_sample,
2557 current_offset, current_dts, sample_size, distance, keyframe);
2562 current_offset += sample_size;
2563 stream_size += sample_size;
2569 "Invalid SampleDelta %d in STTS, at %d st:%d\n",
2576 if (!dts_correction || current_dts + dts_correction > last_dts) {
2577 current_dts += dts_correction;
2581 dts_correction += current_dts - last_dts - 1;
2582 current_dts = last_dts + 1;
2584 last_dts = current_dts;
2597 unsigned chunk_samples, total = 0;
2601 unsigned count, chunk_count;
2614 count = (chunk_samples+samples-1) / samples;
2616 count = (chunk_samples+1023) / 1024;
2619 if (i < sc->stsc_count - 1)
2623 total += chunk_count *
count;
2645 while (chunk_samples > 0) {
2647 unsigned size, samples;
2651 "Zero bytes per frame, but %d samples per frame",
2665 samples =
FFMIN(1024, chunk_samples);
2675 e->
pos = current_offset;
2681 "size %d, duration %d\n", st->
index, i, current_offset, current_dts,
2684 current_offset +=
size;
2685 current_dts += samples;
2686 chunk_samples -= samples;
2703 char filename[1025];
2704 const char *src_path;
2708 src_path = strrchr(src,
'/');
2715 for (i = 0, l = strlen(ref->
path) - 1; l >= 0; l--)
2716 if (ref->
path[l] ==
'/') {
2724 if (i == ref->
nlvl_to - 1 && src_path - src <
sizeof(filename)) {
2725 memcpy(filename, src, src_path - src);
2726 filename[src_path -
src] = 0;
2729 av_strlcat(filename,
"../",
sizeof(filename));
2736 if (strlen(filename) + 1 ==
sizeof(filename))
2743 "this is a possible security issue\n");
2751 "Absolute path %s not tried for security reasons, "
2752 "set demuxer option use_absolute_path to allow absolute paths\n",
2776 if (!st)
return AVERROR(ENOMEM);
2779 if (!sc)
return AVERROR(ENOMEM);
2807 "stream %d, error opening alias: path='%s', dir='%s', "
2808 "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n",
2824 #if FF_API_R_FRAME_RATE
2840 #if CONFIG_H261_DECODER
2843 #if CONFIG_H263_DECODER
2846 #if CONFIG_MPEG4_DECODER
2889 for (i = 0; i < 2; i++) {
2901 if (len < 12 || len - 12 > end -
avio_tell(pb))
2905 if (tag ==
MKTAG(
'n',
'a',
'm',
'e'))
2907 else if (tag ==
MKTAG(
'd',
'a',
't',
'a') && len > 4) {
2926 if (strcmp(key,
"iTunSMPB") == 0) {
2927 int priming, remainder, samples;
2928 if(sscanf(val,
"%*X %X %X %X", &priming, &remainder, &samples) == 3){
2929 if(priming>0 && priming<16384)
2933 if (strcmp(key,
"cdec") != 0) {
2957 if (len > atom.
size)
2960 if (tag ==
MKTAG(
'm',
'e',
'a',
'n') && len > 12) {
2967 domain_len =
avio_get_str(pb, len, domain,
sizeof(domain));
2974 "Unhandled or malformed custom metadata of size %"PRId64
"\n", atom.
size);
2980 while (atom.
size > 8) {
2983 if (tag ==
MKTAG(
'h',
'd',
'l',
'r')) {
2997 int display_matrix[3][3];
3036 for (i = 0; i < 3; i++) {
3044 sc->
width = width >> 16;
3045 sc->
height = height >> 16;
3049 if (display_matrix[0][0] != (1 << 16) ||
3050 display_matrix[1][1] != (1 << 16) ||
3051 display_matrix[2][2] != (1 << 30) ||
3052 display_matrix[0][1] || display_matrix[0][2] ||
3053 display_matrix[1][0] || display_matrix[1][2] ||
3054 display_matrix[2][0] || display_matrix[2][1]) {
3063 for (i = 0; i < 3; i++)
3064 for (j = 0; j < 3; j++)
3068 if (!
isnan(rotate)) {
3069 char rotate_buf[64];
3073 snprintf(rotate_buf,
sizeof(rotate_buf),
"%g", rotate);
3081 double disp_transform[2];
3083 #define SQR(a) ((a)*(double)(a))
3084 for (i = 0; i < 2; i++)
3085 disp_transform[i] = sqrt(
SQR(display_matrix[i][0]) +
SQR(display_matrix[i][1]));
3087 if (disp_transform[0] > 0 && disp_transform[1] > 0 &&
3088 disp_transform[0] < (1<<24) && disp_transform[1] < (1<<24) &&
3089 fabs((disp_transform[0] / disp_transform[1]) - 1.0) > 0.01)
3091 disp_transform[0] / disp_transform[1],
3102 int flags, track_id, i;
3124 "found fragment index for track %u\n", frag->
track_id);
3144 for (i = index->
current_item; i < index->item_count; i++) {
3147 "for track %u and moof_offset %"PRId64
"\n",
3156 "but it doesn't have an (in-order) entry for moof_offset "
3234 int data_offset = 0;
3235 unsigned entries, first_sample_flags = frag->
flags;
3285 for (i = 0; i < entries && !pb->
eof_reached; i++) {
3286 unsigned sample_size = frag->
size;
3287 int sample_flags = i ? frag->
flags : first_sample_flags;
3288 unsigned sample_duration = frag->
duration;
3302 " sc->dts_shift %d ctts.duration %d"
3303 " sc->time_offset %"PRId64
" flags & MOV_TRUN_SAMPLE_CTS %d\n", pts,
3307 if (flags & MOV_TRUN_SAMPLE_CTS) {
3316 ", using it for dts\n", dts);
3323 else if (!found_keyframe)
3324 keyframe = found_keyframe =
3336 offset, dts, sample_size, distance, keyframe);
3338 dts += sample_duration;
3339 offset += sample_size;
3368 if (atom.
type !=
MKTAG(
'm',
'd',
'a',
't')) {
3382 long cmov_len, moov_len;
3396 cmov_len = atom.
size - 6 * 4;
3408 goto free_and_return;
3410 if (uncompress (moov_data, (uLongf *) &moov_len, (
const Bytef *)cmov_data, cmov_len) != Z_OK)
3411 goto free_and_return;
3413 goto free_and_return;
3416 atom.
size = moov_len;
3453 for (i = 0; i < edit_count && !pb->
eof_reached; i++) {
3487 static const uint8_t uuid_isml_manifest[] = {
3488 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
3489 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
3492 if (atom.
size <
sizeof(uuid) || atom.
size == INT64_MAX)
3495 ret =
avio_read(pb, uuid,
sizeof(uuid));
3498 }
else if (ret !=
sizeof(uuid)) {
3501 if (!memcmp(uuid, uuid_isml_manifest,
sizeof(uuid))) {
3504 size_t len = atom.
size -
sizeof(uuid);
3520 }
else if (ret != len) {
3526 while ((ptr =
av_stristr(ptr,
"systemBitrate=\""))) {
3527 ptr +=
sizeof(
"systemBitrate=\"") - 1;
3536 ret = strtol(ptr, &endptr, 10);
3537 if (ret < 0 || errno || *endptr !=
'"') {
3563 && !memcmp(content,
"Anevia\x1A\x1A", 8)
3647 int64_t total_size = 0;
3658 atom.
size = INT64_MAX;
3663 if (atom.
size >= 8) {
3670 uint32_t *
type = (uint32_t *)buf + 1;
3674 if (*type ==
MKTAG(
'm',
'v',
'h',
'd') ||
3675 *type ==
MKTAG(
'c',
'm',
'o',
'v')) {
3680 if (atom.
type !=
MKTAG(
'r',
'o',
'o',
't') &&
3692 if (a.
size == 1 && total_size + 8 <= atom.
size) {
3697 av_log(c->
fc,
AV_LOG_TRACE,
"type: %08x '%.4s' parent:'%.4s' sz: %"PRId64
" %"PRId64
" %"PRId64
"\n",
3700 a.
size = atom.
size - total_size + 8;
3707 for (i = 0; mov_default_parse_table[i].
type; i++)
3708 if (mov_default_parse_table[i].
type == a.
type) {
3723 int err =
parse(c, pb, a);
3739 else if (left < 0) {
3741 "overread end of atom '%.4s' by %"PRId64
" bytes\n",
3742 (
char*)&a.
type, -left);
3747 total_size += a.
size;
3750 if (total_size < atom.
size && atom.
size < 0x7ffff)
3762 int moov_offset = -1;
3768 if ((offset + 8) > (
unsigned int)p->
buf_size)
3773 case MKTAG(
'm',
'o',
'o',
'v'):
3774 moov_offset = offset + 4;
3775 case MKTAG(
'm',
'd',
'a',
't'):
3776 case MKTAG(
'p',
'n',
'o',
't'):
3777 case MKTAG(
'u',
'd',
't',
'a'):
3778 case MKTAG(
'f',
't',
'y',
'p'):
3781 offset + 12 > (
unsigned int)p->
buf_size ||
3784 }
else if (tag ==
MKTAG(
'f',
't',
'y',
'p') &&
3788 score =
FFMAX(score, 5);
3795 case MKTAG(
'e',
'd',
'i',
'w'):
3796 case MKTAG(
'w',
'i',
'd',
'e'):
3797 case MKTAG(
'f',
'r',
'e',
'e'):
3798 case MKTAG(
'j',
'u',
'n',
'k'):
3799 case MKTAG(
'p',
'i',
'c',
't'):
3803 case MKTAG(0x82,0x82,0x7f,0x7d):
3804 case MKTAG(
's',
'k',
'i',
'p'):
3805 case MKTAG(
'u',
'u',
'i',
'd'):
3806 case MKTAG(
'p',
'r',
'f',
'l'):
3818 offset = moov_offset;
3820 while(offset < (p->
buf_size - 16)){
3870 if (end < sample->timestamp) {
3882 if (len > sample->
size-2)
3884 title_len = 2*len + 1;
3897 else if (ch == 0xfffe)
3901 if (len == 1 || len == 2)
4046 int version, fieldlength, i, j;
4077 if (!index->
items) {
4092 for (j = 0; j < ((fieldlength >> 4) & 3) + 1; j++)
4094 for (j = 0; j < ((fieldlength >> 2) & 3) + 1; j++)
4096 for (j = 0; j < ((fieldlength >> 0) & 3) + 1; j++)
4111 if ((seek_ret =
avio_seek(f, stream_size - 4, SEEK_SET)) < 0) {
4116 if (mfra_size < 0 || mfra_size > stream_size) {
4120 if ((seek_ret =
avio_seek(f, -mfra_size, SEEK_CUR)) < 0) {
4140 seek_ret =
avio_seek(f, original_pos, SEEK_SET);
4143 "failed to seek back after looking for mfra\n");
4162 atom.
size = INT64_MAX;
4195 int tmcd_st_id = -1;
4201 if (tmcd_st_id < 0 || tmcd_st_id == i)
4300 int64_t best_dts = INT64_MAX;
4311 ((msc->
pb != s->
pb && dts < best_dts) || (msc->
pb == s->
pb &&
4314 sample = current_sample;
4366 if (ret64 != sample->
pos) {
4388 #if CONFIG_DV_DEMUXER
4435 if (sample < 0 && st->nb_index_entries && timestamp < st->index_entries[0].timestamp)
4467 st = s->
streams[stream_index];
4482 if (stream_index == i)
4509 #define OFFSET(x) offsetof(MOVContext, x)
4510 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
4512 {
"use_absolute_path",
4513 "allow using absolute path when opening alias, this is a possible security issue",
4516 {
"seek_streams_individually",
4517 "Seek each stream individually to the to the closest point",
4523 "use mfra for fragment timestamps",
4528 FLAGS,
"use_mfra_for" },
4530 FLAGS,
"use_mfra_for" },