26#include "config_components.h"
97 unsigned len,
const char *
key)
107 snprintf(buf,
sizeof(buf),
"%d",
current);
109 snprintf(buf,
sizeof(buf),
"%d/%d",
current, total);
117 unsigned len,
const char *
key)
131 unsigned len,
const char *
key)
140 unsigned len,
const char *
key)
156 0x00C4,0x00C5,0x00C7,0x00C9,0x00D1,0x00D6,0x00DC,0x00E1,
157 0x00E0,0x00E2,0x00E4,0x00E3,0x00E5,0x00E7,0x00E9,0x00E8,
158 0x00EA,0x00EB,0x00ED,0x00EC,0x00EE,0x00EF,0x00F1,0x00F3,
159 0x00F2,0x00F4,0x00F6,0x00F5,0x00FA,0x00F9,0x00FB,0x00FC,
160 0x2020,0x00B0,0x00A2,0x00A3,0x00A7,0x2022,0x00B6,0x00DF,
161 0x00AE,0x00A9,0x2122,0x00B4,0x00A8,0x2260,0x00C6,0x00D8,
162 0x221E,0x00B1,0x2264,0x2265,0x00A5,0x00B5,0x2202,0x2211,
163 0x220F,0x03C0,0x222B,0x00AA,0x00BA,0x03A9,0x00E6,0x00F8,
164 0x00BF,0x00A1,0x00AC,0x221A,0x0192,0x2248,0x2206,0x00AB,
165 0x00BB,0x2026,0x00A0,0x00C0,0x00C3,0x00D5,0x0152,0x0153,
166 0x2013,0x2014,0x201C,0x201D,0x2018,0x2019,0x00F7,0x25CA,
167 0x00FF,0x0178,0x2044,0x20AC,0x2039,0x203A,0xFB01,0xFB02,
168 0x2021,0x00B7,0x201A,0x201E,0x2030,0x00C2,0x00CA,0x00C1,
169 0x00CB,0x00C8,0x00CD,0x00CE,0x00CF,0x00CC,0x00D3,0x00D4,
170 0xF8FF,0x00D2,0x00DA,0x00DB,0x00D9,0x0131,0x02C6,0x02DC,
171 0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7,
175 char *
dst,
int dstlen)
178 char *end =
dst+dstlen-1;
181 for (
i = 0;
i <
len;
i++) {
203 for (
int i = 0;
i <
c->nb_heif_item;
i++) {
204 if (!
c->heif_item[
i] ||
c->heif_item[
i]->item_id !=
id)
207 item =
c->heif_item[
i];
224 if (
c->fc->nb_streams < 1)
227 if (
c->cur_item_id == -1) {
228 if (
c->trak_index < 0) {
232 return c->fc->streams[
c->fc->nb_streams-1];
267 st =
c->fc->streams[
c->fc->nb_streams - 1];
287 char language[4] = { 0 };
288 char buf[200], place[100];
289 uint16_t langcode = 0;
290 int32_t longitude, latitude, altitude;
292 const char *
key =
"location";
294 if (
len < 4 + 2 + 1 + 1 + 4 + 4 + 4) {
314 "loci too short (%u bytes left, need at least %d)\n",
len, 12);
322 lat =
llrint(
fabs(latitude * (10000.0 / (1 << 16))));
323 lon =
llrint(
fabs(longitude * (10000.0 / (1 << 16))));
325 snprintf(buf,
sizeof(buf),
"%c%02"PRId64
".%04"PRId64
"%c%03"PRId64
".%04"PRId64
326 "%c%03"PRId64
".%03"PRId64
"/%s",
327 latitude < 0 ?
'-' :
'+', lat / 10000, lat % 10000,
328 longitude < 0 ?
'-' :
'+', lon / 10000, lon % 10000,
329 altitude < 0 ?
'-' :
'+',
alt / 1000,
alt % 1000, place);
331 if (*language && strcmp(language,
"und")) {
333 snprintf(key2,
sizeof(key2),
"%s-%s",
key, language);
344 char language[4], *str;
348 if (!strcmp(
key,
"date"))
361 if (ch == 0xFE || ch == 0xFF) {
375 if (
ret >= 0 && *language && strcmp(language,
"und")) {
377 snprintf(key2,
sizeof(key2),
"%s-%s",
key, language);
382 if (
ret >= 0 &&
len > 0 && !strcmp(
key,
"album")) {
396 if (
c->ignore_chapters)
400 if (n_hmmt >
len / 4)
414 char key2[32], language[4] = {0};
417 uint16_t langcode = 0;
418 uint32_t data_type = 0, str_size_alloc;
426 if (
c->trak_index >= 0 &&
c->trak_index <
c->fc->nb_streams)
427 metadata = &
c->fc->streams[
c->trak_index]->metadata;
432 case MKTAG(
'@',
'P',
'R',
'M'):
key =
"premiere_version"; raw = 1;
break;
433 case MKTAG(
'@',
'P',
'R',
'Q'):
key =
"quicktime_version"; raw = 1;
break;
434 case MKTAG(
'X',
'M',
'P',
'_'):
435 if (
c->export_xmp) {
key =
"xmp"; raw = 1; }
break;
436 case MKTAG(
'a',
'A',
'R',
'T'):
key =
"album_artist";
break;
437 case MKTAG(
'a',
'k',
'I',
'D'):
key =
"account_type";
439 case MKTAG(
'a',
'l',
'b',
'm'):
key =
"album"; tgp = 1;
break;
440 case MKTAG(
'a',
'p',
'I',
'D'):
key =
"account_id";
break;
441 case MKTAG(
'a',
'u',
't',
'h'):
key =
"author"; tgp = 1;
break;
442 case MKTAG(
'c',
'a',
't',
'g'):
key =
"category";
break;
443 case MKTAG(
'c',
'p',
'i',
'l'):
key =
"compilation";
445 case MKTAG(
'c',
'p',
'r',
't'):
key =
"copyright"; tgp = 1;
break;
446 case MKTAG(
'd',
'e',
's',
'c'):
key =
"description";
break;
447 case MKTAG(
'd',
'i',
's',
'k'):
key =
"disc";
449 case MKTAG(
'd',
's',
'c',
'p'):
key =
"comment"; tgp = 1;
break;
450 case MKTAG(
'e',
'g',
'i',
'd'):
key =
"episode_uid";
452 case MKTAG(
'F',
'I',
'R',
'M'):
key =
"firmware"; raw = 1;
break;
453 case MKTAG(
'g',
'n',
'r',
'e'):
key =
"genre"; tgp = 1;
455 case MKTAG(
'h',
'd',
'v',
'd'):
key =
"hd_video";
457 case MKTAG(
'H',
'M',
'M',
'T'):
459 case MKTAG(
'k',
'e',
'y',
'w'):
key =
"keywords";
break;
460 case MKTAG(
'l',
'd',
'e',
's'):
key =
"synopsis";
break;
461 case MKTAG(
'l',
'o',
'c',
'i'):
463 case MKTAG(
'm',
'a',
'n',
'u'):
key =
"make";
break;
464 case MKTAG(
'm',
'o',
'd',
'l'):
key =
"model";
break;
465 case MKTAG(
'n',
'a',
'm',
'e'):
key =
"name";
break;
466 case MKTAG(
'p',
'c',
's',
't'):
key =
"podcast";
468 case MKTAG(
'p',
'e',
'r',
'f'):
key =
"artist"; tgp = 1;
break;
469 case MKTAG(
'p',
'g',
'a',
'p'):
key =
"gapless_playback";
471 case MKTAG(
'p',
'u',
'r',
'd'):
key =
"purchase_date";
break;
472 case MKTAG(
'r',
't',
'n',
'g'):
key =
"rating";
474 case MKTAG(
's',
'o',
'a',
'a'):
key =
"sort_album_artist";
break;
475 case MKTAG(
's',
'o',
'a',
'l'):
key =
"sort_album";
break;
476 case MKTAG(
's',
'o',
'a',
'r'):
key =
"sort_artist";
break;
477 case MKTAG(
's',
'o',
'c',
'o'):
key =
"sort_composer";
break;
478 case MKTAG(
's',
'o',
'n',
'm'):
key =
"sort_name";
break;
479 case MKTAG(
's',
'o',
's',
'n'):
key =
"sort_show";
break;
480 case MKTAG(
's',
't',
'i',
'k'):
key =
"media_type";
482 case MKTAG(
't',
'i',
't',
'l'):
key =
"title"; tgp = 1;
break;
483 case MKTAG(
't',
'n',
'a',
'm'):
key =
"title"; tgp = 1;
break;
484 case MKTAG(
't',
'r',
'k',
'n'):
key =
"track";
486 case MKTAG(
't',
'v',
'e',
'n'):
key =
"episode_id";
break;
487 case MKTAG(
't',
'v',
'e',
's'):
key =
"episode_sort";
489 case MKTAG(
't',
'v',
'n',
'n'):
key =
"network";
break;
490 case MKTAG(
't',
'v',
's',
'h'):
key =
"show";
break;
491 case MKTAG(
't',
'v',
's',
'n'):
key =
"season_number";
493 case MKTAG(
'y',
'r',
'r',
'c'):
key =
"date"; tgp = 1;
break;
494 case MKTAG(0xa9,
'A',
'R',
'T'):
key =
"artist";
break;
495 case MKTAG(0xa9,
'P',
'R',
'D'):
key =
"producer";
break;
496 case MKTAG(0xa9,
'a',
'l',
'b'):
key =
"album";
break;
497 case MKTAG(0xa9,
'a',
'u',
't'):
key =
"artist";
break;
498 case MKTAG(0xa9,
'c',
'h',
'p'):
key =
"chapter";
break;
499 case MKTAG(0xa9,
'c',
'm',
't'):
key =
"comment";
break;
500 case MKTAG(0xa9,
'c',
'o',
'm'):
key =
"composer";
break;
501 case MKTAG(0xa9,
'c',
'p',
'y'):
key =
"copyright";
break;
502 case MKTAG(0xa9,
'd',
'a',
'y'):
key =
"date";
break;
503 case MKTAG(0xa9,
'd',
'i',
'r'):
key =
"director";
break;
504 case MKTAG(0xa9,
'd',
'i',
's'):
key =
"disclaimer";
break;
505 case MKTAG(0xa9,
'e',
'd',
'1'):
key =
"edit_date";
break;
506 case MKTAG(0xa9,
'e',
'n',
'c'):
key =
"encoder";
break;
507 case MKTAG(0xa9,
'f',
'm',
't'):
key =
"original_format";
break;
508 case MKTAG(0xa9,
'g',
'e',
'n'):
key =
"genre";
break;
509 case MKTAG(0xa9,
'g',
'r',
'p'):
key =
"grouping";
break;
510 case MKTAG(0xa9,
'h',
's',
't'):
key =
"host_computer";
break;
511 case MKTAG(0xa9,
'i',
'n',
'f'):
key =
"comment";
break;
512 case MKTAG(0xa9,
'l',
'y',
'r'):
key =
"lyrics";
break;
513 case MKTAG(0xa9,
'm',
'a',
'k'):
key =
"make";
break;
514 case MKTAG(0xa9,
'm',
'o',
'd'):
key =
"model";
break;
515 case MKTAG(0xa9,
'n',
'a',
'm'):
key =
"title";
break;
516 case MKTAG(0xa9,
'o',
'p',
'e'):
key =
"original_artist";
break;
517 case MKTAG(0xa9,
'p',
'r',
'd'):
key =
"producer";
break;
518 case MKTAG(0xa9,
'p',
'r',
'f'):
key =
"performers";
break;
519 case MKTAG(0xa9,
'r',
'e',
'q'):
key =
"playback_requirements";
break;
520 case MKTAG(0xa9,
's',
'r',
'c'):
key =
"original_source";
break;
521 case MKTAG(0xa9,
's',
't',
'3'):
key =
"subtitle";
break;
522 case MKTAG(0xa9,
's',
'w',
'r'):
key =
"encoder";
break;
523 case MKTAG(0xa9,
't',
'o',
'o'):
key =
"encoder";
break;
524 case MKTAG(0xa9,
't',
'r',
'k'):
key =
"track";
break;
525 case MKTAG(0xa9,
'u',
'r',
'l'):
key =
"URL";
break;
526 case MKTAG(0xa9,
'w',
'r',
'n'):
key =
"warning";
break;
527 case MKTAG(0xa9,
'w',
'r',
't'):
key =
"composer";
break;
528 case MKTAG(0xa9,
'x',
'y',
'z'):
key =
"location";
break;
531 if (
c->itunes_metadata && atom.
size > 8) {
534 if (
tag ==
MKTAG(
'd',
'a',
't',
'a') && data_size <= atom.size && data_size >= 16) {
537 str_size = data_size - 16;
540 if (!
key &&
c->found_hdlr_mdta &&
c->meta_keys) {
544 }
else if (atom.
type !=
MKTAG(
'c',
'o',
'v',
'r')) {
546 "The index of 'data' is out of range: %"PRId32
" < 1 or >= %d.\n",
547 index,
c->meta_keys_count);
550 if (atom.
type ==
MKTAG(
'c',
'o',
'v',
'r') ||
551 (
key && !strcmp(
key,
"com.apple.quicktime.artwork"))) {
557 atom.
size -= str_size;
563 }
else if (atom.
size > 4 && (
key ||
c->export_all) && !
c->itunes_metadata && !raw) {
565 if (str_size > atom.
size) {
574 if (tgp && !str_size && !langcode)
577 str_size = atom.
size;
579 if (
c->export_all && !
key) {
585 if (atom.
size < 0 || str_size >= INT_MAX/2)
590 num = (data_type >= 21 && data_type <= 23);
591 str_size_alloc = (
num ? 512 : (raw ? str_size : str_size * 2)) + 1;
599 if (!raw && (data_type == 3 || (data_type == 0 && (langcode < 0x400 || langcode == 0x7fff)))) {
601 }
else if (data_type == 21) {
605 else if (str_size == 2)
607 else if (str_size == 3)
609 else if (str_size == 4)
611 else if (str_size == 8)
613 if (snprintf(str, str_size_alloc,
"%"PRId64,
val) >= str_size_alloc) {
615 "Failed to store the number (%"PRId64
") in string.\n",
val);
619 }
else if (data_type == 22) {
623 else if (str_size == 2)
625 else if (str_size == 3)
627 else if (str_size == 4)
629 else if (str_size == 8)
631 if (snprintf(str, str_size_alloc,
"%"PRIu64,
val) >= str_size_alloc) {
633 "Failed to store the number (%"PRIu64
") in string.\n",
val);
637 }
else if (data_type == 23 && str_size >= 4) {
639 if (snprintf(str, str_size_alloc,
"%f",
val) >= str_size_alloc) {
641 "Failed to store the float32 number (%f) in string.\n",
val);
645 }
else if (data_type > 1 && data_type != 4) {
665 if (*language && strcmp(language,
"und")) {
666 snprintf(key2,
sizeof(key2),
"%s-%s",
key, language);
669 if (!strcmp(
key,
"encoder")) {
670 int major, minor, micro;
671 if (sscanf(str,
"HandBrake %d.%d.%d", &major, &minor, µ) == 3) {
672 c->handbrake_version = 1000000*major + 1000*minor + micro;
676 atom.
size -= str_size;
685 if (
c->itunes_metadata && atom.
size > 8)
696 int i, nb_chapters, str_len,
version;
700 if (
c->ignore_chapters)
703 if ((atom.
size -= 5) < 0)
712 for (
i = 0;
i < nb_chapters;
i++) {
719 if ((atom.
size -= 9+str_len) < 0)
731#define MIN_DATA_ENTRY_BOX_SIZE 12
738 if (
c->fc->nb_streams < 1)
740 st =
c->fc->streams[
c->fc->nb_streams-1];
747 entries >= UINT_MAX /
sizeof(*sc->
drefs))
762 for (
i = 0;
i < entries;
i++) {
767 if (
size < 12 || next < 0 || next > INT64_MAX -
size)
777 uint16_t volume_len,
len;
784 volume_len =
FFMIN(volume_len, 27);
788 dref->
volume[volume_len] = 0;
830 if (
len > volume_len && !strncmp(dref->
path, dref->
volume, volume_len)) {
836 for (j =
len - 1; j >= 0; j--) {
837 if (dref->
path[j] == 0)
842 for (j = 0; j <
len; j++)
843 if (dref->
path[j] ==
':' || dref->
path[j] == 0)
846 }
else if (
type == 0) {
858 for (j = 0; j <
len; j++)
859 if (dref->
dir[j] ==
':')
895 if (
c->trak_index < 0) {
897 c->found_hdlr_mdta = 1;
902 st =
c->fc->streams[
c->fc->nb_streams-1];
917 title_size = atom.
size - 24;
918 if (title_size > 0) {
919 if (title_size >
FFMIN(INT_MAX, SIZE_MAX-1))
930 title_str[title_size] = 0;
932 int off = (!
c->isom && title_str[0] == title_size - 1);
954 int ac3info, acmod, lfeon, bsmod;
957 if (
c->fc->nb_streams < 1)
959 st =
c->fc->streams[
c->fc->nb_streams-1];
970 bsmod = (ac3info >> 14) & 0x7;
971 acmod = (ac3info >> 11) & 0x7;
972 lfeon = (ac3info >> 10) & 0x1;
997 unsigned descriptors_size;
998 int nb_frames, disposition;
1016 if (!descriptors_size || descriptors_size > INT_MAX)
1036 if (
ret != descriptors_size)
1040 descriptor_pb = &
b.pub;
1137 for (
int j = 0; j <
mix->nb_submixes; j++) {
1144 for (
int l = 0; l <
c->fc->nb_stream_groups; l++)
1147 audio_element =
c->fc->stream_groups[l];
1152 for (
int l = 0; l < audio_element->
nb_entries; l++) {
1178 if (atom.
size < 8 ||
c->fc->nb_streams < 1)
1181 st =
c->fc->streams[
c->fc->nb_streams-1];
1194 if (sample_rate > 0) {
1196 "overwrite sample rate from %d to %d by 'srat'\n",
1201 "ignore invalid sample rate %d in 'srat'\n", sample_rate);
1212 int eac3info, acmod, lfeon, bsmod;
1216 if (
c->fc->nb_streams < 1)
1218 st =
c->fc->streams[
c->fc->nb_streams-1];
1222 if (atom.
size < 5 || (uint64_t)atom.
size > (1 << 30))
1238 bsmod = (eac3info >> 12) & 0x1f;
1239 acmod = (eac3info >> 9) & 0x7;
1240 lfeon = (eac3info >> 8) & 0x1;
1263 static const int profile[22] = {
1296 static const struct {
unsigned int dts; uint64_t av; }
map[] = {
1327 uint32_t frame_duration_code = 0;
1328 uint32_t channel_layout_code = 0;
1329 uint64_t channel_layout_mask;
1330 unsigned int stream_construction;
1331 unsigned int representation_type;
1340 if (
c->fc->nb_streams < 1) {
1343 st =
c->fc->streams[
c->fc->nb_streams-1];
1353 frame_duration_code =
get_bits(&gb, 2);
1354 stream_construction =
get_bits(&gb, 5);
1359 representation_type =
get_bits(&gb, 3);
1360 channel_layout_code =
get_bits(&gb, 16);
1363 (frame_duration_code == 0) ? 512 :
1364 (frame_duration_code == 1) ? 1024 :
1365 (frame_duration_code == 2) ? 2048 :
1366 (frame_duration_code == 3) ? 4096 : 0;
1373 if (channel_layout_mask) {
1376 }
else if (representation_type == 2 || representation_type == 3) {
1388 if (
c->fc->nb_streams < 1)
1390 st =
c->fc->streams[
c->fc->nb_streams-1];
1410 if (
c->fc->nb_streams < 1)
1412 st =
c->fc->streams[
c->fc->nb_streams-1];
1418 "Unsupported 'chnl' box with version %d, flags: %#x\n",
1458 AVRational aperture_width, aperture_height, horiz_off, vert_off;
1488 if (aperture_width.
num < 0 || aperture_width.
den <= 0 ||
1489 aperture_height.
num < 0 || aperture_height.
den <= 0 ||
1490 horiz_off.
den <= 0 || vert_off.
den <= 0) {
1500 "horizOff %d/%d vertOff %d/%d\n",
1501 aperture_width.
num, aperture_width.
den, aperture_height.
num, aperture_height.
den,
1502 horiz_off.
num, horiz_off.
den, vert_off.
num, vert_off.
den);
1519 if (top < 0 || bottom < 0 || bottom > (
height - 1) ||
1520 left < 0 || right < 0 || right > (
width - 1)) {
1525 bottom =
height - 1 - bottom;
1526 right =
width - 1 - right;
1528 if (!(
left | right | top | bottom))
1532 (top + bottom) >=
height) {
1540 sizeof(uint32_t) * 4, 0);
1568 if (
c->fc->nb_streams < 1)
1570 st =
c->fc->streams[
c->fc->nb_streams-1];
1591#define DRM_BLOB_SIZE 56
1595 uint8_t intermediate_key[20];
1596 uint8_t intermediate_iv[20];
1599 uint8_t file_checksum[20];
1600 uint8_t calculated_checksum[20];
1601 char checksum_string[2 *
sizeof(file_checksum) + 1];
1605 uint8_t *activation_bytes =
c->activation_bytes;
1615 if (!
c->aes_decrypt) {
1629 ff_data_to_hex(checksum_string, file_checksum,
sizeof(file_checksum), 1);
1633 if (!activation_bytes) {
1638 if (
c->activation_bytes_size != 4) {
1645 if (
c->audible_fixed_key_size != 16) {
1665 if (memcmp(calculated_checksum, file_checksum, 20)) {
1672 for (
i = 0;
i < 4;
i++) {
1674 if (activation_bytes[
i] != output[3 -
i]) {
1680 memcpy(
c->file_key, output + 8, 16);
1681 memcpy(input, output + 26, 16);
1696 if (
c->audible_key_size != 16) {
1701 if (
c->audible_iv_size != 16) {
1707 if (!
c->aes_decrypt) {
1711 memcpy(
c->file_key,
c->audible_key, 16);
1712 memcpy(
c->file_iv,
c->audible_iv, 16);
1722 unsigned char iv[16];
1724 memcpy(iv,
c->file_iv, 16);
1736 int comp_brand_size;
1737 char* comp_brands_str;
1738 uint8_t
type[5] = {0};
1742 if (
c->fc->nb_streams) {
1749 if (strcmp(
type,
"qt "))
1756 comp_brand_size = atom.
size - 8;
1757 if (comp_brand_size < 0 || comp_brand_size == INT_MAX)
1759 comp_brands_str =
av_malloc(comp_brand_size + 1);
1760 if (!comp_brands_str)
1768 comp_brands_str[comp_brand_size] = 0;
1773 if (!strcmp(
type,
"aaxc")) {
1785 if (
c->found_moov) {
1823 if (frag_index->
current < 0 ||
1842 if (frag_index->
current < 0 ||
1870 if (moof_offset >=
offset)
1872 if (moof_offset <=
offset)
1900 if (!frag_stream_info)
1914 for (j = 0; j <
s->nb_streams; j++) {
1916 if (sc2->
id == frag_stream_info->
id)
1917 frag_stream =
s->streams[j];
1940 m0 = m = (
a +
b) >> 1;
1946 if (m <
b && frag_time <= timestamp)
1970 &
c->frag_index.allocated_size,
1971 (
c->frag_index.nb_items + 1) *
1972 sizeof(*
c->frag_index.item));
1975 c->frag_index.item = item;
1979 if (!frag_stream_info)
1982 for (
i = 0;
i <
c->fc->nb_streams;
i++) {
1990 frag_stream_info[
i].
id = sc->
id;
2002 memmove(
c->frag_index.item +
index + 1,
c->frag_index.item +
index,
2003 (
c->frag_index.nb_items -
index) *
sizeof(*
c->frag_index.item));
2005 c->frag_index.current++;
2007 item = &
c->frag_index.item[
index];
2013 c->frag_index.nb_items++;
2019 int id,
int entries)
2028 if (frag_stream_info && frag_stream_info->
index_entry >= 0)
2036 c->fragment.found_tfhd = 0;
2038 if (!
c->has_looked_for_mfra &&
c->use_mfra_for > 0) {
2039 c->has_looked_for_mfra = 1;
2046 "read the mfra (may be a live ismv)\n");
2050 "seekable, can not look for mfra\n");
2053 c->fragment.moof_offset =
c->fragment.implicit_offset =
avio_tell(pb) - 8;
2072 if (time > 0 && time < 2082844800) {
2080 if ((
int64_t)(time * 1000000ULL) / 1000000 != time) {
2094 char language[4] = {0};
2097 if (
c->fc->nb_streams < 1)
2099 st =
c->fc->streams[
c->fc->nb_streams-1];
2143 if (
c->time_scale <= 0) {
2157 for (
i = 0;
i < 3;
i++) {
2204 int little_endian =
avio_rb16(pb) & 0xFF;
2206 if (little_endian == 1)
2215 int pcm_sample_size;
2220 if (atom.
size < 6) {
2230 "Unsupported 'pcmC' box with version %d, flags: %x",
2236 pcm_sample_size =
avio_r8(pb);
2244 switch (pcm_sample_size) {
2258 switch (pcm_sample_size) {
2280 if (format_flags & 1)
2291 char color_parameter_type[5] = { 0 };
2305 if (strncmp(color_parameter_type,
"nclx", 4) &&
2306 strncmp(color_parameter_type,
"nclc", 4) &&
2307 strncmp(color_parameter_type,
"prof", 4)) {
2309 color_parameter_type);
2313 if (!strncmp(color_parameter_type,
"prof", 4)) {
2315 uint8_t *icc_profile;
2323 icc_profile = sd->
data;
2325 if (
c->heif_icc_profile_items >=
c->fc->max_streams) {
2327 "HEIF ICC profile copies exceed cap %d; ignoring further items\n",
2328 c->fc->max_streams);
2338 c->heif_icc_profile_items++;
2351 "%s: pri %d trc %d matrix %d",
2354 if (!strncmp(color_parameter_type,
"nclx", 4)) {
2391 if (!st || atom.
size < 4)
2398 if (
fabs(gamma - 2.2) < 0.01)
2400 else if (
fabs(gamma - 2.8) < 0.01)
2408 unsigned mov_field_order;
2411 if (
c->fc->nb_streams < 1)
2413 st =
c->fc->streams[
c->fc->nb_streams-1];
2417 if ((mov_field_order & 0xFF00) == 0x0100)
2419 else if ((mov_field_order & 0xFF00) == 0x0200) {
2420 switch (mov_field_order & 0xFF) {
2443 if (
size > INT_MAX || (uint64_t)atom.
size > INT_MAX)
2466 }
else if (err < atom.
size) {
2480 uint64_t original_size;
2483 if (
c->fc->nb_streams < 1)
2485 st =
c->fc->streams[
c->fc->nb_streams-1];
2534 if (!
ret &&
c->fc->nb_streams >= 1) {
2546 if (
c->fc->nb_streams >= 1) {
2547 AVStream *
const st =
c->fc->streams[
c->fc->nb_streams - 1];
2558 if (
cid == 0xd4d ||
cid == 0xd4e)
2569 if (
num <= 0 || den <= 0)
2573 if (den >= INT_MAX / 2)
2593 uint64_t original_size;
2594 if (
c->fc->nb_streams >= 1) {
2598 if (atom.
size == 16) {
2603 if (length == atom.
size) {
2604 const uint8_t range_value = par->
extradata[original_size + 19];
2605 switch (range_value) {
2642 if (
c->fc->nb_streams < 1)
2644 st =
c->fc->streams[
c->fc->nb_streams-1];
2646 if ((uint64_t)atom.
size > (1<<30))
2656 }
else if (atom.
size > 8) {
2670#define ALAC_EXTRADATA_SIZE 36
2703 if ((uint64_t)atom.
size > (1<<30))
2706 if (atom.
type ==
MKTAG(
'v',
'v',
'c',
'C')) {
2711 if (atom.
size >= 10) {
2743 uint8_t profile_level;
2746 if (
c->fc->nb_streams < 1)
2748 st =
c->fc->streams[
c->fc->nb_streams-1];
2750 if (atom.
size >= (1<<28) || atom.
size < 7)
2754 if ((profile_level & 0xf0) != 0xc0)
2767 for (
int i = 0;
i <
tag->nb_id;
i++) {
2768 if (
tag->id[
i] ==
id)
2822 if (
c->fc->nb_streams < 1)
2825 if (atom.
size > 4) {
2853 if (
c->fc->nb_streams < 1)
2859 if (atom.
size > 4) {
2866 st =
c->fc->streams[
c->fc->nb_streams - 1];
2885 if (
c->fc->nb_streams < 1)
2893 st =
c->fc->streams[
c->fc->nb_streams - 1];
2917 if (
c->fc->nb_streams < 1)
2919 if (atom.
size <= 40)
2921 st =
c->fc->streams[
c->fc->nb_streams-1];
2923 if ((uint64_t)atom.
size > (1<<30))
2938 unsigned int i, entries;
2940 if (
c->trak_index < 0) {
2944 if (
c->fc->nb_streams < 1)
2946 st =
c->fc->streams[
c->fc->nb_streams-1];
2958 (atom.
type ==
MKTAG(
's',
't',
'c',
'o') ? 4 : 8)));
2975 if (atom.
type ==
MKTAG(
's',
't',
'c',
'o'))
2978 else if (atom.
type ==
MKTAG(
'c',
'o',
'6',
'4'))
3004 ((
format & 0xFFFF) ==
'm' + (
's' << 8) ||
3005 (
format & 0xFFFF) ==
'T' + (
'S' << 8)))
3042 uint8_t codec_name[32] = { 0 };
3083 if (!strncmp(codec_name,
"Planar Y'CbCr 8-bit 4:2:0", 25)) {
3090 !strncmp(codec_name,
"Sorenson H263", 13))
3106 int bits_per_sample,
flags;
3135 (compatible_brands && strstr(compatible_brands->
value,
"qt ")) ||
3148 if (sample_rate < 0 || sample_rate > INT_MAX ||
3149 isnan(sample_rate)) {
3278 if (str_size > 0 &&
size >= (
int)str_size + 30 &&
3280 char *reel_name =
av_malloc(str_size + 1);
3284 reel_name[str_size] = 0;
3292 int t35_identifier_length =
avio_r8(pb);
3294 if (t35_identifier_length <= 0 || t35_identifier_length >=
size)
3301 int hrsd_len =
size - t35_identifier_length - 1;
3303 uint8_t *hrsd_str =
av_malloc(hrsd_len + 1);
3313 hrsd_str[hrsd_len] = 0;
3336#if CONFIG_DV_DEMUXER
3431 int codec_tag,
int format,
3443 : codec_tag !=
MKTAG(
'j',
'p',
'e',
'g')))) {
3481 int pseudo_stream_id;
3485 st =
c->fc->streams[
c->fc->nb_streams-1];
3488 for (pseudo_stream_id = 0;
3490 pseudo_stream_id++) {
3493 int ret, dref_id = 1;
3503 }
else if (
size <= 7) {
3505 "invalid size %"PRId64
" in stsd\n",
size);
3524 "size=%"PRId64
" 4CC=%s codec_type=%d\n",
size,
3556 }
else if (
a.size > 0)
3610 "Duplicate stsd found in this track.\n");
3619 if (entries <= 0 || entries > atom.
size / 8 || entries > 1024) {
3667 unsigned int i, entries;
3669 if (
c->trak_index < 0) {
3674 if (
c->fc->nb_streams < 1)
3676 st =
c->fc->streams[
c->fc->nb_streams-1];
3683 if ((uint64_t)entries * 12 + 4 > atom.
size)
3768 unsigned i, entries;
3770 if (
c->trak_index < 0) {
3775 if (
c->fc->nb_streams < 1)
3777 st =
c->fc->streams[
c->fc->nb_streams-1];
3810 unsigned int i, entries;
3812 if (
c->trak_index < 0) {
3817 if (
c->fc->nb_streams < 1)
3819 st =
c->fc->streams[
c->fc->nb_streams-1];
3838 if (entries >= UINT_MAX /
sizeof(
int))
3864 unsigned int i, entries, sample_size, field_size, num_bytes;
3869 if (
c->trak_index < 0) {
3874 if (
c->fc->nb_streams < 1)
3876 st =
c->fc->streams[
c->fc->nb_streams-1];
3882 if (atom.
type ==
MKTAG(
's',
't',
's',
'z')) {
3901 if (field_size != 4 && field_size != 8 && field_size != 16 && field_size != 32) {
3918 num_bytes = (entries*field_size+4)>>3;
3936 for (
i = 0;
i < entries;
i++) {
3957 unsigned int i, entries;
3959 int64_t total_sample_count = 0;
3963 if (
c->trak_index < 0) {
3968 if (
c->fc->nb_streams < 1)
3970 st =
c->fc->streams[
c->fc->nb_streams-1];
3978 c->fc->nb_streams-1, entries);
3984 if (entries >= INT_MAX /
sizeof(*sc->
stts_data))
3988 unsigned int sample_duration;
3989 unsigned int sample_count;
3990 unsigned int min_entries =
FFMIN(
FFMAX(
i + 1, 1024 * 1024), entries);
4008 sample_count, sample_duration);
4013 if (sample_duration >
c->max_stts_delta) {
4016 av_log(
c->fc,
AV_LOG_WARNING,
"Too large sample offset %u in stts entry %u with count %u in st:%d. Clipping to 1.\n",
4017 sample_duration,
i, sample_count, st->
index);
4019 corrected_dts =
av_sat_add64(corrected_dts, (delta_magnitude < 0 ? (
int64_t)delta_magnitude : 1) * sample_count);
4021 corrected_dts += sample_duration * (uint64_t)sample_count;
4026 if (current_dts > corrected_dts) {
4029 current_dts -= correction * (uint64_t)sample_count;
4041 total_sample_count <= INT_MAX - sc->nb_frames_for_fps) {
4065 "All samples in data stream index:id [%d:%d] have zero "
4066 "duration, stream set to be discarded by default. Override "
4067 "using AVStream->discard or -discard for ffmpeg command.\n",
4082 if (
c->fc->nb_streams < 1)
4084 st =
c->fc->streams[
c->fc->nb_streams - 1];
4089 entries = atom.
size - 4;
4092 c->fc->nb_streams - 1, entries);
4099 if (entries < 0 || entries > UINT_MAX)
4128 unsigned int i, entries, ctts_count = 0;
4130 if (
c->trak_index < 0) {
4135 if (
c->fc->nb_streams < 1)
4137 st =
c->fc->streams[
c->fc->nb_streams-1];
4148 if (entries >= UINT_MAX /
sizeof(*sc->
ctts_data))
4157 const size_t min_size_needed = (ctts_count + 1) *
sizeof(
MOVCtts);
4158 const size_t requested_size =
4167 "ignoring CTTS entry with count=%d duration=%d\n",
4172 if (ctts_count >= UINT_MAX /
sizeof(
MOVCtts) - 1)
4210 uint32_t grouping_type;
4211 uint32_t default_length;
4212 av_unused uint32_t default_group_description_index;
4213 uint32_t entry_count;
4215 if (
c->fc->nb_streams < 1)
4217 st =
c->fc->streams[
c->fc->nb_streams - 1];
4228 if (grouping_type !=
MKTAG(
's',
'y',
'n',
'c'))
4235 if (entry_count > atom.
size)
4245 uint32_t description_length = default_length;
4246 if (
version >= 1 && default_length == 0)
4248 if (grouping_type ==
MKTAG(
's',
'y',
'n',
'c')) {
4249 const uint8_t nal_unit_type =
avio_r8(pb) & 0x3f;
4251 description_length -= 1;
4268 unsigned int i, entries;
4270 uint32_t grouping_type;
4274 if (
c->fc->nb_streams < 1)
4276 st =
c->fc->streams[
c->fc->nb_streams-1];
4283 if (grouping_type ==
MKTAG(
'r',
'a',
'p',
' ')) {
4286 }
else if (grouping_type ==
MKTAG(
's',
'y',
'n',
'c')) {
4327 unsigned int edit_list_index,
4328 int64_t *edit_list_media_time,
4335 *edit_list_media_time = msc->
elst_data[edit_list_index].
time;
4339 if (global_timescale == 0) {
4346 if (*edit_list_duration < 0 ||
4347 *edit_list_media_time > INT64_MAX - *edit_list_duration)
4348 *edit_list_duration = 0;
4422 while (*
index >= 0 && (*tts_index) >= 0 && (*tts_index) < tts_count) {
4426 if ((e_old[*
index].timestamp + tts_data[*tts_index].
offset) <= timestamp_pts &&
4432 if (*tts_sample == 0) {
4434 if (*tts_index >= 0)
4435 *tts_sample = tts_data[*tts_index].
count - 1;
4445 return *
index >= 0 ? 0 : -1;
4469 const size_t requested_size =
4486 ie= &entries[
index];
4501 int64_t* frame_duration_buffer,
4502 int frame_duration_buffer_size) {
4505 av_assert0(end_index >= 0 && end_index <= sti->nb_index_entries);
4506 for (
i = 0;
i < frame_duration_buffer_size;
i++) {
4507 end_ts -= frame_duration_buffer[frame_duration_buffer_size - 1 -
i];
4516 const size_t min_size_needed = (*tts_count + 1) *
sizeof(
MOVTimeToSample);
4517 const size_t requested_size =
4518 min_size_needed > *allocated_size ?
4519 FFMAX(min_size_needed, 2 * (*allocated_size)) :
4525 tts_buf_new =
av_fast_realloc(*tts_data, allocated_size, requested_size);
4530 *tts_data = tts_buf_new;
4536 *tts_count = (*tts_count) + 1;
4540#define MAX_REORDER_DELAY 16
4546 int ctts_sample = 0;
4549 int j,
r, num_swaps;
4552 pts_buf[j] = INT64_MIN;
4560 buf_start = (buf_start + 1);
4573 while (j != buf_start) {
4576 if (pts_buf[j] < pts_buf[
r]) {
4635 if (range_size > current_sample) {
4639 current_sample -= range_size;
4661 int64_t edit_list_media_time = 0;
4662 int64_t edit_list_duration = 0;
4664 int64_t edit_list_dts_counter = 0;
4665 int64_t edit_list_dts_entry_end = 0;
4666 int64_t edit_list_start_tts_sample = 0;
4669 int64_t empty_edits_sum_duration = 0;
4674 int64_t edit_list_start_encountered = 0;
4677 int num_discarded_begin = 0;
4678 int first_non_zero_audio_edit = -1;
4679 int packet_skip_samples = 0;
4681 int found_keyframe_after_edit = 0;
4682 int found_non_empty_edit = 0;
4688 int64_t max_entries = nb_old * 16LL + (1 << 16);
4717 edit_list_dts_entry_end -= msc->
dts_shift;
4721 start_dts = edit_list_dts_entry_end;
4725 av_log(mov->
fc,
AV_LOG_DEBUG,
"Processing st: %d, edit list %"PRId64
" - media time: %"PRId64
", duration: %"PRId64
"\n",
4726 st->
index, edit_list_index, edit_list_media_time, edit_list_duration);
4728 edit_list_dts_counter = edit_list_dts_entry_end;
4729 edit_list_dts_entry_end =
av_sat_add64(edit_list_dts_entry_end, edit_list_duration);
4730 if (edit_list_dts_entry_end == INT64_MAX) {
4732 edit_list_duration);
4735 num_discarded_begin = 0;
4736 if (edit_list_media_time == -1) {
4737 if (!found_non_empty_edit)
4738 empty_edits_sum_duration += edit_list_duration;
4741 found_non_empty_edit = 1;
4746 if (first_non_zero_audio_edit < 0) {
4747 first_non_zero_audio_edit = 1;
4749 first_non_zero_audio_edit = 0;
4752 if (first_non_zero_audio_edit > 0)
4760 search_timestamp = edit_list_media_time;
4769 &
index, &tts_index_old, &tts_sample_old) < 0) {
4771 "st: %d edit list: %"PRId64
" Missing key frame while searching for timestamp: %"PRId64
"\n",
4772 st->
index, edit_list_index, search_timestamp);
4774 &
index, &tts_index_old, &tts_sample_old) < 0) {
4776 "st: %d edit list %"PRId64
" Cannot find an index entry before timestamp: %"PRId64
".\n",
4777 st->
index, edit_list_index, search_timestamp);
4784 edit_list_start_tts_sample = tts_sample_old;
4787 edit_list_start_encountered = 0;
4788 found_keyframe_after_edit = 0;
4796 frame_duration = (
current + 1 < e_old_end) ?
4797 ((
current + 1)->timestamp -
current->timestamp) : edit_list_duration;
4805 if (tts_data_old && tts_index_old < tts_count_old) {
4806 curr_ctts = tts_data_old[tts_index_old].
offset;
4807 av_log(mov->
fc,
AV_LOG_TRACE,
"stts: %"PRId64
" ctts: %"PRId64
", tts_index: %"PRId64
", tts_count: %"PRId64
"\n",
4808 curr_cts, curr_ctts, tts_index_old, tts_count_old);
4809 curr_cts += curr_ctts;
4811 if (tts_sample_old == tts_data_old[tts_index_old].
count) {
4814 tts_data_old[tts_index_old].
count - edit_list_start_tts_sample,
4815 tts_data_old[tts_index_old].
offset, tts_data_old[tts_index_old].
duration) == -1) {
4818 tts_data_old[tts_index_old].
count - edit_list_start_tts_sample,
4819 tts_data_old[tts_index_old].
offset);
4824 edit_list_start_tts_sample = 0;
4828 if (curr_cts < edit_list_media_time || curr_cts >= (edit_list_duration + edit_list_media_time)) {
4830 curr_cts < edit_list_media_time && curr_cts + frame_duration > edit_list_media_time &&
4831 first_non_zero_audio_edit > 0) {
4832 packet_skip_samples = edit_list_media_time - curr_cts;
4836 edit_list_dts_counter -= packet_skip_samples;
4837 if (edit_list_start_encountered == 0) {
4838 edit_list_start_encountered = 1;
4841 if (frame_duration_buffer) {
4843 frame_duration_buffer, num_discarded_begin);
4848 av_log(mov->
fc,
AV_LOG_DEBUG,
"skip %d audio samples from curr_cts: %"PRId64
"\n", packet_skip_samples, curr_cts);
4853 if (edit_list_start_encountered == 0) {
4854 if (!
av_dynarray2_add((
void **)&frame_duration_buffer, &num_discarded_begin,
4855 sizeof(*frame_duration_buffer),
4856 (
const uint8_t *)&frame_duration)) {
4874 if (edit_list_start_encountered == 0) {
4875 edit_list_start_encountered = 1;
4878 if (frame_duration_buffer) {
4880 frame_duration_buffer, num_discarded_begin);
4893 if (!current_index_range ||
index != current_index_range->
end) {
4894 current_index_range = current_index_range ? current_index_range + 1
4898 current_index_range->
end =
index + 1;
4901 if (edit_list_start_encountered > 0) {
4902 edit_list_dts_counter = edit_list_dts_counter + frame_duration;
4906 if ((curr_cts + frame_duration >= (edit_list_duration + edit_list_media_time)) &&
4913 found_keyframe_after_edit = 1;
4916 if (tts_sample_old != 0) {
4919 tts_sample_old - edit_list_start_tts_sample,
4920 tts_data_old[tts_index_old].
offset, tts_data_old[tts_index_old].
duration) == -1) {
4922 tts_index_old, tts_sample_old - edit_list_start_tts_sample,
4923 tts_data_old[tts_index_old].
offset);
4968 current_index_range = current_index_range ? current_index_range + 1
4970 current_index_range->
start = 0;
4971 current_index_range->
end = 0;
5030 if (sg->
index == cra_index)
5031 for (uint32_t j = 0; j < sg->
count; j++)
5033 if (sg->
count > INT_MAX - sample_id)
5035 sample_id += sg->
count;
5046#define MOV_MERGE_CTTS 1
5047#define MOV_MERGE_STTS 2
5122 unsigned int stts_index = 0;
5123 unsigned int stsc_index = 0;
5124 unsigned int stss_index = 0;
5125 unsigned int stps_index = 0;
5127 uint64_t stream_size = 0;
5134 int i, edit_start_index = 0, multiple_edits = 0;
5140 if (
i == 0 && e->
time == -1) {
5144 edit_start_index = 1;
5145 }
else if (
i == edit_start_index && e->
time >= 0) {
5155 "not supported in fragmented MP4 files\n");
5158 "Use -advanced_editlist to correctly decode otherwise "
5159 "a/v desync might occur\n");
5185 unsigned int current_sample = 0;
5186 unsigned int stts_sample = 0;
5187 unsigned int sample_size;
5189 unsigned int rap_group_index = 0;
5190 unsigned int rap_group_sample = 0;
5195 if (current_dts < INT64_MIN + sc->dts_shift)
5247 if (rap_group_present && rap_group_index < sc->rap_group_count) {
5250 if (++rap_group_sample == sc->
rap_group[rap_group_index].
count) {
5251 rap_group_sample = 0;
5257 && !rap_group_present
5263 if (current_offset > INT64_MAX - sample_size) {
5273 if (sample_size > 0x3FFFFFFF) {
5278 e->
pos = current_offset;
5280 e->
size = sample_size;
5283 av_log(mov->
fc,
AV_LOG_TRACE,
"AVIndex stream %d, sample %u, offset %"PRIx64
", dts %"PRId64
", "
5284 "size %u, distance %u, keyframe %d\n", st->
index, current_sample,
5285 current_offset, current_dts, sample_size,
distance, keyframe);
5290 current_offset += sample_size;
5291 stream_size += sample_size;
5309 unsigned chunk_samples, total = 0;
5316 unsigned count, chunk_count;
5329 count = (chunk_samples+samples-1) / samples;
5331 count = (chunk_samples+1023) / 1024;
5338 total += chunk_count *
count;
5360 while (chunk_samples > 0) {
5362 unsigned size, samples;
5366 "Zero bytes per frame, but %d samples per frame",
5380 samples =
FFMIN(1024, chunk_samples);
5389 if (
size > 0x3FFFFFFF) {
5394 e->
pos = current_offset;
5400 "size %u, duration %u\n", st->
index,
i, current_offset, current_dts,
5403 current_offset +=
size;
5404 if (current_dts > INT64_MAX - samples)
5406 current_dts += samples;
5407 chunk_samples -= samples;
5456 unsigned int tts_index = 0, tts_sample = 0;
5463 count >= UINT_MAX /
sizeof(*tts_data))
5468 if (!samples || !tts_data)
5471 for (
int i = 0;
i < count;
i++) {
5495 if (tts_index != sc->
tts_count || tts_sample)
5500 for (
int i = 0;
i + 1 < count;
i++) {
5503 if (samples[
i].
pts >= samples[
i + 1].
pts)
5521 "Updated sample durations in presentation order for stream %d\n",
5545 av_url_split(src_proto,
sizeof(src_proto), src_auth,
sizeof(src_auth), src_host,
sizeof(src_host), &src_port,
NULL, 0,
src);
5546 av_url_split(ref_proto,
sizeof(ref_proto), ref_auth,
sizeof(ref_auth), ref_host,
sizeof(ref_host), &ref_port,
NULL, 0,
ref);
5548 if (strlen(
src) == 0) {
5550 }
else if (strlen(src_auth) + 1 >=
sizeof(src_auth) ||
5551 strlen(ref_auth) + 1 >=
sizeof(ref_auth) ||
5552 strlen(src_host) + 1 >=
sizeof(src_host) ||
5553 strlen(ref_host) + 1 >=
sizeof(ref_host)) {
5555 }
else if (strcmp(src_proto, ref_proto) ||
5556 strcmp(src_auth, ref_auth) ||
5557 strcmp(src_host, ref_host) ||
5558 src_port != ref_port) {
5568 if (
ref->nlvl_to > 0 &&
ref->nlvl_from > 0) {
5569 char filename[1025];
5570 const char *src_path;
5574 src_path = strrchr(
src,
'/');
5581 for (
i = 0, l = strlen(
ref->path) - 1; l >= 0; l--)
5582 if (
ref->path[l] ==
'/') {
5583 if (
i ==
ref->nlvl_to - 1)
5590 if (
i ==
ref->nlvl_to - 1 && src_path -
src <
sizeof(filename)) {
5591 memcpy(filename,
src, src_path -
src);
5592 filename[src_path -
src] = 0;
5594 for (
i = 1;
i <
ref->nlvl_from;
i++)
5595 av_strlcat(filename,
"../",
sizeof(filename));
5598 if (!
c->use_absolute_path) {
5603 "Reference with mismatching origin, %s not tried for security reasons, "
5604 "set demuxer option use_absolute_path to allow it anyway\n",
5609 if (strstr(
ref->path + l + 1,
"..") ||
5610 strstr(
ref->path + l + 1,
":") ||
5611 (
ref->nlvl_from > 1 && same_origin < 0) ||
5612 (filename[0] ==
'/' && src_path ==
src))
5616 if (strlen(filename) + 1 ==
sizeof(filename))
5621 }
else if (
c->use_absolute_path) {
5623 "this is a possible security issue\n");
5628 "Absolute path %s not tried for security reasons, "
5629 "set demuxer option use_absolute_path to allow absolute paths\n",
5655 for (
int j = 0; j <
c->fc->nb_stream_groups; j++)
5658 stg =
c->fc->stream_groups[j];
5666 out->codecpar->bit_rate = 0;
5720 if (!st)
return AVERROR(ENOMEM);
5723 if (!sc)
return AVERROR(ENOMEM);
5728 c->trak_index = st->
index;
5759 "MP4. disabling.\n");
5760 c->advanced_editlist = 0;
5761 c->advanced_editlist_autodisabled = 1;
5773 ret = mov_update_iamf_streams(
c, st);
5781 if (
c->enable_drefs) {
5784 "stream %d, error opening alias: path='%s', dir='%s', "
5785 "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n",
5790 "Skipped opening external track: "
5791 "stream %d, alias: path='%s', dir='%s', "
5792 "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d."
5793 "Set enable_drefs to allow this.\n",
5815#if FF_API_R_FRAME_RATE
5827#if CONFIG_H261_DECODER || CONFIG_H263_DECODER || CONFIG_MPEG4_DECODER
5829#if CONFIG_H261_DECODER
5832#if CONFIG_H263_DECODER
5835#if CONFIG_MPEG4_DECODER
5847 int stts_constant = 1;
5872 c->itunes_metadata = 1;
5874 c->itunes_metadata = 0;
5889 if (count > atom.
size / 8 || count >= UINT_MAX /
sizeof(*
c->meta_keys)) {
5891 "The 'keys' atom with the invalid key count: %"PRIu32
"\n", count);
5899 c->meta_keys[0] =
NULL;
5900 c->meta_keys_count = 1;
5901 for (
i = 1;
i <= count; ++
i) {
5905 c->meta_keys_count =
i + 1;
5906 if (key_size < 8 || key_size > atom.
size) {
5908 "The key# %"PRIu32
" in meta has invalid size:"
5909 "%"PRIu32
"\n",
i, key_size);
5912 atom.
size -= key_size;
5919 if (!
c->meta_keys[
i])
5924 c->meta_keys[
i][key_size] = 0;
5938 if (
c->fc->nb_streams < 1)
5940 st =
c->fc->streams[
c->fc->nb_streams-1];
5942 for (
i = 0;
i < 3;
i++) {
5957 if (
tag ==
MKTAG(
'm',
'e',
'a',
'n'))
5959 else if (
tag ==
MKTAG(
'n',
'a',
'm',
'e'))
5961 else if (
tag ==
MKTAG(
'd',
'a',
't',
'a') &&
len > 4) {
5985 if (strcmp(
key,
"iTunSMPB") == 0) {
5986 int64_t priming, remainder, samples;
5988 if(priming>0 && priming<16384)
5990 (
AVRational){ 1, st->codecpar->sample_rate });
5991 if (remainder > 0) {
5993 (
AVRational){ 1, st->codecpar->sample_rate });
5995 (
AVRational){ 1, st->codecpar->sample_rate });
5997 (
AVRational){ 1, st->codecpar->sample_rate });
6004 "remainder %"PRId64
" samples %"PRId64
"\n",
6005 priming, remainder, samples);
6008 if (strcmp(
mean,
"com.apple.iTunes") == 0 &&
6009 strcmp(
key,
"DISCSUBTITLE") == 0) {
6014 if (strcmp(
key,
"cdec") != 0) {
6021 "Unhandled or malformed custom metadata of size %"PRId64
"\n", atom.
size);
6092 while (atom.
size > 8) {
6098 if (
tag ==
MKTAG(
'h',
'd',
'l',
'r')) {
6108#define IS_MATRIX_IDENT(matrix) \
6109 ( (matrix)[0][0] == (1 << 16) && \
6110 (matrix)[1][1] == (1 << 16) && \
6111 (matrix)[2][2] == (1 << 30) && \
6112 !(matrix)[0][1] && !(matrix)[0][2] && \
6113 !(matrix)[1][0] && !(matrix)[1][2] && \
6114 !(matrix)[2][0] && !(matrix)[2][1])
6121 int display_matrix[3][3];
6122 int res_display_matrix[3][3] = { { 0 } };
6128 if (
c->fc->nb_streams < 1)
6130 st =
c->fc->streams[
c->fc->nb_streams-1];
6167 for (
i = 0;
i < 3;
i++) {
6179 for (
i = 0;
i < 3;
i++) {
6180 const int sh[3] = { 16, 16, 30 };
6181 for (j = 0; j < 3; j++) {
6182 for (e = 0; e < 3; e++) {
6183 res_display_matrix[
i][j] +=
6185 c->movie_display_matrix[e][j]) >> sh[e];
6197 for (
i = 0;
i < 3;
i++)
6198 for (j = 0; j < 3; j++)
6205 double disp_transform[2];
6207 for (
i = 0;
i < 2;
i++)
6211 if (disp_transform[0] > 1 && disp_transform[1] > 1 &&
6212 disp_transform[0] < (1<<24) && disp_transform[1] < (1<<24) &&
6213 fabs((disp_transform[0] / disp_transform[1]) - 1.0) > 0.01)
6215 disp_transform[0] / disp_transform[1],
6234 for (
i = 0;
i <
c->trex_count;
i++)
6235 if (
c->trex_data[
i].track_id == track_id) {
6236 trex = &
c->trex_data[
i];
6243 c->fragment.found_tfhd = 1;
6261 if (frag_stream_info) {
6278 c->chapter_tracks = new_tracks;
6279 c->nb_chapter_tracks =
num;
6284 c->nb_chapter_tracks =
i;
6294 if ((uint64_t)
c->trex_count+1 >= UINT_MAX /
sizeof(*
c->trex_data))
6297 sizeof(*
c->trex_data))) < 0) {
6304 trex = &
c->trex_data[
c->trex_count++];
6322 int64_t base_media_decode_time;
6324 for (
i = 0;
i <
c->fc->nb_streams;
i++) {
6325 sc =
c->fc->streams[
i]->priv_data;
6327 st =
c->fc->streams[
i];
6347 if (frag_stream_info)
6348 frag_stream_info->
tfdt_dts = base_media_decode_time;
6363 int data_offset = 0;
6364 unsigned entries, first_sample_flags = frag->
flags;
6367 int next_frag_index = -1, index_entry_pos;
6368 size_t requested_size;
6377 for (
i = 0;
i <
c->fc->nb_streams;
i++) {
6378 sc =
c->fc->streams[
i]->priv_data;
6380 st =
c->fc->streams[
i];
6400 for (
i =
c->frag_index.current + 1;
i < c->frag_index.nb_items;
i++) {
6402 if (frag_stream_info && frag_stream_info->
index_entry >= 0) {
6403 next_frag_index =
i;
6408 av_assert0(index_entry_pos <= sti->nb_index_entries);
6430 int64_t max_entries = INT64_MAX;
6432 if (sample_data_size > 0)
6442 max_entries =
FFMIN(max_entries,
left / entry_size);
6444 if (entries > max_entries) {
6446 "samples the input can hold\n", entries, max_entries);
6451 if (frag_stream_info) {
6458 ", using it for pts\n",
pts);
6463 ", using it for dts\n",
pts);
6467 int fallback_tfdt = !
c->use_tfdt && !has_sidx && has_tfdt;
6468 int fallback_sidx =
c->use_tfdt && !has_tfdt && has_sidx;
6470 if (fallback_sidx) {
6473 if (fallback_tfdt) {
6477 if (has_tfdt &&
c->use_tfdt || fallback_tfdt) {
6480 ", using it for dts\n", dts);
6481 }
else if (has_sidx && !
c->use_tfdt || fallback_sidx) {
6486 ", using it for dts\n", frag_stream_info->
sidx_pts);
6490 ", using it for dts\n", dts);
6496 ", using it for dts\n", dts);
6532 if (index_entry_pos < sti->nb_index_entries) {
6538 memmove(sc->
tts_data + index_entry_pos + entries,
6541 if (index_entry_pos <= sc->current_sample) {
6544 if (index_entry_pos <= sc->tts_index)
6555 if (frag_stream_info) {
6558 frag_stream_info->
index_base = index_entry_pos;
6561 if (index_entry_pos > 0)
6565 unsigned sample_size = frag->
size;
6566 int sample_flags =
i ? frag->
flags : first_sample_flags;
6567 unsigned sample_duration = frag->
duration;
6568 unsigned ctts_duration = 0;
6570 int index_entry_flags = 0;
6577 if (sample_duration >
c->max_stts_delta) {
6579 "Too large sample duration %u in trun entry %u in st:%d. Clipping to 1.\n",
6580 sample_duration,
i, st->
index);
6581 sample_duration = 1;
6593 "pts %"PRId64
" calculated dts %"PRId64
6594 " sc->dts_shift %d ctts.duration %d"
6595 " sc->time_offset %"PRId64
6596 " flags & MOV_TRUN_SAMPLE_CTS %d\n",
6612 if (prev_dts >= dts)
6626 av_log(
c->fc,
AV_LOG_TRACE,
"AVIndex stream %d, sample %d, offset %"PRIx64
", dts %"PRId64
", "
6627 "size %u, distance %d, keyframe %d\n", st->
index,
6630 if (
av_sat_add64(dts, sample_duration) != dts + (uint64_t)sample_duration)
6632 dts += sample_duration;
6636 if (sample_duration <= INT64_MAX - sc->duration_for_fps &&
6643 if (frag_stream_info)
6648 int gap = entries -
i;
6653 memmove(sc->
tts_data + index_entry_pos,
6654 sc->
tts_data + index_entry_pos + gap,
6656 (sc->
tts_count - (index_entry_pos + gap)));
6660 if (index_entry_pos < sc->current_sample) {
6663 if (index_entry_pos < sc->tts_index)
6672 if (index_entry_pos > 0)
6675 if (prev_dts < sti->index_entries[
i].timestamp)
6706 unsigned i, j, track_id, item_count;
6721 for (
i = 0;
i <
c->fc->nb_streams;
i++) {
6722 sc =
c->fc->streams[
i]->priv_data;
6723 if (sc->
id == track_id) {
6724 st =
c->fc->streams[
i];
6737 if (timescale.
den <= 0) {
6752 offset += (uint64_t)offadd;
6757 if (item_count == 0)
6760 for (
i = 0;
i < item_count;
i++) {
6765 if (
size & 0x80000000) {
6774 if (frag_stream_info)
6775 frag_stream_info->
sidx_pts = timestamp;
6790 is_complete =
offset == stream_size;
6794 if (!
c->have_read_mfra_size) {
6795 if ((
ret =
avio_seek(pb, stream_size - 4, SEEK_SET)) < 0)
6798 c->have_read_mfra_size = 1;
6802 if (
offset == stream_size -
c->mfra_size)
6809 for (
i = 0;
i <
c->frag_index.nb_items;
i++) {
6815 ref_st =
c->fc->streams[j];
6821 if (ref_st)
for (
i = 0;
i <
c->fc->nb_streams;
i++) {
6822 st =
c->fc->streams[
i];
6830 c->frag_index.complete = 1;
6851 if (atom.
type !=
MKTAG(
'm',
'd',
'a',
't')) {
6865 long cmov_len, moov_len;
6879 cmov_len = atom.
size - 6 * 4;
6891 goto free_and_return;
6894 if (uncompress (moov_data, (uLongf *) &moov_len, (
const Bytef *)cmov_data, cmov_len) != Z_OK)
6895 goto free_and_return;
6899 atom.
size = moov_len;
6918 if (
c->fc->nb_streams < 1 ||
c->ignore_editlist)
6920 sc =
c->fc->streams[
c->fc->nb_streams-1]->priv_data;
6927 elst_entry_size =
version == 1 ? 20 : 12;
6928 if (atom.
size != edit_count * elst_entry_size) {
6930 av_log(
c->fc,
AV_LOG_ERROR,
"Invalid edit list entry_count: %d for elst atom of size: %"PRId64
" bytes.\n",
6931 edit_count, atom.
size + 8);
6934 edit_count = atom.
size / elst_entry_size;
6935 if (edit_count * elst_entry_size != atom.
size) {
6969 if (e->
time < 0 && e->
time != -1 &&
6971 av_log(
c->fc,
AV_LOG_ERROR,
"Track %d, edit %d: Invalid edit list media time=%"PRId64
"\n",
6972 c->fc->nb_streams-1,
i, e->
time);
6991 if (
c->fc->nb_streams < 1)
6993 sc =
c->fc->streams[
c->fc->nb_streams - 1]->priv_data;
6995 if (atom.
size %
sizeof(uint32_t))
7002 int nb_timecode_track = atom.
size >> 2;
7003 for (
int i = 0;
i < nb_timecode_track;
i++) {
7019 if (
c->fc->nb_streams < 1)
7021 st =
c->fc->streams[
c->fc->nb_streams - 1];
7023 if (atom.
size < 5) {
7069 if (
c->fc->nb_streams < 1)
7072 sc =
c->fc->streams[
c->fc->nb_streams - 1]->priv_data;
7074 if (atom.
size < 5) {
7095 for (
i = 0;
i < 3;
i++) {
7114 const int mapping[3] = {1, 2, 0};
7115 const int chroma_den = 50000;
7116 const int luma_den = 10000;
7119 if (
c->fc->nb_streams < 1)
7122 sc =
c->fc->streams[
c->fc->nb_streams - 1]->priv_data;
7124 if (atom.
size < 24) {
7138 for (
i = 0;
i < 3;
i++) {
7139 const int j = mapping[
i];
7160 if (
c->fc->nb_streams < 1)
7163 sc =
c->fc->streams[
c->fc->nb_streams - 1]->priv_data;
7165 if (atom.
size < 5) {
7196 if (
c->fc->nb_streams < 1)
7199 sc =
c->fc->streams[
c->fc->nb_streams - 1]->priv_data;
7201 if (atom.
size < 4) {
7224 const int illuminance_den = 10000;
7225 const int ambient_den = 50000;
7226 if (
c->fc->nb_streams < 1)
7228 sc =
c->fc->streams[
c->fc->nb_streams - 1]->priv_data;
7229 if (atom.
size < 6) {
7253 if (
c->fc->nb_streams < 1)
7256 st =
c->fc->streams[
c->fc->nb_streams - 1];
7259 if (atom.
size < 5) {
7302 if (
c->fc->nb_streams < 1)
7305 st =
c->fc->streams[
c->fc->nb_streams - 1];
7308 remaining = atom.
size;
7309 while (remaining > 0) {
7318 case MKTAG(
'p',
'k',
'i',
'n'): {
7328 case MKTAG(
's',
'i',
'd',
'e'):
7331 case MKTAG(
'o',
'v',
'e',
'r'):
7355 if (remaining != 0) {
7380 uint32_t l = 0, t = 0,
r = 0,
b = 0;
7381 uint32_t
tag, padding = 0;
7384 if (
c->fc->nb_streams < 1)
7387 st =
c->fc->streams[
c->fc->nb_streams - 1];
7390 if (atom.
size < 8) {
7400 if (
tag !=
MKTAG(
's',
'v',
'h',
'd')) {
7418 if (
tag !=
MKTAG(
'p',
'r',
'o',
'j')) {
7428 if (
tag !=
MKTAG(
'p',
'r',
'h',
'd')) {
7458 case MKTAG(
'c',
'b',
'm',
'p'):
7462 "Unsupported cubemap layout %d\n",
layout);
7468 case MKTAG(
'e',
'q',
'u',
'i'):
7474 if (
b >= UINT_MAX - t ||
r >= UINT_MAX - l) {
7476 "Invalid bounding rectangle coordinates "
7477 "%"PRIu32
",%"PRIu32
",%"PRIu32
",%"PRIu32
"\n", l, t,
r,
b);
7481 if (l || t ||
r ||
b)
7520 if (
c->fc->nb_streams < 1)
7523 st =
c->fc->streams[
c->fc->nb_streams - 1];
7526 if (atom.
size < 16) {
7535 }
else if (
size > 16) {
7540 if (
tag !=
MKTAG(
'p',
'r',
'j',
'i')) {
7556 case MKTAG(
'r',
'e',
'c',
't'):
7559 case MKTAG(
'e',
'q',
'u',
'i'):
7562 case MKTAG(
'h',
'e',
'q',
'u'):
7565 case MKTAG(
'f',
'i',
's',
'h'):
7568 case MKTAG(
'p',
'r',
'i',
'm'):
7592 uint32_t
tag, baseline = 0;
7596 AVRational horizontal_disparity_adjustment = { 0, 1 };
7598 if (
c->fc->nb_streams < 1)
7601 st =
c->fc->streams[
c->fc->nb_streams - 1];
7604 remaining = atom.
size;
7605 while (remaining > 0) {
7614 case MKTAG(
's',
't',
'r',
'i'): {
7615 int has_right, has_left;
7635 has_right =
tmp & 2;
7638 if (has_left && has_right)
7644 if (has_left || has_right)
7649 case MKTAG(
'h',
'e',
'r',
'o'): {
7670 case MKTAG(
'c',
'a',
'm',
's'): {
7679 if (subsize != 16) {
7685 if (subtag !=
MKTAG(
'b',
'l',
'i',
'n')) {
7698 case MKTAG(
'c',
'm',
'f',
'y'): {
7708 if (subsize != 16) {
7714 if (subtag !=
MKTAG(
'd',
'a',
'd',
'j')) {
7725 horizontal_disparity_adjustment.
num = (int) adjustment;
7726 horizontal_disparity_adjustment.
den = 10000;
7739 if (remaining != 0) {
7774 if (
c->fc->nb_streams < 1)
7777 if (atom.
size < 8) {
7782 remaining = atom.
size;
7783 while (remaining > 0) {
7792 case MKTAG(
'p',
'r',
'o',
'j'): {
7799 case MKTAG(
'e',
'y',
'e',
's'): {
7806 case MKTAG(
'p',
'a',
'c',
'k'): {
7822 if (remaining != 0) {
7835 if (
c->fc->nb_streams < 1)
7838 st =
c->fc->streams[
c->fc->nb_streams - 1];
7841 if (atom.
size != 4) {
7928 static const AVUUID uuid_isml_manifest = {
7929 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
7930 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
7932 static const AVUUID uuid_xmp = {
7933 0xbe, 0x7a, 0xcf, 0xcb, 0x97, 0xa9, 0x42, 0xe8,
7934 0x9c, 0x71, 0x99, 0x94, 0x91, 0xe3, 0xaf, 0xac
7936 static const AVUUID uuid_spherical = {
7937 0xff, 0xcc, 0x82, 0x63, 0xf8, 0x55, 0x4a, 0x93,
7938 0x88, 0x14, 0x58, 0x7a, 0x02, 0x52, 0x1f, 0xdd,
7944 if (
c->fc->nb_streams < 1)
7946 st =
c->fc->streams[
c->fc->nb_streams - 1];
7974 while ((ptr =
av_stristr(ptr,
"systemBitrate=\""))) {
7975 ptr +=
sizeof(
"systemBitrate=\"") - 1;
7976 c->bitrates_count++;
7977 c->bitrates =
av_realloc_f(
c->bitrates,
c->bitrates_count,
sizeof(*
c->bitrates));
7979 c->bitrates_count = 0;
7984 ret = strtol(ptr, &endptr, 10);
7985 if (
ret < 0 || errno || *endptr !=
'"') {
7986 c->bitrates[
c->bitrates_count - 1] = 0;
7988 c->bitrates[
c->bitrates_count - 1] =
ret;
7996 if (
c->export_xmp) {
8030 uint8_t content[16];
8041 && !memcmp(content,
"Anevia\x1A\x1A", 8)
8063 case MKTAG(
'e',
'n',
'c',
'v'):
8064 case MKTAG(
'e',
'n',
'c',
'a'):
8069 "ignoring 'frma' atom of '%.4s', stream has codec id %d\n",
8081 "ignoring 'frma' atom of '%.4s', stream format is '%.4s'\n",
8103 if (frag_stream_info) {
8104 for (
i = 0;
i <
c->fc->nb_streams;
i++) {
8105 *sc =
c->fc->streams[
i]->priv_data;
8106 if ((*sc)->id == frag_stream_info->
id) {
8107 st =
c->fc->streams[
i];
8111 if (
i ==
c->fc->nb_streams)
8117 if (!(*sc)->cenc.default_encrypted_sample)
8128 if (
c->fc->nb_streams < 1)
8130 st =
c->fc->streams[
c->fc->nb_streams - 1];
8133 if (!(*sc)->cenc.encryption_index) {
8135 if (!(*sc)->cenc.default_encrypted_sample)
8138 if (!(*sc)->cenc.encryption_index)
8142 *encryption_index = (*sc)->cenc.encryption_index;
8150 unsigned int subsample_count;
8174 if (use_subsamples) {
8176 av_free((*sample)->subsamples);
8177 (*sample)->subsamples =
av_calloc(subsample_count,
sizeof(*subsamples));
8178 if (!(*sample)->subsamples) {
8185 (*sample)->subsamples[
i].bytes_of_clear_data =
avio_rb16(pb);
8186 (*sample)->subsamples[
i].bytes_of_protected_data =
avio_rb32(pb);
8195 (*sample)->subsample_count = subsample_count;
8206 int use_subsamples,
ret;
8207 unsigned int sample_count,
i, alloc_size = 0;
8223 if (sample_count >= INT_MAX /
sizeof(*encrypted_samples))
8226 for (
i = 0;
i < sample_count;
i++) {
8227 unsigned int min_samples =
FFMIN(
FFMAX(
i + 1, 1024 * 1024), sample_count);
8229 min_samples *
sizeof(*encrypted_samples));
8230 if (encrypted_samples) {
8261 size_t sample_count, sample_info_size,
i;
8263 unsigned int alloc_size = 0;
8272 if (sample_count >= INT_MAX /
sizeof(*encrypted_samples))
8278 av_log(
c->fc,
AV_LOG_INFO,
"Failed to seek for auxiliary info, will only parse senc atoms for encryption info\n");
8283 unsigned int min_samples =
FFMIN(
FFMAX(
i + 1, 1024 * 1024), sample_count);
8285 min_samples *
sizeof(*encrypted_samples));
8286 if (!encrypted_samples) {
8311 for (;
i > 0;
i--) {
8324 unsigned int sample_count, aux_info_type, aux_info_param;
8350 if (aux_info_param != 0) {
8356 if ((aux_info_type ==
MKBETAG(
'c',
'e',
'n',
'c') ||
8357 aux_info_type ==
MKBETAG(
'c',
'e',
'n',
's') ||
8358 aux_info_type ==
MKBETAG(
'c',
'b',
'c',
'1') ||
8359 aux_info_type ==
MKBETAG(
'c',
'b',
'c',
's')) &&
8360 aux_info_param == 0) {
8376 if (sample_count == 0)
8384 if (
ret != sample_count) {
8405 uint64_t *auxiliary_offsets;
8409 unsigned int version, entry_count, aux_info_type, aux_info_param;
8410 unsigned int alloc_size = 0;
8436 if (aux_info_param != 0) {
8442 if ((aux_info_type ==
MKBETAG(
'c',
'e',
'n',
'c') ||
8443 aux_info_type ==
MKBETAG(
'c',
'e',
'n',
's') ||
8444 aux_info_type ==
MKBETAG(
'c',
'b',
'c',
'1') ||
8445 aux_info_type ==
MKBETAG(
'c',
'b',
'c',
's')) &&
8446 aux_info_param == 0) {
8459 if (entry_count >= INT_MAX /
sizeof(*auxiliary_offsets))
8463 unsigned int min_offsets =
FFMIN(
FFMAX(
i + 1, 1024), entry_count);
8466 min_offsets *
sizeof(*auxiliary_offsets));
8467 if (!auxiliary_offsets) {
8478 if (
c->frag_index.current >= 0) {
8504 uint8_t *side_data =
NULL, *extra_data;
8505 size_t side_data_size = 0;
8507 unsigned int version, kid_count, extra_data_size, alloc_size = 0;
8509 if (
c->fc->nb_streams < 1)
8511 st =
c->fc->streams[
c->fc->nb_streams-1];
8528 if (kid_count >= INT_MAX /
sizeof(*key_ids)) {
8533 for (
unsigned int i = 0;
i < kid_count && !pb->
eof_reached;
i++) {
8534 unsigned int min_kid_count =
FFMIN(
FFMAX(
i + 1, 1024), kid_count);
8536 min_kid_count *
sizeof(*key_ids));
8564 extra_data =
av_malloc(extra_data_size);
8570 if (
ret != extra_data_size) {
8579 info->
data = extra_data;
8587 if (old_side_data) {
8588 side_data = old_side_data->
data;
8589 side_data_size = old_side_data->
size;
8591 if (!old_side_data || side_data !=
c->pssh_side_data)
8592 c->pssh_side_data_allocated = 0;
8595 &
c->pssh_side_data_allocated, info);
8599 if (old_side_data) {
8600 old_side_data->
data = side_data;
8601 old_side_data->
size = side_data_size;
8605 side_data, side_data_size, 0)) {
8610 c->pssh_side_data = side_data;
8622 if (
c->fc->nb_streams < 1)
8624 st =
c->fc->streams[
c->fc->nb_streams-1];
8628 av_log(
c->fc,
AV_LOG_ERROR,
"schm boxes are only supported in first sample descriptor\n");
8652 unsigned int version, pattern, is_protected, iv_size;
8654 if (
c->fc->nb_streams < 1)
8656 st =
c->fc->streams[
c->fc->nb_streams-1];
8693 if (iv_size != 0 && iv_size != 8 && iv_size != 16) {
8705 if (iv_size != 8 && iv_size != 16) {
8725 if (
c->fc->nb_streams < 1)
8727 st =
c->fc->streams[
c->fc->nb_streams-1];
8729 if ((uint64_t)atom.
size > (1<<30) || atom.
size < 42)
8738 if (
avio_read(pb, buf,
sizeof(buf)) !=
sizeof(buf)) {
8761 char kid_hex[16*2+1];
8763 if (
c->decryption_default_key &&
c->decryption_default_key_len !=
len) {
8764 av_log(
c->fc,
AV_LOG_ERROR,
"invalid default decryption key length: got %d, expected %d\n",
c->decryption_default_key_len,
len);
8768 if (!
c->decryption_keys) {
8770 memcpy(
out,
c->decryption_default_key,
len);
8774 if (
sample->key_id_size != 16) {
8781 if (!key_entry_hex) {
8782 if (!
c->decryption_default_key) {
8786 memcpy(
out,
c->decryption_default_key,
len);
8789 if (strlen(key_entry_hex->
value) !=
len*2) {
8799 int bytes_of_protected_data;
8822 if (!
sample->subsample_count) {
8828 for (
i = 0;
i <
sample->subsample_count;
i++) {
8835 input +=
sample->subsamples[
i].bytes_of_clear_data;
8836 size -=
sample->subsamples[
i].bytes_of_clear_data;
8840 bytes_of_protected_data =
sample->subsamples[
i].bytes_of_protected_data;
8843 input += bytes_of_protected_data;
8844 size -= bytes_of_protected_data;
8858 int num_of_encrypted_blocks;
8860 uint8_t decryption_key[16];
8880 memcpy(iv,
sample->iv, 16);
8883 if (!
sample->subsample_count) {
8889 for (
i = 0;
i <
sample->subsample_count;
i++) {
8895 if (
sample->subsamples[
i].bytes_of_protected_data % 16) {
8901 input +=
sample->subsamples[
i].bytes_of_clear_data;
8902 size -=
sample->subsamples[
i].bytes_of_clear_data;
8905 num_of_encrypted_blocks =
sample->subsamples[
i].bytes_of_protected_data/16;
8906 if (num_of_encrypted_blocks > 0) {
8909 input +=
sample->subsamples[
i].bytes_of_protected_data;
8910 size -=
sample->subsamples[
i].bytes_of_protected_data;
8923 int i,
ret, rem_bytes;
8948 if (!
sample->subsample_count) {
8952 }
else if (!
sample->crypt_byte_block && !
sample->skip_byte_block) {
8957 for (
i = 0;
i <
sample->subsample_count;
i++) {
8964 input +=
sample->subsamples[
i].bytes_of_clear_data;
8965 size -=
sample->subsamples[
i].bytes_of_clear_data;
8969 rem_bytes =
sample->subsamples[
i].bytes_of_protected_data;
8970 while (rem_bytes > 0) {
8971 if (rem_bytes < 16*sample->crypt_byte_block) {
8976 rem_bytes -= 16*
sample->crypt_byte_block;
8978 rem_bytes -=
FFMIN(16*
sample->skip_byte_block, rem_bytes);
8980 input +=
sample->subsamples[
i].bytes_of_protected_data;
8981 size -=
sample->subsamples[
i].bytes_of_protected_data;
8994 int i,
ret, rem_bytes;
8997 uint8_t decryption_key[16];
9018 if (!
sample->subsample_count) {
9020 memcpy(iv,
sample->iv, 16);
9023 }
else if (!
sample->crypt_byte_block && !
sample->skip_byte_block) {
9028 for (
i = 0;
i <
sample->subsample_count;
i++) {
9035 input +=
sample->subsamples[
i].bytes_of_clear_data;
9036 size -=
sample->subsamples[
i].bytes_of_clear_data;
9039 memcpy(iv,
sample->iv, 16);
9041 rem_bytes =
sample->subsamples[
i].bytes_of_protected_data;
9042 while (rem_bytes > 0) {
9043 if (rem_bytes < 16*sample->crypt_byte_block) {
9048 rem_bytes -= 16*
sample->crypt_byte_block;
9050 rem_bytes -=
FFMIN(16*
sample->skip_byte_block, rem_bytes);
9052 input +=
sample->subsamples[
i].bytes_of_protected_data;
9053 size -=
sample->subsamples[
i].bytes_of_protected_data;
9110 int encrypted_index,
ret;
9113 encrypted_index = current_index;
9114 encryption_index =
NULL;
9115 if (frag_stream_info) {
9117 if (frag_stream_info->
stsd_id == 1) {
9119 encrypted_index = current_index - frag_stream_info->
index_base;
9129 if (encryption_index) {
9141 encrypted_sample =
NULL;
9145 }
else if (encrypted_index >= 0 && encrypted_index < encryption_index->nb_encrypted_samples) {
9148 if (!encrypted_sample) {
9153 if (!encrypted_sample) {
9183 if (
c->fc->nb_streams < 1)
9185 st =
c->fc->streams[
c->fc->nb_streams-1];
9231 unsigned format_info;
9232 int channel_assignment, channel_assignment1, channel_assignment2;
9236 if (
c->fc->nb_streams < 1)
9238 st =
c->fc->streams[
c->fc->nb_streams-1];
9245 ratebits = (format_info >> 28) & 0xF;
9246 channel_assignment1 = (format_info >> 15) & 0x1F;
9247 channel_assignment2 = format_info & 0x1FFF;
9248 if (channel_assignment2)
9249 channel_assignment = channel_assignment2;
9251 channel_assignment = channel_assignment1;
9270 if (
c->fc->nb_streams < 1)
9272 st =
c->fc->streams[
c->fc->nb_streams-1];
9289 if (
c->fc->nb_streams < 1)
9291 st =
c->fc->streams[
c->fc->nb_streams - 1];
9314 int ret, old_size, num_arrays;
9316 if (
c->fc->nb_streams < 1)
9318 st =
c->fc->streams[
c->fc->nb_streams-1];
9341 num_arrays = buf[5];
9365 AVBPrint scheme_buf, value_buf;
9366 int64_t scheme_str_len = 0, value_str_len = 0;
9374 if (
c->fc->nb_streams < 1)
9376 st =
c->fc->streams[
c->fc->nb_streams-1];
9384 "Unsupported 'kind' box with version %d, flags: %x",
9394 ret = scheme_str_len;
9398 if (scheme_str_len + 1 >=
size) {
9406 size -= scheme_str_len + 1;
9410 ret = value_str_len;
9414 if (value_str_len ==
size) {
9421 "%s stream %d KindBox(scheme: %s, value: %s)\n",
9424 scheme_buf.str, value_buf.str);
9431 for (
int j = 0;
map.value_maps[j].disposition; j++) {
9455 int ambisonic_order, channel_order, normalization, channel_count;
9456 int ambi_channels, non_diegetic_channels;
9458 if (
c->fc->nb_streams < 1)
9461 st =
c->fc->streams[
c->fc->nb_streams - 1];
9463 if (atom.
size < 16) {
9477 "Unsupported ambisonic type %d\n",
type & 0x7f);
9480 non_diegetic_channels = (
type >> 7) * 2;
9485 if (channel_order) {
9487 "Unsupported channel_order %d\n", channel_order);
9492 if (normalization) {
9494 "Unsupported normalization %d\n", normalization);
9499 if (ambisonic_order < 0 || ambisonic_order > 31 ||
9500 channel_count != ((ambisonic_order + 1LL) * (ambisonic_order + 1LL) +
9501 non_diegetic_channels)) {
9503 "Invalid number of channels (%d / %d)\n",
9504 channel_count, ambisonic_order);
9507 ambi_channels = channel_count - non_diegetic_channels;
9513 for (
i = 0;
i < channel_count;
i++) {
9516 if (
channel >= channel_count) {
9545 if (
c->fc->nb_streams < 1)
9548 st =
c->fc->streams[
c->fc->nb_streams - 1];
9550 if (atom.
size < 5) {
9576 else if (
size == 8) {
9597 c->cur_item_id, aux_type.str);
9601 if ((
av_stristr(aux_type.str,
"hdrgainmap")))
9603 else if (strstr(aux_type.str,
"urn:mpeg:hevc:2015:auxid:1") ||
9604 strstr(aux_type.str,
"urn:mpeg:mpegB:cicp:systems:auxiliary:alpha"))
9627 int version, offset_size, length_size, base_offset_size, index_size;
9628 int item_count, extent_count;
9629 int64_t base_offset, extent_offset, extent_length;
9632 if (
c->found_iloc) {
9641 offset_size = (
value >> 4) & 0xF;
9642 length_size =
value & 0xF;
9644 base_offset_size = (
value >> 4) & 0xF;
9652 if (item_count > atom.
size)
9658 c->heif_item = heif_item;
9659 if (item_count >
c->nb_heif_item)
9660 memset(&
c->heif_item[
c->nb_heif_item], 0,
9661 sizeof(*
c->heif_item) * (item_count -
c->nb_heif_item));
9662 c->nb_heif_item =
FFMAX(
c->nb_heif_item, item_count);
9665 for (
int i = 0;
i < item_count;
i++) {
9673 if (offset_type > 1) {
9679 if (
rb_size(pb, &base_offset, base_offset_size) < 0)
9682 if (extent_count > 1) {
9688 if (
rb_size(pb, &extent_offset, offset_size) < 0 ||
9689 rb_size(pb, &extent_length, length_size) < 0 ||
9690 base_offset > INT64_MAX - extent_offset)
9693 for (j = 0; j <
c->nb_heif_item; j++) {
9694 item =
c->heif_item[j];
9696 item =
c->heif_item[j] =
av_mallocz(
sizeof(*item));
9697 else if (item->
item_id != item_id)
9703 if (j ==
c->nb_heif_item)
9708 if (offset_type == 1)
9713 "extent_offset %"PRId64
", extent_length %"PRId64
"\n",
9763 for (
i = 0;
i <
c->nb_heif_item;
i++) {
9764 item =
c->heif_item[
i];
9767 else if (item->
item_id != item_id)
9775 if (
i ==
c->nb_heif_item) {
9783 item->
type = item_type;
9786 switch (item_type) {
9787 case MKTAG(
'a',
'v',
'0',
'1'):
9788 case MKTAG(
'j',
'p',
'e',
'g'):
9789 case MKTAG(
'h',
'v',
'c',
'1'):
9805 if (
c->found_iinf) {
9814 if (entry_count > atom.
size)
9828 c->heif_item = heif_item;
9829 if (entry_count >
c->nb_heif_item)
9830 memset(&
c->heif_item[
c->nb_heif_item], 0,
9831 sizeof(*
c->heif_item) * (entry_count -
c->nb_heif_item));
9832 c->nb_heif_item =
FFMAX(
c->nb_heif_item, entry_count);
9834 for (
i = 0;
i < entry_count;
i++) {
9855 c->found_iinf = got_stream;
9858 for (;
i >= 0;
i--) {
9873 sizeof(*
c->heif_group));
9878 c->heif_group = tmap;
9882 "item reference count other than 2",
9887 tmap = &tmap[
c->nb_heif_group];
9898 for (
int i = 0;
i < entries;
i++) {
9923 sizeof(*
c->heif_group));
9928 c->heif_group = grid;
9929 grid = &grid[
c->nb_heif_group];
9939 for (
int i = 0;
i < entries;
i++) {
9966 int item_id_size =
version ? 4 : 2;
9970 for (
int i = 0;
i <
c->nb_heif_group;
i++) {
9971 if (
c->heif_group[
i].item->item_id == from_item_id) {
9973 "referencing the same Derived Image item\n");
9977 for (
int i = 0;
i <
c->nb_heif_item;
i++) {
9978 if (!
c->heif_item[
i] ||
c->heif_item[
i]->item_id != from_item_id)
9980 item =
c->heif_item[
i];
9982 switch (item->
type) {
9983 case MKTAG(
'g',
'r',
'i',
'd'):
9984 case MKTAG(
'i',
'o',
'v',
'l'):
9985 case MKTAG(
't',
'm',
'a',
'p'):
10002 "Derived image item references no input images\n");
10012 from_item_id, entries);
10014 switch (item->
type) {
10015 case MKTAG(
'g',
'r',
'i',
'd'):
10016 case MKTAG(
'i',
'o',
'v',
'l'):
10019 case MKTAG(
't',
'm',
'a',
'p'):
10034 int item_id_size =
version ? 4 : 2;
10052 for (
int i = 0;
i < entries;
i++) {
10090 if (entries != 1) {
10092 "count other than 1",
10098 for (
int i = 0;
i < entries;
i++) {
10136 while (atom.
size) {
10146 case MKTAG(
'd',
'i',
'm',
'g'):
10151 case MKTAG(
'c',
'd',
's',
'c'):
10156 case MKTAG(
'a',
'u',
'x',
'l'):
10157 case MKTAG(
't',
'h',
'm',
'b'):
10209 c->cur_item_id, angle);
10229 c->cur_item_id,
axis);
10249 while (atom.
size >= 8) {
10291 for (
int i = 0;
i < count;
i++) {
10293 int assoc_count =
avio_r8(pb);
10299 for (
int j = 0; j < assoc_count; j++) {
10309 if (
index > nb_atoms) {
10317 c->cur_item_id = item_id;
10321 (
MOVAtom) { .size = ref->size,
10322 .type = MKTAG(
'i',
'p',
'c',
'o') });
10344 if (
a.size <= 8 ||
a.size > atom.
size ||
a.type !=
MKTAG(
'i',
'p',
'c',
'o'))
10347 atom.
size -=
a.size;
10357 if (
a.size <= 8 ||
a.size > atom.
size ||
a.type !=
MKTAG(
'i',
'p',
'm',
'a')) {
10370 c->cur_item_id = -1;
10371 for (
int i = 0;
i < nb_atoms;
i++)
10381 uint16_t graphics_mode =
avio_rb16(pb);
10384 if (
c->fc->nb_streams < 1)
10386 AVStream *st =
c->fc->streams[
c->fc->nb_streams - 1];
10390 switch (graphics_mode) {
10415 int profile_level_indication, reference_ch_layout, config_length;
10418 if (
ctx->nb_streams < 1)
10421 st =
ctx->streams[
ctx->nb_streams - 1];
10428 profile_level_indication =
avio_r8(pb);
10430 st->
codecpar->
level = ((profile_level_indication - 1) % 5) + 1;
10432 reference_ch_layout =
avio_r8(pb);
10437 if (!reference_ch_layout ||
10455 if (
c->fc->nb_streams < 1)
10457 st =
c->fc->streams[
c->fc->nb_streams - 1];
10468 case MKTAG(
'r',
'g',
'b',
'3'):
10471 case MKTAG(
'r',
'g',
'b',
'a'):
10620{
MKTAG(
'i',
'a',
'c',
'b'), mov_read_iacb },
10634 if (
c->atom_depth > 10) {
10641 atom.
size = INT64_MAX;
10642 while (total_size <= atom.
size - 8) {
10648 if (((
a.type ==
MKTAG(
'f',
'r',
'e',
'e') &&
c->moov_retry) ||
10649 a.type ==
MKTAG(
'h',
'o',
'o',
'v')) &&
10661 a.type =
MKTAG(
'm',
'o',
'o',
'v');
10664 if (atom.
type !=
MKTAG(
'r',
'o',
'o',
't') &&
10666 if (
a.type ==
MKTAG(
't',
'r',
'a',
'k') ||
10667 a.type ==
MKTAG(
'm',
'd',
'a',
't')) {
10675 if (
a.size == 1 && total_size + 8 <= atom.
size) {
10682 a.size = atom.
size - total_size + 8;
10704 if (!
parse &&
c->found_hdlr_mdta &&
10706 a.type ==
MKTAG(
'k',
'e',
'y',
's') &&
10707 c->meta_keys_count == 0) {
10721 if (
c->found_moov &&
c->found_mdat &&
a.size <= INT64_MAX - start_pos &&
10725 c->next_root_atom = start_pos +
a.size;
10732 else if (
left < 0) {
10734 "overread end of atom '%s' by %"PRId64
" bytes\n",
10740 total_size +=
a.size;
10743 if (total_size < atom.
size && atom.
size < 0x7ffff)
10755 int moov_offset = -1;
10763 if ((
offset + 8ULL) > (
unsigned int)p->buf_size)
10766 if (
size == 1 &&
offset + 16 <= (
unsigned int)p->buf_size) {
10769 }
else if (
size == 0) {
10772 if (
size < minsize) {
10779 case MKTAG(
'm',
'o',
'o',
'v'):
10780 moov_offset =
offset + 4;
10782 case MKTAG(
'm',
'd',
'a',
't'):
10783 case MKTAG(
'p',
'n',
'o',
't'):
10784 case MKTAG(
'u',
'd',
't',
'a'):
10785 case MKTAG(
'f',
't',
'y',
'p'):
10786 if (
tag ==
MKTAG(
'f',
't',
'y',
'p') &&
10791 score =
FFMAX(score, 5);
10797 case MKTAG(
'e',
'd',
'i',
'w'):
10798 case MKTAG(
'w',
'i',
'd',
'e'):
10799 case MKTAG(
'f',
'r',
'e',
'e'):
10800 case MKTAG(
'j',
'u',
'n',
'k'):
10801 case MKTAG(
'p',
'i',
'c',
't'):
10804 case MKTAG(0x82,0x82,0x7f,0x7d):
10807 case MKTAG(
's',
'k',
'i',
'p'):
10808 case MKTAG(
'u',
'u',
'i',
'd'):
10809 case MKTAG(
'p',
'r',
'f',
'l'):
10823 while (
offset < (p->buf_size - 16)) {
10857 for (
i = 0;
i <
s->nb_streams;
i++) {
10859 if (sc->
id == chapter_track) {
10860 st =
s->streams[
i];
10895 int len, title_len;
10897 if (end < sample->timestamp) {
10911 title_len = 2*
len + 1;
10924 else if (ch == 0xfffe)
10928 if (
len == 1 ||
len == 2)
10964 int hh, mm,
ss, ff, drop;
10977 hh, mm,
ss, drop ?
';' :
':', ff);
10993 int rounded_tc_rate;
10998 if (!tc_rate.
num || !tc_rate.
den || !tmcd_nb_frames)
11017 rounded_tc_rate = (tc_rate.
num + tc_rate.
den / 2LL) / tc_rate.
den;
11020 if (tmcd_nb_frames == tc_rate.
num / tc_rate.
den &&
11022 tmcd_nb_frames = rounded_tc_rate;
11034 for (
i = 0;
i < (*index)->nb_encrypted_samples;
i++) {
11037 av_freep(&(*index)->encrypted_samples);
11038 av_freep(&(*index)->auxiliary_info_sizes);
11039 av_freep(&(*index)->auxiliary_offsets);
11114 for (
i = 0;
i <
s->nb_streams;
i++) {
11170 for (
i = 0;
i <
s->nb_streams;
i++) {
11188 for (
i = 0;
i <
s->nb_streams;
i++) {
11207 unsigned track_id, item_count;
11225 for (
i = 0;
i < item_count;
i++) {
11247 if (frag_stream_info &&
11251 for (j = 0; j < ((fieldlength >> 4) & 3) + 1; j++)
11253 for (j = 0; j < ((fieldlength >> 2) & 3) + 1; j++)
11255 for (j = 0; j < ((fieldlength >> 0) & 3) + 1; j++)
11269 if ((seek_ret =
avio_seek(
f, stream_size - 4, SEEK_SET)) < 0) {
11274 c->have_read_mfra_size = 1;
11275 if (!
c->mfra_size ||
c->mfra_size > stream_size) {
11298 c->frag_index.complete = 1;
11300 seek_ret =
avio_seek(
f, original_pos, SEEK_SET);
11301 if (seek_ret < 0) {
11303 "failed to seek back after looking for mfra\n");
11315 *nb_coded_side_data,
11346 *nb_coded_side_data,
11369 *nb_coded_side_data,
11377 9 *
sizeof(*
matrix), 0);
11396 int64_t coded_width = 0, coded_height = 0;
11408 if (!
c->idat_offset) {
11429 av_log(
c->fc,
AV_LOG_TRACE,
"grid: grid_rows %d grid_cols %d output_width %d output_height %d\n",
11445 if (coded_width > INT_MAX || coded_height > INT_MAX)
11447 if (coded_width == 0 || coded_height == 0)
11457 while (y < tile_grid->coded_height) {
11460 while (x < tile_grid->coded_width) {
11493 uint16_t canvas_fill_value[4];
11502 if (!
c->idat_offset) {
11517 for (
int i = 0;
i < 4;
i++)
11520 canvas_fill_value[0], canvas_fill_value[1],
11521 canvas_fill_value[2], canvas_fill_value[3]);
11522 for (
int i = 0;
i < 4;
i++)
11546 "horizontal_offset[%d] %d, vertical_offset[%d] %d\n",
11570 if (
ref->is_idat_relative) {
11571 if (!
c->idat_offset) {
11582 if (
offset > INT64_MAX -
ref->extent_offset) {
11589 if (err !=
ref->extent_length) {
11620 int *nb_coded_side_data)
11650 int *nb_coded_side_data)
11659 switch(
ref->type) {
11660 case MKTAG(
'E',
'x',
'i',
'f'):
11698 for (
int j = 0; j < grid->
nb_items; j++) {
11715 "reference a stream\n",
11745 case MKTAG(
'g',
'r',
'i',
'd'):
11748 case MKTAG(
'i',
'o',
'v',
'l'):
11779 uint8_t *payload =
NULL;
11797 for (
int j = 0; j < tmap->
nb_items; j++) {
11812 child_stg = item->
stg;
11813 if (!st && !child_stg) {
11815 "reference a stream or tmap\n",
11882 if (err64 !=
pos) {
11895 for (
int j = 0; j < tmap->
nb_items; j++) {
11899 int *nb_coded_side_data;
11917 (uint8_t *)gain, gain_size, 0);
11974 "a stream or group\n",
12030 int *nb_coded_side_data;
12032 double maker_33 = 0.0, maker_48 = 0.0,
headroom;
12036 if ((!gain_map->
st && !gain_map->
stg) ||
12039 "a stream or group\n",
12044 if (!
base->ifd.count)
12054 if ((!maker33 && !maker48) ||
12062 maker_48 =
av_q2d(*maker48->value.rat);
12064 if (maker_33 < 1.0) {
12065 if (maker_48 <= 0.01) {
12066 headroom = -20.0 * maker_48 + 1.8;
12068 headroom = -0.101 * maker_48 + 1.601;
12071 if (maker_48 <= 0.01) {
12072 headroom = -70.0 * maker_48 + 3.0;
12074 headroom = -0.303 * maker_48 + 2.303;
12103 if (gain_map->
st) {
12131 (uint8_t *)gain, gain_size, 0);
12138 int count =
base->ifd.count;
12139 base->ifd.count = 0;
12142 base->ifd.count = count;
12161 case MKTAG(
't',
'm',
'a',
'p'):
12183 case MKTAG(
'a',
'u',
'x',
'l'):
12272 for (
int i = 0;
i <
s->nb_streams;
i++) {
12287 for (
int j = 0; j <
s->nb_streams; j++) {
12295 for (
int k = 0; k <
tag->nb_id; k++) {
12296 if (
tag->id[k] != st->
id)
12325 uint32_t *tref_id,
int nb_tref_id,
int first_index)
12330 for (
int i = first_index;
i <
s->nb_streams;
i++)
12331 for (
int j = 0; j < nb_tref_id; j++)
12332 if (
s->streams[
i]->index != st->
index &&
12333 s->streams[
i]->id == tref_id[j])
12334 return s->streams[
i];
12341 static const uint32_t tref_tags[] = {
12342 MKTAG(
'c',
'd',
's',
'c'),
12343 MKTAG(
'r',
'n',
'd',
'r'),
12349 if (
s->nb_streams <= 1)
12352 for (
int i = 0;
i <
s->nb_streams;
i++) {
12374 stg->
id = st_ref->
id;
12396 if (
s->nb_streams <= 1)
12399 for (
int i = 0;
i <
s->nb_streams;
i++) {
12424 j = st_base->
index + 1;
12428 av_log(
s, loglevel,
"Failed to find base stream for LCEVC stream\n");
12449 if (
s->nb_streams <= 1)
12458 for (
int i = 0;
i <
s->nb_streams;
i++) {
12490 av_log(
s, loglevel,
"Failed to find base layer for Dolby Vision EL stream\n");
12520 int highest_id = 0, lowest_iamf_id = INT_MAX;
12522 for (
int i = 0;
i <
s->nb_streams;
i++) {
12526 highest_id =
FFMAX(highest_id, st->
id);
12529 for (
int i = 0;
i <
s->nb_stream_groups;
i++) {
12535 lowest_iamf_id =
FFMIN(lowest_iamf_id, st->
id);
12539 if (highest_id < lowest_iamf_id)
12542 highest_id += !lowest_iamf_id;
12543 for (
int i = 0; highest_id > 1 &&
i <
s->nb_stream_groups;
i++) {
12550 st->
id += highest_id;
12572 atom.
size = INT64_MAX;
12603 for (
i = 0;
i <
s->nb_streams;
i++)
12604 if (
s->streams[
i]->codecpar->codec_tag ==
AV_RL32(
"tmcd")) {
12606 }
else if (
s->streams[
i]->codecpar->codec_tag ==
AV_RL32(
"rtmd")) {
12631 for (
i = 0;
i <
s->nb_streams;
i++) {
12692 for (
i = 0;
i <
s->nb_streams;
i++) {
12711 s->streams[
i]->codecpar->bit_rate = mov->
bitrates[
i];
12717 for (
i = 0;
i <
s->nb_streams;
i++) {
12794 int64_t best_dts = INT64_MAX;
12798 for (
i = 0;
i <
s->nb_streams;
i++) {
12805 uint64_t dtsdiff = best_dts > dts ? best_dts - (uint64_t)dts : ((uint64_t)dts - best_dts);
12807 if (!
sample || (no_interleave && current_sample->
pos <
sample->pos) ||
12811 (dtsdiff >
AV_TIME_BASE && dts < best_dts && mov->interleaved_read)))))) {
12812 sample = current_sample;
12835 if (target >= 0 &&
avio_seek(
s->pb, target, SEEK_SET) != target) {
12868 uint8_t *side, *extradata;
12869 int extradata_size;
12883 memcpy(side, extradata, extradata_size);
12893 const uint32_t cdat =
AV_RB32(
"cdat");
12902 if ((src_size - 8) / 2 >= INT_MAX / 3)
12910 while (src_size >= 10) {
12911 const uint32_t atom_size =
avio_rb32(pb);
12912 const uint32_t atom_type =
avio_rb32(pb);
12913 const uint32_t data_size = atom_size - 8;
12914 const uint8_t cc_field =
12915 atom_type == cdat ? 1 :
12916 atom_type ==
cdt2 ? 2 :
12923 if (data_size < 2 || data_size > src_size) {
12929 if (data_size % 2 != 0) {
12937 src_size -= data_size;
12941 for (uint32_t
i = 0;
i < data_size;
i += 2) {
12942 pkt->data[
out_size] = (0x1F << 3) | (1 << 2) | (cc_field - 1);
12974 if (
pkt->duration == 0) {
12977 if (next_dts >=
pkt->dts)
12978 pkt->duration = next_dts -
pkt->dts;
12996 if (!
ffstream(st)->first_discard_sample)
12998 if (!
ffstream(st)->last_discard_sample)
13014 uint8_t sample_is_depended_on = (sample_flags >> 2) & 0x3;
13054 if (
s->pb->pos == 0) {
13068 for (
i = 0;
i <
s->nb_streams;
i++) {
13108 if (ret64 !=
sample->pos) {
13113 }
else if (ret64 < 0) {
13127 else if (sc->
iamf) {
13160 if (au_size >
sample->size - 4) {
13162 "APV au_size %u exceeds sample body %d\n",
13163 au_size,
sample->size - 4);
13166 au_size =
sample->size - 4;
13177#if CONFIG_DV_DEMUXER
13263 int64_t key_sample_dts, key_sample_pts;
13290 int sample, time_sample,
ret, requested_sample;
13315 if (requested_sample < 0)
13324 timestamp = next_ts;
13339 time_sample = next;
13354 time_sample = next;
13373 (
AVRational){1, st->codecpar->sample_rate});
13385 if (stream_index >=
s->nb_streams)
13388 st =
s->streams[stream_index];
13394 if (
mc->seek_individually) {
13397 int64_t next_root_atom =
mc->next_root_atom;
13400 for (
i = 0;
i <
s->nb_streams;
i++) {
13406 if (stream_index ==
i)
13409 mc->next_root_atom = 0;
13418 (!next_root_atom ||
mc->next_root_atom < next_root_atom))
13419 next_root_atom =
mc->next_root_atom;
13421 mc->next_root_atom = next_root_atom;
13423 for (
i = 0;
i <
s->nb_streams;
i++) {
13425 st =
s->streams[
i];
13443#define OFFSET(x) offsetof(MOVContext, x)
13444#define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
13446 {
"use_absolute_path",
13447 "allow using absolute path when opening alias, this is a possible security issue",
13450 {
"seek_streams_individually",
13451 "Seek each stream individually to the closest point",
13454 {
"ignore_editlist",
"Ignore the edit list atom.",
OFFSET(ignore_editlist),
AV_OPT_TYPE_BOOL, {.i64 = 0},
13456 {
"advanced_editlist",
13457 "Modify the AVIndex according to the editlists. Use this option to decode in the order specified by the edits.",
13463 "use mfra for fragment timestamps",
13466 .unit =
"use_mfra_for"},
13468 FLAGS, .unit =
"use_mfra_for" },
13470 FLAGS, .unit =
"use_mfra_for" },
13472 FLAGS, .unit =
"use_mfra_for" },
13475 {
"export_all",
"Export unrecognized metadata entries",
OFFSET(export_all),
13477 {
"export_xmp",
"Export full XMP metadata",
OFFSET(export_xmp),
13479 {
"activation_bytes",
"Secret bytes for Audible AAX files",
OFFSET(activation_bytes),
13481 {
"audible_key",
"AES-128 Key for Audible AAXC files",
OFFSET(audible_key),
13483 {
"audible_iv",
"AES-128 IV for Audible AAXC files",
OFFSET(audible_iv),
13485 {
"audible_fixed_key",
13486 "Fixed key used for handling Audible AAX files",
OFFSET(audible_fixed_key),
13492 {.i64 = 0}, 0, 1,
FLAGS },
13500 .class_name =
"mov,mp4,m4a,3gp,3g2,mj2",
13507 .p.name =
"mov,mp4,m4a,3gp,3g2,mj2",
13510 .p.extensions =
"mov,mp4,m4a,3gp,3g2,mj2,psp,m4v,m4b,ism,ismv,isma,f4v,avif,heic,heif",
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
const uint16_t ff_ac3_channel_layout_tab[8]
Map audio coding mode (acmod) to channel layout mask.
static double val(void *priv, double ch)
static const char *const format[]
#define ALAC_EXTRADATA_SIZE
AVAmbientViewingEnvironment * av_ambient_viewing_environment_alloc(size_t *size)
Allocate an AVAmbientViewingEnvironment structure.
static AVFormatContext * ctx
static int parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_unreachable(msg)
Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
uint64_t avio_rb64(AVIOContext *s)
#define AVIO_FLAG_READ
read-only
int64_t avio_size(AVIOContext *s)
Get the filesize.
unsigned int avio_rb16(AVIOContext *s)
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.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
unsigned int avio_rl32(AVIOContext *s)
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a string from pb into buf.
unsigned int avio_rb24(AVIOContext *s)
unsigned int avio_rb32(AVIOContext *s)
int avio_r8(AVIOContext *s)
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
Ensures that the requested seekback buffer size will be available.
int64_t ff_read_string_to_bprint_overwrite(AVIOContext *s, struct AVBPrint *bp, int64_t max_len)
Read a whole null-terminated string of text from AVIOContext to an AVBPrint buffer overwriting its co...
void ffio_init_read_context(FFIOContext *s, const uint8_t *buffer, int buffer_size)
Wrap a buffer in an AVIOContext for reading.
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
unsigned int ffio_read_leb(AVIOContext *s)
Read a unsigned integer coded as a variable number of up to eight little-endian bytes,...
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static int BS_FUNC left(const BSCTX *bc)
Return the number of the bits left in a buffer.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_BPRINT_SIZE_UNLIMITED
#define AV_BPRINT_SIZE_AUTOMATIC
static int FUNC metadata(CodedBitstreamContext *ctx, RWContext *rw, APVRawMetadata *current)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
#define ss(width, name, subs,...)
static int read_probe(const AVProbeData *p)
Public libavutil channel layout APIs header.
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
#define PUT_UTF8(val, tmp, PUT_BYTE)
Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long).
static const AVColorPrimariesDesc color_primaries[AVCOL_PRI_NB]
static __device__ float fabs(float a)
static const uint16_t fc[]
#define AV_PROFILE_DTS_EXPRESS
#define AV_PROFILE_DTS_HD_MA
#define AV_PROFILE_UNKNOWN
#define AV_PROFILE_DTS_HD_HRA
#define AV_EF_COMPLIANT
consider all spec non compliances as errors
#define FF_COMPLIANCE_STRICT
Strictly conform to all the things in the spec no matter what consequences.
#define AV_EF_EXPLODE
abort decoding on minor error detection
@ AV_FIELD_TT
Top coded_first, top displayed first.
@ AV_FIELD_BB
Bottom coded first, bottom displayed first.
@ AV_FIELD_BT
Bottom coded first, top displayed first.
@ AV_FIELD_TB
Top coded first, bottom displayed first.
#define AV_PROFILE_DTS_96_24
@ AV_AUDIO_SERVICE_TYPE_KARAOKE
#define AV_PROFILE_DTS_ES
int ff_buffer_packet(AVFormatContext *s, AVPacket *pkt)
void ff_rfps_calculate(AVFormatContext *ic)
int ff_rfps_add_frame(AVFormatContext *ic, AVStream *st, int64_t ts)
add frame for rfps calculation.
AVChapter * avpriv_new_chapter(AVFormatContext *s, int64_t id, AVRational time_base, int64_t start, int64_t end, const char *title)
Add a new chapter.
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
int ff_itunes_parse_smpb(const char *value, int64_t *priming, int64_t *remainder, int64_t *samples)
Parse the gapless playback information Apple encoders store in an iTunSMPB tag.
void ff_configure_buffers_for_index(AVFormatContext *s, int64_t time_tolerance)
int ff_generate_avci_extradata(AVStream *st)
Generate standard extradata for AVC-Intra based on width/height and field order.
#define FFERROR_REDO
Returned by demuxers to indicate that data was consumed but discarded (ignored streams or junk data).
int ff_get_extradata(void *logctx, AVCodecParameters *par, AVIOContext *pb, int size)
Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end which is always set to 0 and f...
int ff_add_attached_pic(AVFormatContext *s, AVStream *st, AVIOContext *pb, AVBufferRef **buf, int size)
Add an attached pic to an AVStream.
#define OPUS_SEEK_PREROLL_MS
int ff_isom_parse_dvcc_dvvc(void *logctx, AVStream *st, const uint8_t *buf_ptr, uint64_t size)
#define ISOM_DVCC_DVVC_SIZE
int ff_dvdclut_yuv_to_rgb(uint32_t *clut, const size_t clut_size)
int ff_dvdclut_palette_extradata_cat(const uint32_t *clut, const size_t clut_size, AVCodecParameters *par)
#define FF_DVDCLUT_CLUT_SIZE
#define FF_DVDCLUT_CLUT_LEN
channel
Use these values when setting the channel map with ebur128_set_channel().
AVEncryptionInfo * av_encryption_info_alloc(uint32_t subsample_count, uint32_t key_id_size, uint32_t iv_size)
Allocates an AVEncryptionInfo structure and sub-pointers to hold the given number of subsamples.
AVEncryptionInfo * av_encryption_info_clone(const AVEncryptionInfo *info)
Allocates an AVEncryptionInfo structure with a copy of the given data.
int av_encryption_init_info_append_side_data(uint8_t **side_data, size_t *side_data_size, unsigned int *allocated_size, const AVEncryptionInitInfo *info)
Appends a copy of the given encryption init info list to encryption init info side data,...
uint8_t * av_encryption_info_add_side_data(const AVEncryptionInfo *info, size_t *size)
Allocates and initializes side data that holds a copy of the given encryption info.
AVEncryptionInitInfo * av_encryption_init_info_alloc(uint32_t system_id_size, uint32_t num_key_ids, uint32_t key_id_size, uint32_t data_size)
Allocates an AVEncryptionInitInfo structure and sub-pointers to hold the given sizes.
void av_encryption_init_info_free(AVEncryptionInitInfo *info)
Frees the given encryption init info object.
void av_encryption_info_free(AVEncryptionInfo *info)
Frees the given encryption info object.
int av_exif_get_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, int flags, AVExifEntry **value)
Get an entry with the tagged ID from the EXIF metadata struct.
int av_exif_parse_buffer(void *logctx, const uint8_t *buf, size_t size, AVExifMetadata *ifd, enum AVExifHeaderMode header_mode)
Decodes the EXIF data provided in the buffer and writes it into the struct *ifd.
void av_exif_free(AVExifMetadata *ifd)
Frees all resources associated with the given EXIF metadata struct.
int av_exif_write(void *logctx, const AVExifMetadata *ifd, AVBufferRef **buffer, enum AVExifHeaderMode header_mode)
Allocates a buffer using av_malloc of an appropriate size and writes the EXIF data represented by ifd...
int32_t av_exif_get_tag_id(const char *name)
Retrieves the tag ID associated with the provided tag string name.
int av_exif_remove_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, int flags)
Remove an entry from the provided EXIF metadata struct.
@ AV_EXIF_TIFF_HEADER
The TIFF header starts with 0x49492a00, or 0x4d4d002a.
@ AV_EXIF_T_OFF
The first four bytes point to the actual start, then it's AV_EXIF_TIFF_HEADER.
static struct @111144215057303131116103221376075045141373005341 current
static int64_t start_time
static int read_header(FFV1Context *f, RangeCoder *c)
FLAC (Free Lossless Audio Codec) common stuff.
@ FLAC_METADATA_TYPE_STREAMINFO
static av_always_inline void flac_parse_block_header(const uint8_t *block_header, int *last, int *type, int *size)
Parse the metadata block parameters from the header.
#define FLAC_STREAMINFO_SIZE
static av_cold void cleanup(FlashSV2Context *s)
bitstream reader API header.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
static void skip_bits(GetBitContext *s, int n)
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_BINARY
Underlying C type is a uint8_t* that is either NULL or points to an array allocated with the av_mallo...
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_DICT
Underlying C type is AVDictionary*.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
#define AV_CH_SIDE_SURROUND_RIGHT
#define AV_CH_TOP_FRONT_LEFT
#define AV_CH_FRONT_RIGHT
#define AV_CH_SIDE_SURROUND_LEFT
#define AV_CH_TOP_BACK_CENTER
#define AV_CH_FRONT_RIGHT_OF_CENTER
#define AV_CH_BACK_CENTER
#define AV_CH_TOP_FRONT_CENTER
#define AV_CH_FRONT_LEFT_OF_CENTER
#define AV_CH_LOW_FREQUENCY_2
#define AV_CH_TOP_SIDE_RIGHT
#define AV_CH_FRONT_CENTER
#define AV_CH_TOP_BACK_RIGHT
#define AV_CH_TOP_SIDE_LEFT
#define AV_CH_TOP_BACK_LEFT
#define AV_CH_LOW_FREQUENCY
#define AV_CH_TOP_FRONT_RIGHT
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
AVCodecID
Identify the syntax and semantics of the bitstream.
@ AV_CODEC_ID_GSM
as in Berlin toast format
@ AV_CODEC_ID_DVD_SUBTITLE
@ AV_CODEC_ID_ADPCM_IMA_QT
@ AV_CODEC_ID_ADPCM_IMA_WAV
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
@ AVDISCARD_ALL
discard all
@ AVDISCARD_NONKEY
discard all frames except keyframes
AVPacketSideData * av_packet_side_data_new(AVPacketSideData **psd, int *pnb_sd, enum AVPacketSideDataType type, size_t size, int flags)
Allocate a new packet side data.
AVPacketSideData * av_packet_side_data_add(AVPacketSideData **psd, int *pnb_sd, enum AVPacketSideDataType type, void *data, size_t size, int flags)
Wrap existing data as packet side data.
const AVPacketSideData * av_packet_side_data_get(const AVPacketSideData *sd, int nb_sd, enum AVPacketSideDataType type)
Get side information from a side data array.
@ AV_PKT_DATA_HEVC_CONF
Dolby Vision enhancement-layer HEVC decoder configuration.
@ AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT
Ambient viewing environment metadata, as defined by H.274.
@ AV_PKT_DATA_GAIN_MAP_PARAMS
Parameters describing how to combine this gain map with its base image to form an alternate rendition...
@ AV_PKT_DATA_ICC_PROFILE
ICC profile data consisting of an opaque octet buffer following the format described by ISO 15076-1.
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
@ AV_PKT_DATA_AUDIO_SERVICE_TYPE
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
@ AV_PKT_DATA_SPHERICAL
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
@ AV_PKT_DATA_PALETTE
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette.
@ AV_PKT_DATA_ENCRYPTION_INFO
This side data contains encryption info for how to decrypt the packet.
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
@ AV_PKT_DATA_EXIF
Extensible image file format metadata.
@ AV_PKT_DATA_ENCRYPTION_INIT_INFO
This side data is encryption initialization data.
@ AV_PKT_DATA_NEW_EXTRADATA
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
@ AV_PKT_DATA_STEREO3D
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
@ AV_PKT_DATA_FRAME_CROPPING
The number of pixels to discard from the top/bottom/left/right border of the decoded frame to obtain ...
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
@ AV_PKT_DATA_DOVI_CONF
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2....
#define AV_PKT_FLAG_DISCARD
Flag is used to discard packets which are required to maintain valid decoder state but are not requir...
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
Allocate new information of a packet.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
#define AV_PKT_FLAG_DISPOSABLE
Flag is used to indicate packets that contain frames that can be discarded by the decoder.
int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, uint8_t *data, size_t size)
Wrap an existing array as a packet side data.
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
AVStreamGroup * avformat_stream_group_create(AVFormatContext *s, enum AVStreamGroupParamsType type, AVDictionary **options)
Add a new empty stream group to a media file.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
int avformat_stream_group_add_stream(AVStreamGroup *stg, AVStream *st)
Add an already allocated stream to a stream group.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
int avformat_stream_group_add_stream_group(AVStreamGroup *stg, AVStreamGroup *group)
Add an already allocated stream group to another stream group.
void av_url_split(char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url)
Split a URL string into components.
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
struct AVAESCTR * av_aes_ctr_alloc(void)
Allocate an AVAESCTR context.
int av_aes_ctr_init(struct AVAESCTR *a, const uint8_t *key)
Initialize an AVAESCTR context.
void av_aes_ctr_set_full_iv(struct AVAESCTR *a, const uint8_t *iv)
Forcefully change the "full" 16-byte iv, including the counter.
void av_aes_ctr_crypt(struct AVAESCTR *a, uint8_t *dst, const uint8_t *src, int count)
Process a buffer using a previously initialized context.
void av_aes_ctr_free(struct AVAESCTR *a)
Release an AVAESCTR context.
struct AVAES * av_aes_alloc(void)
Allocate an AVAES context.
int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt)
Initialize an AVAES context.
void av_aes_crypt(AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt)
Encrypt or decrypt a buffer using a previously initialized context.
int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrder order, int flags)
Change the AVChannelOrder of a channel layout.
#define AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL
The specified retype target order is ignored and the simplest possible (canonical) order is used for ...
#define AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_MONO
int av_channel_layout_custom_init(AVChannelLayout *channel_layout, int nb_channels)
Initialize a custom channel layout with the specified number of channels.
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask)
Initialize a native channel layout from a bitmask indicating which channels are present.
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
@ AV_CHAN_AMBISONIC_BASE
Range of channels between AV_CHAN_AMBISONIC_BASE and AV_CHAN_AMBISONIC_END represent Ambisonic compon...
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
#define AV_DICT_APPEND
If the entry already exists, append to it.
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
#define AV_DICT_DONT_STRDUP_KEY
Take ownership of a key that's been allocated with av_malloc() or another memory allocation function.
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags)
Convenience wrapper for av_dict_set() that converts the value to a string and stores it.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
void av_iamf_audio_element_free(AVIAMFAudioElement **paudio_element)
Free an AVIAMFAudioElement and all its contents.
@ AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE
void av_iamf_mix_presentation_free(AVIAMFMixPresentation **pmix_presentation)
Free an AVIAMFMixPresentation and all its contents.
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
AVRational av_add_q(AVRational b, AVRational c)
Add two rationals.
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
static AVRational av_make_q(int num, int den)
Create an AVRational.
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
static double av_q2d(AVRational a)
Convert an AVRational to a double.
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
AVRational av_sub_q(AVRational b, AVRational c)
Subtract one rational from another.
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
void * av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, const uint8_t *elem_data)
Add an element of size elem_size to a dynamic array.
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate an array through a pointer to a pointer.
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
char * av_fourcc_make_string(char *buf, uint32_t fourcc)
Fill the provided buffer with a string containing a FourCC (four-character code) representation.
#define av_fourcc2str(fourcc)
#define AV_FOURCC_MAX_STRING_SIZE
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len)
Update hash value.
struct AVSHA * av_sha_alloc(void)
Allocate an AVSHA context.
void av_sha_final(AVSHA *ctx, uint8_t *digest)
Finish hashing and output digest value.
av_cold int av_sha_init(AVSHA *ctx, int bits)
Initialize SHA-1 or SHA-2 hashing.
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,...
char * av_stristr(const char *s1, const char *s2)
Locate the first case-independent occurrence in the string haystack of the string needle.
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define AV_TIME_BASE
Internal time base represented as integer.
#define LIBAVUTIL_VERSION_INT
void av_display_rotation_set(int32_t matrix[9], double angle)
Initialize a transformation matrix describing a pure clockwise rotation by the specified angle (in de...
void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip)
Flip the input matrix horizontally and/or vertically.
AVSphericalMapping * av_spherical_alloc(size_t *size)
Allocate a AVSphericalVideo structure and initialize its fields to default values.
AVSphericalProjection
Projection of the video surface(s) on a sphere.
@ AV_SPHERICAL_RECTILINEAR
Video frame displays on a flat, rectangular 2D surface.
@ AV_SPHERICAL_EQUIRECTANGULAR
Video represents a sphere mapped on a flat surface using equirectangular projection.
@ AV_SPHERICAL_EQUIRECTANGULAR_TILE
Video represents a portion of a sphere mapped on a flat surface using equirectangular projection.
@ AV_SPHERICAL_CUBEMAP
Video frame is split into 6 faces of a cube, and arranged on a 3x2 layout.
@ AV_SPHERICAL_HALF_EQUIRECTANGULAR
Video frame displays as a 180 degree equirectangular projection.
@ AV_SPHERICAL_PARAMETRIC_IMMERSIVE
Parametric Immersive projection (Apple).
@ AV_SPHERICAL_FISHEYE
Fisheye projection (Apple).
AVStereo3DType
List of possible 3D Types.
AVStereo3D * av_stereo3d_alloc_size(size_t *size)
Allocate an AVStereo3D structure and set its fields to default values.
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
AVStereo3DPrimaryEye
List of possible primary eyes.
AVStereo3DView
List of possible view types.
@ AV_STEREO3D_2D
Video is not stereoscopic (and metadata has to be there).
@ AV_STEREO3D_TOPBOTTOM
Views are on top of each other.
@ AV_STEREO3D_UNSPEC
Video is stereoscopic but the packing is unspecified.
@ AV_STEREO3D_SIDEBYSIDE
Views are next to each other.
@ AV_PRIMARY_EYE_NONE
Neither eye.
@ AV_PRIMARY_EYE_LEFT
Left eye.
@ AV_PRIMARY_EYE_RIGHT
Right eye.
@ AV_STEREO3D_VIEW_RIGHT
Frame contains only the right view.
@ AV_STEREO3D_VIEW_PACKED
Frame contains two packed views.
@ AV_STEREO3D_VIEW_LEFT
Frame contains only the left view.
@ AV_STEREO3D_VIEW_UNSPEC
Content is unspecified.
#define MAX_REORDER_DELAY
const VDPAUPixFmtMap * map
int ff_iamfdec_read_descriptors(IAMFContext *c, AVIOContext *pb, int max_size, void *log_ctx)
int ff_iamf_read_packet(AVFormatContext *s, IAMFDemuxContext *c, AVIOContext *pb, int max_size, int stream_id_offset, AVPacket *pkt)
void ff_iamf_read_deinit(IAMFDemuxContext *c)
const char *const ff_id3v1_genre_str[ID3v1_GENRE_MAX+1]
ID3v1 genres.
static const int16_t alpha[]
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
static av_always_inline double av_int2double(uint64_t i)
Reinterpret a 64-bit integer as a double.
int ff_mov_lang_to_iso639(unsigned code, char to[4])
const AVCodecTag ff_codec_movdata_tags[]
const struct MP4TrackKindMapping ff_mov_track_kind_table[]
const AVCodecTag ff_codec_movsubtitle_tags[]
#define MOV_TRUN_SAMPLE_DURATION
#define MOV_GRAPHICS_MODE_COPY
int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb)
#define FF_MOV_FLAG_MFRA_PTS
#define MOV_TRUN_SAMPLE_CTS
#define MOV_TKHD_FLAG_ENABLED
#define MOV_TFHD_DEFAULT_BASE_IS_MOOF
#define MOV_INFE_FLAG_HIDDEN
#define FF_MOV_FLAG_MFRA_DTS
const AVCodecTag ff_codec_movaudio_tags[]
#define MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES
const AVCodecTag ff_codec_movvideo_tags[]
#define MOV_TFHD_DEFAULT_SIZE
#define MOV_ISMV_TTML_TAG
#define MOV_TRUN_FIRST_SAMPLE_FLAGS
#define MOV_GRAPHICS_MODE_PREMUL_BLACK_ALPHA
#define MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC
#define MOV_GRAPHICS_MODE_DITHER_COPY
#define MOV_TRUN_SAMPLE_FLAGS
#define MOV_TFHD_DEFAULT_FLAGS
#define MOV_TRUN_DATA_OFFSET
#define MOV_TFHD_BASE_DATA_OFFSET
static enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags)
Compute codec id for 'lpcm' tag.
#define MOV_TRUN_SAMPLE_SIZE
#define MOV_SAMPLE_DEPENDENCY_NO
#define MOV_GRAPHICS_MODE_STRAIGHT_ALPHA
#define FF_MOV_FLAG_MFRA_AUTO
#define MOV_TFHD_DEFAULT_DURATION
static int mix(int c0, int c1)
Macro definitions for various function/variable attributes.
AVGainMapParams * av_gain_map_params_alloc(size_t *size)
Allocate an AVGainMapParams structure and initialize it to default values.
int av_gain_map_params_from_iso21496(AVGainMapParams *restrict p, const uint8_t *data, size_t size)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
static av_cold int read_close(AVFormatContext *ctx)
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
static const uint16_t mask[17]
#define FFSWAP(type, a, b)
#define MKTAG(a, b, c, d)
#define MKBETAG(a, b, c, d)
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
static int mlp_samplerate(int in)
static uint64_t truehd_layout(int chanmap)
static int mov_read_ilst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int64_t mov_get_skip_samples(AVStream *st, int sample)
static int search_frag_moof_offset(MOVFragmentIndex *frag_index, int64_t offset)
static int mov_read_sbas(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int update_frag_index(MOVContext *c, int64_t offset)
static int get_eia608_packet(AVIOContext *pb, AVPacket *pkt, int src_size)
static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_pack(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int read_image_grid(AVFormatContext *s, const HEIFGroup *grid, AVStreamGroupTileGrid *tile_grid)
static int mov_apply_heif_item_references(AVFormatContext *s, HEIFItem *item, AVPacketSideData **coded_side_data, int *nb_coded_side_data)
static int find_prev_closest_index(AVStream *st, AVIndexEntry *e_old, int nb_old, MOVTimeToSample *tts_data, int64_t tts_count, int64_t timestamp_pts, int flag, int64_t *index, int64_t *tts_index, int64_t *tts_sample)
Find the closest previous frame to the timestamp_pts, in e_old index entries.
static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags)
static HEIFItem * get_heif_item(MOVContext *c, unsigned id)
Get the requested item.
static void mov_free_stream_context(AVFormatContext *s, AVStream *st)
static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc)
static int heif_add_stream(MOVContext *c, HEIFItem *item)
static int mov_read_dops(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int set_display_matrix_from_item(AVPacketSideData **coded_side_data, int *nb_coded_side_data, const HEIFItem *item)
static int mov_compare_presentation_samples(const void *a, const void *b)
static int mov_switch_root(AVFormatContext *s, int64_t target, int index)
static int mov_read_vexu_proj(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_srat(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int get_key_from_kid(uint8_t *out, int len, MOVContext *c, AVEncryptionInfo *sample)
static int mov_read_aclr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_idat(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_parse_tmcd_streams(AVFormatContext *s)
static int mov_read_lhvc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int aax_filter(uint8_t *input, int size, MOVContext *c)
static void mov_current_sample_dec(MOVStreamContext *sc)
static int mov_finalize_stsd_entry(MOVContext *c, AVStream *st)
static int mov_read_pitm(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static void set_curr_stream_little_endian(MOVContext *c)
static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp, int flags)
static int mov_read_uncc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
static int mov_parse_lcevc_streams(AVFormatContext *s)
static int mov_read_hvce(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int cbcs_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *sample, uint8_t *input, int size)
static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_finalize_packet(AVFormatContext *s, AVStream *st, AVIndexEntry *sample, int64_t current_index, AVPacket *pkt)
static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static uint64_t mov_dts_channel_layout_to_mask(unsigned int code)
static int64_t get_stream_info_time(MOVFragmentStreamInfo *frag_stream_info)
static int mov_read_saio(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_skip_multiple_stsd(MOVContext *c, AVIOContext *pb, int codec_tag, int format, int64_t size)
static int mov_read_iref_auxl(MOVContext *c, AVIOContext *pb, uint32_t type, int version, uint32_t size)
static int mov_add_tref_id(MovTref *tag, uint32_t id)
static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_tmcd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
static int mov_metadata_gnre(MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_dpxe(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static MovTref * mov_find_tref_tag(const MOVStreamContext *sc, uint32_t name)
static int mov_parse_heif_layered_video_auxl_alpha(AVFormatContext *s, HEIFItem *base, HEIFItem *alpha)
static int mov_read_eyes(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int cenc_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *sample, uint8_t *input, int size)
static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_metadata_hmmt(MOVContext *c, AVIOContext *pb, unsigned len)
static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_dts_stream_construction_to_profile(unsigned int sc)
static int mov_read_gama(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int rb_size(AVIOContext *pb, int64_t *value, int size)
static int mov_read_chpl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_header(AVFormatContext *s)
static int mov_read_dfla(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_st3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_metadata_3gp(MOVContext *c, AVIOContext *pb, int64_t len, const char *key, AVDictionary **metadata)
static int test_same_origin(const char *src, const char *ref)
static int sanity_checks(void *log_obj, MOVStreamContext *sc, int index)
static void mov_current_sample_set(MOVStreamContext *sc, int current_sample)
static int mov_merge_tts_data(MOVContext *mov, AVStream *st, int flags)
static int mov_aaxc_crypto(MOVContext *c)
static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_ddts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_ipco(MOVContext *c, AVIOContext *pb, MOVAtom atom, MOVAtomExt **atoms, int *nb_atoms)
static int mov_read_sdtp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int cenc_filter(MOVContext *mov, AVStream *st, MOVStreamContext *sc, AVPacket *pkt, int current_index)
static const AVClass mov_class
static int mov_read_sample_encryption_info(MOVContext *c, AVIOContext *pb, MOVStreamContext *sc, AVEncryptionInfo **sample, int use_subsamples)
static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static const uint32_t mac_to_unicode[128]
static int mov_parse_heif_layered_video_auxl_gmap(AVFormatContext *s, HEIFItem *base, HEIFItem *gain_map)
static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
An strf atom is a BITMAPINFOHEADER struct.
static uint32_t get_sgpd_sync_index(const MOVStreamContext *sc, int nal_unit_type)
static void fix_frag_index_entries(MOVFragmentIndex *frag_index, int index, int id, int entries)
static int mov_read_rtmd_track(AVFormatContext *s, AVStream *st)
static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_dmlp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_metadata_int8_bypass_padding(MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
static int mov_read_schm(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_metadata_loci(MOVContext *c, AVIOContext *pb, unsigned len)
static int read_tfra(MOVContext *mov, AVIOContext *f)
static int mov_seek_fragment(AVFormatContext *s, AVStream *st, int64_t timestamp)
static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom, enum AVCodecID codec_id)
static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len)
static int mov_read_adrm(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_parse_heif_layered_video_tmap(AVFormatContext *s, const HEIFGroup *tmap)
static int mov_parse_dovi_streams(AVFormatContext *s)
static int mov_read_chnl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static void mov_metadata_creation_time(MOVContext *c, AVIOContext *pb, AVDictionary **metadata, int version)
static int mov_stsc_index_valid(unsigned int index, unsigned int count)
static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_dvcc_dvvc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int should_retry(AVIOContext *pb, int error_code)
static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_tfdt(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_moov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_clli(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static void mov_update_dts_shift(MOVStreamContext *sc, int duration, void *logctx)
static int mov_read_kind(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_sbgp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_metadata_track_or_disc_number(MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
static int mov_read_ares(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_pssh(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_finalize_stsd_codec(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc)
static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_iprp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_cdsc_rndr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int cens_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *sample, uint8_t *input, int size)
static int read_image_iovl(AVFormatContext *s, const HEIFGroup *grid, AVStreamGroupTileGrid *tile_grid)
static int mov_read_alac(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_mfra(MOVContext *c, AVIOContext *f)
static int mov_read_iref_dimg_grid(MOVContext *c, AVIOContext *pb, HEIFItem *item, int version, int entries)
#define MIN_DATA_ENTRY_BOX_SIZE
static int mov_change_extradata(AVStream *st, AVPacket *pkt)
static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc)
static int mov_read_timecode_track(AVFormatContext *s, AVStream *st)
static int mov_read_imir(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_svq3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_pcmc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_auxc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_parse_cdsc_and_rndr_streams(AVFormatContext *s)
static const MOVParseTableEntry mov_default_parse_table[]
static int mov_read_jp2h(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_iref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_trex(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_saiz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_hfov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_free(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int set_icc_profile_from_item(AVPacketSideData **coded_side_data, int *nb_coded_side_data, const HEIFItem *item)
static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_parse_heif_item_references(AVFormatContext *s, HEIFItem *item, AVPacketSideData **coded_side_data, int *nb_coded_side_data)
static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static AVStream * get_curr_st(MOVContext *c)
Get the current stream in the parsing process.
static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc, int64_t size)
static int mov_read_mdat(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int cbc1_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *sample, uint8_t *input, int size)
static int mov_metadata_int8_no_padding(MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
static int search_frag_timestamp(AVFormatContext *s, MOVFragmentIndex *frag_index, AVStream *st, int64_t timestamp)
static int mov_read_avid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int set_exif_from_item(AVFormatContext *s, AVPacketSideData **coded_side_data, int *nb_coded_side_data, const HEIFItem *item)
static void fix_timescale(MOVContext *c, MOVStreamContext *sc)
static int mov_read_custom(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int get_current_encryption_info(MOVContext *c, MOVEncryptionIndex **encryption_index, MOVStreamContext **sc)
Gets the current encryption info and associated current stream context.
static int mov_read_close(AVFormatContext *s)
static int mov_read_pasp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_open_dref(MOVContext *c, AVIOContext **pb, const char *src, MOVDref *ref)
static MOVFragmentStreamInfo * get_frag_stream_info_from_pkt(MOVFragmentIndex *frag_index, AVPacket *pkt, int id)
static int mov_read_avss(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_tenc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_ipma(MOVContext *c, AVIOContext *pb, MOVAtom atom, MOVAtomExt *atoms, int nb_atoms)
static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int build_open_gop_key_points(AVStream *st)
static void mov_build_index(MOVContext *mov, AVStream *st)
static void mov_update_sample_durations(MOVContext *mov, AVStream *st)
static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_find_tref_id(const MovTref *tag, uint32_t id)
static int mov_parse_heif_layered_video(AVFormatContext *s)
static int mov_read_amve(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_keys(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_wfex(MOVContext *c, AVIOContext *pb, MOVAtom atom)
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...
static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define IS_MATRIX_IDENT(matrix)
static int can_seek_to_key_sample(AVStream *st, int sample, int64_t requested_pts)
static int mov_parse_auxiliary_info(MOVContext *c, MOVStreamContext *sc, AVIOContext *pb, MOVEncryptionIndex *encryption_index)
static int64_t mov_get_stsc_samples(MOVStreamContext *sc, unsigned int index)
static int mov_read_vpcc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int64_t add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Add index entry with the given values, to the end of ffstream(st)->index_entries.
static int mov_parse_tiles(AVFormatContext *s)
static void mov_fix_index(MOVContext *mov, AVStream *st)
Fix ffstream(st)->index_entries, so that it contains only the entries (and the entries which are need...
static int mov_read_iref_cdsc(MOVContext *c, AVIOContext *pb, uint32_t type, int version, uint32_t size)
static int cenc_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *sample, uint8_t *input, int size)
static int mov_read_senc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_sgpd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static AVStream * mov_find_reference_track(AVFormatContext *s, AVStream *st, uint32_t *tref_id, int nb_tref_id, int first_index)
static void fix_index_entry_timestamps(AVStream *st, int end_index, int64_t end_ts, int64_t *frame_duration_buffer, int frame_duration_buffer_size)
Rewrite timestamps of index entries in the range [end_index - frame_duration_buffer_size,...
static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int add_tts_entry(MOVTimeToSample **tts_data, unsigned int *tts_count, unsigned int *allocated_size, int count, int offset, unsigned int duration)
static void mov_parse_stsd_subtitle(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc, int64_t size)
static int mov_read_clap(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_dvc1(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_vdep(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_SAND(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int64_t mov_read_atom_into_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom, AVCodecParameters *par, uint8_t *buf)
static void mov_free_encryption_index(MOVEncryptionIndex **index)
static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len, char *dst, int dstlen)
static void fix_stream_ids(AVFormatContext *s)
static AVIndexEntry * mov_find_next_sample(AVFormatContext *s, AVStream **st)
static int mov_read_chap(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int is_open_key_sample(const MOVStreamContext *sc, int sample)
static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_SA3D(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_realloc_extradata(AVCodecParameters *par, MOVAtom atom)
static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_coll(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_frma(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_ispe(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_codec_id(AVStream *st, uint32_t format)
static void export_orphan_timecode(AVFormatContext *s)
static int mov_parse_heif_items(AVFormatContext *s)
static void mov_estimate_video_delay(MOVContext *c, AVStream *st)
static int mov_read_vmhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static MOVFragmentStreamInfo * get_frag_stream_info(MOVFragmentIndex *frag_index, int index, int id)
static int mov_read_irot(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_probe(const AVProbeData *p)
static int parse_timecode_in_framenum_format(AVFormatContext *s, AVStream *st, int64_t value, int flags)
static int mov_parse_uuid_spherical(MOVStreamContext *sc, AVIOContext *pb, size_t len)
static void mov_current_sample_inc(MOVStreamContext *sc)
static int mov_read_fiel(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_iref_dimg_tmap(MOVContext *c, AVIOContext *pb, HEIFItem *item, int version, int entries)
static int mov_read_targa_y216(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int get_edit_list_entry(MOVContext *mov, const MOVStreamContext *msc, unsigned int edit_list_index, int64_t *edit_list_media_time, int64_t *edit_list_duration, int64_t global_timescale)
Get ith edit list entry (media time, duration).
static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int64_t get_frag_time(AVFormatContext *s, AVStream *dst_st, MOVFragmentIndex *frag_index, int index)
static MOVFragmentStreamInfo * get_current_frag_stream_info(MOVFragmentIndex *frag_index)
static int mov_read_esds(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_iref_dimg(MOVContext *c, AVIOContext *pb, int version, uint32_t size)
static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_parse_exif_item(AVFormatContext *s, HEIFItem *item, const HEIFItem *ref)
static int tmcd_is_referenced(AVFormatContext *s, int tmcd_id)
static void mov_read_chapters(AVFormatContext *s)
static int mov_read_mhac(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static void set_frag_stream(MOVFragmentIndex *frag_index, int id)
static const AVOption mov_options[]
static MovTref * mov_add_tref_tag(MOVStreamContext *sc, uint32_t name)
static int mov_read_vexu(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, int64_t size)
Read 'chan' tag from the input stream.
int ff_mov_read_chnl(AVFormatContext *s, AVIOContext *pb, AVStream *st, int version)
Read 'chnl' tag from the input stream.
mpeg audio layer common tables.
const uint64_t ff_mpa_cicp_channel_layout_masks[20]
static int headroom(int *la)
static float distance(float x, float y, int band)
const char * av_color_space_name(enum AVColorSpace space)
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AVCOL_RANGE_JPEG
Full range content.
@ AVALPHA_MODE_STRAIGHT
Alpha channel is independent of color values.
@ AVALPHA_MODE_UNSPECIFIED
Unknown alpha handling, or no alpha channel.
@ AVALPHA_MODE_PREMULTIPLIED
Alpha channel is multiplied into color values.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AVCOL_TRC_GAMMA22
also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
@ AVCOL_TRC_GAMMA28
also ITU-R BT470BG
@ AVCOL_SPC_RESERVED
reserved for future use by ITU-T and ISO/IEC just like 15-255 are
static const uint16_t table[]
int ff_get_qtpalette(int codec_id, AVIOContext *pb, uint32_t *palette)
Retrieve the palette (or "color table" in QuickTime terms), either from the video sample description,...
int ff_replaygain_export(AVStream *st, AVDictionary *metadata)
Parse replaygain tags and export them as per-stream side data.
const AVCodecTag ff_codec_bmp_tags[]
const AVCodecTag ff_codec_wav_tags[]
internal header for RIFF based (de)muxers do NOT include this in end user applications
int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int size, int big_endian)
Public header for SHA-1 & SHA-256 hash function implementations.
#define FF_ARRAY_ELEMS(a)
AVRational ambient_illuminance
Environmental illuminance of the ambient viewing environment in lux.
AVRational ambient_light_x
Normalized x chromaticity coordinate of the environmental ambient light in the nominal viewing enviro...
AVRational ambient_light_y
Normalized y chromaticity coordinate of the environmental ambient light in the nominal viewing enviro...
A reference to a data buffer.
uint8_t * data
The data buffer.
size_t size
Size of data in bytes.
An AVChannelLayout holds information about the channel layout of audio data.
enum AVChannelOrder order
Channel order used in this layout.
union AVChannelLayout::@162063043056170047076125117143030261346263330336 u
Details about which channels are present in this layout.
int nb_channels
Number of channels in this layout.
AVChannelCustom * map
This member must be used when the channel order is AV_CHANNEL_ORDER_CUSTOM.
Describe the class of an AVClass context structure.
This struct describes the properties of an encoded stream.
enum AVColorSpace color_space
int extradata_size
Size of the extradata content in bytes.
int frame_size
Audio frame size, if known.
enum AVFieldOrder field_order
The order of the fields in interlaced video.
int height
The height of the video frame in pixels.
int nb_coded_side_data
Amount of entries in coded_side_data.
int bits_per_coded_sample
The number of bits per sample in the codedwords.
AVChannelLayout ch_layout
The channel layout and number of channels.
int width
The width of the video frame in pixels.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
int seek_preroll
Number of audio samples to skip after a discontinuity.
enum AVMediaType codec_type
General type of the encoded data.
int profile
Codec-specific bitstream restrictions that the stream conforms to.
int block_align
The number of bytes per coded audio frame, required by some formats.
int video_delay
Number of delayed frames.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
enum AVColorPrimaries color_primaries
int sample_rate
The number of audio samples per second.
enum AVColorTransferCharacteristic color_trc
enum AVAlphaMode alpha_mode
Video with alpha channel only.
int initial_padding
Number of padding audio samples at the start.
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
enum AVColorRange color_range
Additional colorspace characteristics.
unsigned MaxFALL
Max average light level per frame (cd/m^2).
unsigned MaxCLL
Max content light level (cd/m^2).
This describes encryption info for a packet.
uint32_t skip_byte_block
Only used for pattern encryption.
uint8_t * iv
The initialization vector.
uint32_t crypt_byte_block
Only used for pattern encryption.
uint8_t * key_id
The ID of the key used to encrypt the packet.
uint32_t scheme
The fourcc encryption scheme, in big-endian byte order.
This describes info used to initialize an encryption key system.
uint8_t * data
Key-system specific initialization data.
uint8_t ** key_ids
An array of key IDs this initialization data is for.
uint8_t * system_id
A unique identifier for the key system this is for, can be NULL if it is not known.
uint32_t num_key_ids
The number of key IDs.
union AVExifEntry::@325220332140161067313112036135003363017341144014 value
AVStream ** streams
A list of all streams in the file.
int error_recognition
Error recognition; higher values will detect more errors but may misdetect some more or less valid pa...
AVRational base_offset
Small constants added before the log-domain math to avoid a singularity at zero.
AVRational alternate_offset
Parameters describing how to combine a gain map rendition with its base rendition to recover the alte...
AVRational alternate_hdr_headroom
struct AVGainMapParams::AVGainMapChannel channels[3]
int nb_channels
Must be 1 or 3.
int use_base_color_space
If non-zero, the gain map is applied in the colour space of the base rendition; otherwise in that of ...
Information on how to combine one or more audio streams, as defined in section 3.6 of IAMF.
enum AVIAMFAudioElementType audio_element_type
Audio element type as defined in section 3.6 of IAMF.
Information on how to render and mix one or more AVIAMFAudioElement to generate the final audio outpu...
Submix element as defined in section 3.7 of IAMF.
unsigned int audio_element_id
The id of the Audio Element this submix element references.
Submix layout as defined in section 3.7 of IAMF.
unsigned int nb_elements
Number of elements in the submix.
AVIAMFSubmixElement ** elements
Array of submix elements.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
int eof_reached
true if was unable to read due to error or eof
int error
contains the error code or 0 if no error happened
int min_distance
Minimum distance between this and the previous keyframe, used to avoid unneeded searching.
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
enum AVPacketSideDataType type
This structure stores compressed data.
This structure contains the data a format has to probe a file.
Rational number (pair of numerator and denominator).
uint64_t count
number of bytes in buffer
uint32_t bound_left
Distance from the left edge.
enum AVSphericalProjection projection
Projection type.
uint32_t bound_top
Distance from the top edge.
uint32_t bound_bottom
Distance from the bottom edge.
uint32_t bound_right
Distance from the right edge.
int32_t pitch
Rotation around the right vector [-90, 90].
int32_t roll
Rotation around the forward vector [-180, 180].
int32_t yaw
Rotation around the up vector [-180, 180].
uint32_t padding
Number of pixels to pad from the edge of each cube face.
enum AVStereo3DType type
How views are packed within the video.
uint32_t baseline
The distance between the centres of the lenses of the camera system, in micrometers.
AVRational horizontal_disparity_adjustment
Relative shift of the left and right images, which changes the zero parallax plane.
enum AVStereo3DPrimaryEye primary_eye
Which eye is the primary eye when rendering in 2D.
int flags
Additional information about the frame packing.
AVRational horizontal_field_of_view
Horizontal field of view, in degrees.
enum AVStereo3DView view
Determines which views are packed.
AVStreamGroupLayeredVideo is meant to define the relation between a base layer video stream and a sep...
int height
Height of the final image for presentation.
unsigned int el_index
Index of the enhancement layer stream in AVStreamGroup.
int width
Width of the final stream for presentation.
unsigned int metadata_index
Index of the metadata stream in the AVStreamGroup.
AVStreamGroupTileGrid holds information on how to combine several independent images on a single canv...
int width
Width of the final image for presentation.
int height
Height of the final image for presentation.
int coded_width
Width of the canvas.
struct AVStreamGroupTileGrid::@036353327352337314037001273105074056331305251354 * offsets
An nb_tiles sized array of offsets in pixels from the topleft edge of the canvas, indicating where ea...
unsigned int nb_tiles
Amount of tiles in the grid.
uint8_t background[4]
The pixel value per channel in RGBA format used if no pixel of any tile is located at a particular pi...
int horizontal
Offset in pixels from the left edge of the canvas where the tile should be placed.
unsigned int idx
Index of the stream in the group this tile references.
int coded_height
Width of the canvas.
int vertical
Offset in pixels from the top edge of the canvas where the tile should be placed.
unsigned int nb_entries
Number of elements in AVStreamGroup.entries.
enum AVStreamGroupParamsType type
Group type.
struct AVIAMFMixPresentation * iamf_mix_presentation
AVStreamGroupEntry ** entries
A list of streams or child groups in the group.
struct AVStreamGroupTileGrid * tile_grid
struct AVStreamGroupTREF * tref
int nb_coded_side_data
Amount of entries in coded_side_data.
AVDictionary * metadata
Metadata that applies to the whole group.
union AVStreamGroup::@313244315204024013007202273061153315146016101155 params
Group type-specific parameters.
struct AVIAMFAudioElement * iamf_audio_element
int disposition
Stream group disposition - a combination of AV_DISPOSITION_* flags.
int64_t id
Group type-specific group ID.
AVPacketSideData * coded_side_data
Additional data associated with the group.
struct AVStreamGroupLayeredVideo * layered_video
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
int64_t nb_frames
number of frames in this stream if known or 0
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
int64_t duration
Decoding: duration of the stream, in stream time base.
int id
Format-specific stream ID.
int index
stream index in AVFormatContext
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
AVPacket attached_pic
For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet will contain the attached pictu...
AVRational avg_frame_rate
Average framerate.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
AVRational r_frame_rate
Real base framerate of the stream.
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
This file is part of FFmpeg.
int64_t last_discard_sample
The sample after last sample that is intended to be discarded after first_discard_sample.
int64_t first_discard_sample
If not 0, the first audio sample that should be discarded from the stream.
int skip_samples
Number of samples to skip at the start of the frame decoded from the next packet.
AVRational display_aspect_ratio
display aspect ratio (0 if unknown)
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
enum AVStreamParseType need_parsing
unsigned int index_entries_allocated_size
HEIFItemRef * iref_from_list
HEIFItemRef * iref_to_list
unsigned int audio_element_id
AVIAMFAudioElement * element
element backs celement iff the AVIAMFAudioElement is owned by this structure.
unsigned int nb_substreams
IAMFSubStream * substreams
IAMFMixPresentation ** mix_presentations
IAMFAudioElement ** audio_elements
unsigned int substream_count
AVIAMFMixPresentation * mix
mix backs cmix iff the AVIAMFMixPresentation is owned by this structure.
const AVIAMFMixPresentation * cmix
unsigned int mix_presentation_id
AVCodecParameters * codecpar
unsigned int audio_substream_id
AVDictionary * decryption_keys
int * bitrates
bitrates read before streams creation
uint8_t * decryption_default_key
unsigned int aax_mode
'aax' file has been detected
int found_mdat
'mdat' atom has been found
int found_iinf
'iinf' atom has been found
int64_t next_root_atom
offset of the next root atom
DVDemuxContext * dv_demux
unsigned int nb_chapter_tracks
MOVFragmentIndex frag_index
struct AVAES * aes_decrypt
MOVFragment fragment
current fragment in moof atom
AVFormatContext * dv_fctx
int advanced_editlist_autodisabled
int found_moov
'moov' atom has been found
int found_iloc
'iloc' atom has been found
int trak_index
Index of the current 'trak'.
uint64_t * auxiliary_offsets
Absolute seek position.
unsigned int nb_encrypted_samples
size_t auxiliary_offsets_count
size_t auxiliary_info_sample_count
uint8_t auxiliary_info_default_size
uint8_t * auxiliary_info_sizes
AVEncryptionInfo ** encrypted_samples
MOVFragmentStreamInfo * stream_info
MOVFragmentIndexItem * item
MOVEncryptionIndex * encryption_index
uint64_t base_data_offset
int(* parse)(MOVContext *ctx, AVIOContext *pb, MOVAtom atom)
int64_t time_offset
time offset of the edit list entries
uint32_t min_sample_duration
uint8_t ** extradata
extradata array (and size) for multiple stsd
MOVEncryptionIndex * encryption_index
int64_t track_end
used for dts generation in fragmented movie files
int pseudo_stream_id
-1 means demux all ids
unsigned int rap_group_count
unsigned int ctts_allocated_size
unsigned int per_sample_iv_size
AVContentLightMetadata * coll
int stsd_colr_trc
the colr atom of the sample description being read sets the transfer
MOVTimeToSample * tts_data
unsigned int samples_per_frame
int open_key_samples_count
unsigned int sample_size
may contain value calculated from stsd or value from stsz atom
AVEncryptionInfo * default_encrypted_sample
int16_t audio_cid
stsd audio compression id
struct AVAESCTR * aes_ctr
AVAmbientViewingEnvironment * ambient
struct MOVStreamContext::@212112112267365060330232277203165117121340225276 cenc
MOVIndexRange * current_index_range
unsigned int * sample_sizes
AVMasteringDisplayMetadata * mastering
uint8_t tmcd_nb_frames
tmcd number of frames per tick / second
int v_spacing
pasp vSpacing
unsigned int sample_count
int dts_shift
dts shift when ctts is negative
int64_t min_corrected_pts
minimum Composition time shown by the edits excluding empty edits.
int stsd_gama_trc
transfer from the gama atom of the sample description being read
int ffindex
AVStream index.
AVSphericalMapping * spherical
unsigned int keyframe_count
unsigned int bytes_per_frame
uint32_t tmcd_flags
tmcd track flags
unsigned * stps_data
partial sync sample for mpeg-2 open gop
unsigned int stts_allocated_size
unsigned int sync_group_count
MOVIndexRange * index_ranges
struct IAMFDemuxContext * iamf
unsigned int stsz_sample_size
always contains sample size from stsz atom
int h_spacing
pasp hSpacing
unsigned int tts_allocated_size
uint32_t * id
trackID of the referenced track
#define OPUS_TIMESTAMP_RATE
The clock of Opus: packet lengths, pre-skip and trimming count samples at 48 kHz whatever the sample ...
#define av_malloc_array(a, b)
#define av_realloc_f(p, o, n)
#define avpriv_request_sample(...)
static const uint8_t fixed_key[]
static int ref[MAX_W *MAX_W]
int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx)
Init a timecode struct with the passed parameters.
char * av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum_arg)
Load timecode string in buf.
#define AV_TIMECODE_STR_SIZE
@ AV_TIMECODE_FLAG_ALLOWNEGATIVE
negative time values are allowed
@ AV_TIMECODE_FLAG_DROPFRAME
timecode is drop frame
@ AV_TIMECODE_FLAG_24HOURSMAX
timecode wraps after 24 hours
static const int16_t cdt2[8]
UUID parsing and serialization utilities.
static int av_uuid_equal(const AVUUID uu1, const AVUUID uu2)
Compares two UUIDs for equality.
uint8_t AVUUID[AV_UUID_LEN]
static float mean(const float *input, int size)