73                                              unsigned len, 
const char *key)
 
   77     short current, total = 0;
 
   83         snprintf(buf, 
sizeof(buf), 
"%d", current);
 
   85         snprintf(buf, 
sizeof(buf), 
"%d/%d", current, total);
 
   93                                             unsigned len, 
const char *key)
 
  107                                         unsigned len, 
const char *key)
 
  116                              unsigned len, 
const char *key)
 
  132     0x00C4,0x00C5,0x00C7,0x00C9,0x00D1,0x00D6,0x00DC,0x00E1,
 
  133     0x00E0,0x00E2,0x00E4,0x00E3,0x00E5,0x00E7,0x00E9,0x00E8,
 
  134     0x00EA,0x00EB,0x00ED,0x00EC,0x00EE,0x00EF,0x00F1,0x00F3,
 
  135     0x00F2,0x00F4,0x00F6,0x00F5,0x00FA,0x00F9,0x00FB,0x00FC,
 
  136     0x2020,0x00B0,0x00A2,0x00A3,0x00A7,0x2022,0x00B6,0x00DF,
 
  137     0x00AE,0x00A9,0x2122,0x00B4,0x00A8,0x2260,0x00C6,0x00D8,
 
  138     0x221E,0x00B1,0x2264,0x2265,0x00A5,0x00B5,0x2202,0x2211,
 
  139     0x220F,0x03C0,0x222B,0x00AA,0x00BA,0x03A9,0x00E6,0x00F8,
 
  140     0x00BF,0x00A1,0x00AC,0x221A,0x0192,0x2248,0x2206,0x00AB,
 
  141     0x00BB,0x2026,0x00A0,0x00C0,0x00C3,0x00D5,0x0152,0x0153,
 
  142     0x2013,0x2014,0x201C,0x201D,0x2018,0x2019,0x00F7,0x25CA,
 
  143     0x00FF,0x0178,0x2044,0x20AC,0x2039,0x203A,0xFB01,0xFB02,
 
  144     0x2021,0x00B7,0x201A,0x201E,0x2030,0x00C2,0x00CA,0x00C1,
 
  145     0x00CB,0x00C8,0x00CD,0x00CE,0x00CF,0x00CC,0x00D3,0x00D4,
 
  146     0xF8FF,0x00D2,0x00DA,0x00DB,0x00D9,0x0131,0x02C6,0x02DC,
 
  147     0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7,
 
  151                                char *dst, 
int dstlen)
 
  154     char *
end = dst+dstlen-1;
 
  157     for (i = 0; i < 
len; i++) {
 
  159         if (c < 0x80 && p < end)
 
  211                             unsigned len, 
const char *key)
 
  223     char language[4] = { 0 };
 
  225     uint16_t langcode = 0;
 
  226     double longitude, latitude;
 
  227     const char *key = 
"location";
 
  229     if (len < 4 + 2 + 1 + 1 + 4 + 4 + 4)
 
  249     snprintf(buf, 
sizeof(buf), 
"%+08.4f%+09.4f/", latitude, longitude);
 
  250     if (*language && strcmp(language, 
"und")) {
 
  252         snprintf(key2, 
sizeof(key2), 
"%s-%s", key, language);
 
  262     char key2[32], language[4] = {0};
 
  264     const char *key = NULL;
 
  265     uint16_t langcode = 0;
 
  266     uint32_t data_type = 0, str_size, str_size_alloc;
 
  270     case MKTAG(0xa9,
'n',
'a',
'm'): key = 
"title";     
break;
 
  271     case MKTAG(0xa9,
'a',
'u',
't'):
 
  272     case MKTAG(0xa9,
'A',
'R',
'T'): key = 
"artist";    
break;
 
  273     case MKTAG( 
'a',
'A',
'R',
'T'): key = 
"album_artist";    
break;
 
  274     case MKTAG(0xa9,
'w',
'r',
't'): key = 
"composer";  
break;
 
  275     case MKTAG( 
'c',
'p',
'i',
'l'): key = 
"compilation";
 
  277     case MKTAG( 
'c',
'p',
'r',
't'):
 
  278     case MKTAG(0xa9,
'c',
'p',
'y'): key = 
"copyright"; 
break;
 
  279     case MKTAG(0xa9,
'g',
'r',
'p'): key = 
"grouping"; 
break;
 
  280     case MKTAG(0xa9,
'l',
'y',
'r'): key = 
"lyrics"; 
break;
 
  281     case MKTAG(0xa9,
'c',
'm',
't'):
 
  282     case MKTAG(0xa9,
'i',
'n',
'f'): key = 
"comment";   
break;
 
  283     case MKTAG(0xa9,
'a',
'l',
'b'): key = 
"album";     
break;
 
  284     case MKTAG(0xa9,
'd',
'a',
'y'): key = 
"date";      
break;
 
  285     case MKTAG(0xa9,
'g',
'e',
'n'): key = 
"genre";     
break;
 
  286     case MKTAG( 
'g',
'n',
'r',
'e'): key = 
"genre";
 
  288     case MKTAG(0xa9,
't',
'o',
'o'):
 
  289     case MKTAG(0xa9,
's',
'w',
'r'): key = 
"encoder";   
break;
 
  290     case MKTAG(0xa9,
'e',
'n',
'c'): key = 
"encoder";   
break;
 
  291     case MKTAG(0xa9,
'm',
'a',
'k'): key = 
"make";      
break;
 
  292     case MKTAG(0xa9,
'm',
'o',
'd'): key = 
"model";     
break;
 
  293     case MKTAG(0xa9,
'x',
'y',
'z'): key = 
"location";  
break;
 
  294     case MKTAG( 
'd',
'e',
's',
'c'): key = 
"description";
break;
 
  295     case MKTAG( 
'l',
'd',
'e',
's'): key = 
"synopsis";  
break;
 
  296     case MKTAG( 
't',
'v',
's',
'h'): key = 
"show";      
break;
 
  297     case MKTAG( 
't',
'v',
'e',
'n'): key = 
"episode_id";
break;
 
  298     case MKTAG( 
't',
'v',
'n',
'n'): key = 
"network";   
break;
 
  299     case MKTAG( 
't',
'r',
'k',
'n'): key = 
"track";
 
  301     case MKTAG( 
'd',
'i',
's',
'k'): key = 
"disc";
 
  303     case MKTAG( 
't',
'v',
'e',
's'): key = 
"episode_sort";
 
  305     case MKTAG( 
't',
'v',
's',
'n'): key = 
"season_number";
 
  307     case MKTAG( 
's',
't',
'i',
'k'): key = 
"media_type";
 
  309     case MKTAG( 
'h',
'd',
'v',
'd'): key = 
"hd_video";
 
  311     case MKTAG( 
'p',
'g',
'a',
'p'): key = 
"gapless_playback";
 
  313     case MKTAG( 
'@',
'P',
'R',
'M'):
 
  315     case MKTAG( 
'@',
'P',
'R',
'Q'):
 
  317     case MKTAG( 
'l',
'o',
'c',
'i'):
 
  319     case MKTAG( 
'X',
'M',
'P',
'_'):
 
  326         if (tag == 
MKTAG(
'd',
'a',
't',
'a')) {
 
  329             str_size = data_size - 16;
 
  332             if (atom.
type == 
MKTAG(
'c', 
'o', 
'v', 
'r')) {
 
  346         str_size = atom.
size;
 
  358     str_size_alloc = str_size << 1; 
 
  364         parse(c, pb, str_size, key);
 
  366         if (data_type == 3 || (data_type == 0 && (langcode < 0x400 || langcode == 0x7fff))) { 
 
  370             if (ret != str_size) {
 
  378         if (*language && strcmp(language, 
"und")) {
 
  379             snprintf(key2, 
sizeof(key2), 
"%s-%s", key, language);
 
  383     av_dlog(c->
fc, 
"lang \"%3s\" ", language);
 
  384     av_dlog(c->
fc, 
"tag \"%s\" value \"%s\" atom \"%.4s\" %d %"PRId64
"\n",
 
  385             key, str, (
char*)&atom.
type, str_size_alloc, atom.
size);
 
  394     int i, nb_chapters, str_len, 
version;
 
  397     if ((atom.
size -= 5) < 0)
 
  406     for (i = 0; i < nb_chapters; i++) {
 
  413         if ((atom.
size -= 9+str_len) < 0)
 
  423 #define MIN_DATA_ENTRY_BOX_SIZE 12 
  438         entries >= UINT_MAX / 
sizeof(*sc->
drefs))
 
  457         av_dlog(c->
fc, 
"type %.4s size %d\n", (
char*)&dref->
type, size);
 
  459         if (dref->
type == 
MKTAG(
'a',
'l',
'i',
's') && size > 150) {
 
  461             uint16_t volume_len, 
len;
 
  467             volume_len = 
FFMIN(volume_len, 27);
 
  469             dref->
volume[volume_len] = 0;
 
  475             len = 
FFMIN(len, 63);
 
  490             for (type = 0; type != -1 && 
avio_tell(pb) < next; ) {
 
  504                     if (len > volume_len && !strncmp(dref->
path, dref->
volume, volume_len)) {
 
  506                         memmove(dref->
path, dref->
path+volume_len, len);
 
  509                     for (j = 0; j < 
len; j++)
 
  510                         if (dref->
path[j] == 
':')
 
  513                 } 
else if (type == 0) { 
 
  521                     for (j = 0; j < 
len; j++)
 
  522                         if (dref->
dir[j] == 
':')
 
  554     av_dlog(c->
fc, 
"ctype= %.4s (0x%08x)\n", (
char*)&ctype, ctype);
 
  555     av_dlog(c->
fc, 
"stype= %.4s\n", (
char*)&type);
 
  557     if     (type == 
MKTAG(
'v',
'i',
'd',
'e'))
 
  559     else if (type == 
MKTAG(
's',
'o',
'u',
'n'))
 
  561     else if (type == 
MKTAG(
'm',
'1',
'a',
' '))
 
  563     else if ((type == 
MKTAG(
's',
'u',
'b',
'p')) || (type == 
MKTAG(
'c',
'l',
'c',
'p')))
 
  570     title_size = atom.
size - 24;
 
  571     if (title_size > 0) {
 
  576         title_str[title_size] = 0;
 
  579                         (!c->
isom && title_str[0] == title_size - 1), 0);
 
  616     int ac3info, acmod, lfeon, bsmod;
 
  623     bsmod = (ac3info >> 14) & 0x7;
 
  624     acmod = (ac3info >> 11) & 0x7;
 
  625     lfeon = (ac3info >> 10) & 0x1;
 
  626     st->
codec->
channels = ((
int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon;
 
  640     int eac3info, acmod, lfeon, bsmod;
 
  651     bsmod = (eac3info >> 12) & 0x1f;
 
  652     acmod = (eac3info >>  9) & 0x7;
 
  653     lfeon = (eac3info >>  8) & 0x1;
 
  712                "sample aspect ratio already set to %d:%d, ignoring 'pasp' atom (%d:%d)\n",
 
  715     } 
else if (den != 0) {
 
  736     char* comp_brands_str;
 
  740     if (strcmp(type, 
"qt  "))
 
  747     comp_brand_size = atom.
size - 8;
 
  748     if (comp_brand_size < 0)
 
  750     comp_brands_str = 
av_malloc(comp_brand_size + 1); 
 
  751     if (!comp_brands_str)
 
  753     avio_read(pb, comp_brands_str, comp_brand_size);
 
  754     comp_brands_str[comp_brand_size] = 0;
 
  790                         "read the mfra (may be a live ismv)\n");
 
  794                     "seekable, can not look for mfra\n");
 
  806         struct tm *ptm, tmbuf;
 
  808         if(time >= 2082844800)
 
  813         if (strftime(buffer, 
sizeof(buffer), 
"%Y-%m-%d %H:%M:%S", ptm))
 
  823     char language[4] = {0};
 
  825     int64_t creation_time;
 
  865     int64_t creation_time;
 
  914     av_dlog(c->
fc, 
"enda %d\n", little_endian);
 
  915     if (little_endian == 1) {
 
  939     char color_parameter_type[5] = { 0 };
 
  947     if (strncmp(color_parameter_type, 
"nclx", 4) &&
 
  948         strncmp(color_parameter_type, 
"nclc", 4)) {
 
  950                color_parameter_type);
 
  958     av_dlog(c->
fc, 
"%s: pri %d trc %d matrix %d",
 
  959             color_parameter_type, color_primaries, color_trc, color_matrix);
 
  963         av_dlog(c->
fc, 
" full %"PRIu8
"", color_range);
 
  983         switch (color_primaries) {
 
  994         switch (color_matrix) {
 
 1008     unsigned mov_field_order;
 
 1017     if ((mov_field_order & 0xFF00) == 0x0100)
 
 1019     else if ((mov_field_order & 0xFF00) == 0x0200) {
 
 1020         switch (mov_field_order & 0xFF) {
 
 1056     if (size > INT_MAX || (uint64_t)atom.
size > INT_MAX)
 
 1069     } 
else if (err < atom.
size) {
 
 1073     memset(buf + 8 + err, 0, FF_INPUT_BUFFER_PADDING_SIZE);
 
 1125                 codec->
width = 1440;
 
 1146     if ((uint64_t)atom.
size > (1<<30))
 
 1156     } 
else if (atom.
size > 8) { 
 
 1177     if ((uint64_t)atom.
size > (1<<30))
 
 1180     if (atom.
size >= 10) {
 
 1186         if (type == 
MKTAG(
'f',
'i',
'e',
'l') && size == atom.
size)
 
 1210     if (atom.
size >= (1<<28) || atom.
size < 7)
 
 1214     if ((profile_level & 0xf0) != 0xc0)
 
 1236     if (atom.
size <= 40)
 
 1240     if ((uint64_t)atom.
size > (1<<30))
 
 1254     unsigned int i, entries;
 
 1278     if      (atom.
type == 
MKTAG(
's',
't',
'c',
'o'))
 
 1281     else if (atom.
type == 
MKTAG(
'c',
'o',
'6',
'4'))
 
 1314         ((format & 0xFFFF) == 
'm' + (
's' << 8) ||
 
 1315          (format & 0xFFFF) == 
'T' + (
'S' << 8)))
 
 1322                format && format != 
MKTAG(
'm',
'p',
'4',
's')) {
 
 1346     unsigned int color_depth, 
len, j;
 
 1347     int color_greyscale;
 
 1375     if (!memcmp(codec_name, 
"Planar Y'CbCr 8-bit 4:2:0", 25)) {
 
 1382         !memcmp(codec_name, 
"Sorenson H263", 13))
 
 1387     av_dlog(c->
fc, 
"depth %d, ctab id %d\n",
 
 1397     if ((color_depth == 2) || (color_depth == 4) || (color_depth == 8)) {
 
 1399         unsigned int color_start, color_count, color_end;
 
 1400         unsigned char a, 
r, 
g, 
b;
 
 1402         if (color_greyscale) {
 
 1403             int color_index, color_dec;
 
 1406             color_count = 1 << color_depth;
 
 1408             color_dec   = 256 / (color_count - 1);
 
 1409             for (j = 0; j < color_count; j++) {
 
 1410                 r = g = b = color_index;
 
 1411                 sc->
palette[j] = (0xFF
U << 24) | (r << 16) | (g << 8) | (b);
 
 1412                 color_index -= color_dec;
 
 1413                 if (color_index < 0)
 
 1416         } 
else if (color_table_id) {
 
 1419             color_count = 1 << color_depth;
 
 1420             if (color_depth == 2)
 
 1422             else if (color_depth == 4)
 
 1427             for (j = 0; j < color_count; j++) {
 
 1428                 r = color_table[j * 3 + 0];
 
 1429                 g = color_table[j * 3 + 1];
 
 1430                 b = color_table[j * 3 + 2];
 
 1431                 sc->
palette[j] = (0xFF
U << 24) | (r << 16) | (g << 8) | (b);
 
 1438             if ((color_start <= 255) && (color_end <= 255)) {
 
 1439                 for (j = color_start; j <= color_end; j++) {
 
 1450                     sc->
palette[j] = (a << 24 ) | (r << 16) | (g << 8) | (b);
 
 1461     int bits_per_sample, 
flags;
 
 1478     av_dlog(c->
fc, 
"version =%d, isom =%d\n", version, c->
isom);
 
 1480         (compatible_brands && strstr(compatible_brands->
value, 
"qt  "))) {
 
 1487         } 
else if (version == 2) {
 
 1545     if (bits_per_sample) {
 
 1570     y  = (ycbcr >> 16) & 0xFF;
 
 1571     cr = (ycbcr >> 8)  & 0xFF;
 
 1574     b = av_clip_uint8(1.164 * (y - 16)                      + 2.018 * (cb - 128));
 
 1575     g = av_clip_uint8(1.164 * (y - 16) - 0.813 * (cr - 128) - 0.391 * (cb - 128));
 
 1576     r = av_clip_uint8(1.164 * (y - 16) + 1.596 * (cr - 128));
 
 1578     return (r << 16) | (g << 8) | b;
 
 1583     char buf[256] = {0};
 
 1591         snprintf(buf, 
sizeof(buf), 
"size: %dx%d\n",
 
 1595     for (i = 0; i < 16; i++) {
 
 1596         uint32_t yuv = 
AV_RB32(src + i * 4);
 
 1599         av_strlcatf(buf, 
sizeof(buf), 
"%06"PRIx32
"%s", rgba, i != 15 ? 
", " : 
"");
 
 1602     if (
av_strlcat(buf, 
"\n", 
sizeof(buf)) >= 
sizeof(buf))
 
 1635                 if (format == 
AV_RB32(
"name") && (int64_t)size >= (int64_t)len + 18) {
 
 1637                     if (str_size > 0 && size >= (
int)str_size + 26) {
 
 1638                         char *reel_name = 
av_malloc(str_size + 1);
 
 1642                         reel_name[str_size] = 0; 
 
 1644                         if (*reel_name == 0) {
 
 1669 #if CONFIG_DV_DEMUXER 
 1735                                   int codec_tag, 
int format,
 
 1741          (codec_tag != format &&
 
 1743                                  : codec_tag != 
MKTAG(
'j',
'p',
'e',
'g')))) {
 
 1752     if ( codec_tag == 
AV_RL32(
"avc1") ||
 
 1753          codec_tag == 
AV_RL32(
"hvc1") ||
 
 1765     int pseudo_stream_id;
 
 1772     for (pseudo_stream_id = 0;
 
 1774          pseudo_stream_id++) {
 
 1777         int ret, dref_id = 1;
 
 1787         }
else if (size <= 7){
 
 1801         av_dlog(c->
fc, 
"size=%"PRId64
" 4CC= %c%c%c%c codec_type=%d\n", size,
 
 1802                 (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff,
 
 1826         } 
else if (a.
size > 0)
 
 1851     unsigned int i, entries;
 
 1875     for (i = 0; i < entries && !pb->
eof_reached; i++) {
 
 1893     unsigned i, entries;
 
 1911     for (i = 0; i < entries && !pb->
eof_reached; i++) {
 
 1928     unsigned int i, entries;
 
 1940     av_dlog(c->
fc, 
"keyframe_count = %d\n", entries);
 
 1957     for (i = 0; i < entries && !pb->
eof_reached; i++) {
 
 1974     unsigned int i, entries, sample_size, field_size, num_bytes;
 
 1986     if (atom.
type == 
MKTAG(
's',
't',
's',
'z')) {
 
 2005     if (field_size != 4 && field_size != 8 && field_size != 16 && field_size != 32) {
 
 2012     if (entries >= (UINT_MAX - 4) / field_size)
 
 2022     num_bytes = (entries*field_size+4)>>3;
 
 2030     if (
avio_read(pb, buf, num_bytes) < num_bytes) {
 
 2038     for (i = 0; i < entries && !pb->
eof_reached; i++) {
 
 2056     unsigned int i, entries;
 
 2058     int64_t total_sample_count=0;
 
 2069     av_dlog(c->
fc, 
"track[%i].stts.entries = %i\n",
 
 2080     for (i = 0; i < entries && !pb->
eof_reached; i++) {
 
 2081         int sample_duration;
 
 2088         if (sample_duration < 0) {
 
 2091             sample_duration = 1;
 
 2093         if (sample_count < 0) {
 
 2100         av_dlog(c->
fc, 
"sample_count=%d, sample_duration=%d\n",
 
 2101                 sample_count, sample_duration);
 
 2105             && sample_count == 1
 
 2106             && total_sample_count > 100
 
 2107             && sample_duration/10 > duration / total_sample_count)
 
 2108             sample_duration = duration / total_sample_count;
 
 2109         duration+=(int64_t)sample_duration*sample_count;
 
 2110         total_sample_count+=sample_count;
 
 2139     unsigned int i, entries;
 
 2154     if (entries >= UINT_MAX / 
sizeof(*sc->
ctts_data))
 
 2160     for (i = 0; i < entries && !pb->
eof_reached; i++) {
 
 2167         av_dlog(c->
fc, 
"count=%d, duration=%d\n",
 
 2170         if (
FFABS(duration) > (1<<28) && i+2<entries) {
 
 2195     unsigned int i, entries;
 
 2197     uint32_t grouping_type;
 
 2207     if (grouping_type != 
MKTAG( 
'r',
'a',
'p',
' '))
 
 2223     for (i = 0; i < entries && !pb->
eof_reached; i++) {
 
 2236     int64_t current_offset;
 
 2237     int64_t current_dts = 0;
 
 2238     unsigned int stts_index = 0;
 
 2239     unsigned int stsc_index = 0;
 
 2240     unsigned int stss_index = 0;
 
 2241     unsigned int stps_index = 0;
 
 2243     uint64_t stream_size = 0;
 
 2263         unsigned int current_sample = 0;
 
 2264         unsigned int stts_sample = 0;
 
 2265         unsigned int sample_size;
 
 2267         unsigned int rap_group_index = 0;
 
 2268         unsigned int rap_group_sample = 0;
 
 2319                 if (rap_group_present && rap_group_index < sc->rap_group_count) {
 
 2322                     if (++rap_group_sample == sc->
rap_group[rap_group_index].
count) {
 
 2323                         rap_group_sample = 0;
 
 2329                     && !rap_group_present
 
 2338                     e->
pos = current_offset;
 
 2340                     e->
size = sample_size;
 
 2343                     av_dlog(mov->
fc, 
"AVIndex stream %d, sample %d, offset %"PRIx64
", dts %"PRId64
", " 
 2344                             "size %d, distance %d, keyframe %d\n", st->
index, current_sample,
 
 2345                             current_offset, current_dts, sample_size, distance, keyframe);
 
 2350                 current_offset += sample_size;
 
 2351                 stream_size += sample_size;
 
 2365         unsigned chunk_samples, total = 0;
 
 2369             unsigned count, chunk_count;
 
 2382                 count = (chunk_samples+samples-1) / samples;
 
 2384                 count = (chunk_samples+1023) / 1024;
 
 2387             if (i < sc->stsc_count - 1)
 
 2391             total += chunk_count * 
count;
 
 2394         av_dlog(mov->
fc, 
"chunk count %d\n", total);
 
 2413             while (chunk_samples > 0) {
 
 2415                 unsigned size, samples;
 
 2426                         samples = 
FFMIN(1024, chunk_samples);
 
 2436                 e->
pos = current_offset;
 
 2441                 av_dlog(mov->
fc, 
"AVIndex stream %d, chunk %d, offset %"PRIx64
", dts %"PRId64
", " 
 2442                         "size %d, duration %d\n", st->
index, i, current_offset, current_dts,
 
 2445                 current_offset += 
size;
 
 2446                 current_dts += samples;
 
 2447                 chunk_samples -= samples;
 
 2459         char filename[1024];
 
 2460         const char *src_path;
 
 2464         src_path = strrchr(src, 
'/');
 
 2471         for (i = 0, l = strlen(ref->
path) - 1; l >= 0; l--)
 
 2472             if (ref->
path[l] == 
'/') {
 
 2480         if (i == ref->
nlvl_to - 1 && src_path - src  < 
sizeof(filename)) {
 
 2481             memcpy(filename, src, src_path - src);
 
 2482             filename[src_path - 
src] = 0;
 
 2492     } 
else if (use_absolute_path) {
 
 2494                "this is a possible security issue\n");
 
 2519     if (!st) 
return AVERROR(ENOMEM);
 
 2522     if (!sc) 
return AVERROR(ENOMEM);
 
 2550                    "stream %d, error opening alias: path='%s', dir='%s', " 
 2551                    "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n",
 
 2566 #if FF_API_R_FRAME_RATE 
 2582 #if CONFIG_H261_DECODER 
 2585 #if CONFIG_H263_DECODER 
 2588 #if CONFIG_MPEG4_DECODER 
 2630     for (i = 0; i < 2; i++) {
 
 2641         if (len < 12 || len - 12 > end - 
avio_tell(pb))
 
 2645         if (tag == 
MKTAG(
'n', 
'a', 
'm', 
'e'))
 
 2647         else if (tag == 
MKTAG(
'd', 
'a', 
't', 
'a') && len > 4) {
 
 2662         if (strcmp(key, 
"iTunSMPB") == 0) {
 
 2663             int priming, remainder, samples;
 
 2664             if(sscanf(val, 
"%*X %X %X %X", &priming, &remainder, &samples) == 3){
 
 2665                 if(priming>0 && priming<16384)
 
 2669         if (strcmp(key, 
"cdec") != 0) {
 
 2693     if (len > atom.
size)
 
 2696     if (tag == 
MKTAG(
'm', 
'e', 
'a', 
'n') && len > 12) {
 
 2703         domain_len = 
avio_get_str(pb, len, domain, 
sizeof(domain));
 
 2710            "Unhandled or malformed custom metadata of size %"PRId64
"\n", atom.
size);
 
 2716     while (atom.
size > 8) {
 
 2719         if (tag == 
MKTAG(
'h',
'd',
'l',
'r')) {
 
 2733     int64_t disp_transform[2];
 
 2734     int display_matrix[3][3];
 
 2773     for (i = 0; i < 3; i++) {
 
 2781     sc->
width = width >> 16;
 
 2782     sc->
height = height >> 16;
 
 2786     if (display_matrix[0][0] != (1 << 16) ||
 
 2787         display_matrix[1][1] != (1 << 16) ||
 
 2788         display_matrix[2][2] != (1 << 30) ||
 
 2789         display_matrix[0][1] || display_matrix[0][2] ||
 
 2790         display_matrix[1][0] || display_matrix[1][2] ||
 
 2791         display_matrix[2][0] || display_matrix[2][1]) {
 
 2800         for (i = 0; i < 3; i++)
 
 2801             for (j = 0; j < 3; j++)
 
 2805         if (!
isnan(rotate)) {
 
 2806             char rotate_buf[64];
 
 2810             snprintf(rotate_buf, 
sizeof(rotate_buf), 
"%g", rotate);
 
 2819     if (width && height &&
 
 2820         ((display_matrix[0][0] != 65536  ||
 
 2821           display_matrix[1][1] != 65536) &&
 
 2822          !display_matrix[0][1] &&
 
 2823          !display_matrix[1][0] &&
 
 2824          !display_matrix[2][0] && !display_matrix[2][1])) {
 
 2825         for (i = 0; i < 2; i++)
 
 2827                 (int64_t)  width  * display_matrix[0][i] +
 
 2828                 (int64_t)  height * display_matrix[1][i] +
 
 2829                 ((int64_t) display_matrix[2][i] << 16);
 
 2833             ((
double) disp_transform[0] * height) /
 
 2834             ((
double) disp_transform[1] * width), INT_MAX);
 
 2844     int flags, track_id, i;
 
 2866                    "found fragment index for track %u\n", frag->
track_id);
 
 2886         for (i = index->
current_item; i < index->item_count; i++) {
 
 2889                         "for track %u and moof_offset %"PRId64
"\n",
 
 2898                    "but it doesn't have an (in-order) entry for moof_offset " 
 2976     int data_offset = 0;
 
 2977     unsigned entries, first_sample_flags = frag->
flags;
 
 2996     av_dlog(c->
fc, 
"flags 0x%x entries %d\n", flags, entries);
 
 3026     av_dlog(c->
fc, 
"first sample flags 0x%x\n", first_sample_flags);
 
 3027     for (i = 0; i < entries && !pb->
eof_reached; i++) {
 
 3028         unsigned sample_size = frag->
size;
 
 3029         int sample_flags = i ? frag->
flags : first_sample_flags;
 
 3030         unsigned sample_duration = frag->
duration;
 
 3042                 int64_t pts = frag->
time;
 
 3044                         " sc->dts_shift %d ctts.duration %d" 
 3045                         " sc->time_offset %"PRId64
" flags & MOV_TRUN_SAMPLE_CTS %d\n", pts,
 
 3049                 if (flags & MOV_TRUN_SAMPLE_CTS) {
 
 3058                         ", using it for dts\n", dts);
 
 3065         else if (!found_keyframe)
 
 3066             keyframe = found_keyframe =
 
 3073         av_dlog(c->
fc, 
"AVIndex stream %d, sample %d, offset %"PRIx64
", dts %"PRId64
", " 
 3075                 offset, dts, sample_size, distance, keyframe);
 
 3077         dts += sample_duration;
 
 3078         offset += sample_size;
 
 3107     if (atom.
type != 
MKTAG(
'm',
'd',
'a',
't')) {
 
 3121     long cmov_len, moov_len;
 
 3135     cmov_len = atom.
size - 6 * 4;
 
 3146     if (uncompress (moov_data, (uLongf *) &moov_len, (
const Bytef *)cmov_data, cmov_len) != Z_OK)
 
 3147         goto free_and_return;
 
 3148     if (
ffio_init_context(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0)
 
 3149         goto free_and_return;
 
 3151     atom.
size = moov_len;
 
 3167     int i, edit_count, 
version, edit_start_index = 0;
 
 3178     if ((uint64_t)edit_count*12+8 > atom.
size)
 
 3182     for (i=0; i<edit_count; i++){
 
 3194         if (i == 0 && time == -1) {
 
 3196             edit_start_index = 1;
 
 3197         } 
else if (i == edit_start_index && time >= 0)
 
 3202         av_dlog(c->
fc, 
"duration=%"PRId64
" time=%"PRId64
" rate=%f\n",
 
 3203                 duration, time, rate / 65536.0);
 
 3208                "a/v desync might occur, patch welcome\n");
 
 3228     static const uint8_t uuid_isml_manifest[] = {
 
 3229         0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
 
 3230         0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
 
 3233     if (atom.
size < 
sizeof(uuid) || atom.
size == INT64_MAX)
 
 3236     ret = 
avio_read(pb, uuid, 
sizeof(uuid));
 
 3239     } 
else if (ret != 
sizeof(uuid)) {
 
 3242     if (!memcmp(uuid, uuid_isml_manifest, 
sizeof(uuid))) {
 
 3245         size_t len = atom.
size - 
sizeof(uuid);
 
 3261         } 
else if (ret != len) {
 
 3267         while ((ptr = 
av_stristr(ptr, 
"systemBitrate=\""))) {
 
 3268             ptr += 
sizeof(
"systemBitrate=\"") - 1;
 
 3277             ret = strtol(ptr, &endptr, 10);
 
 3278             if (ret < 0 || errno || *endptr != 
'"') {
 
 3304         && !memcmp(content, 
"Anevia\x1A\x1A", 8)
 
 3387     int64_t total_size = 0;
 
 3392         atom.
size = INT64_MAX;
 
 3397         if (atom.
size >= 8) {
 
 3404                 uint32_t *
type = (uint32_t *)buf + 1;
 
 3407                 if (*type == 
MKTAG(
'm',
'v',
'h',
'd') ||
 
 3408                     *type == 
MKTAG(
'c',
'm',
'o',
'v')) {
 
 3413             if (atom.
type != 
MKTAG(
'r',
'o',
'o',
't') &&
 
 3429         av_dlog(c->
fc, 
"type: %08x '%.4s' parent:'%.4s' sz: %"PRId64
" %"PRId64
" %"PRId64
"\n",
 
 3432             a.
size = atom.
size - total_size + 8;
 
 3439         for (i = 0; mov_default_parse_table[i].
type; i++)
 
 3440             if (mov_default_parse_table[i].
type == a.
type) {
 
 3455             int err = 
parse(c, pb, a);
 
 3468             else if (left < 0) {
 
 3470                        "overread end of atom '%.4s' by %"PRId64
" bytes\n",
 
 3471                        (
char*)&a.
type, -left);
 
 3476         total_size += a.
size;
 
 3479     if (total_size < atom.
size && atom.
size < 0x7ffff)
 
 3490     int moov_offset = -1;
 
 3496         if ((offset + 8) > (
unsigned int)p->
buf_size)
 
 3501         case MKTAG(
'm',
'o',
'o',
'v'):
 
 3502             moov_offset = offset + 4;
 
 3503         case MKTAG(
'm',
'd',
'a',
't'):
 
 3504         case MKTAG(
'p',
'n',
'o',
't'): 
 
 3505         case MKTAG(
'u',
'd',
't',
'a'): 
 
 3506         case MKTAG(
'f',
't',
'y',
'p'):
 
 3509                  offset + 12 > (
unsigned int)p->
buf_size ||
 
 3512             } 
else if (tag == 
MKTAG(
'f',
't',
'y',
'p') &&
 
 3514                 score = 
FFMAX(score, 5);
 
 3521         case MKTAG(
'e',
'd',
'i',
'w'): 
 
 3522         case MKTAG(
'w',
'i',
'd',
'e'):
 
 3523         case MKTAG(
'f',
'r',
'e',
'e'):
 
 3524         case MKTAG(
'j',
'u',
'n',
'k'):
 
 3525         case MKTAG(
'p',
'i',
'c',
't'):
 
 3529         case MKTAG(0x82,0x82,0x7f,0x7d):
 
 3530         case MKTAG(
's',
'k',
'i',
'p'):
 
 3531         case MKTAG(
'u',
'u',
'i',
'd'):
 
 3532         case MKTAG(
'p',
'r',
'f',
'l'):
 
 3544         offset = moov_offset;
 
 3546         while(offset < (p->
buf_size - 16)){ 
 
 3551                 av_log(NULL, 
AV_LOG_WARNING, 
"Found media data tag MPEG indicating this is a MOV-packed MPEG-PS.\n");
 
 3596         if (end < sample->timestamp) {
 
 3608         if (len > sample->
size-2)
 
 3610         title_len = 2*len + 1;
 
 3623             else if (ch == 0xfffe)
 
 3627                 if (len == 1 || len == 2)
 
 3771     int version, fieldlength, i, j, err;
 
 3799     if (!index->
items) {
 
 3813         for (j = 0; j < ((fieldlength >> 4) & 3) + 1; j++)
 
 3815         for (j = 0; j < ((fieldlength >> 2) & 3) + 1; j++)
 
 3817         for (j = 0; j < ((fieldlength >> 0) & 3) + 1; j++)
 
 3832     if ((seek_ret = 
avio_seek(f, stream_size - 4, SEEK_SET)) < 0) {
 
 3837     if (mfra_size < 0 || mfra_size > stream_size) {
 
 3841     if ((seek_ret = 
avio_seek(f, -mfra_size, SEEK_CUR)) < 0) {
 
 3859     seek_ret = 
avio_seek(f, original_pos, SEEK_SET);
 
 3862                "failed to seek back after looking for mfra\n");
 
 3881         atom.
size = INT64_MAX;
 
 3914             int tmcd_st_id = -1;
 
 3920             if (tmcd_st_id < 0 || tmcd_st_id == i)
 
 4019     int64_t best_dts = INT64_MAX;
 
 4030                  ((msc->
pb != s->
pb && dts < best_dts) || (msc->
pb == s->
pb &&
 
 4033                 sample = current_sample;
 
 4093 #if CONFIG_DV_DEMUXER 
 4128     av_dlog(s, 
"stream %d, pts %"PRId64
", dts %"PRId64
", pos 0x%"PRIx64
", duration %d\n",
 
 4140     av_dlog(s, 
"stream %d, timestamp %"PRId64
", sample %d\n", st->
index, timestamp, sample);
 
 4141     if (sample < 0 && st->nb_index_entries && timestamp < st->index_entries[0].timestamp)
 
 4166     int64_t seek_timestamp, timestamp;
 
 4173     st = s->
streams[stream_index];
 
 4186         if (stream_index == i)
 
 4195 #define OFFSET(x) offsetof(MOVContext, x) 
 4196 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM 
 4198     {
"use_absolute_path",
 
 4199         "allow using absolute path when opening alias, this is a possible security issue",
 
 4205         "use mfra for fragment timestamps",
 
 4215     { 
"export_all", 
"Export unrecognized metadata entries", 
OFFSET(export_all),
 
 4228     .
name           = 
"mov,mp4,m4a,3gp,3g2,mj2",
 
 4232     .extensions     = 
"mov,mp4,m4a,3gp,3g2,mj2",