70 unsigned len,
const char *key)
74 short current, total = 0;
80 snprintf(buf,
sizeof(buf),
"%d", current);
82 snprintf(buf,
sizeof(buf),
"%d/%d", current, total);
89 unsigned len,
const char *key)
105 unsigned len,
const char *key)
116 unsigned len,
const char *key)
134 char key[1024]={0},
data[1024]={0};
144 if (atom.
size <= 8)
return 0;
146 for (i = 0; i < 3; i++) {
149 int str_size = 0, skip_size = 0;
153 case MKTAG(
'n',
'a',
'm',
'e'):
155 str_size = skip_size = data_size - 12;
159 case MKTAG(
'd',
'a',
't',
'a'):
162 str_size = skip_size = data_size - 16;
167 skip_size = data_size - 8;
175 target[str_size] = 0;
177 atom.
size -= skip_size;
180 if (skip_size > str_size)
avio_skip(pb, skip_size - str_size);
184 if (strcmp(key,
"iTunSMPB") == 0) {
185 int priming, remainder, samples;
186 if(sscanf(
data,
"%*X %X %X %X", &priming, &remainder, &samples) == 3){
187 if(priming>0 && priming<16384)
192 if (strcmp(key,
"cdec") == 0) {
201 0x00C4,0x00C5,0x00C7,0x00C9,0x00D1,0x00D6,0x00DC,0x00E1,
202 0x00E0,0x00E2,0x00E4,0x00E3,0x00E5,0x00E7,0x00E9,0x00E8,
203 0x00EA,0x00EB,0x00ED,0x00EC,0x00EE,0x00EF,0x00F1,0x00F3,
204 0x00F2,0x00F4,0x00F6,0x00F5,0x00FA,0x00F9,0x00FB,0x00FC,
205 0x2020,0x00B0,0x00A2,0x00A3,0x00A7,0x2022,0x00B6,0x00DF,
206 0x00AE,0x00A9,0x2122,0x00B4,0x00A8,0x2260,0x00C6,0x00D8,
207 0x221E,0x00B1,0x2264,0x2265,0x00A5,0x00B5,0x2202,0x2211,
208 0x220F,0x03C0,0x222B,0x00AA,0x00BA,0x03A9,0x00E6,0x00F8,
209 0x00BF,0x00A1,0x00AC,0x221A,0x0192,0x2248,0x2206,0x00AB,
210 0x00BB,0x2026,0x00A0,0x00C0,0x00C3,0x00D5,0x0152,0x0153,
211 0x2013,0x2014,0x201C,0x201D,0x2018,0x2019,0x00F7,0x25CA,
212 0x00FF,0x0178,0x2044,0x20AC,0x2039,0x203A,0xFB01,0xFB02,
213 0x2021,0x00B7,0x201A,0x201E,0x2030,0x00C2,0x00CA,0x00C1,
214 0x00CB,0x00C8,0x00CD,0x00CE,0x00CF,0x00CC,0x00D3,0x00D4,
215 0xF8FF,0x00D2,0x00DA,0x00DB,0x00D9,0x0131,0x02C6,0x02DC,
216 0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7,
220 char *dst,
int dstlen)
223 char *
end = dst+dstlen-1;
226 for (i = 0; i <
len; i++) {
228 if (c < 0x80 && p < end)
280 unsigned len,
const char *key)
292 #ifdef MOV_EXPORT_ALL_METADATA
295 char str[1024], key2[16], language[4] = {0};
296 const char *key = NULL;
297 uint16_t langcode = 0;
298 uint32_t data_type = 0, str_size;
305 case MKTAG(0xa9,
'n',
'a',
'm'): key =
"title";
break;
306 case MKTAG(0xa9,
'a',
'u',
't'):
307 case MKTAG(0xa9,
'A',
'R',
'T'): key =
"artist";
break;
308 case MKTAG(
'a',
'A',
'R',
'T'): key =
"album_artist";
break;
309 case MKTAG(0xa9,
'w',
'r',
't'): key =
"composer";
break;
310 case MKTAG(
'c',
'p',
'r',
't'):
311 case MKTAG(0xa9,
'c',
'p',
'y'): key =
"copyright";
break;
312 case MKTAG(0xa9,
'g',
'r',
'p'): key =
"grouping";
break;
313 case MKTAG(0xa9,
'l',
'y',
'r'): key =
"lyrics";
break;
314 case MKTAG(0xa9,
'c',
'm',
't'):
315 case MKTAG(0xa9,
'i',
'n',
'f'): key =
"comment";
break;
316 case MKTAG(0xa9,
'a',
'l',
'b'): key =
"album";
break;
317 case MKTAG(0xa9,
'd',
'a',
'y'): key =
"date";
break;
318 case MKTAG(0xa9,
'g',
'e',
'n'): key =
"genre";
break;
319 case MKTAG(
'g',
'n',
'r',
'e'): key =
"genre";
321 case MKTAG(0xa9,
't',
'o',
'o'):
322 case MKTAG(0xa9,
's',
'w',
'r'): key =
"encoder";
break;
323 case MKTAG(0xa9,
'e',
'n',
'c'): key =
"encoder";
break;
324 case MKTAG(0xa9,
'm',
'a',
'k'): key =
"make";
break;
325 case MKTAG(0xa9,
'm',
'o',
'd'): key =
"model";
break;
326 case MKTAG(0xa9,
'x',
'y',
'z'): key =
"location";
break;
327 case MKTAG(
'd',
'e',
's',
'c'): key =
"description";
break;
328 case MKTAG(
'l',
'd',
'e',
's'): key =
"synopsis";
break;
329 case MKTAG(
't',
'v',
's',
'h'): key =
"show";
break;
330 case MKTAG(
't',
'v',
'e',
'n'): key =
"episode_id";
break;
331 case MKTAG(
't',
'v',
'n',
'n'): key =
"network";
break;
332 case MKTAG(
't',
'r',
'k',
'n'): key =
"track";
334 case MKTAG(
'd',
'i',
's',
'k'): key =
"disc";
336 case MKTAG(
't',
'v',
'e',
's'): key =
"episode_sort";
338 case MKTAG(
't',
'v',
's',
'n'): key =
"season_number";
340 case MKTAG(
's',
't',
'i',
'k'): key =
"media_type";
342 case MKTAG(
'h',
'd',
'v',
'd'): key =
"hd_video";
344 case MKTAG(
'p',
'g',
'a',
'p'): key =
"gapless_playback";
346 case MKTAG(
'@',
'P',
'R',
'M'):
348 case MKTAG(
'@',
'P',
'R',
'Q'):
355 if (tag ==
MKTAG(
'd',
'a',
't',
'a')) {
358 str_size = data_size - 16;
361 if (atom.
type ==
MKTAG(
'c',
'o',
'v',
'r')) {
375 str_size = atom.
size;
377 #ifdef MOV_EXPORT_ALL_METADATA
389 str_size =
FFMIN3(
sizeof(str)-1, str_size, atom.
size);
392 parse(c, pb, str_size, key);
394 if (data_type == 3 || (data_type == 0 && (langcode < 0x400 || langcode == 0x7fff))) {
403 if (*language && strcmp(language,
"und")) {
404 snprintf(key2,
sizeof(key2),
"%s-%s", key, language);
408 av_dlog(c->
fc,
"lang \"%3s\" ", language);
409 av_dlog(c->
fc,
"tag \"%s\" value \"%s\" atom \"%.4s\" %d %"PRId64
"\n",
410 key, str, (
char*)&atom.
type, str_size, atom.
size);
418 int i, nb_chapters, str_len,
version;
421 if ((atom.
size -= 5) < 0)
430 for (i = 0; i < nb_chapters; i++) {
437 if ((atom.
size -= 9+str_len) < 0)
447 #define MIN_DATA_ENTRY_BOX_SIZE 12
462 entries >= UINT_MAX /
sizeof(*sc->
drefs))
481 av_dlog(c->
fc,
"type %.4s size %d\n", (
char*)&dref->
type, size);
483 if (dref->
type ==
MKTAG(
'a',
'l',
'i',
's') && size > 150) {
485 uint16_t volume_len,
len;
491 volume_len =
FFMIN(volume_len, 27);
493 dref->
volume[volume_len] = 0;
499 len =
FFMIN(len, 63);
514 for (type = 0; type != -1 &&
avio_tell(pb) < next; ) {
528 if (len > volume_len && !strncmp(dref->
path, dref->
volume, volume_len)) {
530 memmove(dref->
path, dref->
path+volume_len, len);
533 for (j = 0; j <
len; j++)
534 if (dref->
path[j] ==
':')
537 }
else if (type == 0) {
545 for (j = 0; j <
len; j++)
546 if (dref->
dir[j] ==
':')
578 av_dlog(c->
fc,
"ctype= %.4s (0x%08x)\n", (
char*)&ctype, ctype);
579 av_dlog(c->
fc,
"stype= %.4s\n", (
char*)&type);
581 if (type ==
MKTAG(
'v',
'i',
'd',
'e'))
583 else if (type ==
MKTAG(
's',
'o',
'u',
'n'))
585 else if (type ==
MKTAG(
'm',
'1',
'a',
' '))
587 else if ((type ==
MKTAG(
's',
'u',
'b',
'p')) || (type ==
MKTAG(
'c',
'l',
'c',
'p')))
594 title_size = atom.
size - 24;
595 if (title_size > 0) {
600 title_str[title_size] = 0;
603 (!c->
isom && title_str[0] == title_size - 1), 0);
640 int ac3info, acmod, lfeon, bsmod;
647 bsmod = (ac3info >> 14) & 0x7;
648 acmod = (ac3info >> 11) & 0x7;
649 lfeon = (ac3info >> 10) & 0x1;
650 st->
codec->
channels = ((
int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon;
664 int eac3info, acmod, lfeon, bsmod;
675 bsmod = (eac3info >> 12) & 0x1f;
676 acmod = (eac3info >> 9) & 0x7;
677 lfeon = (eac3info >> 8) & 0x1;
736 "sample aspect ratio already set to %d:%d, ignoring 'pasp' atom (%d:%d)\n",
739 }
else if (den != 0) {
760 char minor_ver_str[11];
761 char* comp_brands_str;
765 if (strcmp(type,
"qt "))
770 snprintf(minor_ver_str,
sizeof(minor_ver_str),
"%d", minor_ver);
773 comp_brand_size = atom.
size - 8;
774 if (comp_brand_size < 0)
776 comp_brands_str =
av_malloc(comp_brand_size + 1);
777 if (!comp_brands_str)
779 avio_read(pb, comp_brands_str, comp_brand_size);
780 comp_brands_str[comp_brand_size] = 0;
819 if(time >= 2082844800)
822 ptm = gmtime(&timet);
824 strftime(buffer,
sizeof(buffer),
"%Y-%m-%d %H:%M:%S", ptm);
834 char language[4] = {0};
836 int64_t creation_time;
876 int64_t creation_time;
925 av_dlog(c->
fc,
"enda %d\n", little_endian);
926 if (little_endian == 1) {
950 unsigned mov_field_order;
959 if ((mov_field_order & 0xFF00) == 0x0100)
961 else if ((mov_field_order & 0xFF00) == 0x0200) {
962 switch (mov_field_order & 0xFF) {
998 if (size > INT_MAX || (uint64_t)atom.
size > INT_MAX)
1011 }
else if (err < atom.
size) {
1015 memset(buf + 8 + err, 0, FF_INPUT_BUFFER_PADDING_SIZE);
1064 codec->
width = 1440;
1085 if ((uint64_t)atom.
size > (1<<30))
1095 }
else if (atom.
size > 8) {
1116 if ((uint64_t)atom.
size > (1<<30))
1119 if (atom.
size >= 10) {
1125 if (type ==
MKTAG(
'f',
'i',
'e',
'l') && size == atom.
size)
1145 if (atom.
size >= (1<<28) || atom.
size < 7)
1149 if ((profile_level & 0xf0) != 0xc0)
1171 if (atom.
size <= 40)
1175 if ((uint64_t)atom.
size > (1<<30))
1189 unsigned int i, entries;
1203 if (entries >= UINT_MAX/
sizeof(int64_t))
1211 if (atom.
type ==
MKTAG(
's',
't',
'c',
'o'))
1214 else if (atom.
type ==
MKTAG(
'c',
'o',
'6',
'4'))
1247 ((format & 0xFFFF) ==
'm' + (
's' << 8) ||
1248 (format & 0xFFFF) ==
'T' + (
'S' << 8)))
1255 format && format !=
MKTAG(
'm',
'p',
'4',
's')) {
1278 unsigned int color_depth,
len, j;
1279 int color_greyscale;
1303 if (!memcmp(st->
codec->
codec_name,
"Planar Y'CbCr 8-bit 4:2:0", 25)) {
1315 av_dlog(c->
fc,
"depth %d, ctab id %d\n",
1325 if ((color_depth == 2) || (color_depth == 4) || (color_depth == 8)) {
1327 unsigned int color_start, color_count, color_end;
1328 unsigned char a,
r,
g,
b;
1330 if (color_greyscale) {
1331 int color_index, color_dec;
1334 color_count = 1 << color_depth;
1336 color_dec = 256 / (color_count - 1);
1337 for (j = 0; j < color_count; j++) {
1338 r = g = b = color_index;
1339 sc->
palette[j] = (0xFF
U << 24) | (r << 16) | (g << 8) | (b);
1340 color_index -= color_dec;
1341 if (color_index < 0)
1344 }
else if (color_table_id) {
1347 color_count = 1 << color_depth;
1348 if (color_depth == 2)
1350 else if (color_depth == 4)
1355 for (j = 0; j < color_count; j++) {
1356 r = color_table[j * 3 + 0];
1357 g = color_table[j * 3 + 1];
1358 b = color_table[j * 3 + 2];
1359 sc->
palette[j] = (0xFF
U << 24) | (r << 16) | (g << 8) | (b);
1366 if ((color_start <= 255) && (color_end <= 255)) {
1367 for (j = color_start; j <= color_end; j++) {
1378 sc->
palette[j] = (a << 24 ) | (r << 16) | (g << 8) | (b);
1389 int bits_per_sample,
flags;
1406 av_dlog(c->
fc,
"version =%d, isom =%d\n", version, c->
isom);
1408 (compatible_brands && strstr(compatible_brands->
value,
"qt "))) {
1415 }
else if (version == 2) {
1469 if (bits_per_sample) {
1522 #if CONFIG_DV_DEMUXER
1587 int codec_tag,
int format,
1593 (codec_tag != format &&
1595 : codec_tag !=
MKTAG(
'j',
'p',
'e',
'g')))) {
1604 if ( codec_tag ==
AV_RL32(
"avc1") ||
1605 codec_tag ==
AV_RL32(
"hvc1") ||
1617 int pseudo_stream_id;
1624 for (pseudo_stream_id = 0;
1626 pseudo_stream_id++) {
1629 int ret, dref_id = 1;
1639 }
else if (size <= 7){
1653 av_dlog(c->
fc,
"size=%"PRId64
" 4CC= %c%c%c%c codec_type=%d\n", size,
1654 (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff,
1678 }
else if (a.
size > 0)
1703 unsigned int i, entries;
1719 if (entries >= UINT_MAX /
sizeof(*sc->
stsc_data))
1725 for (i = 0; i < entries && !pb->
eof_reached; i++) {
1743 unsigned i, entries;
1753 if (entries >= UINT_MAX /
sizeof(*sc->
stps_data))
1759 for (i = 0; i < entries && !pb->
eof_reached; i++) {
1776 unsigned int i, entries;
1788 av_dlog(c->
fc,
"keyframe_count = %d\n", entries);
1797 if (entries >= UINT_MAX /
sizeof(
int))
1803 for (i = 0; i < entries && !pb->
eof_reached; i++) {
1820 unsigned int i, entries, sample_size, field_size, num_bytes;
1832 if (atom.
type ==
MKTAG(
's',
't',
's',
'z')) {
1851 if (field_size != 4 && field_size != 8 && field_size != 16 && field_size != 32) {
1858 if (entries >= UINT_MAX /
sizeof(
int) || entries >= (UINT_MAX - 4) / field_size)
1864 num_bytes = (entries*field_size+4)>>3;
1872 if (
avio_read(pb, buf, num_bytes) < num_bytes) {
1880 for (i = 0; i < entries && !pb->
eof_reached; i++) {
1898 unsigned int i, entries;
1900 int64_t total_sample_count=0;
1911 av_dlog(c->
fc,
"track[%i].stts.entries = %i\n",
1914 if (entries >= UINT_MAX /
sizeof(*sc->
stts_data))
1922 for (i = 0; i < entries && !pb->
eof_reached; i++) {
1923 int sample_duration;
1930 if (sample_duration < 0) {
1933 sample_duration = 1;
1935 if (sample_count < 0) {
1942 av_dlog(c->
fc,
"sample_count=%d, sample_duration=%d\n",
1943 sample_count, sample_duration);
1947 && sample_count == 1
1948 && total_sample_count > 100
1949 && sample_duration/10 > duration / total_sample_count)
1950 sample_duration = duration / total_sample_count;
1951 duration+=(int64_t)sample_duration*sample_count;
1952 total_sample_count+=sample_count;
1981 unsigned int i, entries;
1996 if (entries >= UINT_MAX /
sizeof(*sc->
ctts_data))
2002 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2009 av_dlog(c->
fc,
"count=%d, duration=%d\n",
2012 if (
FFABS(duration) > (1<<28) && i+2<entries) {
2037 unsigned int i, entries;
2039 uint32_t grouping_type;
2049 if (grouping_type !=
MKTAG(
'r',
'a',
'p',
' '))
2057 if (entries >= UINT_MAX /
sizeof(*sc->
rap_group))
2063 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2076 int64_t current_offset;
2077 int64_t current_dts = 0;
2078 unsigned int stts_index = 0;
2079 unsigned int stsc_index = 0;
2080 unsigned int stss_index = 0;
2081 unsigned int stps_index = 0;
2083 uint64_t stream_size = 0;
2103 unsigned int current_sample = 0;
2104 unsigned int stts_sample = 0;
2105 unsigned int sample_size;
2107 unsigned int rap_group_index = 0;
2108 unsigned int rap_group_sample = 0;
2159 if (rap_group_present && rap_group_index < sc->rap_group_count) {
2162 if (++rap_group_sample == sc->
rap_group[rap_group_index].
count) {
2163 rap_group_sample = 0;
2169 && !rap_group_present
2178 e->
pos = current_offset;
2180 e->
size = sample_size;
2183 av_dlog(mov->
fc,
"AVIndex stream %d, sample %d, offset %"PRIx64
", dts %"PRId64
", "
2184 "size %d, distance %d, keyframe %d\n", st->
index, current_sample,
2185 current_offset, current_dts, sample_size, distance, keyframe);
2190 current_offset += sample_size;
2191 stream_size += sample_size;
2205 unsigned chunk_samples, total = 0;
2209 unsigned count, chunk_count;
2222 count = (chunk_samples+samples-1) / samples;
2224 count = (chunk_samples+1023) / 1024;
2227 if (i < sc->stsc_count - 1)
2231 total += chunk_count *
count;
2234 av_dlog(mov->
fc,
"chunk count %d\n", total);
2253 while (chunk_samples > 0) {
2255 unsigned size, samples;
2266 samples =
FFMIN(1024, chunk_samples);
2276 e->
pos = current_offset;
2281 av_dlog(mov->
fc,
"AVIndex stream %d, chunk %d, offset %"PRIx64
", dts %"PRId64
", "
2282 "size %d, duration %d\n", st->
index, i, current_offset, current_dts,
2285 current_offset +=
size;
2286 current_dts += samples;
2287 chunk_samples -= samples;
2299 char filename[1024];
2300 const char *src_path;
2304 src_path = strrchr(src,
'/');
2311 for (i = 0, l = strlen(ref->
path) - 1; l >= 0; l--)
2312 if (ref->
path[l] ==
'/') {
2320 if (i == ref->
nlvl_to - 1 && src_path - src <
sizeof(filename)) {
2321 memcpy(filename, src, src_path - src);
2322 filename[src_path -
src] = 0;
2332 }
else if (use_absolute_path) {
2334 "this is a possible security issue\n");
2359 if (!st)
return AVERROR(ENOMEM);
2362 if (!sc)
return AVERROR(ENOMEM);
2390 "stream %d, error opening alias: path='%s', dir='%s', "
2391 "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n",
2406 #if FF_API_R_FRAME_RATE
2422 #if CONFIG_H261_DECODER
2425 #if CONFIG_H263_DECODER
2428 #if CONFIG_MPEG4_DECODER
2459 while (atom.
size > 8) {
2462 if (tag ==
MKTAG(
'h',
'd',
'l',
'r')) {
2476 int64_t disp_transform[2];
2477 int display_matrix[3][2];
2515 for (i = 0; i < 3; i++) {
2523 sc->
width = width >> 16;
2524 sc->
height = height >> 16;
2529 if (display_matrix[1][0] == -65536 && display_matrix[0][1] == 65536) {
2533 if (display_matrix[0][0] == -65536 && display_matrix[1][1] == -65536) {
2537 if (display_matrix[1][0] == 65536 && display_matrix[0][1] == -65536) {
2545 if (width && height &&
2546 ((display_matrix[0][0] != 65536 ||
2547 display_matrix[1][1] != 65536) &&
2548 !display_matrix[0][1] &&
2549 !display_matrix[1][0] &&
2550 !display_matrix[2][0] && !display_matrix[2][1])) {
2551 for (i = 0; i < 2; i++)
2553 (int64_t) width * display_matrix[0][i] +
2554 (int64_t) height * display_matrix[1][i] +
2555 ((int64_t) display_matrix[2][i] << 16);
2559 ((
double) disp_transform[0] * height) /
2560 ((
double) disp_transform[1] * width), INT_MAX);
2569 int flags, track_id, i;
2642 int data_offset = 0;
2643 unsigned entries, first_sample_flags = frag->
flags;
2662 av_dlog(c->
fc,
"flags 0x%x entries %d\n", flags, entries);
2692 av_dlog(c->
fc,
"first sample flags 0x%x\n", first_sample_flags);
2693 for (i = 0; i < entries && !pb->
eof_reached; i++) {
2694 unsigned sample_size = frag->
size;
2695 int sample_flags = i ? frag->
flags : first_sample_flags;
2696 unsigned sample_duration = frag->
duration;
2709 else if (!found_keyframe)
2710 keyframe = found_keyframe =
2717 av_dlog(c->
fc,
"AVIndex stream %d, sample %d, offset %"PRIx64
", dts %"PRId64
", "
2719 offset, dts, sample_size, distance, keyframe);
2721 dts += sample_duration;
2722 offset += sample_size;
2751 if (atom.
type !=
MKTAG(
'm',
'd',
'a',
't')) {
2765 long cmov_len, moov_len;
2779 cmov_len = atom.
size - 6 * 4;
2790 if (uncompress (moov_data, (uLongf *) &moov_len, (
const Bytef *)cmov_data, cmov_len) != Z_OK)
2791 goto free_and_return;
2792 if (
ffio_init_context(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0)
2793 goto free_and_return;
2795 atom.
size = moov_len;
2811 int i, edit_count,
version, edit_start_index = 0;
2822 if ((uint64_t)edit_count*12+8 > atom.
size)
2826 for (i=0; i<edit_count; i++){
2838 if (i == 0 && time == -1) {
2840 edit_start_index = 1;
2841 }
else if (i == edit_start_index && time >= 0)
2846 av_dlog(c->
fc,
"duration=%"PRId64
" time=%"PRId64
" rate=%f\n",
2847 duration, time, rate / 65536.0);
2852 "a/v desync might occur, patch welcome\n");
2872 static const uint8_t uuid_isml_manifest[] = {
2873 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
2874 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
2877 if (atom.
size <
sizeof(uuid) || atom.
size == INT64_MAX)
2880 ret =
avio_read(pb, uuid,
sizeof(uuid));
2883 }
else if (ret !=
sizeof(uuid)) {
2886 if (!memcmp(uuid, uuid_isml_manifest,
sizeof(uuid))) {
2889 size_t len = atom.
size -
sizeof(uuid);
2905 }
else if (ret != len) {
2911 while ((ptr =
av_stristr(ptr,
"systemBitrate=\"")) != NULL) {
2912 ptr +=
sizeof(
"systemBitrate=\"") - 1;
2921 ret = strtol(ptr, &endptr, 10);
2922 if (ret < 0 || errno || *endptr !=
'"') {
3005 int64_t total_size = 0;
3010 atom.
size = INT64_MAX;
3015 if (atom.
size >= 8) {
3018 if (atom.
type !=
MKTAG(
'r',
'o',
'o',
't') &&
3034 av_dlog(c->
fc,
"type: %08x '%.4s' parent:'%.4s' sz: %"PRId64
" %"PRId64
" %"PRId64
"\n",
3037 a.
size = atom.
size - total_size + 8;
3044 for (i = 0; mov_default_parse_table[i].
type; i++)
3045 if (mov_default_parse_table[i].
type == a.
type) {
3060 int err =
parse(c, pb, a);
3073 else if (left < 0) {
3075 "overread end of atom '%.4s' by %"PRId64
" bytes\n",
3076 (
char*)&a.
type, -left);
3081 total_size += a.
size;
3084 if (total_size < atom.
size && atom.
size < 0x7ffff)
3095 int moov_offset = -1;
3101 if ((offset + 8) > (
unsigned int)p->
buf_size)
3106 case MKTAG(
'm',
'o',
'o',
'v'):
3107 moov_offset = offset + 4;
3108 case MKTAG(
'j',
'P',
' ',
' '):
3109 case MKTAG(
'm',
'd',
'a',
't'):
3110 case MKTAG(
'p',
'n',
'o',
't'):
3111 case MKTAG(
'u',
'd',
't',
'a'):
3112 case MKTAG(
'f',
't',
'y',
'p'):
3115 offset + 12 > (
unsigned int)p->
buf_size ||
3124 case MKTAG(
'e',
'd',
'i',
'w'):
3125 case MKTAG(
'w',
'i',
'd',
'e'):
3126 case MKTAG(
'f',
'r',
'e',
'e'):
3127 case MKTAG(
'j',
'u',
'n',
'k'):
3128 case MKTAG(
'p',
'i',
'c',
't'):
3132 case MKTAG(0x82,0x82,0x7f,0x7d):
3133 case MKTAG(
's',
'k',
'i',
'p'):
3134 case MKTAG(
'u',
'u',
'i',
'd'):
3135 case MKTAG(
'p',
'r',
'f',
'l'):
3147 offset = moov_offset;
3149 while(offset < (p->
buf_size - 16)){
3154 av_log(NULL,
AV_LOG_WARNING,
"Found media data tag MPEG indicating this is a MOV-packed MPEG-PS.\n");
3206 if (len > sample->
size-2)
3208 title_len = 2*len + 1;
3221 else if (ch == 0xfffe)
3225 if (len == 1 || len == 2)
3371 atom.
size = INT64_MAX;
3400 int tmcd_st_id = -1;
3406 if (tmcd_st_id < 0 || tmcd_st_id == i)
3450 int64_t best_dts = INT64_MAX;
3461 ((msc->
pb != s->
pb && dts < best_dts) || (msc->
pb == s->
pb &&
3464 sample = current_sample;
3524 #if CONFIG_DV_DEMUXER
3559 av_dlog(s,
"stream %d, pts %"PRId64
", dts %"PRId64
", pos 0x%"PRIx64
", duration %d\n",
3571 av_dlog(s,
"stream %d, timestamp %"PRId64
", sample %d\n", st->
index, timestamp, sample);
3572 if (sample < 0 && st->nb_index_entries && timestamp < st->index_entries[0].timestamp)
3597 int64_t seek_timestamp, timestamp;
3604 st = s->
streams[stream_index];
3617 if (stream_index == i)
3627 {
"use_absolute_path",
3628 "allow using absolute path when opening alias, this is a possible security issue",
3644 .
name =
"mov,mp4,m4a,3gp,3g2,mj2",
3652 .priv_class = &mov_class,