Go to the documentation of this file.
26 #include "config_components.h"
93 unsigned len,
const char *
key)
113 unsigned len,
const char *
key)
127 unsigned len,
const char *
key)
136 unsigned len,
const char *
key)
152 0x00C4,0x00C5,0x00C7,0x00C9,0x00D1,0x00D6,0x00DC,0x00E1,
153 0x00E0,0x00E2,0x00E4,0x00E3,0x00E5,0x00E7,0x00E9,0x00E8,
154 0x00EA,0x00EB,0x00ED,0x00EC,0x00EE,0x00EF,0x00F1,0x00F3,
155 0x00F2,0x00F4,0x00F6,0x00F5,0x00FA,0x00F9,0x00FB,0x00FC,
156 0x2020,0x00B0,0x00A2,0x00A3,0x00A7,0x2022,0x00B6,0x00DF,
157 0x00AE,0x00A9,0x2122,0x00B4,0x00A8,0x2260,0x00C6,0x00D8,
158 0x221E,0x00B1,0x2264,0x2265,0x00A5,0x00B5,0x2202,0x2211,
159 0x220F,0x03C0,0x222B,0x00AA,0x00BA,0x03A9,0x00E6,0x00F8,
160 0x00BF,0x00A1,0x00AC,0x221A,0x0192,0x2248,0x2206,0x00AB,
161 0x00BB,0x2026,0x00A0,0x00C0,0x00C3,0x00D5,0x0152,0x0153,
162 0x2013,0x2014,0x201C,0x201D,0x2018,0x2019,0x00F7,0x25CA,
163 0x00FF,0x0178,0x2044,0x20AC,0x2039,0x203A,0xFB01,0xFB02,
164 0x2021,0x00B7,0x201A,0x201E,0x2030,0x00C2,0x00CA,0x00C1,
165 0x00CB,0x00C8,0x00CD,0x00CE,0x00CF,0x00CC,0x00D3,0x00D4,
166 0xF8FF,0x00D2,0x00DA,0x00DB,0x00D9,0x0131,0x02C6,0x02DC,
167 0x00AF,0x02D8,0x02D9,0x02DA,0x00B8,0x02DD,0x02DB,0x02C7,
171 char *
dst,
int dstlen)
174 char *end =
dst+dstlen-1;
177 for (
i = 0;
i <
len;
i++) {
199 for (
int i = 0;
i <
c->nb_heif_item;
i++) {
200 if (!
c->heif_item[
i] ||
c->heif_item[
i]->item_id !=
id)
203 item =
c->heif_item[
i];
219 if (
c->fc->nb_streams < 1)
222 if (
c->cur_item_id == -1)
223 return c->fc->streams[
c->fc->nb_streams-1];
257 st =
c->fc->streams[
c->fc->nb_streams - 1];
278 char buf[200], place[100];
279 uint16_t langcode = 0;
280 double longitude, latitude, altitude;
281 const char *
key =
"location";
283 if (
len < 4 + 2 + 1 + 1 + 4 + 4 + 4) {
303 "loci too short (%u bytes left, need at least %d)\n",
len, 12);
311 snprintf(buf,
sizeof(buf),
"%+08.4f%+09.4f", latitude, longitude);
331 if (
c->ignore_chapters)
335 if (n_hmmt >
len / 4)
352 uint16_t langcode = 0;
353 uint32_t data_type = 0, str_size_alloc;
360 if (
c->trak_index >= 0 &&
c->trak_index <
c->fc->nb_streams)
361 metadata = &
c->fc->streams[
c->trak_index]->metadata;
366 case MKTAG(
'@',
'P',
'R',
'M'):
key =
"premiere_version"; raw = 1;
break;
367 case MKTAG(
'@',
'P',
'R',
'Q'):
key =
"quicktime_version"; raw = 1;
break;
368 case MKTAG(
'X',
'M',
'P',
'_'):
369 if (
c->export_xmp) {
key =
"xmp"; raw = 1; }
break;
370 case MKTAG(
'a',
'A',
'R',
'T'):
key =
"album_artist";
break;
371 case MKTAG(
'a',
'k',
'I',
'D'):
key =
"account_type";
373 case MKTAG(
'a',
'p',
'I',
'D'):
key =
"account_id";
break;
374 case MKTAG(
'c',
'a',
't',
'g'):
key =
"category";
break;
375 case MKTAG(
'c',
'p',
'i',
'l'):
key =
"compilation";
377 case MKTAG(
'c',
'p',
'r',
't'):
key =
"copyright";
break;
378 case MKTAG(
'd',
'e',
's',
'c'):
key =
"description";
break;
379 case MKTAG(
'd',
'i',
's',
'k'):
key =
"disc";
381 case MKTAG(
'e',
'g',
'i',
'd'):
key =
"episode_uid";
383 case MKTAG(
'F',
'I',
'R',
'M'):
key =
"firmware"; raw = 1;
break;
384 case MKTAG(
'g',
'n',
'r',
'e'):
key =
"genre";
386 case MKTAG(
'h',
'd',
'v',
'd'):
key =
"hd_video";
388 case MKTAG(
'H',
'M',
'M',
'T'):
390 case MKTAG(
'k',
'e',
'y',
'w'):
key =
"keywords";
break;
391 case MKTAG(
'l',
'd',
'e',
's'):
key =
"synopsis";
break;
392 case MKTAG(
'l',
'o',
'c',
'i'):
394 case MKTAG(
'm',
'a',
'n',
'u'):
key =
"make";
break;
395 case MKTAG(
'm',
'o',
'd',
'l'):
key =
"model";
break;
396 case MKTAG(
'n',
'a',
'm',
'e'):
key =
"name";
break;
397 case MKTAG(
'p',
'c',
's',
't'):
key =
"podcast";
399 case MKTAG(
'p',
'g',
'a',
'p'):
key =
"gapless_playback";
401 case MKTAG(
'p',
'u',
'r',
'd'):
key =
"purchase_date";
break;
402 case MKTAG(
'r',
't',
'n',
'g'):
key =
"rating";
404 case MKTAG(
's',
'o',
'a',
'a'):
key =
"sort_album_artist";
break;
405 case MKTAG(
's',
'o',
'a',
'l'):
key =
"sort_album";
break;
406 case MKTAG(
's',
'o',
'a',
'r'):
key =
"sort_artist";
break;
407 case MKTAG(
's',
'o',
'c',
'o'):
key =
"sort_composer";
break;
408 case MKTAG(
's',
'o',
'n',
'm'):
key =
"sort_name";
break;
409 case MKTAG(
's',
'o',
's',
'n'):
key =
"sort_show";
break;
410 case MKTAG(
's',
't',
'i',
'k'):
key =
"media_type";
412 case MKTAG(
't',
'r',
'k',
'n'):
key =
"track";
414 case MKTAG(
't',
'v',
'e',
'n'):
key =
"episode_id";
break;
415 case MKTAG(
't',
'v',
'e',
's'):
key =
"episode_sort";
417 case MKTAG(
't',
'v',
'n',
'n'):
key =
"network";
break;
418 case MKTAG(
't',
'v',
's',
'h'):
key =
"show";
break;
419 case MKTAG(
't',
'v',
's',
'n'):
key =
"season_number";
421 case MKTAG(0xa9,
'A',
'R',
'T'):
key =
"artist";
break;
422 case MKTAG(0xa9,
'P',
'R',
'D'):
key =
"producer";
break;
423 case MKTAG(0xa9,
'a',
'l',
'b'):
key =
"album";
break;
424 case MKTAG(0xa9,
'a',
'u',
't'):
key =
"artist";
break;
425 case MKTAG(0xa9,
'c',
'h',
'p'):
key =
"chapter";
break;
426 case MKTAG(0xa9,
'c',
'm',
't'):
key =
"comment";
break;
427 case MKTAG(0xa9,
'c',
'o',
'm'):
key =
"composer";
break;
428 case MKTAG(0xa9,
'c',
'p',
'y'):
key =
"copyright";
break;
429 case MKTAG(0xa9,
'd',
'a',
'y'):
key =
"date";
break;
430 case MKTAG(0xa9,
'd',
'i',
'r'):
key =
"director";
break;
431 case MKTAG(0xa9,
'd',
'i',
's'):
key =
"disclaimer";
break;
432 case MKTAG(0xa9,
'e',
'd',
'1'):
key =
"edit_date";
break;
433 case MKTAG(0xa9,
'e',
'n',
'c'):
key =
"encoder";
break;
434 case MKTAG(0xa9,
'f',
'm',
't'):
key =
"original_format";
break;
435 case MKTAG(0xa9,
'g',
'e',
'n'):
key =
"genre";
break;
436 case MKTAG(0xa9,
'g',
'r',
'p'):
key =
"grouping";
break;
437 case MKTAG(0xa9,
'h',
's',
't'):
key =
"host_computer";
break;
438 case MKTAG(0xa9,
'i',
'n',
'f'):
key =
"comment";
break;
439 case MKTAG(0xa9,
'l',
'y',
'r'):
key =
"lyrics";
break;
440 case MKTAG(0xa9,
'm',
'a',
'k'):
key =
"make";
break;
441 case MKTAG(0xa9,
'm',
'o',
'd'):
key =
"model";
break;
442 case MKTAG(0xa9,
'n',
'a',
'm'):
key =
"title";
break;
443 case MKTAG(0xa9,
'o',
'p',
'e'):
key =
"original_artist";
break;
444 case MKTAG(0xa9,
'p',
'r',
'd'):
key =
"producer";
break;
445 case MKTAG(0xa9,
'p',
'r',
'f'):
key =
"performers";
break;
446 case MKTAG(0xa9,
'r',
'e',
'q'):
key =
"playback_requirements";
break;
447 case MKTAG(0xa9,
's',
'r',
'c'):
key =
"original_source";
break;
448 case MKTAG(0xa9,
's',
't',
'3'):
key =
"subtitle";
break;
449 case MKTAG(0xa9,
's',
'w',
'r'):
key =
"encoder";
break;
450 case MKTAG(0xa9,
't',
'o',
'o'):
key =
"encoder";
break;
451 case MKTAG(0xa9,
't',
'r',
'k'):
key =
"track";
break;
452 case MKTAG(0xa9,
'u',
'r',
'l'):
key =
"URL";
break;
453 case MKTAG(0xa9,
'w',
'r',
'n'):
key =
"warning";
break;
454 case MKTAG(0xa9,
'w',
'r',
't'):
key =
"composer";
break;
455 case MKTAG(0xa9,
'x',
'y',
'z'):
key =
"location";
break;
458 if (
c->itunes_metadata && atom.
size > 8) {
461 if (
tag ==
MKTAG(
'd',
'a',
't',
'a') && data_size <= atom.size && data_size >= 16) {
464 str_size = data_size - 16;
467 if (!
key &&
c->found_hdlr_mdta &&
c->meta_keys) {
469 if (index < c->meta_keys_count &&
index > 0) {
471 }
else if (atom.
type !=
MKTAG(
'c',
'o',
'v',
'r')) {
473 "The index of 'data' is out of range: %"PRId32
" < 1 or >= %d.\n",
474 index,
c->meta_keys_count);
477 if (atom.
type ==
MKTAG(
'c',
'o',
'v',
'r') ||
478 (
key && !strcmp(
key,
"com.apple.quicktime.artwork"))) {
484 atom.
size -= str_size;
490 }
else if (atom.
size > 4 && (
key ||
c->export_all) && !
c->itunes_metadata && !raw) {
492 if (str_size > atom.
size) {
502 str_size = atom.
size;
504 if (
c->export_all && !
key) {
510 if (atom.
size < 0 || str_size >= INT_MAX/2)
515 num = (data_type >= 21 && data_type <= 23);
516 str_size_alloc = (num ? 512 : (raw ? str_size : str_size * 2)) + 1;
524 if (!raw && (data_type == 3 || (data_type == 0 && (langcode < 0x400 || langcode == 0x7fff)))) {
526 }
else if (data_type == 21) {
530 else if (str_size == 2)
532 else if (str_size == 3)
534 else if (str_size == 4)
536 if (
snprintf(str, str_size_alloc,
"%d",
val) >= str_size_alloc) {
538 "Failed to store the number (%d) in string.\n",
val);
542 }
else if (data_type == 22) {
543 unsigned int val = 0;
546 else if (str_size == 2)
548 else if (str_size == 3)
550 else if (str_size == 4)
552 if (
snprintf(str, str_size_alloc,
"%u",
val) >= str_size_alloc) {
554 "Failed to store the number (%u) in string.\n",
val);
558 }
else if (data_type == 23 && str_size >= 4) {
560 if (
snprintf(str, str_size_alloc,
"%f",
val) >= str_size_alloc) {
562 "Failed to store the float32 number (%f) in string.\n",
val);
566 }
else if (data_type > 1 && data_type != 4) {
590 if (!strcmp(
key,
"encoder")) {
591 int major, minor, micro;
592 if (sscanf(str,
"HandBrake %d.%d.%d", &major, &minor, µ) == 3) {
593 c->handbrake_version = 1000000*major + 1000*minor + micro;
597 atom.
size -= str_size;
606 if (
c->itunes_metadata && atom.
size > 8)
617 int i, nb_chapters, str_len,
version;
621 if (
c->ignore_chapters)
624 if ((atom.
size -= 5) < 0)
633 for (
i = 0;
i < nb_chapters;
i++) {
640 if ((atom.
size -= 9+str_len) < 0)
652 #define MIN_DATA_ENTRY_BOX_SIZE 12
659 if (
c->fc->nb_streams < 1)
661 st =
c->fc->streams[
c->fc->nb_streams-1];
668 entries >= UINT_MAX /
sizeof(*sc->
drefs))
683 for (
i = 0;
i < entries;
i++) {
688 if (
size < 12 || next < 0 || next > INT64_MAX -
size)
698 uint16_t volume_len,
len;
705 volume_len =
FFMIN(volume_len, 27);
709 dref->
volume[volume_len] = 0;
751 if (
len > volume_len && !strncmp(dref->
path, dref->
volume, volume_len)) {
757 for (j =
len - 1; j >= 0; j--) {
758 if (dref->
path[j] == 0)
763 for (j = 0; j <
len; j++)
764 if (dref->
path[j] ==
':' || dref->
path[j] == 0)
767 }
else if (
type == 0) {
779 for (j = 0; j <
len; j++)
780 if (dref->
dir[j] ==
':')
816 if (
c->trak_index < 0) {
818 c->found_hdlr_mdta = 1;
823 st =
c->fc->streams[
c->fc->nb_streams-1];
838 title_size = atom.
size - 24;
839 if (title_size > 0) {
840 if (title_size >
FFMIN(INT_MAX, SIZE_MAX-1))
851 title_str[title_size] = 0;
853 int off = (!
c->isom && title_str[0] == title_size - 1);
873 int ac3info, acmod, lfeon, bsmod;
876 if (
c->fc->nb_streams < 1)
878 st =
c->fc->streams[
c->fc->nb_streams-1];
889 bsmod = (ac3info >> 14) & 0x7;
890 acmod = (ac3info >> 11) & 0x7;
891 lfeon = (ac3info >> 10) & 0x1;
916 unsigned descriptors_size;
917 int nb_frames, disposition;
923 if (
c->fc->nb_streams < 1)
934 if (!descriptors_size || descriptors_size > INT_MAX)
937 st =
c->fc->streams[
c->fc->nb_streams - 1];
955 if (
ret != descriptors_size)
959 descriptor_pb = &
b.pub;
1056 for (
int j = 0; j <
mix->nb_submixes; j++) {
1063 for (
int l = 0; l <
c->fc->nb_stream_groups; l++)
1066 audio_element =
c->fc->stream_groups[l];
1071 for (
int l = 0; l < audio_element->
nb_streams; l++) {
1097 if (atom.
size < 8 ||
c->fc->nb_streams < 1)
1100 st =
c->fc->streams[
c->fc->nb_streams-1];
1113 if (sample_rate > 0) {
1115 "overwrite sample rate from %d to %d by 'srat'\n",
1120 "ignore invalid sample rate %d in 'srat'\n", sample_rate);
1131 int eac3info, acmod, lfeon, bsmod;
1134 if (
c->fc->nb_streams < 1)
1136 st =
c->fc->streams[
c->fc->nb_streams-1];
1152 bsmod = (eac3info >> 12) & 0x1f;
1153 acmod = (eac3info >> 9) & 0x7;
1154 lfeon = (eac3info >> 8) & 0x1;
1177 static const int profile[22] = {
1210 static const struct {
unsigned int dts; uint64_t av; }
map[] = {
1238 #define DDTS_SIZE 20
1241 uint32_t frame_duration_code = 0;
1242 uint32_t channel_layout_code = 0;
1243 uint64_t channel_layout_mask;
1244 unsigned int stream_construction;
1245 unsigned int representation_type;
1254 if (
c->fc->nb_streams < 1) {
1257 st =
c->fc->streams[
c->fc->nb_streams-1];
1267 frame_duration_code =
get_bits(&gb, 2);
1268 stream_construction =
get_bits(&gb, 5);
1273 representation_type =
get_bits(&gb, 3);
1274 channel_layout_code =
get_bits(&gb, 16);
1277 (frame_duration_code == 0) ? 512 :
1278 (frame_duration_code == 1) ? 1024 :
1279 (frame_duration_code == 2) ? 2048 :
1280 (frame_duration_code == 3) ? 4096 : 0;
1287 if (channel_layout_mask) {
1290 }
else if (representation_type == 2 || representation_type == 3) {
1302 if (
c->fc->nb_streams < 1)
1304 st =
c->fc->streams[
c->fc->nb_streams-1];
1324 if (
c->fc->nb_streams < 1)
1326 st =
c->fc->streams[
c->fc->nb_streams-1];
1332 "Unsupported 'chnl' box with version %d, flags: %#x\n",
1356 if (
c->fc->nb_streams < 1)
1358 st =
c->fc->streams[
c->fc->nb_streams-1];
1372 AVRational aperture_width, aperture_height, horiz_off, vert_off;
1374 uint64_t top, bottom,
left, right;
1402 if (aperture_width.
num < 0 || aperture_width.
den < 0 ||
1403 aperture_height.
num < 0 || aperture_height.
den < 0 ||
1404 horiz_off.
den < 0 || vert_off.
den < 0) {
1414 "horizOff %d/%d vertOff %d/%d\n",
1415 aperture_width.
num, aperture_width.
den, aperture_height.
num, aperture_height.
den,
1416 horiz_off.
num, horiz_off.
den, vert_off.
num, vert_off.
den);
1433 if (bottom > (
height - 1) ||
1434 right > (
width - 1)) {
1439 bottom =
height - 1 - bottom;
1440 right =
width - 1 - right;
1442 if (!(
left | right | top | bottom))
1446 (top + bottom) >=
height) {
1454 sizeof(uint32_t) * 4, 0);
1482 if (
c->fc->nb_streams < 1)
1484 st =
c->fc->streams[
c->fc->nb_streams-1];
1505 #define DRM_BLOB_SIZE 56
1509 uint8_t intermediate_key[20];
1510 uint8_t intermediate_iv[20];
1513 uint8_t file_checksum[20];
1514 uint8_t calculated_checksum[20];
1515 char checksum_string[2 *
sizeof(file_checksum) + 1];
1519 uint8_t *activation_bytes =
c->activation_bytes;
1529 if (!
c->aes_decrypt) {
1543 ff_data_to_hex(checksum_string, file_checksum,
sizeof(file_checksum), 1);
1547 if (!activation_bytes) {
1552 if (
c->activation_bytes_size != 4) {
1559 if (
c->audible_fixed_key_size != 16) {
1579 if (memcmp(calculated_checksum, file_checksum, 20)) {
1586 for (
i = 0;
i < 4;
i++) {
1588 if (activation_bytes[
i] !=
output[3 -
i]) {
1594 memcpy(
c->file_key,
output + 8, 16);
1610 if (
c->audible_key_size != 16) {
1615 if (
c->audible_iv_size != 16) {
1621 if (!
c->aes_decrypt) {
1625 memcpy(
c->file_key,
c->audible_key, 16);
1626 memcpy(
c->file_iv,
c->audible_iv, 16);
1636 unsigned char iv[16];
1638 memcpy(iv,
c->file_iv, 16);
1650 int comp_brand_size;
1651 char* comp_brands_str;
1652 uint8_t
type[5] = {0};
1656 if (
c->fc->nb_streams) {
1663 if (strcmp(
type,
"qt "))
1670 comp_brand_size = atom.
size - 8;
1671 if (comp_brand_size < 0 || comp_brand_size == INT_MAX)
1673 comp_brands_str =
av_malloc(comp_brand_size + 1);
1674 if (!comp_brands_str)
1682 comp_brands_str[comp_brand_size] = 0;
1687 if (!strcmp(
type,
"aaxc")) {
1699 if (
c->found_moov) {
1721 if (index < 0 || index >= frag_index->
nb_items)
1737 if (frag_index->
current < 0 ||
1756 if (frag_index->
current < 0 ||
1784 if (moof_offset >=
offset)
1786 if (moof_offset <=
offset)
1814 if (!frag_stream_info)
1828 for (j = 0; j <
s->nb_streams; j++) {
1830 if (sc2->
id == frag_stream_info->
id)
1831 frag_stream =
s->streams[j];
1854 m0 = m = (
a +
b) >> 1;
1860 if (m <
b && frag_time <= timestamp)
1877 if (index < c->frag_index.nb_items &&
1884 &
c->frag_index.allocated_size,
1885 (
c->frag_index.nb_items + 1) *
1886 sizeof(*
c->frag_index.item));
1889 c->frag_index.item = item;
1893 if (!frag_stream_info)
1896 for (
i = 0;
i <
c->fc->nb_streams;
i++) {
1904 frag_stream_info[
i].
id = sc->
id;
1915 if (index < c->frag_index.nb_items)
1916 memmove(
c->frag_index.item +
index + 1,
c->frag_index.item +
index,
1917 (
c->frag_index.nb_items -
index) *
sizeof(*
c->frag_index.item));
1919 item = &
c->frag_index.item[
index];
1925 c->frag_index.nb_items++;
1931 int id,
int entries)
1940 if (frag_stream_info && frag_stream_info->
index_entry >= 0)
1948 c->fragment.found_tfhd = 0;
1950 if (!
c->has_looked_for_mfra &&
c->use_mfra_for > 0) {
1951 c->has_looked_for_mfra = 1;
1958 "read the mfra (may be a live ismv)\n");
1962 "seekable, can not look for mfra\n");
1965 c->fragment.moof_offset =
c->fragment.implicit_offset =
avio_tell(pb) - 8;
1984 if (time > 0 && time < 2082844800) {
1992 if ((
int64_t)(time * 1000000ULL) / 1000000 != time) {
2009 if (
c->fc->nb_streams < 1)
2011 st =
c->fc->streams[
c->fc->nb_streams-1];
2055 if (
c->time_scale <= 0) {
2069 for (
i = 0;
i < 3;
i++) {
2090 if (
fc->nb_streams < 1)
2092 st =
fc->streams[
fc->nb_streams-1];
2117 int little_endian =
avio_rb16(pb) & 0xFF;
2119 if (little_endian == 1)
2128 int pcm_sample_size;
2133 if (atom.
size < 6) {
2143 "Unsupported 'pcmC' box with version %d, flags: %x",
2149 pcm_sample_size =
avio_r8(pb);
2151 if (
fc->nb_streams < 1)
2154 st =
fc->streams[
fc->nb_streams - 1];
2158 switch (pcm_sample_size) {
2172 switch (pcm_sample_size) {
2194 if (format_flags & 1)
2205 char color_parameter_type[5] = { 0 };
2219 if (strncmp(color_parameter_type,
"nclx", 4) &&
2220 strncmp(color_parameter_type,
"nclc", 4) &&
2221 strncmp(color_parameter_type,
"prof", 4)) {
2223 color_parameter_type);
2227 if (!strncmp(color_parameter_type,
"prof", 4)) {
2229 uint8_t *icc_profile;
2237 icc_profile = sd->
data;
2239 if (
c->heif_icc_profile_items >=
c->fc->max_streams) {
2241 "HEIF ICC profile copies exceed cap %d; ignoring further items\n",
2242 c->fc->max_streams);
2252 c->heif_icc_profile_items++;
2263 "%s: pri %d trc %d matrix %d",
2266 if (!strncmp(color_parameter_type,
"nclx", 4)) {
2293 unsigned mov_field_order;
2296 if (
c->fc->nb_streams < 1)
2298 st =
c->fc->streams[
c->fc->nb_streams-1];
2302 if ((mov_field_order & 0xFF00) == 0x0100)
2304 else if ((mov_field_order & 0xFF00) == 0x0200) {
2305 switch (mov_field_order & 0xFF) {
2328 if (
size > INT_MAX || (uint64_t)atom.
size > INT_MAX)
2351 }
else if (err < atom.
size) {
2365 uint64_t original_size;
2368 if (
c->fc->nb_streams < 1)
2370 st =
c->fc->streams[
c->fc->nb_streams-1];
2419 if (!
ret &&
c->fc->nb_streams >= 1) {
2431 if (
c->fc->nb_streams >= 1) {
2432 AVStream *
const st =
c->fc->streams[
c->fc->nb_streams - 1];
2443 if (
cid == 0xd4d ||
cid == 0xd4e)
2454 if (num <= 0 || den <= 0)
2458 if (den >= INT_MAX / 2)
2478 uint64_t original_size;
2479 if (
c->fc->nb_streams >= 1) {
2483 if (atom.
size == 16) {
2488 if (length == atom.
size) {
2489 const uint8_t range_value = par->
extradata[original_size + 19];
2490 switch (range_value) {
2527 if (
c->fc->nb_streams < 1)
2529 st =
c->fc->streams[
c->fc->nb_streams-1];
2531 if ((uint64_t)atom.
size > (1<<30))
2541 }
else if (atom.
size > 8) {
2555 #define ALAC_EXTRADATA_SIZE 36
2588 if ((uint64_t)atom.
size > (1<<30))
2591 if (atom.
type ==
MKTAG(
'v',
'v',
'c',
'C')) {
2596 if (atom.
size >= 10) {
2628 uint8_t profile_level;
2631 if (
c->fc->nb_streams < 1)
2633 st =
c->fc->streams[
c->fc->nb_streams-1];
2635 if (atom.
size >= (1<<28) || atom.
size < 7)
2639 if ((profile_level & 0xf0) != 0xc0)
2652 for (
int i = 0;
i <
tag->nb_id;
i++) {
2653 if (
tag->id[
i] ==
id)
2707 if (
c->fc->nb_streams < 1)
2710 if (atom.
size > 4) {
2738 if (
c->fc->nb_streams < 1)
2744 if (atom.
size > 4) {
2751 st =
c->fc->streams[
c->fc->nb_streams - 1];
2770 if (
c->fc->nb_streams < 1)
2778 st =
c->fc->streams[
c->fc->nb_streams - 1];
2802 if (
c->fc->nb_streams < 1)
2804 if (atom.
size <= 40)
2806 st =
c->fc->streams[
c->fc->nb_streams-1];
2808 if ((uint64_t)atom.
size > (1<<30))
2823 unsigned int i, entries;
2825 if (
c->trak_index < 0) {
2829 if (
c->fc->nb_streams < 1)
2831 st =
c->fc->streams[
c->fc->nb_streams-1];
2843 (atom.
type ==
MKTAG(
's',
't',
'c',
'o') ? 4 : 8)));
2860 if (atom.
type ==
MKTAG(
's',
't',
'c',
'o'))
2863 else if (atom.
type ==
MKTAG(
'c',
'o',
'6',
'4'))
2889 ((
format & 0xFFFF) ==
'm' + (
's' << 8) ||
2890 (
format & 0xFFFF) ==
'T' + (
'S' << 8)))
2927 uint8_t codec_name[32] = { 0 };
2968 if (!strncmp(codec_name,
"Planar Y'CbCr 8-bit 4:2:0", 25)) {
2975 !strncmp(codec_name,
"Sorenson H263", 13))
2991 int bits_per_sample,
flags;
3020 (compatible_brands && strstr(compatible_brands->
value,
"qt ")) ||
3151 if (str_size > 0 &&
size >= (
int)str_size + 30 &&
3153 char *reel_name =
av_malloc(str_size + 1);
3157 reel_name[str_size] = 0;
3165 int t35_identifier_length =
avio_r8(pb);
3167 if (t35_identifier_length <= 0 || t35_identifier_length >=
size)
3174 int hrsd_len =
size - t35_identifier_length - 1;
3176 uint8_t *hrsd_str =
av_malloc(hrsd_len + 1);
3186 hrsd_str[hrsd_len] = 0;
3209 #if CONFIG_DV_DEMUXER
3303 int codec_tag,
int format,
3315 : codec_tag !=
MKTAG(
'j',
'p',
'e',
'g')))) {
3353 int pseudo_stream_id;
3356 st =
c->fc->streams[
c->fc->nb_streams-1];
3359 for (pseudo_stream_id = 0;
3361 pseudo_stream_id++) {
3364 int ret, dref_id = 1;
3374 }
else if (
size <= 7) {
3376 "invalid size %"PRId64
" in stsd\n",
size);
3393 "size=%"PRId64
" 4CC=%s codec_type=%d\n",
size,
3423 }
else if (
a.size > 0)
3456 if (
c->fc->nb_streams < 1)
3458 st =
c->fc->streams[
c->fc->nb_streams - 1];
3463 "Duplicate stsd found in this track.\n");
3472 if (entries <= 0 || entries > atom.
size / 8 || entries > 1024) {
3520 unsigned int i, entries;
3522 if (
c->trak_index < 0) {
3527 if (
c->fc->nb_streams < 1)
3529 st =
c->fc->streams[
c->fc->nb_streams-1];
3536 if ((uint64_t)entries * 12 + 4 > atom.
size)
3621 unsigned i, entries;
3623 if (
c->trak_index < 0) {
3628 if (
c->fc->nb_streams < 1)
3630 st =
c->fc->streams[
c->fc->nb_streams-1];
3663 unsigned int i, entries;
3665 if (
c->trak_index < 0) {
3670 if (
c->fc->nb_streams < 1)
3672 st =
c->fc->streams[
c->fc->nb_streams-1];
3691 if (entries >= UINT_MAX /
sizeof(
int))
3717 unsigned int i, entries, sample_size, field_size, num_bytes;
3722 if (
c->trak_index < 0) {
3727 if (
c->fc->nb_streams < 1)
3729 st =
c->fc->streams[
c->fc->nb_streams-1];
3735 if (atom.
type ==
MKTAG(
's',
't',
's',
'z')) {
3754 if (field_size != 4 && field_size != 8 && field_size != 16 && field_size != 32) {
3771 num_bytes = (entries*field_size+4)>>3;
3789 for (
i = 0;
i < entries;
i++) {
3810 unsigned int i, entries;
3812 int64_t total_sample_count = 0;
3816 if (
c->trak_index < 0) {
3821 if (
c->fc->nb_streams < 1)
3823 st =
c->fc->streams[
c->fc->nb_streams-1];
3831 c->fc->nb_streams-1, entries);
3837 if (entries >= INT_MAX /
sizeof(*sc->
stts_data))
3841 unsigned int sample_duration;
3842 unsigned int sample_count;
3843 unsigned int min_entries =
FFMIN(
FFMAX(
i + 1, 1024 * 1024), entries);
3861 sample_count, sample_duration);
3866 if (sample_duration >
c->max_stts_delta) {
3869 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",
3870 sample_duration,
i, sample_count, st->
index);
3872 corrected_dts =
av_sat_add64(corrected_dts, (delta_magnitude < 0 ? (
int64_t)delta_magnitude : 1) * sample_count);
3874 corrected_dts += sample_duration * (uint64_t)sample_count;
3879 if (current_dts > corrected_dts) {
3882 current_dts -= correction * (uint64_t)sample_count;
3893 duration <= INT64_MAX - sc->duration_for_fps &&
3894 total_sample_count <= INT_MAX - sc->nb_frames_for_fps) {
3916 "All samples in data stream index:id [%d:%d] have zero "
3917 "duration, stream set to be discarded by default. Override "
3918 "using AVStream->discard or -discard for ffmpeg command.\n",
3933 if (
c->fc->nb_streams < 1)
3935 st =
c->fc->streams[
c->fc->nb_streams - 1];
3940 entries = atom.
size - 4;
3943 c->fc->nb_streams - 1, entries);
3950 if (entries < 0 || entries > UINT_MAX)
3979 unsigned int i, entries, ctts_count = 0;
3981 if (
c->trak_index < 0) {
3986 if (
c->fc->nb_streams < 1)
3988 st =
c->fc->streams[
c->fc->nb_streams-1];
3999 if (entries >= UINT_MAX /
sizeof(*sc->
ctts_data))
4008 const size_t min_size_needed = (ctts_count + 1) *
sizeof(
MOVCtts);
4009 const size_t requested_size =
4018 "ignoring CTTS entry with count=%d duration=%d\n",
4023 if (ctts_count >= UINT_MAX /
sizeof(
MOVCtts) - 1)
4061 uint32_t grouping_type;
4062 uint32_t default_length;
4063 av_unused uint32_t default_group_description_index;
4064 uint32_t entry_count;
4066 if (
c->fc->nb_streams < 1)
4068 st =
c->fc->streams[
c->fc->nb_streams - 1];
4079 if (grouping_type !=
MKTAG(
's',
'y',
'n',
'c'))
4093 uint32_t description_length = default_length;
4094 if (
version >= 1 && default_length == 0)
4096 if (grouping_type ==
MKTAG(
's',
'y',
'n',
'c')) {
4097 const uint8_t nal_unit_type =
avio_r8(pb) & 0x3f;
4099 description_length -= 1;
4116 unsigned int i, entries;
4118 uint32_t grouping_type;
4122 if (
c->fc->nb_streams < 1)
4124 st =
c->fc->streams[
c->fc->nb_streams-1];
4131 if (grouping_type ==
MKTAG(
'r',
'a',
'p',
' ')) {
4134 }
else if (grouping_type ==
MKTAG(
's',
'y',
'n',
'c')) {
4175 unsigned int edit_list_index,
4176 int64_t *edit_list_media_time,
4183 *edit_list_media_time = msc->
elst_data[edit_list_index].
time;
4187 if (global_timescale == 0) {
4194 if (*edit_list_duration + (uint64_t)*edit_list_media_time > INT64_MAX)
4195 *edit_list_duration = 0;
4268 for (
int64_t index_tts_count = 0; index_tts_count < *
index; index_tts_count++) {
4269 if (*tts_index < tts_count) {
4271 if (tts_data[*tts_index].
count == *tts_sample) {
4278 while (*
index >= 0 && (*tts_index) >= 0 && (*tts_index) < tts_count) {
4282 if ((e_old[*
index].timestamp + tts_data[*tts_index].
offset) <= timestamp_pts &&
4288 if (*tts_sample == 0) {
4290 if (*tts_index >= 0)
4291 *tts_sample = tts_data[*tts_index].
count - 1;
4301 return *
index >= 0 ? 0 : -1;
4325 const size_t requested_size =
4342 ie= &entries[
index];
4357 int64_t* frame_duration_buffer,
4358 int frame_duration_buffer_size) {
4361 av_assert0(end_index >= 0 && end_index <= sti->nb_index_entries);
4362 for (
i = 0;
i < frame_duration_buffer_size;
i++) {
4363 end_ts -= frame_duration_buffer[frame_duration_buffer_size - 1 -
i];
4372 const size_t min_size_needed = (*tts_count + 1) *
sizeof(
MOVTimeToSample);
4373 const size_t requested_size =
4374 min_size_needed > *allocated_size ?
4375 FFMAX(min_size_needed, 2 * (*allocated_size)) :
4381 tts_buf_new =
av_fast_realloc(*tts_data, allocated_size, requested_size);
4386 *tts_data = tts_buf_new;
4392 *tts_count = (*tts_count) + 1;
4396 #define MAX_REORDER_DELAY 16
4402 int ctts_sample = 0;
4405 int j,
r, num_swaps;
4408 pts_buf[j] = INT64_MIN;
4416 buf_start = (buf_start + 1);
4429 while (j != buf_start) {
4432 if (pts_buf[j] < pts_buf[
r]) {
4491 if (range_size > current_sample) {
4495 current_sample -= range_size;
4517 int64_t edit_list_media_time = 0;
4518 int64_t edit_list_duration = 0;
4520 int64_t edit_list_dts_counter = 0;
4521 int64_t edit_list_dts_entry_end = 0;
4522 int64_t edit_list_start_tts_sample = 0;
4525 int64_t empty_edits_sum_duration = 0;
4530 int64_t edit_list_start_encountered = 0;
4533 int num_discarded_begin = 0;
4534 int first_non_zero_audio_edit = -1;
4535 int packet_skip_samples = 0;
4537 int found_keyframe_after_edit = 0;
4538 int found_non_empty_edit = 0;
4571 edit_list_dts_entry_end -= msc->
dts_shift;
4575 start_dts = edit_list_dts_entry_end;
4579 av_log(mov->
fc,
AV_LOG_DEBUG,
"Processing st: %d, edit list %"PRId64
" - media time: %"PRId64
", duration: %"PRId64
"\n",
4580 st->
index, edit_list_index, edit_list_media_time, edit_list_duration);
4582 edit_list_dts_counter = edit_list_dts_entry_end;
4583 edit_list_dts_entry_end =
av_sat_add64(edit_list_dts_entry_end, edit_list_duration);
4584 if (edit_list_dts_entry_end == INT64_MAX) {
4586 edit_list_duration);
4589 num_discarded_begin = 0;
4590 if (!found_non_empty_edit && edit_list_media_time == -1) {
4591 empty_edits_sum_duration += edit_list_duration;
4594 found_non_empty_edit = 1;
4599 if (first_non_zero_audio_edit < 0) {
4600 first_non_zero_audio_edit = 1;
4602 first_non_zero_audio_edit = 0;
4605 if (first_non_zero_audio_edit > 0)
4613 search_timestamp = edit_list_media_time;
4622 &
index, &tts_index_old, &tts_sample_old) < 0) {
4624 "st: %d edit list: %"PRId64
" Missing key frame while searching for timestamp: %"PRId64
"\n",
4625 st->
index, edit_list_index, search_timestamp);
4627 &
index, &tts_index_old, &tts_sample_old) < 0) {
4629 "st: %d edit list %"PRId64
" Cannot find an index entry before timestamp: %"PRId64
".\n",
4630 st->
index, edit_list_index, search_timestamp);
4637 edit_list_start_tts_sample = tts_sample_old;
4640 edit_list_start_encountered = 0;
4641 found_keyframe_after_edit = 0;
4644 frame_duration = (
current + 1 < e_old_end) ?
4645 ((
current + 1)->timestamp -
current->timestamp) : edit_list_duration;
4653 if (tts_data_old && tts_index_old < tts_count_old) {
4654 curr_ctts = tts_data_old[tts_index_old].
offset;
4655 av_log(mov->
fc,
AV_LOG_TRACE,
"stts: %"PRId64
" ctts: %"PRId64
", tts_index: %"PRId64
", tts_count: %"PRId64
"\n",
4656 curr_cts, curr_ctts, tts_index_old, tts_count_old);
4657 curr_cts += curr_ctts;
4659 if (tts_sample_old == tts_data_old[tts_index_old].
count) {
4662 tts_data_old[tts_index_old].
count - edit_list_start_tts_sample,
4663 tts_data_old[tts_index_old].
offset, tts_data_old[tts_index_old].
duration) == -1) {
4666 tts_data_old[tts_index_old].
count - edit_list_start_tts_sample,
4667 tts_data_old[tts_index_old].
offset);
4672 edit_list_start_tts_sample = 0;
4676 if (curr_cts < edit_list_media_time || curr_cts >= (edit_list_duration + edit_list_media_time)) {
4678 curr_cts < edit_list_media_time && curr_cts + frame_duration > edit_list_media_time &&
4679 first_non_zero_audio_edit > 0) {
4680 packet_skip_samples = edit_list_media_time - curr_cts;
4684 edit_list_dts_counter -= packet_skip_samples;
4685 if (edit_list_start_encountered == 0) {
4686 edit_list_start_encountered = 1;
4689 if (frame_duration_buffer) {
4691 frame_duration_buffer, num_discarded_begin);
4696 av_log(mov->
fc,
AV_LOG_DEBUG,
"skip %d audio samples from curr_cts: %"PRId64
"\n", packet_skip_samples, curr_cts);
4701 if (edit_list_start_encountered == 0) {
4702 num_discarded_begin++;
4703 frame_duration_buffer =
av_realloc(frame_duration_buffer,
4704 num_discarded_begin *
sizeof(
int64_t));
4705 if (!frame_duration_buffer) {
4709 frame_duration_buffer[num_discarded_begin - 1] = frame_duration;
4724 if (edit_list_start_encountered == 0) {
4725 edit_list_start_encountered = 1;
4728 if (frame_duration_buffer) {
4730 frame_duration_buffer, num_discarded_begin);
4743 if (!current_index_range ||
index != current_index_range->
end) {
4744 current_index_range = current_index_range ? current_index_range + 1
4748 current_index_range->
end =
index + 1;
4751 if (edit_list_start_encountered > 0) {
4752 edit_list_dts_counter = edit_list_dts_counter + frame_duration;
4756 if ((curr_cts + frame_duration >= (edit_list_duration + edit_list_media_time)) &&
4763 found_keyframe_after_edit = 1;
4766 if (tts_sample_old != 0) {
4769 tts_sample_old - edit_list_start_tts_sample,
4770 tts_data_old[tts_index_old].
offset, tts_data_old[tts_index_old].
duration) == -1) {
4772 tts_index_old, tts_sample_old - edit_list_start_tts_sample,
4773 tts_data_old[tts_index_old].
offset);
4808 current_index_range = current_index_range ? current_index_range + 1
4810 current_index_range->
start = 0;
4811 current_index_range->
end = 0;
4870 if (sg->
index == cra_index)
4871 for (uint32_t j = 0; j < sg->
count; j++)
4873 if (sg->
count > INT_MAX - sample_id)
4875 sample_id += sg->
count;
4886 #define MOV_MERGE_CTTS 1
4887 #define MOV_MERGE_STTS 2
4962 unsigned int stts_index = 0;
4963 unsigned int stsc_index = 0;
4964 unsigned int stss_index = 0;
4965 unsigned int stps_index = 0;
4967 uint64_t stream_size = 0;
4974 int i, edit_start_index = 0, multiple_edits = 0;
4980 if (
i == 0 && e->
time == -1) {
4984 edit_start_index = 1;
4985 }
else if (
i == edit_start_index && e->
time >= 0) {
4995 "not supported in fragmented MP4 files\n");
4998 "Use -advanced_editlist to correctly decode otherwise "
4999 "a/v desync might occur\n");
5025 unsigned int current_sample = 0;
5026 unsigned int stts_sample = 0;
5027 unsigned int sample_size;
5029 unsigned int rap_group_index = 0;
5030 unsigned int rap_group_sample = 0;
5035 if (current_dts < INT64_MIN + sc->dts_shift)
5087 if (rap_group_present && rap_group_index < sc->rap_group_count) {
5090 if (++rap_group_sample == sc->
rap_group[rap_group_index].
count) {
5091 rap_group_sample = 0;
5097 && !rap_group_present
5103 if (current_offset > INT64_MAX - sample_size) {
5113 if (sample_size > 0x3FFFFFFF) {
5118 e->
pos = current_offset;
5120 e->
size = sample_size;
5123 av_log(mov->
fc,
AV_LOG_TRACE,
"AVIndex stream %d, sample %u, offset %"PRIx64
", dts %"PRId64
", "
5124 "size %u, distance %u, keyframe %d\n", st->
index, current_sample,
5125 current_offset, current_dts, sample_size,
distance, keyframe);
5130 current_offset += sample_size;
5131 stream_size += sample_size;
5149 unsigned chunk_samples, total = 0;
5156 unsigned count, chunk_count;
5171 count = (chunk_samples+1023) / 1024;
5178 total += chunk_count *
count;
5200 while (chunk_samples > 0) {
5206 "Zero bytes per frame, but %d samples per frame",
5229 if (
size > 0x3FFFFFFF) {
5234 e->
pos = current_offset;
5240 "size %u, duration %u\n", st->
index,
i, current_offset, current_dts,
5243 current_offset +=
size;
5244 if (current_dts > INT64_MAX -
samples)
5282 av_url_split(src_proto,
sizeof(src_proto), src_auth,
sizeof(src_auth), src_host,
sizeof(src_host), &src_port,
NULL, 0,
src);
5283 av_url_split(ref_proto,
sizeof(ref_proto), ref_auth,
sizeof(ref_auth), ref_host,
sizeof(ref_host), &ref_port,
NULL, 0,
ref);
5285 if (strlen(
src) == 0) {
5287 }
else if (strlen(src_auth) + 1 >=
sizeof(src_auth) ||
5288 strlen(ref_auth) + 1 >=
sizeof(ref_auth) ||
5289 strlen(src_host) + 1 >=
sizeof(src_host) ||
5290 strlen(ref_host) + 1 >=
sizeof(ref_host)) {
5292 }
else if (strcmp(src_proto, ref_proto) ||
5293 strcmp(src_auth, ref_auth) ||
5294 strcmp(src_host, ref_host) ||
5295 src_port != ref_port) {
5305 if (
ref->nlvl_to > 0 &&
ref->nlvl_from > 0) {
5306 char filename[1025];
5307 const char *src_path;
5311 src_path = strrchr(
src,
'/');
5318 for (
i = 0, l = strlen(
ref->path) - 1; l >= 0; l--)
5319 if (
ref->path[l] ==
'/') {
5320 if (
i ==
ref->nlvl_to - 1)
5327 if (
i ==
ref->nlvl_to - 1 && src_path -
src <
sizeof(filename)) {
5328 memcpy(filename,
src, src_path -
src);
5329 filename[src_path -
src] = 0;
5331 for (
i = 1;
i <
ref->nlvl_from;
i++)
5332 av_strlcat(filename,
"../",
sizeof(filename));
5335 if (!
c->use_absolute_path) {
5340 "Reference with mismatching origin, %s not tried for security reasons, "
5341 "set demuxer option use_absolute_path to allow it anyway\n",
5346 if (strstr(
ref->path + l + 1,
"..") ||
5347 strstr(
ref->path + l + 1,
":") ||
5348 (
ref->nlvl_from > 1 && same_origin < 0) ||
5349 (filename[0] ==
'/' && src_path ==
src))
5353 if (strlen(filename) + 1 ==
sizeof(filename))
5358 }
else if (
c->use_absolute_path) {
5360 "this is a possible security issue\n");
5365 "Absolute path %s not tried for security reasons, "
5366 "set demuxer option use_absolute_path to allow absolute paths\n",
5392 for (
int j = 0; j <
c->fc->nb_stream_groups; j++)
5394 stg =
c->fc->stream_groups[j];
5402 out->codecpar->bit_rate = 0;
5455 if (!st)
return AVERROR(ENOMEM);
5458 if (!sc)
return AVERROR(ENOMEM);
5463 c->trak_index = st->
index;
5494 "MP4. disabling.\n");
5495 c->advanced_editlist = 0;
5496 c->advanced_editlist_autodisabled = 1;
5503 ret = mov_update_iamf_streams(
c, st);
5511 if (
c->enable_drefs) {
5514 "stream %d, error opening alias: path='%s', dir='%s', "
5515 "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n",
5520 "Skipped opening external track: "
5521 "stream %d, alias: path='%s', dir='%s', "
5522 "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d."
5523 "Set enable_drefs to allow this.\n",
5545 #if FF_API_R_FRAME_RATE
5557 #if CONFIG_H261_DECODER || CONFIG_H263_DECODER || CONFIG_MPEG4_DECODER
5559 #if CONFIG_H261_DECODER
5562 #if CONFIG_H263_DECODER
5565 #if CONFIG_MPEG4_DECODER
5577 int stts_constant = 1;
5602 c->itunes_metadata = 1;
5604 c->itunes_metadata = 0;
5619 if (
count >= UINT_MAX /
sizeof(*
c->meta_keys)) {
5621 "The 'keys' atom with the invalid key count: %"PRIu32
"\n",
count);
5625 c->meta_keys_count =
count + 1;
5626 c->meta_keys =
av_mallocz(
c->meta_keys_count *
sizeof(*
c->meta_keys));
5633 if (key_size < 8 || key_size > atom.
size) {
5635 "The key# %"PRIu32
" in meta has invalid size:"
5636 "%"PRIu32
"\n",
i, key_size);
5639 atom.
size -= key_size;
5646 if (!
c->meta_keys[
i])
5662 if (
c->fc->nb_streams < 1)
5664 st =
c->fc->streams[
c->fc->nb_streams-1];
5666 for (
i = 0;
i < 3;
i++) {
5677 if (len < 12 || len - 12 > end -
avio_tell(pb))
5681 if (
tag ==
MKTAG(
'm',
'e',
'a',
'n'))
5683 else if (
tag ==
MKTAG(
'n',
'a',
'm',
'e'))
5685 else if (
tag ==
MKTAG(
'd',
'a',
't',
'a') &&
len > 4) {
5709 if (strcmp(
key,
"iTunSMPB") == 0) {
5710 int priming, remainder,
samples;
5711 if(sscanf(
val,
"%*X %X %X %X", &priming, &remainder, &
samples) == 3){
5712 if(priming>0 && priming<16384)
5714 (
AVRational){ 1, st->codecpar->sample_rate });
5715 if (remainder > 0) {
5717 (
AVRational){ 1, st->codecpar->sample_rate });
5719 (
AVRational){ 1, st->codecpar->sample_rate });
5721 (
AVRational){ 1, st->codecpar->sample_rate });
5731 if (strcmp(
mean,
"com.apple.iTunes") == 0 &&
5732 strcmp(
key,
"DISCSUBTITLE") == 0) {
5737 if (strcmp(
key,
"cdec") != 0) {
5744 "Unhandled or malformed custom metadata of size %"PRId64
"\n", atom.
size);
5815 while (atom.
size > 8) {
5821 if (
tag ==
MKTAG(
'h',
'd',
'l',
'r')) {
5831 #define IS_MATRIX_IDENT(matrix) \
5832 ( (matrix)[0][0] == (1 << 16) && \
5833 (matrix)[1][1] == (1 << 16) && \
5834 (matrix)[2][2] == (1 << 30) && \
5835 !(matrix)[0][1] && !(matrix)[0][2] && \
5836 !(matrix)[1][0] && !(matrix)[1][2] && \
5837 !(matrix)[2][0] && !(matrix)[2][1])
5844 int display_matrix[3][3];
5845 int res_display_matrix[3][3] = { { 0 } };
5851 if (
c->fc->nb_streams < 1)
5853 st =
c->fc->streams[
c->fc->nb_streams-1];
5890 for (
i = 0;
i < 3;
i++) {
5902 for (
i = 0;
i < 3;
i++) {
5903 const int sh[3] = { 16, 16, 30 };
5904 for (j = 0; j < 3; j++) {
5905 for (e = 0; e < 3; e++) {
5906 res_display_matrix[
i][j] +=
5908 c->movie_display_matrix[e][j]) >> sh[e];
5920 for (
i = 0;
i < 3;
i++)
5921 for (j = 0; j < 3; j++)
5928 double disp_transform[2];
5930 for (
i = 0;
i < 2;
i++)
5934 if (disp_transform[0] > 1 && disp_transform[1] > 1 &&
5935 disp_transform[0] < (1<<24) && disp_transform[1] < (1<<24) &&
5936 fabs((disp_transform[0] / disp_transform[1]) - 1.0) > 0.01)
5938 disp_transform[0] / disp_transform[1],
5957 for (
i = 0;
i <
c->trex_count;
i++)
5958 if (
c->trex_data[
i].track_id == track_id) {
5959 trex = &
c->trex_data[
i];
5966 c->fragment.found_tfhd = 1;
5984 if (frag_stream_info) {
5996 num = atom.
size / 4;
6001 c->chapter_tracks = new_tracks;
6002 c->nb_chapter_tracks = num;
6007 c->nb_chapter_tracks =
i;
6017 if ((uint64_t)
c->trex_count+1 >= UINT_MAX /
sizeof(*
c->trex_data))
6020 sizeof(*
c->trex_data))) < 0) {
6027 trex = &
c->trex_data[
c->trex_count++];
6045 int64_t base_media_decode_time;
6047 for (
i = 0;
i <
c->fc->nb_streams;
i++) {
6048 sc =
c->fc->streams[
i]->priv_data;
6050 st =
c->fc->streams[
i];
6070 if (frag_stream_info)
6071 frag_stream_info->
tfdt_dts = base_media_decode_time;
6086 int data_offset = 0;
6087 unsigned entries, first_sample_flags = frag->
flags;
6090 int next_frag_index = -1, index_entry_pos;
6091 size_t requested_size;
6092 size_t old_allocated_size;
6101 for (
i = 0;
i <
c->fc->nb_streams;
i++) {
6102 sc =
c->fc->streams[
i]->priv_data;
6104 st =
c->fc->streams[
i];
6124 for (
i =
c->frag_index.current + 1; i < c->frag_index.nb_items;
i++) {
6126 if (frag_stream_info && frag_stream_info->
index_entry >= 0) {
6127 next_frag_index =
i;
6132 av_assert0(index_entry_pos <= sti->nb_index_entries);
6145 if (frag_stream_info) {
6152 ", using it for pts\n",
pts);
6157 ", using it for dts\n",
pts);
6161 int fallback_tfdt = !
c->use_tfdt && !has_sidx && has_tfdt;
6162 int fallback_sidx =
c->use_tfdt && !has_tfdt && has_sidx;
6164 if (fallback_sidx) {
6167 if (fallback_tfdt) {
6171 if (has_tfdt &&
c->use_tfdt || fallback_tfdt) {
6174 ", using it for dts\n", dts);
6175 }
else if (has_sidx && !
c->use_tfdt || fallback_sidx) {
6180 ", using it for dts\n", frag_stream_info->
sidx_pts);
6184 ", using it for dts\n", dts);
6190 ", using it for dts\n", dts);
6223 memset((uint8_t*)(sc->
tts_data) + old_allocated_size, 0,
6226 if (index_entry_pos < sti->nb_index_entries) {
6232 memmove(sc->
tts_data + index_entry_pos + entries,
6235 if (index_entry_pos < sc->current_sample) {
6247 if (frag_stream_info) {
6250 frag_stream_info->
index_base = index_entry_pos;
6253 if (index_entry_pos > 0)
6257 unsigned sample_size = frag->
size;
6258 int sample_flags =
i ? frag->
flags : first_sample_flags;
6259 unsigned sample_duration = frag->
duration;
6260 unsigned ctts_duration = 0;
6262 int index_entry_flags = 0;
6273 dts -= ctts_duration;
6278 "pts %"PRId64
" calculated dts %"PRId64
6279 " sc->dts_shift %d ctts.duration %d"
6280 " sc->time_offset %"PRId64
6281 " flags & MOV_TRUN_SAMPLE_CTS %d\n",
6297 if (prev_dts >= dts)
6311 av_log(
c->fc,
AV_LOG_TRACE,
"AVIndex stream %d, sample %d, offset %"PRIx64
", dts %"PRId64
", "
6312 "size %u, distance %d, keyframe %d\n", st->
index,
6315 if (
av_sat_add64(dts, sample_duration) != dts + (uint64_t)sample_duration)
6319 dts += sample_duration;
6323 if (sample_duration <= INT64_MAX - sc->duration_for_fps &&
6330 if (frag_stream_info)
6335 int gap = entries -
i;
6340 memmove(sc->
tts_data + index_entry_pos,
6341 sc->
tts_data + index_entry_pos + gap,
6343 (sc->
tts_count - (index_entry_pos + gap)));
6347 if (index_entry_pos < sc->current_sample) {
6357 if (index_entry_pos > 0)
6360 if (prev_dts < sti->index_entries[
i].timestamp)
6391 unsigned i, j, track_id, item_count;
6406 for (
i = 0;
i <
c->fc->nb_streams;
i++) {
6407 sc =
c->fc->streams[
i]->priv_data;
6408 if (sc->
id == track_id) {
6409 st =
c->fc->streams[
i];
6422 if (timescale.
den <= 0) {
6437 offset += (uint64_t)offadd;
6442 if (item_count == 0)
6445 for (
i = 0;
i < item_count;
i++) {
6450 if (
size & 0x80000000) {
6459 if (frag_stream_info)
6460 frag_stream_info->
sidx_pts = timestamp;
6475 is_complete =
offset == stream_size;
6479 if (!
c->have_read_mfra_size) {
6480 if ((
ret =
avio_seek(pb, stream_size - 4, SEEK_SET)) < 0)
6483 c->have_read_mfra_size = 1;
6487 if (
offset == stream_size -
c->mfra_size)
6494 for (
i = 0;
i <
c->frag_index.nb_items;
i++) {
6500 ref_st =
c->fc->streams[j];
6506 if (ref_st)
for (
i = 0;
i <
c->fc->nb_streams;
i++) {
6507 st =
c->fc->streams[
i];
6515 c->frag_index.complete = 1;
6536 if (atom.
type !=
MKTAG(
'm',
'd',
'a',
't')) {
6550 long cmov_len, moov_len;
6564 cmov_len = atom.
size - 6 * 4;
6576 goto free_and_return;
6579 if (uncompress (moov_data, (uLongf *) &moov_len, (
const Bytef *)cmov_data, cmov_len) != Z_OK)
6580 goto free_and_return;
6584 atom.
size = moov_len;
6603 if (
c->fc->nb_streams < 1 ||
c->ignore_editlist)
6605 sc =
c->fc->streams[
c->fc->nb_streams-1]->priv_data;
6612 elst_entry_size =
version == 1 ? 20 : 12;
6613 if (atom.
size != edit_count * elst_entry_size) {
6615 av_log(
c->fc,
AV_LOG_ERROR,
"Invalid edit list entry_count: %d for elst atom of size: %"PRId64
" bytes.\n",
6616 edit_count, atom.
size + 8);
6619 edit_count = atom.
size / elst_entry_size;
6620 if (edit_count * elst_entry_size != atom.
size) {
6654 if (e->
time < 0 && e->
time != -1 &&
6656 av_log(
c->fc,
AV_LOG_ERROR,
"Track %d, edit %d: Invalid edit list media time=%"PRId64
"\n",
6657 c->fc->nb_streams-1,
i, e->
time);
6676 if (
c->fc->nb_streams < 1)
6678 sc =
c->fc->streams[
c->fc->nb_streams - 1]->priv_data;
6680 if (atom.
size %
sizeof(uint32_t))
6687 int nb_timecode_track = atom.
size >> 2;
6688 for (
int i = 0;
i < nb_timecode_track;
i++) {
6704 if (
c->fc->nb_streams < 1)
6706 st =
c->fc->streams[
c->fc->nb_streams - 1];
6708 if (atom.
size < 5) {
6748 if (
c->fc->nb_streams < 1)
6751 sc =
c->fc->streams[
c->fc->nb_streams - 1]->priv_data;
6753 if (atom.
size < 5) {
6774 for (
i = 0;
i < 3;
i++) {
6793 const int mapping[3] = {1, 2, 0};
6794 const int chroma_den = 50000;
6795 const int luma_den = 10000;
6798 if (
c->fc->nb_streams < 1)
6801 sc =
c->fc->streams[
c->fc->nb_streams - 1]->priv_data;
6803 if (atom.
size < 24) {
6817 for (
i = 0;
i < 3;
i++) {
6818 const int j = mapping[
i];
6839 if (
c->fc->nb_streams < 1)
6842 sc =
c->fc->streams[
c->fc->nb_streams - 1]->priv_data;
6844 if (atom.
size < 5) {
6875 if (
c->fc->nb_streams < 1)
6878 sc =
c->fc->streams[
c->fc->nb_streams - 1]->priv_data;
6880 if (atom.
size < 4) {
6903 const int illuminance_den = 10000;
6904 const int ambient_den = 50000;
6905 if (
c->fc->nb_streams < 1)
6907 sc =
c->fc->streams[
c->fc->nb_streams - 1]->priv_data;
6908 if (atom.
size < 6) {
6932 if (
c->fc->nb_streams < 1)
6935 st =
c->fc->streams[
c->fc->nb_streams - 1];
6938 if (atom.
size < 5) {
6981 if (
c->fc->nb_streams < 1)
6984 st =
c->fc->streams[
c->fc->nb_streams - 1];
6987 remaining = atom.
size;
6988 while (remaining > 0) {
6990 if (size < 8 || size > remaining ) {
6997 case MKTAG(
'p',
'k',
'i',
'n'): {
7007 case MKTAG(
's',
'i',
'd',
'e'):
7010 case MKTAG(
'o',
'v',
'e',
'r'):
7034 if (remaining != 0) {
7059 uint32_t l = 0, t = 0,
r = 0,
b = 0;
7060 uint32_t
tag, padding = 0;
7063 if (
c->fc->nb_streams < 1)
7066 st =
c->fc->streams[
c->fc->nb_streams - 1];
7069 if (atom.
size < 8) {
7075 if (size <= 12 || size > atom.
size)
7079 if (
tag !=
MKTAG(
's',
'v',
'h',
'd')) {
7097 if (
tag !=
MKTAG(
'p',
'r',
'o',
'j')) {
7107 if (
tag !=
MKTAG(
'p',
'r',
'h',
'd')) {
7137 case MKTAG(
'c',
'b',
'm',
'p'):
7141 "Unsupported cubemap layout %d\n",
layout);
7147 case MKTAG(
'e',
'q',
'u',
'i'):
7153 if (
b >= UINT_MAX - t ||
r >= UINT_MAX - l) {
7155 "Invalid bounding rectangle coordinates "
7156 "%"PRIu32
",%"PRIu32
",%"PRIu32
",%"PRIu32
"\n", l, t,
r,
b);
7160 if (l || t ||
r ||
b)
7198 if (
c->fc->nb_streams < 1)
7201 st =
c->fc->streams[
c->fc->nb_streams - 1];
7204 if (atom.
size < 16) {
7213 }
else if (
size > 16) {
7218 if (
tag !=
MKTAG(
'p',
'r',
'j',
'i')) {
7234 case MKTAG(
'r',
'e',
'c',
't'):
7237 case MKTAG(
'e',
'q',
'u',
'i'):
7240 case MKTAG(
'h',
'e',
'q',
'u'):
7243 case MKTAG(
'f',
'i',
's',
'h'):
7246 case MKTAG(
'p',
'r',
'i',
'm'):
7269 uint32_t
tag, baseline = 0;
7273 AVRational horizontal_disparity_adjustment = { 0, 1 };
7275 if (
c->fc->nb_streams < 1)
7278 st =
c->fc->streams[
c->fc->nb_streams - 1];
7281 remaining = atom.
size;
7282 while (remaining > 0) {
7284 if (size < 8 || size > remaining ) {
7291 case MKTAG(
's',
't',
'r',
'i'): {
7292 int has_right, has_left;
7312 has_right =
tmp & 2;
7315 if (has_left && has_right)
7321 if (has_left || has_right)
7326 case MKTAG(
'h',
'e',
'r',
'o'): {
7347 case MKTAG(
'c',
'a',
'm',
's'): {
7356 if (subsize != 16) {
7362 if (subtag !=
MKTAG(
'b',
'l',
'i',
'n')) {
7375 case MKTAG(
'c',
'm',
'f',
'y'): {
7385 if (subsize != 16) {
7391 if (subtag !=
MKTAG(
'd',
'a',
'd',
'j')) {
7402 horizontal_disparity_adjustment.
num = (int) adjustment;
7403 horizontal_disparity_adjustment.
den = 10000;
7416 if (remaining != 0) {
7446 if (
c->fc->nb_streams < 1)
7449 if (atom.
size < 8) {
7454 remaining = atom.
size;
7455 while (remaining > 0) {
7457 if (size < 8 || size > remaining ) {
7464 case MKTAG(
'p',
'r',
'o',
'j'): {
7471 case MKTAG(
'e',
'y',
'e',
's'): {
7478 case MKTAG(
'p',
'a',
'c',
'k'): {
7494 if (remaining != 0) {
7507 if (
c->fc->nb_streams < 1)
7510 st =
c->fc->streams[
c->fc->nb_streams - 1];
7513 if (atom.
size != 4) {
7600 static const AVUUID uuid_isml_manifest = {
7601 0xa5, 0xd4, 0x0b, 0x30, 0xe8, 0x14, 0x11, 0xdd,
7602 0xba, 0x2f, 0x08, 0x00, 0x20, 0x0c, 0x9a, 0x66
7604 static const AVUUID uuid_xmp = {
7605 0xbe, 0x7a, 0xcf, 0xcb, 0x97, 0xa9, 0x42, 0xe8,
7606 0x9c, 0x71, 0x99, 0x94, 0x91, 0xe3, 0xaf, 0xac
7608 static const AVUUID uuid_spherical = {
7609 0xff, 0xcc, 0x82, 0x63, 0xf8, 0x55, 0x4a, 0x93,
7610 0x88, 0x14, 0x58, 0x7a, 0x02, 0x52, 0x1f, 0xdd,
7616 if (
c->fc->nb_streams < 1)
7618 st =
c->fc->streams[
c->fc->nb_streams - 1];
7646 while ((ptr =
av_stristr(ptr,
"systemBitrate=\""))) {
7647 ptr +=
sizeof(
"systemBitrate=\"") - 1;
7648 c->bitrates_count++;
7649 c->bitrates =
av_realloc_f(
c->bitrates,
c->bitrates_count,
sizeof(*
c->bitrates));
7651 c->bitrates_count = 0;
7656 ret = strtol(ptr, &endptr, 10);
7657 if (
ret < 0 || errno || *endptr !=
'"') {
7658 c->bitrates[
c->bitrates_count - 1] = 0;
7660 c->bitrates[
c->bitrates_count - 1] =
ret;
7668 if (
c->export_xmp) {
7702 uint8_t content[16];
7713 && !memcmp(content,
"Anevia\x1A\x1A", 8)
7728 if (
c->fc->nb_streams < 1)
7730 st =
c->fc->streams[
c->fc->nb_streams - 1];
7735 case MKTAG(
'e',
'n',
'c',
'v'):
7736 case MKTAG(
'e',
'n',
'c',
'a'):
7741 "ignoring 'frma' atom of '%.4s', stream has codec id %d\n",
7753 "ignoring 'frma' atom of '%.4s', stream format is '%.4s'\n",
7775 if (frag_stream_info) {
7776 for (
i = 0;
i <
c->fc->nb_streams;
i++) {
7777 *sc =
c->fc->streams[
i]->priv_data;
7778 if ((*sc)->id == frag_stream_info->
id) {
7779 st =
c->fc->streams[
i];
7783 if (
i ==
c->fc->nb_streams)
7789 if (!(*sc)->cenc.default_encrypted_sample)
7800 if (
c->fc->nb_streams < 1)
7802 st =
c->fc->streams[
c->fc->nb_streams - 1];
7805 if (!(*sc)->cenc.encryption_index) {
7807 if (!(*sc)->cenc.default_encrypted_sample)
7810 if (!(*sc)->cenc.encryption_index)
7814 *encryption_index = (*sc)->cenc.encryption_index;
7822 unsigned int subsample_count;
7846 if (use_subsamples) {
7848 av_free((*sample)->subsamples);
7849 (*sample)->subsamples =
av_calloc(subsample_count,
sizeof(*subsamples));
7850 if (!(*sample)->subsamples) {
7857 (*sample)->subsamples[
i].bytes_of_clear_data =
avio_rb16(pb);
7858 (*sample)->subsamples[
i].bytes_of_protected_data =
avio_rb32(pb);
7867 (*sample)->subsample_count = subsample_count;
7878 int use_subsamples,
ret;
7879 unsigned int sample_count,
i, alloc_size = 0;
7895 if (sample_count >= INT_MAX /
sizeof(*encrypted_samples))
7898 for (
i = 0;
i < sample_count;
i++) {
7899 unsigned int min_samples =
FFMIN(
FFMAX(
i + 1, 1024 * 1024), sample_count);
7901 min_samples *
sizeof(*encrypted_samples));
7902 if (encrypted_samples) {
7933 size_t sample_count, sample_info_size,
i;
7935 unsigned int alloc_size = 0;
7944 if (sample_count >= INT_MAX /
sizeof(*encrypted_samples))
7950 av_log(
c->fc,
AV_LOG_INFO,
"Failed to seek for auxiliary info, will only parse senc atoms for encryption info\n");
7955 unsigned int min_samples =
FFMIN(
FFMAX(
i + 1, 1024 * 1024), sample_count);
7957 min_samples *
sizeof(*encrypted_samples));
7958 if (!encrypted_samples) {
7983 for (;
i > 0;
i--) {
7996 unsigned int sample_count, aux_info_type, aux_info_param;
8022 if (aux_info_param != 0) {
8028 if ((aux_info_type ==
MKBETAG(
'c',
'e',
'n',
'c') ||
8029 aux_info_type ==
MKBETAG(
'c',
'e',
'n',
's') ||
8030 aux_info_type ==
MKBETAG(
'c',
'b',
'c',
'1') ||
8031 aux_info_type ==
MKBETAG(
'c',
'b',
'c',
's')) &&
8032 aux_info_param == 0) {
8048 if (sample_count == 0)
8056 if (
ret != sample_count) {
8077 uint64_t *auxiliary_offsets;
8081 unsigned int version, entry_count, aux_info_type, aux_info_param;
8082 unsigned int alloc_size = 0;
8108 if (aux_info_param != 0) {
8114 if ((aux_info_type ==
MKBETAG(
'c',
'e',
'n',
'c') ||
8115 aux_info_type ==
MKBETAG(
'c',
'e',
'n',
's') ||
8116 aux_info_type ==
MKBETAG(
'c',
'b',
'c',
'1') ||
8117 aux_info_type ==
MKBETAG(
'c',
'b',
'c',
's')) &&
8118 aux_info_param == 0) {
8131 if (entry_count >= INT_MAX /
sizeof(*auxiliary_offsets))
8135 unsigned int min_offsets =
FFMIN(
FFMAX(
i + 1, 1024), entry_count);
8138 min_offsets *
sizeof(*auxiliary_offsets));
8139 if (!auxiliary_offsets) {
8150 if (
c->frag_index.current >= 0) {
8176 uint8_t *side_data, *extra_data;
8177 size_t side_data_size;
8179 unsigned int version, kid_count, extra_data_size, alloc_size = 0;
8181 if (
c->fc->nb_streams < 1)
8183 st =
c->fc->streams[
c->fc->nb_streams-1];
8200 if (kid_count >= INT_MAX /
sizeof(*key_ids)) {
8205 for (
unsigned int i = 0;
i < kid_count && !pb->
eof_reached;
i++) {
8206 unsigned int min_kid_count =
FFMIN(
FFMAX(
i + 1, 1024), kid_count);
8208 min_kid_count *
sizeof(*key_ids));
8213 info->key_ids = key_ids;
8216 if (!
info->key_ids[
i]) {
8220 info->num_key_ids =
i + 1;
8236 extra_data =
av_malloc(extra_data_size);
8242 if (
ret != extra_data_size) {
8251 info->data = extra_data;
8252 info->data_size = extra_data_size;
8257 if (old_side_data) {
8259 if (old_init_info) {
8267 info = old_init_info;
8283 side_data, side_data_size, 0))
8296 if (
c->fc->nb_streams < 1)
8298 st =
c->fc->streams[
c->fc->nb_streams-1];
8302 av_log(
c->fc,
AV_LOG_ERROR,
"schm boxes are only supported in first sample descriptor\n");
8326 unsigned int version, pattern, is_protected, iv_size;
8328 if (
c->fc->nb_streams < 1)
8330 st =
c->fc->streams[
c->fc->nb_streams-1];
8379 if (iv_size != 8 && iv_size != 16) {
8399 if (
c->fc->nb_streams < 1)
8401 st =
c->fc->streams[
c->fc->nb_streams-1];
8403 if ((uint64_t)atom.
size > (1<<30) || atom.
size < 42)
8412 if (
avio_read(pb, buf,
sizeof(buf)) !=
sizeof(buf)) {
8435 char kid_hex[16*2+1];
8437 if (
c->decryption_default_key &&
c->decryption_default_key_len !=
len) {
8438 av_log(
c->fc,
AV_LOG_ERROR,
"invalid default decryption key length: got %d, expected %d\n",
c->decryption_default_key_len,
len);
8442 if (!
c->decryption_keys) {
8444 memcpy(
out,
c->decryption_default_key,
len);
8448 if (
sample->key_id_size != 16) {
8455 if (!key_entry_hex) {
8456 if (!
c->decryption_default_key) {
8460 memcpy(
out,
c->decryption_default_key,
len);
8463 if (strlen(key_entry_hex->
value) !=
len*2) {
8473 int bytes_of_protected_data;
8496 if (!
sample->subsample_count) {
8502 for (
i = 0;
i <
sample->subsample_count;
i++) {
8510 size -=
sample->subsamples[
i].bytes_of_clear_data;
8514 bytes_of_protected_data =
sample->subsamples[
i].bytes_of_protected_data;
8517 input += bytes_of_protected_data;
8518 size -= bytes_of_protected_data;
8532 int num_of_encrypted_blocks;
8534 uint8_t decryption_key[16];
8554 memcpy(iv,
sample->iv, 16);
8557 if (!
sample->subsample_count) {
8563 for (
i = 0;
i <
sample->subsample_count;
i++) {
8569 if (
sample->subsamples[
i].bytes_of_protected_data % 16) {
8576 size -=
sample->subsamples[
i].bytes_of_clear_data;
8579 num_of_encrypted_blocks =
sample->subsamples[
i].bytes_of_protected_data/16;
8580 if (num_of_encrypted_blocks > 0) {
8583 input +=
sample->subsamples[
i].bytes_of_protected_data;
8584 size -=
sample->subsamples[
i].bytes_of_protected_data;
8597 int i,
ret, rem_bytes;
8622 if (!
sample->subsample_count) {
8626 }
else if (!
sample->crypt_byte_block && !
sample->skip_byte_block) {
8631 for (
i = 0;
i <
sample->subsample_count;
i++) {
8639 size -=
sample->subsamples[
i].bytes_of_clear_data;
8643 rem_bytes =
sample->subsamples[
i].bytes_of_protected_data;
8644 while (rem_bytes > 0) {
8645 if (rem_bytes < 16*sample->crypt_byte_block) {
8650 rem_bytes -= 16*
sample->crypt_byte_block;
8652 rem_bytes -=
FFMIN(16*
sample->skip_byte_block, rem_bytes);
8654 input +=
sample->subsamples[
i].bytes_of_protected_data;
8655 size -=
sample->subsamples[
i].bytes_of_protected_data;
8668 int i,
ret, rem_bytes;
8671 uint8_t decryption_key[16];
8692 if (!
sample->subsample_count) {
8694 memcpy(iv,
sample->iv, 16);
8697 }
else if (!
sample->crypt_byte_block && !
sample->skip_byte_block) {
8702 for (
i = 0;
i <
sample->subsample_count;
i++) {
8710 size -=
sample->subsamples[
i].bytes_of_clear_data;
8713 memcpy(iv,
sample->iv, 16);
8715 rem_bytes =
sample->subsamples[
i].bytes_of_protected_data;
8716 while (rem_bytes > 0) {
8717 if (rem_bytes < 16*sample->crypt_byte_block) {
8722 rem_bytes -= 16*
sample->crypt_byte_block;
8724 rem_bytes -=
FFMIN(16*
sample->skip_byte_block, rem_bytes);
8726 input +=
sample->subsamples[
i].bytes_of_protected_data;
8727 size -=
sample->subsamples[
i].bytes_of_protected_data;
8762 if (
current >= 0 && current < frag_index->nb_items) {
8784 int encrypted_index,
ret;
8787 encrypted_index = current_index;
8788 encryption_index =
NULL;
8789 if (frag_stream_info) {
8791 if (frag_stream_info->
stsd_id == 1) {
8793 encrypted_index = current_index - frag_stream_info->
index_base;
8803 if (encryption_index) {
8815 encrypted_sample =
NULL;
8819 }
else if (encrypted_index >= 0 && encrypted_index < encryption_index->nb_encrypted_samples) {
8822 if (!encrypted_sample) {
8827 if (!encrypted_sample) {
8857 if (
c->fc->nb_streams < 1)
8859 st =
c->fc->streams[
c->fc->nb_streams-1];
8905 unsigned format_info;
8906 int channel_assignment, channel_assignment1, channel_assignment2;
8910 if (
c->fc->nb_streams < 1)
8912 st =
c->fc->streams[
c->fc->nb_streams-1];
8919 ratebits = (format_info >> 28) & 0xF;
8920 channel_assignment1 = (format_info >> 15) & 0x1F;
8921 channel_assignment2 = format_info & 0x1FFF;
8922 if (channel_assignment2)
8923 channel_assignment = channel_assignment2;
8925 channel_assignment = channel_assignment1;
8944 if (
c->fc->nb_streams < 1)
8946 st =
c->fc->streams[
c->fc->nb_streams-1];
8963 if (
c->fc->nb_streams < 1)
8965 st =
c->fc->streams[
c->fc->nb_streams - 1];
8988 int ret, old_size, num_arrays;
8990 if (
c->fc->nb_streams < 1)
8992 st =
c->fc->streams[
c->fc->nb_streams-1];
9015 num_arrays = buf[5];
9039 AVBPrint scheme_buf, value_buf;
9040 int64_t scheme_str_len = 0, value_str_len = 0;
9048 if (
c->fc->nb_streams < 1)
9050 st =
c->fc->streams[
c->fc->nb_streams-1];
9058 "Unsupported 'kind' box with version %d, flags: %x",
9068 ret = scheme_str_len;
9072 if (scheme_str_len + 1 >=
size) {
9080 size -= scheme_str_len + 1;
9084 ret = value_str_len;
9088 if (value_str_len ==
size) {
9095 "%s stream %d KindBox(scheme: %s, value: %s)\n",
9098 scheme_buf.str, value_buf.str);
9105 for (
int j = 0;
map.value_maps[j].disposition; j++) {
9129 int ambisonic_order, channel_order, normalization, channel_count;
9130 int ambi_channels, non_diegetic_channels;
9132 if (
c->fc->nb_streams < 1)
9135 st =
c->fc->streams[
c->fc->nb_streams - 1];
9137 if (atom.
size < 16) {
9151 "Unsupported ambisonic type %d\n",
type & 0x7f);
9154 non_diegetic_channels = (
type >> 7) * 2;
9159 if (channel_order) {
9161 "Unsupported channel_order %d\n", channel_order);
9166 if (normalization) {
9168 "Unsupported normalization %d\n", normalization);
9173 if (ambisonic_order < 0 || ambisonic_order > 31 ||
9174 channel_count != ((ambisonic_order + 1LL) * (ambisonic_order + 1LL) +
9175 non_diegetic_channels)) {
9177 "Invalid number of channels (%d / %d)\n",
9178 channel_count, ambisonic_order);
9181 ambi_channels = channel_count - non_diegetic_channels;
9187 for (
i = 0;
i < channel_count;
i++) {
9190 if (
channel >= channel_count) {
9219 if (
c->fc->nb_streams < 1)
9222 st =
c->fc->streams[
c->fc->nb_streams - 1];
9224 if (atom.
size < 5) {
9250 else if (
size == 8) {
9276 int version, offset_size, length_size, base_offset_size, index_size;
9277 int item_count, extent_count;
9278 int64_t base_offset, extent_offset, extent_length;
9281 if (
c->found_iloc) {
9290 offset_size = (
value >> 4) & 0xF;
9291 length_size =
value & 0xF;
9293 base_offset_size = (
value >> 4) & 0xF;
9304 c->heif_item = heif_item;
9305 if (item_count >
c->nb_heif_item)
9306 memset(&
c->heif_item[
c->nb_heif_item], 0,
9307 sizeof(*
c->heif_item) * (item_count -
c->nb_heif_item));
9308 c->nb_heif_item =
FFMAX(
c->nb_heif_item, item_count);
9311 for (
int i = 0;
i < item_count;
i++) {
9319 if (offset_type > 1) {
9325 if (
rb_size(pb, &base_offset, base_offset_size) < 0)
9328 if (extent_count > 1) {
9334 if (
rb_size(pb, &extent_offset, offset_size) < 0 ||
9335 rb_size(pb, &extent_length, length_size) < 0 ||
9336 base_offset > INT64_MAX - extent_offset)
9339 for (j = 0; j <
c->nb_heif_item; j++) {
9340 item =
c->heif_item[j];
9342 item =
c->heif_item[j] =
av_mallocz(
sizeof(*item));
9343 else if (item->
item_id != item_id)
9349 if (j ==
c->nb_heif_item)
9354 if (offset_type == 1)
9359 "extent_offset %"PRId64
", extent_length %"PRId64
"\n",
9409 for (
i = 0;
i <
c->nb_heif_item;
i++) {
9410 item =
c->heif_item[
i];
9413 else if (item->
item_id != item_id)
9421 if (
i ==
c->nb_heif_item) {
9429 item->
type = item_type;
9431 switch (item_type) {
9432 case MKTAG(
'a',
'v',
'0',
'1'):
9433 case MKTAG(
'j',
'p',
'e',
'g'):
9434 case MKTAG(
'h',
'v',
'c',
'1'):
9450 if (
c->found_iinf) {
9462 c->heif_item = heif_item;
9463 if (entry_count >
c->nb_heif_item)
9464 memset(&
c->heif_item[
c->nb_heif_item], 0,
9465 sizeof(*
c->heif_item) * (entry_count -
c->nb_heif_item));
9466 c->nb_heif_item =
FFMAX(
c->nb_heif_item, entry_count);
9468 for (
i = 0;
i < entry_count;
i++) {
9484 c->found_iinf = got_stream;
9487 for (;
i >= 0;
i--) {
9506 for (
int i = 0;
i <
c->nb_heif_grid;
i++) {
9507 if (
c->heif_grid[
i].item->item_id == from_item_id) {
9509 "referencing the same Derived Image item\n");
9513 for (
int i = 0;
i <
c->nb_heif_item;
i++) {
9514 if (!
c->heif_item[
i] ||
c->heif_item[
i]->item_id != from_item_id)
9516 item =
c->heif_item[
i];
9518 switch (item->
type) {
9519 case MKTAG(
'g',
'r',
'i',
'd'):
9520 case MKTAG(
'i',
'o',
'v',
'l'):
9537 "Derived image item references no input images\n");
9542 sizeof(*
c->heif_grid));
9545 c->heif_grid = grid;
9546 grid = &grid[
c->nb_heif_grid];
9556 for (
i = 0;
i < entries;
i++) {
9570 from_item_id, entries);
9585 int item_id_size =
version ? 4 : 2;
9602 for (
int i = 0;
i < entries;
i++) {
9642 if (size < 14 || size > atom.
size || next > INT64_MAX -
size)
9648 case MKTAG(
'd',
'i',
'm',
'g'):
9653 case MKTAG(
'c',
'd',
's',
'c'):
9654 case MKTAG(
't',
'h',
'm',
'b'):
9706 c->cur_item_id, angle);
9726 c->cur_item_id, axis);
9731 item->
vflip = !axis;
9739 typedef struct MOVAtoms {
9745 MOVAtoms *atoms =
NULL;
9755 if (
a.size < 8 ||
a.type !=
MKTAG(
'i',
'p',
'c',
'o'))
9759 while (
a.size >= 8) {
9768 if (
ref->size >
a.size ||
ref->size < 8)
9782 a.size -=
ref->size;
9793 if (
a.size < 8 ||
a.type !=
MKTAG(
'i',
'p',
'm',
'a')) {
9802 for (
int i = 0;
i < count;
i++) {
9804 int assoc_count =
avio_r8(pb);
9811 for (
int j = 0; j < assoc_count; j++) {
9827 c->cur_item_id = item_id;
9830 (
MOVAtom) { .size = ref->size,
9831 .type = MKTAG(
'i',
'p',
'c',
'o') });
9840 c->cur_item_id = -1;
9841 for (
int i = 0;
i < nb_atoms;
i++)
9975 {
MKTAG(
'i',
'a',
'c',
'b'), mov_read_iacb },
9987 if (
c->atom_depth > 10) {
9994 atom.
size = INT64_MAX;
9995 while (total_size <= atom.
size - 8) {
10001 if (((
a.type ==
MKTAG(
'f',
'r',
'e',
'e') &&
c->moov_retry) ||
10002 a.type ==
MKTAG(
'h',
'o',
'o',
'v')) &&
10014 a.type =
MKTAG(
'm',
'o',
'o',
'v');
10017 if (atom.
type !=
MKTAG(
'r',
'o',
'o',
't') &&
10019 if (
a.type ==
MKTAG(
't',
'r',
'a',
'k') ||
10020 a.type ==
MKTAG(
'm',
'd',
'a',
't')) {
10028 if (
a.size == 1 && total_size + 8 <= atom.
size) {
10035 a.size = atom.
size - total_size + 8;
10057 if (!
parse &&
c->found_hdlr_mdta &&
10059 a.type ==
MKTAG(
'k',
'e',
'y',
's') &&
10060 c->meta_keys_count == 0) {
10074 if (
c->found_moov &&
c->found_mdat &&
a.size <= INT64_MAX - start_pos &&
10078 c->next_root_atom = start_pos +
a.size;
10085 else if (
left < 0) {
10087 "overread end of atom '%s' by %"PRId64
" bytes\n",
10093 total_size +=
a.size;
10096 if (total_size < atom.
size && atom.
size < 0x7ffff)
10108 int moov_offset = -1;
10116 if ((
offset + 8ULL) > (
unsigned int)
p->buf_size)
10119 if (
size == 1 &&
offset + 16 <= (
unsigned int)
p->buf_size) {
10122 }
else if (
size == 0) {
10125 if (
size < minsize) {
10132 case MKTAG(
'm',
'o',
'o',
'v'):
10133 moov_offset =
offset + 4;
10135 case MKTAG(
'm',
'd',
'a',
't'):
10136 case MKTAG(
'p',
'n',
'o',
't'):
10137 case MKTAG(
'u',
'd',
't',
'a'):
10138 case MKTAG(
'f',
't',
'y',
'p'):
10139 if (
tag ==
MKTAG(
'f',
't',
'y',
'p') &&
10144 score =
FFMAX(score, 5);
10150 case MKTAG(
'e',
'd',
'i',
'w'):
10151 case MKTAG(
'w',
'i',
'd',
'e'):
10152 case MKTAG(
'f',
'r',
'e',
'e'):
10153 case MKTAG(
'j',
'u',
'n',
'k'):
10154 case MKTAG(
'p',
'i',
'c',
't'):
10157 case MKTAG(0x82,0x82,0x7f,0x7d):
10160 case MKTAG(
's',
'k',
'i',
'p'):
10161 case MKTAG(
'u',
'u',
'i',
'd'):
10162 case MKTAG(
'p',
'r',
'f',
'l'):
10176 while (
offset < (
p->buf_size - 16)) {
10210 for (
i = 0;
i <
s->nb_streams;
i++) {
10212 if (sc->
id == chapter_track) {
10213 st =
s->streams[
i];
10248 int len, title_len;
10250 if (end < sample->timestamp) {
10264 title_len = 2*
len + 1;
10277 else if (ch == 0xfffe)
10281 if (
len == 1 ||
len == 2)
10317 int hh, mm,
ss, ff, drop;
10330 hh, mm,
ss, drop ?
';' :
':', ff);
10346 int rounded_tc_rate;
10351 if (!tc_rate.
num || !tc_rate.
den || !tmcd_nb_frames)
10370 rounded_tc_rate = (tc_rate.
num + tc_rate.
den / 2LL) / tc_rate.
den;
10373 if (tmcd_nb_frames == tc_rate.
num / tc_rate.
den &&
10375 tmcd_nb_frames = rounded_tc_rate;
10387 for (
i = 0;
i < (*index)->nb_encrypted_samples;
i++) {
10390 av_freep(&(*index)->encrypted_samples);
10391 av_freep(&(*index)->auxiliary_info_sizes);
10392 av_freep(&(*index)->auxiliary_offsets);
10466 for (
i = 0;
i <
s->nb_streams;
i++) {
10520 for (
i = 0;
i <
s->nb_streams;
i++) {
10538 for (
i = 0;
i <
s->nb_streams;
i++) {
10557 unsigned track_id, item_count;
10569 for (
i = 0;
i < item_count;
i++) {
10591 if (frag_stream_info &&
10595 for (j = 0; j < ((fieldlength >> 4) & 3) + 1; j++)
10597 for (j = 0; j < ((fieldlength >> 2) & 3) + 1; j++)
10599 for (j = 0; j < ((fieldlength >> 0) & 3) + 1; j++)
10613 if ((seek_ret =
avio_seek(
f, stream_size - 4, SEEK_SET)) < 0) {
10618 c->have_read_mfra_size = 1;
10619 if (!
c->mfra_size ||
c->mfra_size > stream_size) {
10642 c->frag_index.complete = 1;
10644 seek_ret =
avio_seek(
f, original_pos, SEEK_SET);
10645 if (seek_ret < 0) {
10647 "failed to seek back after looking for mfra\n");
10672 nb_coded_side_data,
10674 9 *
sizeof(*
matrix), 0);
10693 int64_t coded_width = 0, coded_height = 0;
10705 if (!
c->idat_offset) {
10726 av_log(
c->fc,
AV_LOG_TRACE,
"grid: grid_rows %d grid_cols %d output_width %d output_height %d\n",
10742 if (coded_width > INT_MAX || coded_height > INT_MAX)
10752 while (y < tile_grid->coded_height) {
10755 while (x < tile_grid->coded_width) {
10788 uint16_t canvas_fill_value[4];
10797 if (!
c->idat_offset) {
10812 for (
int i = 0;
i < 4;
i++)
10815 canvas_fill_value[0], canvas_fill_value[1],
10816 canvas_fill_value[2], canvas_fill_value[3]);
10817 for (
int i = 0;
i < 4;
i++)
10841 "horizontal_offset[%d] %d, vertical_offset[%d] %d\n",
10868 if (
ref->is_idat_relative) {
10869 if (!
c->idat_offset) {
10880 if (
offset > INT64_MAX -
ref->extent_offset) {
10887 if (err !=
ref->extent_length) {
10952 for (
int j = 0; j < grid->
nb_tiles; j++) {
10960 if (!item || item->
item_id != tile_id)
10965 "reference a stream\n",
11009 case MKTAG(
'g',
'r',
'i',
'd'):
11012 case MKTAG(
'i',
'o',
'v',
'l'):
11025 switch(
ref->type) {
11026 case MKTAG(
'E',
'x',
'i',
'f'):
11110 switch(
ref->type) {
11111 case MKTAG(
'E',
'x',
'i',
'f'):
11145 for (
int i = 0;
i <
s->nb_streams;
i++) {
11160 for (
int j = 0; j <
s->nb_streams; j++) {
11168 for (
int k = 0; k <
tag->nb_id; k++) {
11169 if (
tag->id[k] != st->
id)
11198 uint32_t *tref_id,
int nb_tref_id,
int first_index)
11203 for (
int i = first_index;
i <
s->nb_streams;
i++)
11204 for (
int j = 0; j < nb_tref_id; j++)
11205 if (
s->streams[
i]->index != st->
index &&
11206 s->streams[
i]->id == tref_id[j])
11207 return s->streams[
i];
11217 if (
s->nb_streams <= 1)
11220 for (
int i = 0;
i <
s->nb_streams;
i++) {
11233 av_log(
s, loglevel,
"Failed to find referenced stream\n");
11264 if (
s->nb_streams <= 1)
11267 for (
int i = 0;
i <
s->nb_streams;
i++) {
11292 j = st_base->
index + 1;
11296 av_log(
s, loglevel,
"Failed to find base stream for LCEVC stream\n");
11317 if (
s->nb_streams <= 1)
11326 for (
int i = 0;
i <
s->nb_streams;
i++) {
11358 av_log(
s, loglevel,
"Failed to find base layer for Dolby Vision EL stream\n");
11388 int highest_id = 0, lowest_iamf_id = INT_MAX;
11390 for (
int i = 0;
i <
s->nb_streams;
i++) {
11394 highest_id =
FFMAX(highest_id, st->
id);
11397 for (
int i = 0;
i <
s->nb_stream_groups;
i++) {
11403 lowest_iamf_id =
FFMIN(lowest_iamf_id, st->
id);
11407 if (highest_id < lowest_iamf_id)
11410 highest_id += !lowest_iamf_id;
11411 for (
int i = 0; highest_id > 1 &&
i <
s->nb_stream_groups;
i++) {
11418 st->
id += highest_id;
11440 atom.
size = INT64_MAX;
11471 for (
i = 0;
i <
s->nb_streams;
i++)
11472 if (
s->streams[
i]->codecpar->codec_tag ==
AV_RL32(
"tmcd")) {
11474 }
else if (
s->streams[
i]->codecpar->codec_tag ==
AV_RL32(
"rtmd")) {
11499 for (
i = 0;
i <
s->nb_streams;
i++) {
11560 for (
i = 0;
i <
s->nb_streams;
i++) {
11579 s->streams[
i]->codecpar->bit_rate = mov->
bitrates[
i];
11585 for (
i = 0;
i <
s->nb_streams;
i++) {
11662 int64_t best_dts = INT64_MAX;
11666 for (
i = 0;
i <
s->nb_streams;
i++) {
11673 uint64_t dtsdiff = best_dts > dts ? best_dts - (uint64_t)dts : ((uint64_t)dts - best_dts);
11675 if (!
sample || (no_interleave && current_sample->
pos <
sample->pos) ||
11678 ((dtsdiff <= AV_TIME_BASE && current_sample->pos < sample->
pos) ||
11679 (dtsdiff >
AV_TIME_BASE && dts < best_dts && mov->interleaved_read)))))) {
11680 sample = current_sample;
11701 if (
index >= 0 && index < mov->frag_index.nb_items)
11703 if (target >= 0 &&
avio_seek(
s->pb, target, SEEK_SET) != target) {
11711 if (
index >= 0 && index < mov->frag_index.nb_items &&
11735 uint8_t *side, *extradata;
11736 int extradata_size;
11750 memcpy(side, extradata, extradata_size);
11760 const uint32_t cdat =
AV_RB32(
"cdat");
11769 if ((src_size - 8) / 2 >= INT_MAX / 3)
11777 while (src_size >= 10) {
11778 const uint32_t atom_size =
avio_rb32(pb);
11779 const uint32_t atom_type =
avio_rb32(pb);
11780 const uint32_t data_size = atom_size - 8;
11781 const uint8_t cc_field =
11782 atom_type == cdat ? 1 :
11783 atom_type ==
cdt2 ? 2 :
11790 if (data_size < 2 || data_size > src_size) {
11796 if (data_size % 2 != 0) {
11804 src_size -= data_size;
11808 for (uint32_t
i = 0;
i < data_size;
i += 2) {
11844 if (next_dts >=
pkt->
dts)
11863 if (!
ffstream(st)->first_discard_sample)
11865 if (!
ffstream(st)->last_discard_sample)
11881 uint8_t sample_is_depended_on = (sample_flags >> 2) & 0x3;
11921 if (
s->pb->pos == 0) {
11935 for (
i = 0;
i <
s->nb_streams;
i++) {
11975 if (ret64 !=
sample->pos) {
11980 }
else if (ret64 < 0) {
11994 else if (sc->
iamf) {
12027 if (au_size >
sample->size - 4) {
12029 "APV au_size %u exceeds sample body %d\n",
12030 au_size,
sample->size - 4);
12033 au_size =
sample->size - 4;
12044 #if CONFIG_DV_DEMUXER
12130 int64_t key_sample_dts, key_sample_pts;
12157 int sample, time_sample,
ret, requested_sample;
12172 if (sample < 0 && sti->nb_index_entries && timestamp < sti->index_entries[0].timestamp)
12182 if (requested_sample < 0)
12191 timestamp = next_ts;
12206 time_sample = next;
12221 time_sample = next;
12240 (
AVRational){1, st->codecpar->sample_rate});
12252 if (stream_index >=
s->nb_streams)
12255 st =
s->streams[stream_index];
12261 if (
mc->seek_individually) {
12266 for (
i = 0;
i <
s->nb_streams;
i++) {
12271 if (stream_index ==
i)
12280 for (
i = 0;
i <
s->nb_streams;
i++) {
12282 st =
s->streams[
i];
12300 #define OFFSET(x) offsetof(MOVContext, x)
12301 #define FLAGS AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
12303 {
"use_absolute_path",
12304 "allow using absolute path when opening alias, this is a possible security issue",
12307 {
"seek_streams_individually",
12308 "Seek each stream individually to the closest point",
12311 {
"ignore_editlist",
"Ignore the edit list atom.",
OFFSET(ignore_editlist),
AV_OPT_TYPE_BOOL, {.i64 = 0},
12313 {
"advanced_editlist",
12314 "Modify the AVIndex according to the editlists. Use this option to decode in the order specified by the edits.",
12320 "use mfra for fragment timestamps",
12323 .unit =
"use_mfra_for"},
12325 FLAGS, .unit =
"use_mfra_for" },
12327 FLAGS, .unit =
"use_mfra_for" },
12329 FLAGS, .unit =
"use_mfra_for" },
12332 {
"export_all",
"Export unrecognized metadata entries",
OFFSET(export_all),
12334 {
"export_xmp",
"Export full XMP metadata",
OFFSET(export_xmp),
12336 {
"activation_bytes",
"Secret bytes for Audible AAX files",
OFFSET(activation_bytes),
12338 {
"audible_key",
"AES-128 Key for Audible AAXC files",
OFFSET(audible_key),
12340 {
"audible_iv",
"AES-128 IV for Audible AAXC files",
OFFSET(audible_iv),
12342 {
"audible_fixed_key",
12343 "Fixed key used for handling Audible AAX files",
OFFSET(audible_fixed_key),
12349 {.i64 = 0}, 0, 1,
FLAGS },
12364 .
p.
name =
"mov,mp4,m4a,3gp,3g2,mj2",
12367 .p.extensions =
"mov,mp4,m4a,3gp,3g2,mj2,psp,m4v,m4b,ism,ismv,isma,f4v,avif,heic,heif",
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.
unsigned int ctts_allocated_size
@ AV_EXIF_T_OFF
The first four bytes point to the actual start, then it's AV_EXIF_TIFF_HEADER.
static int mov_finalize_stsd_entry(MOVContext *c, AVStream *st)
static int mov_read_chpl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_frma(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom)
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int found_iloc
'iloc' atom has been found
int ff_rfps_add_frame(AVFormatContext *ic, AVStream *st, int64_t ts)
add frame for rfps calculation.
static int read_image_iovl(AVFormatContext *s, const HEIFGrid *grid, AVStreamGroupTileGrid *tile_grid)
@ AV_PRIMARY_EYE_RIGHT
Right eye.
static int mov_read_irot(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVIAMFSubmixElement ** elements
Array of submix elements.
static void skip_bits_long(GetBitContext *s, int n)
Skips the specified number of bits.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_BPRINT_SIZE_UNLIMITED
#define MOV_TFHD_DEFAULT_FLAGS
#define PUT_UTF8(val, tmp, PUT_BYTE)
#define AV_TIMECODE_STR_SIZE
int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt)
Initialize an AVAES context.
int skip_samples
Number of samples to skip at the start of the frame decoded from the next packet.
int16_t audio_cid
stsd audio compression id
AVSphericalProjection
Projection of the video surface(s) on a sphere.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
static int mov_read_dops(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int can_seek_to_key_sample(AVStream *st, int sample, int64_t requested_pts)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
@ AV_CODEC_ID_ADPCM_IMA_QT
#define AV_EF_EXPLODE
abort decoding on minor error detection
int64_t id
Group type-specific group ID.
@ AV_STEREO3D_VIEW_LEFT
Frame contains only the left view.
#define MOV_TRUN_SAMPLE_FLAGS
@ AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT
Ambient viewing environment metadata, as defined by H.274.
unsigned int nb_chapter_tracks
static int mix(int c0, int c1)
const uint16_t ff_ac3_channel_layout_tab[8]
Map audio coding mode (acmod) to channel layout mask.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static HEIFItem * get_heif_item(MOVContext *c, unsigned id)
Get the requested item.
#define MOV_TKHD_FLAG_ENABLED
#define AV_CH_TOP_SIDE_LEFT
enum AVMediaType codec_type
General type of the encoded data.
struct AVStreamGroupTileGrid * tile_grid
enum AVSphericalProjection projection
Projection type.
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.
uint8_t ** extradata
extradata array (and size) for multiple stsd
static const AVClass mov_class
uint32_t bound_bottom
Distance from the bottom edge.
uint8_t AVUUID[AV_UUID_LEN]
static int mov_parse_tmcd_streams(AVFormatContext *s)
#define AV_CH_TOP_FRONT_CENTER
#define AV_CHANNEL_LAYOUT_STEREO
static int mov_read_targa_y216(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_chnl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_moof(MOVContext *c, AVIOContext *pb, MOVAtom atom)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
@ AV_PKT_DATA_FRAME_CROPPING
The number of pixels to discard from the top/bottom/left/right border of the decoded frame to obtain ...
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...
This struct describes the properties of an encoded stream.
#define AV_CH_LOW_FREQUENCY_2
static int sanity_checks(void *log_obj, MOVStreamContext *sc, int index)
char * av_stristr(const char *s1, const char *s2)
Locate the first case-independent occurrence in the string haystack of the string needle.
enum AVColorSpace color_space
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
int ff_replaygain_export(AVStream *st, AVDictionary *metadata)
Parse replaygain tags and export them as per-stream side data.
static int tmcd_is_referenced(AVFormatContext *s, int tmcd_id)
@ 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...
unsigned int nb_substreams
#define AVERROR_EOF
End of file.
uint8_t * data
The data buffer.
enum AVDiscard discard
Selects which packets can be discarded at will and do not need to be demuxed.
static const AVOption mov_options[]
static int mov_codec_id(AVStream *st, uint32_t format)
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
static av_always_inline double av_int2double(uint64_t i)
Reinterpret a 64-bit integer as a double.
static int mov_read_iloc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define AV_PKT_FLAG_DISCARD
Flag is used to discard packets which are required to maintain valid decoder state but are not requir...
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce output
static int mov_read_alac(MOVContext *c, AVIOContext *pb, MOVAtom atom)
struct MOVStreamContext::@492 cenc
static int test_same_origin(const char *src, const char *ref)
static int cbcs_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *sample, uint8_t *input, int size)
uint64_t base_data_offset
AVChannelCustom * map
This member must be used when the channel order is AV_CHANNEL_ORDER_CUSTOM.
int ff_buffer_packet(AVFormatContext *s, AVPacket *pkt)
#define IS_MATRIX_IDENT(matrix)
#define AV_PROFILE_DTS_EXPRESS
int disposition
Stream group disposition - a combination of AV_DISPOSITION_* flags.
static void mov_update_dts_shift(MOVStreamContext *sc, int duration, void *logctx)
AVSphericalMapping * spherical
union AVChannelLayout::@529 u
Details about which channels are present in this layout.
#define AV_CH_TOP_FRONT_RIGHT
unsigned MaxCLL
Max content light level (cd/m^2).
int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen)
void av_encryption_init_info_free(AVEncryptionInitInfo *info)
Frees the given encryption init info object.
int64_t first_discard_sample
If not 0, the first audio sample that should be discarded from the stream.
static int mov_read_avss(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int found_moov
'moov' atom has been found
int ff_iamf_read_packet(AVFormatContext *s, IAMFDemuxContext *c, AVIOContext *pb, int max_size, int stream_id_offset, AVPacket *pkt)
static int mov_read_custom(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static av_cold void cleanup(FlashSV2Context *s)
AVStream ** streams
A list of all streams in the file.
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom, enum AVCodecID codec_id)
@ AVCOL_RANGE_JPEG
Full range content.
unsigned int rap_group_count
void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip)
Flip the input matrix horizontally and/or vertically.
static int mov_read_iref_cdsc(MOVContext *c, AVIOContext *pb, uint32_t type, int version, uint32_t size)
av_cold int av_sha_init(AVSHA *ctx, int bits)
Initialize SHA-1 or SHA-2 hashing.
static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_idat(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int found_mdat
'mdat' atom has been found
uint32_t crypt_byte_block
Only used for pattern encryption.
@ AV_PKT_DATA_ENCRYPTION_INIT_INFO
This side data is encryption initialization data.
static int mov_read_avid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVRational ambient_light_x
Normalized x chromaticity coordinate of the environmental ambient light in the nominal viewing enviro...
int seek_preroll
Number of audio samples to skip after a discontinuity.
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.
static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int * bitrates
bitrates read before streams creation
static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVRational avg_frame_rate
Average framerate.
static const uint16_t table[]
static struct @601 current
static int mov_read_colr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static void set_last_stream_little_endian(AVFormatContext *fc)
static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
An strf atom is a BITMAPINFOHEADER struct.
#define FF_COMPLIANCE_STRICT
Strictly conform to all the things in the spec no matter what consequences.
#define AV_DICT_APPEND
If the entry already exists, append to it.
int error
contains the error code or 0 if no error happened
void av_iamf_mix_presentation_free(AVIAMFMixPresentation **pmix_presentation)
Free an AVIAMFMixPresentation and all its contents.
unsigned int metadata_index
Index of the metadata stream in the AVStreamGroup.
static int mov_parse_auxiliary_info(MOVContext *c, MOVStreamContext *sc, AVIOContext *pb, MOVEncryptionIndex *encryption_index)
static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp, int flags)
static int mov_read_saio(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int64_t mov_get_stsc_samples(MOVStreamContext *sc, unsigned int index)
#define AV_LOG_VERBOSE
Detailed information.
const AVCodecTag ff_codec_wav_tags[]
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_change_extradata(AVStream *st, AVPacket *pkt)
static unsigned int nb_streams
#define AV_CH_TOP_FRONT_LEFT
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...
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
struct AVStreamGroupTREF * tref
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
static const uint8_t fixed_key[]
@ AV_SPHERICAL_EQUIRECTANGULAR_TILE
Video represents a portion of a sphere mapped on a flat surface using equirectangular projection.
uint32_t baseline
The distance between the centres of the lenses of the camera system, in micrometers.
static void mov_current_sample_set(MOVStreamContext *sc, int current_sample)
void ffio_init_read_context(FFIOContext *s, const uint8_t *buffer, int buffer_size)
Wrap a buffer in an AVIOContext for reading.
#define AV_PKT_FLAG_DISPOSABLE
Flag is used to indicate packets that contain frames that can be discarded by the decoder.
enum AVChannelOrder order
Channel order used in this layout.
int vertical
Offset in pixels from the top edge of the canvas where the tile should be placed.
static int mov_read_moov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVRational av_sub_q(AVRational b, AVRational c)
Subtract one rational from another.
static int mov_read_esds(MOVContext *c, AVIOContext *pb, MOVAtom atom)
unsigned int sample_count
int nb_channels
Number of channels in this layout.
@ AV_SPHERICAL_EQUIRECTANGULAR
Video represents a sphere mapped on a flat surface using equirectangular projection.
int ff_dvdclut_yuv_to_rgb(uint32_t *clut, const size_t clut_size)
AVEncryptionInitInfo * av_encryption_init_info_get_side_data(const uint8_t *side_data, size_t side_data_size)
Creates a copy of the AVEncryptionInitInfo that is contained in the given side data.
@ AV_STEREO3D_VIEW_RIGHT
Frame contains only the right view.
int advanced_editlist_autodisabled
int64_t avio_size(AVIOContext *s)
Get the filesize.
size_t av_strlcatf(char *dst, size_t size, const char *fmt,...)
static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom)
@ AV_STEREO3D_VIEW_UNSPEC
Content is unspecified.
static int mov_read_vexu(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
struct AVAESCTR * aes_ctr
static int cenc_filter(MOVContext *mov, AVStream *st, MOVStreamContext *sc, AVPacket *pkt, int current_index)
static int mov_read_sdtp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_jp2h(MOVContext *c, AVIOContext *pb, MOVAtom atom)
@ AV_STEREO3D_UNSPEC
Video is stereoscopic but the packing is unspecified.
static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define OPUS_SEEK_PREROLL_MS
const AVIAMFMixPresentation * cmix
uint8_t * decryption_default_key
static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom)
@ AV_FIELD_BT
Bottom coded first, top displayed first.
#define AV_CH_TOP_BACK_LEFT
int ff_mov_lang_to_iso639(unsigned code, char to[4])
int ff_generate_avci_extradata(AVStream *st)
Generate standard extradata for AVC-Intra based on width/height and field order.
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...
static int mov_add_tref_id(MovTref *tag, uint32_t id)
@ AV_PKT_DATA_DOVI_CONF
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2....
AVRational horizontal_field_of_view
Horizontal field of view, in degrees.
static void skip_bits(GetBitContext *s, int n)
enum AVColorPrimaries color_primaries
uint32_t scheme
The fourcc encryption scheme, in big-endian byte order.
@ AV_STEREO3D_SIDEBYSIDE
Views are next to each other.
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
HEIFItem ** tile_item_list
static int set_icc_profile_from_item(AVPacketSideData **coded_side_data, int *nb_coded_side_data, const HEIFItem *item)
#define AV_CH_TOP_BACK_CENTER
@ AV_FIELD_TT
Top coded_first, top displayed first.
@ AV_STEREO3D_VIEW_PACKED
Frame contains two packed views.
@ AV_SPHERICAL_PARAMETRIC_IMMERSIVE
Parametric Immersive projection (Apple).
#define FF_DVDCLUT_CLUT_LEN
uint32_t skip_byte_block
Only used for pattern encryption.
static int aax_filter(uint8_t *input, int size, MOVContext *c)
@ 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...
const char * av_color_space_name(enum AVColorSpace space)
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.
AVMasteringDisplayMetadata * mastering
#define AV_FOURCC_MAX_STRING_SIZE
@ AV_PKT_DATA_PALETTE
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette.
static int mov_find_tref_id(const MovTref *tag, uint32_t id)
static MovTref * mov_add_tref_tag(MOVStreamContext *sc, uint32_t name)
static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC
static int mov_read_aclr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
AVStreamGroupTileGrid holds information on how to combine several independent images on a single canv...
#define FF_DVDCLUT_CLUT_SIZE
@ AV_STEREO3D_2D
Video is not stereoscopic (and metadata has to be there).
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
static MOVFragmentStreamInfo * get_current_frag_stream_info(MOVFragmentIndex *frag_index)
int coded_width
Width of the canvas.
void av_iamf_audio_element_free(AVIAMFAudioElement **paudio_element)
Free an AVIAMFAudioElement and all its contents.
unsigned int index_entries_allocated_size
static av_cold int read_close(AVFormatContext *ctx)
static int mov_read_amve(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_chap(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
void av_exif_free(AVExifMetadata *ifd)
Frees all resources associated with the given EXIF metadata struct.
#define MOV_TRUN_SAMPLE_DURATION
static double val(void *priv, double ch)
static int set_display_matrix_from_item(AVPacketSideData **coded_side_data, int *nb_coded_side_data, const HEIFItem *item)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
int coded_height
Width of the canvas.
int v_spacing
pasp vSpacing
uint8_t * iv
The initialization vector.
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
int64_t duration
Decoding: duration of the stream, in stream time base.
AVRational ambient_illuminance
Environmental illuminance of the ambient viewing environment in lux.
#define ss(width, name, subs,...)
static int get_key_from_kid(uint8_t *out, int len, MOVContext *c, AVEncryptionInfo *sample)
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
enum AVIAMFAudioElementType audio_element_type
Audio element type as defined in section 3.6 of IAMF.
static int update_frag_index(MOVContext *c, int64_t offset)
size_t auxiliary_info_sample_count
@ AV_FIELD_TB
Top coded first, bottom displayed first.
static int mov_read_pack(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVPacket attached_pic
For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet will contain the attached pictu...
static int mov_read_saiz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES
static int mov_merge_tts_data(MOVContext *mov, AVStream *st, int flags)
#define MOV_TRUN_DATA_OFFSET
AVEncryptionInfo * av_encryption_info_clone(const AVEncryptionInfo *info)
Allocates an AVEncryptionInfo structure with a copy of the given data.
AVAmbientViewingEnvironment * av_ambient_viewing_environment_alloc(size_t *size)
Allocate an AVAmbientViewingEnvironment structure.
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
AVIAMFAudioElement * element
element backs celement iff the AVIAMFAudioElement is owned by this structure.
static int mov_read_ares(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_adrm(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int av_get_bits_per_sample(enum AVCodecID codec_id)
Return codec bits per sample.
enum AVColorTransferCharacteristic color_trc
IAMFAudioElement ** audio_elements
unsigned int avio_rb32(AVIOContext *s)
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define FF_ARRAY_ELEMS(a)
#define AV_PROFILE_UNKNOWN
static void mov_free_encryption_index(MOVEncryptionIndex **index)
#define AV_CH_LOW_FREQUENCY
uint64_t * auxiliary_offsets
Absolute seek position.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
int dts_shift
dts shift when ctts is negative
int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx)
Init a timecode struct with the passed parameters.
int frame_size
Audio frame size, if known.
static int mov_read_srat(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a UTF-16 string from pb and convert it to UTF-8.
static int mov_metadata_track_or_disc_number(MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
static int mov_parse_exif_item(AVFormatContext *s, AVPacketSideData **coded_side_data, int *nb_coded_side_data, const HEIFItem *ref)
#define flags(name, subs,...)
int ff_add_attached_pic(AVFormatContext *s, AVStream *st, AVIOContext *pb, AVBufferRef **buf, int size)
Add an attached pic to an AVStream.
static int add_tts_entry(MOVTimeToSample **tts_data, unsigned int *tts_count, unsigned int *allocated_size, int count, int offset, unsigned int duration)
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.
#define FF_MOV_FLAG_MFRA_PTS
int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb)
static int mov_read_coll(MOVContext *c, AVIOContext *pb, MOVAtom atom)
MOVEncryptionIndex * encryption_index
static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
unsigned int audio_substream_id
#define MOV_TFHD_DEFAULT_BASE_IS_MOOF
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
unsigned int substream_count
#define MOV_TFHD_DEFAULT_DURATION
#define ALAC_EXTRADATA_SIZE
void * av_realloc_array(void *ptr, size_t nmemb, size_t size)
struct AVAES * aes_decrypt
uint32_t bound_top
Distance from the top edge.
int width
The width of the video frame in pixels.
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
#define MOV_TRUN_FIRST_SAMPLE_FLAGS
static double av_q2d(AVRational a)
Convert an AVRational to a double.
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.
#define fc(width, name, range_min, range_max)
static void mov_estimate_video_delay(MOVContext *c, AVStream *st)
int64_t timestamp
Timestamp in AVStream.time_base units, preferably the time from which on correctly decoded frames are...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int64_t min_corrected_pts
minimum Composition time shown by the edits excluding empty edits.
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 mov_read_lhvc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_CH_TOP_SIDE_RIGHT
static AVFormatContext * ctx
static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
@ AV_PKT_DATA_STEREO3D
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int ff_iamfdec_read_descriptors(IAMFContext *c, AVIOContext *pb, int max_size, void *log_ctx)
AVRational display_aspect_ratio
display aspect ratio (0 if unknown)
static AVIndexEntry * mov_find_next_sample(AVFormatContext *s, AVStream **st)
int ff_mov_read_chnl(AVFormatContext *s, AVIOContext *pb, AVStream *st, int version)
Read 'chnl' tag from the input stream.
struct AVStreamGroupTileGrid::@460 * offsets
An nb_tiles sized array of offsets in pixels from the topleft edge of the canvas, indicating where ea...
int min_distance
Minimum distance between this and the previous keyframe, used to avoid unneeded searching.
static int mov_read_dvcc_dvvc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int(* parse)(MOVContext *ctx, AVIOContext *pb, MOVAtom atom)
int nb_coded_side_data
Amount of entries in coded_side_data.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_ddts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_uuid(MOVContext *c, AVIOContext *pb, MOVAtom atom)
struct AVStreamGroupLayeredVideo * layered_video
void av_sha_final(AVSHA *ctx, uint8_t *digest)
Finish hashing and output digest value.
#define MAX_REORDER_DELAY
AVEncryptionInfo ** encrypted_samples
static int mov_read_close(AVFormatContext *s)
int flags
Additional information about the frame packing.
static enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags)
Compute codec id for 'lpcm' tag.
static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#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...
static int mov_read_sample_encryption_info(MOVContext *c, AVIOContext *pb, MOVStreamContext *sc, AVEncryptionInfo **sample, int use_subsamples)
enum AVStreamParseType need_parsing
unsigned int keyframe_count
static int mov_read_SAND(MOVContext *c, AVIOContext *pb, MOVAtom atom)
unsigned int audio_element_id
@ AVDISCARD_ALL
discard all
#define av_realloc_f(p, o, n)
static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom)
MOVIndexRange * index_ranges
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 void set_frag_stream(MOVFragmentIndex *frag_index, int id)
static int mov_read_free(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_realloc_extradata(AVCodecParameters *par, MOVAtom atom)
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define LIBAVUTIL_VERSION_INT
int32_t av_exif_get_tag_id(const char *name)
Retrieves the tag ID associated with the provided tag string name.
@ AV_PKT_DATA_EXIF
Extensible image file format metadata.
static int mov_dts_stream_construction_to_profile(unsigned int sc)
Describe the class of an AVClass context structure.
and forward the result(frame or status change) to the corresponding input. If nothing is possible
static __device__ float fabs(float a)
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
static uint64_t truehd_layout(int chanmap)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
New swscale design to change SwsGraph is what coordinates multiple passes These can include cascaded scaling error diffusion and so on Or we could have separate passes for the vertical and horizontal scaling In between each SwsPass lies a fully allocated image buffer Graph passes may have different levels of e g we can have a single threaded error diffusion pass following a multi threaded scaling pass SwsGraph is internally recreated whenever the image format
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
This describes info used to initialize an encryption key system.
static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int read_image_grid(AVFormatContext *s, const HEIFGrid *grid, AVStreamGroupTileGrid *tile_grid)
struct AVAESCTR * av_aes_ctr_alloc(void)
Allocate an AVAESCTR context.
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.
AVPacketSideData * coded_side_data
Additional data associated with the grid.
Rational number (pair of numerator and denominator).
@ AV_PRIMARY_EYE_LEFT
Left eye.
static int mov_read_sgpd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL
The specified retype target order is ignored and the simplest possible (canonical) order is used for ...
static int mov_probe(const AVProbeData *p)
@ AV_OPT_TYPE_DICT
Underlying C type is AVDictionary*.
static int get_eia608_packet(AVIOContext *pb, AVPacket *pkt, int src_size)
@ AV_CODEC_ID_DVD_SUBTITLE
int64_t time_offset
time offset of the edit list entries
static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom)
const char * av_default_item_name(void *ptr)
Return the context name.
AVRational horizontal_disparity_adjustment
Relative shift of the left and right images, which changes the zero parallax plane.
uint64_t avio_rb64(AVIOContext *s)
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.
MOVIndexRange * current_index_range
static int mov_open_dref(MOVContext *c, AVIOContext **pb, const char *src, MOVDref *ref)
This structure contains the data a format has to probe a file.
struct AVAES * av_aes_alloc(void)
Allocate an AVAES context.
static int mov_read_schm(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define FLAC_STREAMINFO_SIZE
const char * av_color_primaries_name(enum AVColorPrimaries primaries)
#define FF_MOV_FLAG_MFRA_DTS
#define MOV_SAMPLE_DEPENDENCY_NO
#define AV_DICT_DONT_OVERWRITE
Don't overwrite existing entries.
const AVCodecTag ff_codec_movvideo_tags[]
static int mov_read_ilst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define AV_CH_FRONT_CENTER
AVChannelLayout ch_layout
The channel layout and number of channels.
static MOVFragmentStreamInfo * get_frag_stream_info_from_pkt(MOVFragmentIndex *frag_index, AVPacket *pkt, int id)
static uint32_t get_sgpd_sync_index(const MOVStreamContext *sc, int nal_unit_type)
static int mov_read_fiel(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
#define AV_CH_FRONT_LEFT_OF_CENTER
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
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.
#define MOV_TFHD_BASE_DATA_OFFSET
int av_exif_remove_entry(void *logctx, AVExifMetadata *ifd, uint16_t id, int flags)
Remove an entry from the provided EXIF metadata struct.
int open_key_samples_count
const AVCodecTag ff_codec_movaudio_tags[]
const AVCodecTag ff_codec_movdata_tags[]
static int mov_read_wfex(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVStereo3D * av_stereo3d_alloc_size(size_t *size)
Allocate an AVStereo3D structure and set its fields to default values.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int sample_rate
The number of audio samples per second.
static void mov_parse_stsd_subtitle(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc, int64_t size)
static int mov_skip_multiple_stsd(MOVContext *c, AVIOContext *pb, int codec_tag, int format, int64_t size)
@ AV_CODEC_ID_GSM
as in Berlin toast format
int64_t nb_frames
number of frames in this stream if known or 0
AVCodecID
Identify the syntax and semantics of the bitstream.
const AVPacketSideData * av_packet_side_data_get(const AVPacketSideData *sd, int nb_sd, enum AVPacketSideDataType type)
Get side information from a side data array.
unsigned int audio_element_id
The id of the Audio Element this submix element references.
static int should_retry(AVIOContext *pb, int error_code)
int avformat_stream_group_add_stream(AVStreamGroup *stg, AVStream *st)
Add an already allocated stream to a stream group.
@ AV_PKT_DATA_SPHERICAL
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
int extradata_size
Size of the extradata content in bytes.
Submix layout as defined in section 3.7 of IAMF.
static int mov_read_pasp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
DVDemuxContext * dv_demux
enum AVStereo3DPrimaryEye primary_eye
Which eye is the primary eye when rendering in 2D.
static const AVColorPrimariesDesc color_primaries[AVCOL_PRI_NB]
static int mov_read_SA3D(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
uint8_t auxiliary_info_default_size
static int mov_read_header(AVFormatContext *s)
static int mov_read_vdep(MOVContext *c, AVIOContext *pb, MOVAtom atom)
@ AV_SPHERICAL_HALF_EQUIRECTANGULAR
Video frame displays as a 180 degree equirectangular projection.
#define AV_PROFILE_DTS_HD_HRA
static int cbc1_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *sample, uint8_t *input, int size)
unsigned int avio_rl32(AVIOContext *s)
@ AVDISCARD_NONKEY
discard all frames except keyframes
static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom)
@ AV_SPHERICAL_CUBEMAP
Video frame is split into 6 faces of a cube, and arranged on a 3x2 layout.
unsigned int avio_rb24(AVIOContext *s)
static int cens_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *sample, uint8_t *input, int size)
static void mov_free_stream_context(AVFormatContext *s, AVStream *st)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
static int get_current_encryption_info(MOVContext *c, MOVEncryptionIndex **encryption_index, MOVStreamContext **sc)
Gets the current encryption info and associated current stream context.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
int av_aes_ctr_init(struct AVAESCTR *a, const uint8_t *key)
Initialize an AVAESCTR context.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
An AVChannelLayout holds information about the channel layout of audio data.
static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static void mov_current_sample_dec(MOVStreamContext *sc)
uint32_t bound_right
Distance from the right edge.
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
int64_t last_discard_sample
The sample after last sample that is intended to be discarded after first_discard_sample.
#define i(width, name, range_min, range_max)
unsigned int stsz_sample_size
always contains sample size from stsz atom
#define FF_MOV_FLAG_MFRA_AUTO
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
static int64_t start_time
int ff_dvdclut_palette_extradata_cat(const uint32_t *clut, const size_t clut_size, AVCodecParameters *par)
static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen)
Read a string from pb into buf.
static int mov_read_iprp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
void av_sha_update(struct AVSHA *ctx, const uint8_t *data, size_t len)
Update hash value.
static av_const double hypot(double x, double y)
static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define AV_PROFILE_DTS_ES
static AVRational av_make_q(int num, int den)
Create an AVRational.
static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
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,...
#define AV_NOPTS_VALUE
Undefined timestamp value.
#define MKBETAG(a, b, c, d)
char * av_fourcc_make_string(char *buf, uint32_t fourcc)
Fill the provided buffer with a string containing a FourCC (four-character code) representation.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
void av_aes_ctr_set_full_iv(struct AVAESCTR *a, const uint8_t *iv)
Forcefully change the "full" 16-byte iv, including the counter.
struct AVIAMFAudioElement * iamf_audio_element
int profile
Codec-specific bitstream restrictions that the stream conforms to.
AVContentLightMetadata * coll
static int mov_parse_heif_items(AVFormatContext *s)
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 void mov_current_sample_inc(MOVStreamContext *sc)
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
static int mov_read_vexu_proj(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static void fix_timescale(MOVContext *c, MOVStreamContext *sc)
int avio_r8(AVIOContext *s)
IAMFSubStream * substreams
uint32_t padding
Number of pixels to pad from the edge of each cube face.
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrder order, int flags)
Change the AVChannelOrder of a channel layout.
static int mov_parse_dovi_streams(AVFormatContext *s)
int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
Allocate, reallocate an array through a pointer to a pointer.
Information on how to combine one or more audio streams, as defined in section 3.6 of IAMF.
@ AV_PRIMARY_EYE_NONE
Neither eye.
static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
@ AV_TIMECODE_FLAG_24HOURSMAX
timecode wraps after 24 hours
static AVStream * mov_find_reference_track(AVFormatContext *s, AVStream *st, uint32_t *tref_id, int nb_tref_id, int first_index)
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
Ensures that the requested seekback buffer size will be available.
unsigned int nb_tiles
Amount of tiles in the grid.
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.
static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
static int mov_read_infe(MOVContext *c, AVIOContext *pb, MOVAtom atom)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
#define AV_CH_TOP_BACK_RIGHT
size_t auxiliary_offsets_count
int flags
A combination of AV_PKT_FLAG values.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
void av_encryption_info_free(AVEncryptionInfo *info)
Frees the given encryption info object.
static int read_header(FFV1Context *f, RangeCoder *c)
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
#define AV_CH_FRONT_RIGHT_OF_CENTER
This file is part of FFmpeg.
AVBufferRef * av_buffer_alloc(size_t size)
Allocate an AVBuffer of the given size using av_malloc().
MOVFragmentStreamInfo * stream_info
struct AVEncryptionInitInfo * next
An optional pointer to the next initialization info in the list.
#define AV_STEREO3D_FLAG_INVERT
Inverted views, Right/Bottom represents the left view.
AVStream ** streams
A list of streams in the group.
void ff_rfps_calculate(AVFormatContext *ic)
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some input
static int mov_read_clli(MOVContext *c, AVIOContext *pb, MOVAtom atom)
uint32_t * id
trackID of the referenced track
struct AVIAMFMixPresentation * iamf_mix_presentation
size_t size
Size of data in bytes.
MOVFragmentIndexItem * item
#define AV_LOG_INFO
Standard information.
struct IAMFDemuxContext * iamf
#define FFERROR_REDO
Returned by demuxers to indicate that data was consumed but discarded (ignored streams or junk data).
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.
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_aes_ctr_free(struct AVAESCTR *a)
Release an AVAESCTR context.
int error_recognition
Error recognition; higher values will detect more errors but may misdetect some more or less valid pa...
static int mov_read_dfla(MOVContext *c, AVIOContext *pb, MOVAtom atom)
uint64_t count
number of bytes in buffer
@ AV_SPHERICAL_RECTILINEAR
Video frame displays on a flat, rectangular 2D surface.
static const MOVParseTableEntry mov_default_parse_table[]
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel layout
int nb_coded_side_data
Amount of entries in coded_side_data.
static void mov_metadata_creation_time(MOVContext *c, AVIOContext *pb, AVDictionary **metadata, int version)
static int mov_metadata_hmmt(MOVContext *c, AVIOContext *pb, unsigned len)
struct AVSHA * av_sha_alloc(void)
Allocate an AVSHA context.
static int mov_read_tenc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int av_uuid_equal(const AVUUID uu1, const AVUUID uu2)
Compares two UUIDs for equality.
static int mov_stsc_index_valid(unsigned int index, unsigned int count)
static int mov_finalize_packet(AVFormatContext *s, AVStream *st, AVIndexEntry *sample, int64_t current_index, AVPacket *pkt)
static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags)
static const uint32_t mac_to_unicode[128]
int width
Width of the final image for presentation.
unsigned int bytes_per_frame
int32_t roll
Rotation around the forward vector [-180, 180].
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
and forward the test the status of outputs and forward it to the corresponding return FFERROR_NOT_READY If the filters stores internally one or a few frame for some it can consider them to be part of the FIFO and delay acknowledging a status change accordingly Example code
#define AV_CH_SIDE_SURROUND_RIGHT
static int mov_read_trex(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int search_frag_timestamp(AVFormatContext *s, MOVFragmentIndex *frag_index, AVStream *st, int64_t timestamp)
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...
int ff_isom_parse_dvcc_dvvc(void *logctx, AVStream *st, const uint8_t *buf_ptr, uint64_t size)
static int mov_read_pssh(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
@ AV_SPHERICAL_FISHEYE
Fisheye projection (Apple).
int height
The height of the video frame in pixels.
#define AV_TIME_BASE
Internal time base represented as integer.
int block_align
The number of bytes per coded audio frame, required by some formats.
static int rb_size(AVIOContext *pb, int64_t *value, int size)
AVStereo3DPrimaryEye
List of possible primary eyes.
#define av_malloc_array(a, b)
int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
@ AV_FIELD_BB
Bottom coded first, bottom displayed first.
@ AV_PKT_DATA_ICC_PROFILE
ICC profile data consisting of an opaque octet buffer following the format described by ISO 15076-1.
@ AV_STEREO3D_TOPBOTTOM
Views are on top of each other.
Information on how to render and mix one or more AVIAMFAudioElement to generate the final audio outpu...
const char *const ff_id3v1_genre_str[ID3v1_GENRE_MAX+1]
ID3v1 genres.
unsigned int * sample_sizes
MOVFragmentIndex frag_index
static int mov_read_vpcc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int width
Width of the final stream for presentation.
#define AV_CH_BACK_CENTER
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default value
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.
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
static void fix_frag_index_entries(MOVFragmentIndex *frag_index, int index, int id, int entries)
static int mov_finalize_stsd_codec(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc)
static int mov_read_mdcv(MOVContext *c, AVIOContext *pb, MOVAtom atom)
@ AV_TIMECODE_FLAG_ALLOWNEGATIVE
negative time values are allowed
static int mov_read_mdat(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_keys(MOVContext *c, AVIOContext *pb, MOVAtom atom)
enum AVColorRange color_range
Additional colorspace characteristics.
#define MOV_TFHD_DEFAULT_SIZE
int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb, AVCodecParameters *par, int size, int big_endian)
static void fix_stream_ids(AVFormatContext *s)
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
static void mov_build_index(MOVContext *mov, AVStream *st)
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
static int mov_read_svq3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static MovTref * mov_find_tref_tag(const MOVStreamContext *sc, uint32_t name)
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
void * av_calloc(size_t nmemb, size_t size)
@ AV_IAMF_AUDIO_ELEMENT_TYPE_SCENE
enum AVFieldOrder field_order
The order of the fields in interlaced video.
static int mov_read_iinf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
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...
int horizontal
Offset in pixels from the left edge of the canvas where the tile should be placed.
static int64_t get_stream_info_time(MOVFragmentStreamInfo *frag_stream_info)
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 av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
@ AV_TIMECODE_FLAG_DROPFRAME
timecode is drop frame
Undefined Behavior In the C language
AVAmbientViewingEnvironment * ambient
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
static int mov_read_tmcd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define AV_PROFILE_DTS_96_24
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
int id
Format-specific stream ID.
#define AV_LOG_FATAL
Something went wrong and recovery is not possible.
unsigned int nb_encrypted_samples
static int mov_read_senc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
int height
Height of the final image for presentation.
#define FFSWAP(type, a, b)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
uint8_t * key_id
The ID of the key used to encrypt the packet.
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,...
int32_t pitch
Rotation around the right vector [-90, 90].
AVDictionary * metadata
Metadata that applies to the whole group.
unsigned int avio_rb16(AVIOContext *s)
enum AVStereo3DType type
How views are packed within the video.
static const int16_t cdt2[8]
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.
@ AV_AUDIO_SERVICE_TYPE_KARAOKE
static int mov_read_dmlp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define AV_INPUT_BUFFER_PADDING_SIZE
int pseudo_stream_id
-1 means demux all ids
static int mov_read_tfdt(MOVContext *c, AVIOContext *pb, MOVAtom atom)
Tag MUST be and< 10hcoeff half pel interpolation filter coefficients, hcoeff[0] are the 2 middle coefficients[1] are the next outer ones and so on, resulting in a filter like:...eff[2], hcoeff[1], hcoeff[0], hcoeff[0], hcoeff[1], hcoeff[2] ... the sign of the coefficients is not explicitly stored but alternates after each coeff and coeff[0] is positive, so ...,+,-,+,-,+,+,-,+,-,+,... hcoeff[0] is not explicitly stored but found by subtracting the sum of all stored coefficients with signs from 32 hcoeff[0]=32 - hcoeff[1] - hcoeff[2] - ... a good choice for hcoeff and htaps is htaps=6 hcoeff={40,-10, 2} an alternative which requires more computations at both encoder and decoder side and may or may not be better is htaps=8 hcoeff={42,-14, 6,-2}ref_frames minimum of the number of available reference frames and max_ref_frames for example the first frame after a key frame always has ref_frames=1spatial_decomposition_type wavelet type 0 is a 9/7 symmetric compact integer wavelet 1 is a 5/3 symmetric compact integer wavelet others are reserved stored as delta from last, last is reset to 0 if always_reset||keyframeqlog quality(logarithmic quantizer scale) stored as delta from last, last is reset to 0 if always_reset||keyframemv_scale stored as delta from last, last is reset to 0 if always_reset||keyframe FIXME check that everything works fine if this changes between framesqbias dequantization bias stored as delta from last, last is reset to 0 if always_reset||keyframeblock_max_depth maximum depth of the block tree stored as delta from last, last is reset to 0 if always_reset||keyframequant_table quantization tableHighlevel bitstream structure:==============================--------------------------------------------|Header|--------------------------------------------|------------------------------------|||Block0||||split?||||yes no||||......... intra?||||:Block01 :yes no||||:Block02 :....... ..........||||:Block03 ::y DC ::ref index:||||:Block04 ::cb DC ::motion x :||||......... :cr DC ::motion y :||||....... ..........|||------------------------------------||------------------------------------|||Block1|||...|--------------------------------------------|------------ ------------ ------------|||Y subbands||Cb subbands||Cr subbands||||--- ---||--- ---||--- ---|||||LL0||HL0||||LL0||HL0||||LL0||HL0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||LH0||HH0||||LH0||HH0||||LH0||HH0|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HL1||LH1||||HL1||LH1||||HL1||LH1|||||--- ---||--- ---||--- ---||||--- ---||--- ---||--- ---|||||HH1||HL2||||HH1||HL2||||HH1||HL2|||||...||...||...|||------------ ------------ ------------|--------------------------------------------Decoding process:=================------------|||Subbands|------------||||------------|Intra DC||||LL0 subband prediction ------------|\ Dequantization ------------------- \||Reference frames|\ IDWT|------- -------|Motion \|||Frame 0||Frame 1||Compensation . OBMC v -------|------- -------|--------------. \------> Frame n output Frame Frame<----------------------------------/|...|------------------- Range Coder:============Binary Range Coder:------------------- The implemented range coder is an adapted version based upon "Range encoding: an algorithm for removing redundancy from a digitised message." by G. N. N. Martin. The symbols encoded by the Snow range coder are bits(0|1). The associated probabilities are not fix but change depending on the symbol mix seen so far. bit seen|new state ---------+----------------------------------------------- 0|256 - state_transition_table[256 - old_state];1|state_transition_table[old_state];state_transition_table={ 0, 0, 0, 0, 0, 0, 0, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 190, 191, 192, 194, 194, 195, 196, 197, 198, 199, 200, 201, 202, 202, 204, 205, 206, 207, 208, 209, 209, 210, 211, 212, 213, 215, 215, 216, 217, 218, 219, 220, 220, 222, 223, 224, 225, 226, 227, 227, 229, 229, 230, 231, 232, 234, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 0, 0, 0, 0, 0, 0, 0};FIXME Range Coding of integers:------------------------- FIXME Neighboring Blocks:===================left and top are set to the respective blocks unless they are outside of the image in which case they are set to the Null block top-left is set to the top left block unless it is outside of the image in which case it is set to the left block if this block has no larger parent block or it is at the left side of its parent block and the top right block is not outside of the image then the top right block is used for top-right else the top-left block is used Null block y, cb, cr are 128 level, ref, mx and my are 0 Motion Vector Prediction:=========================1. the motion vectors of all the neighboring blocks are scaled to compensate for the difference of reference frames scaled_mv=(mv *(256 *(current_reference+1)/(mv.reference+1))+128)> the median of the scaled left
static int heif_add_stream(MOVContext *c, HEIFItem *item)
static int search_frag_moof_offset(MOVFragmentIndex *frag_index, int64_t offset)
#define AV_DICT_MATCH_CASE
Only get an entry with exact-case key match.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
static int mov_switch_root(AVFormatContext *s, int64_t target, int index)
@ FLAC_METADATA_TYPE_STREAMINFO
This describes encryption info for a packet.
MOVEncryptionIndex * encryption_index
#define MIN_DATA_ENTRY_BOX_SIZE
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.
int index
stream index in AVFormatContext
static int mov_seek_fragment(AVFormatContext *s, AVStream *st, int64_t timestamp)
#define AV_PROFILE_DTS_HD_MA
void ff_configure_buffers_for_index(AVFormatContext *s, int64_t time_tolerance)
static void mov_parse_stsd_video(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc)
const AVCodecTag ff_codec_bmp_tags[]
int h_spacing
pasp hSpacing
static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int64_t get_frag_time(AVFormatContext *s, AVStream *dst_st, MOVFragmentIndex *frag_index, int index)
unsigned int sample_size
may contain value calculated from stsd or value from stsz atom
unsigned int nb_streams
Number of elements in AVStreamGroup.streams.
static int mlp_samplerate(int in)
#define ISOM_DVCC_DVVC_SIZE
static int mov_read_sbgp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
Allocate new information of a packet.
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
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_parse_uuid_spherical(MOVStreamContext *sc, AVIOContext *pb, size_t len)
@ AV_OPT_TYPE_INT
Underlying C type is int.
AVFormatContext * dv_fctx
void av_channel_layout_uninit(AVChannelLayout *channel_layout)
Free any allocated data in the channel layout and reset the channel count to 0.
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
unsigned int aax_mode
'aax' file has been detected
static int mov_read_sv3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
static int mov_aaxc_crypto(MOVContext *c)
static int64_t mov_get_skip_samples(AVStream *st, int sample)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_WB16 unsigned int_TMPL AV_RB8
static int ref[MAX_W *MAX_W]
static int mov_read_cdsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVRational r_frame_rate
Real base framerate of the stream.
int64_t track_end
used for dts generation in fragmented movie files
MOVFragment fragment
current fragment in moof atom
int eof_reached
true if was unable to read due to error or eof
static int mov_metadata_int8_bypass_padding(MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
Filter the word “frame” indicates either a video frame or a group of audio samples
static float mean(const float *input, int size)
static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len)
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
unsigned int per_sample_iv_size
const AVCodecTag ff_codec_movsubtitle_tags[]
AVRational av_mul_q(AVRational b, AVRational c)
Multiply two rationals.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
static void export_orphan_timecode(AVFormatContext *s)
static int mov_read_sbas(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#define AV_CH_FRONT_RIGHT
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.
static int mov_metadata_gnre(MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
@ AV_PKT_DATA_ENCRYPTION_INFO
This side data contains encryption info for how to decrypt the packet.
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
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.
static int mov_read_dpxe(MOVContext *c, AVIOContext *pb, MOVAtom atom)
unsigned int nb_elements
Number of elements in the submix.
#define AVIO_FLAG_READ
read-only
@ AV_PKT_DATA_AUDIO_SERVICE_TYPE
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
AVSphericalMapping * av_spherical_alloc(size_t *size)
Allocate a AVSphericalVideo structure and initialize its fields to default values.
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
static int mov_read_rtmd_track(AVFormatContext *s, AVStream *st)
static int read_probe(const AVProbeData *p)
int bits_per_coded_sample
The number of bits per sample in the codedwords.
static int mov_parse_tiles(AVFormatContext *s)
enum AVStreamGroupParamsType type
Group type.
A reference to a data buffer.
static int mov_read_iref_dimg(MOVContext *c, AVIOContext *pb, int version)
static int mov_read_pcmc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int build_open_gop_key_points(AVStream *st)
static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc)
IAMFMixPresentation ** mix_presentations
int trak_index
Index of the current 'trak'.
static int mov_read_timecode_track(AVFormatContext *s, AVStream *st)
uint32_t bound_left
Distance from the left edge.
static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len, char *dst, int dstlen)
uint8_t * auxiliary_info_sizes
int video_delay
Number of delayed frames.
#define avpriv_request_sample(...)
MOVTimeToSample * tts_data
const VDPAUPixFmtMap * map
AVStreamGroup * avformat_stream_group_create(AVFormatContext *s, enum AVStreamGroupParamsType type, AVDictionary **options)
Add a new empty stream group to a media file.
#define AV_CHANNEL_LAYOUT_MONO
int height
Height of the final image for presentation.
enum AVStereo3DView view
Determines which views are packed.
static int read_tfra(MOVContext *mov, AVIOContext *f)
static int mov_read_hvce(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVRational av_add_q(AVRational b, AVRational c)
Add two rationals.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
@ AV_PKT_DATA_HEVC_CONF
Dolby Vision enhancement-layer HEVC decoder configuration.
AVStereo3DView
List of possible view types.
#define AV_CH_SIDE_SURROUND_LEFT
This structure stores compressed data.
unsigned MaxFALL
Max average light level per frame (cd/m^2).
static int mov_parse_lcevc_streams(AVFormatContext *s)
static int mov_read_hfov(MOVContext *c, AVIOContext *pb, MOVAtom atom)
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
unsigned * stps_data
partial sync sample for mpeg-2 open gop
@ AV_CODEC_ID_ADPCM_IMA_WAV
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
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.
int64_t pos
byte position in stream, -1 if unknown
AVDictionary * decryption_keys
static int mov_metadata_loci(MOVContext *c, AVIOContext *pb, unsigned len)
static int mov_read_eyes(MOVContext *c, AVIOContext *pb, MOVAtom atom)
@ AV_CHAN_AMBISONIC_BASE
Range of channels between AV_CHAN_AMBISONIC_BASE and AV_CHAN_AMBISONIC_END represent Ambisonic compon...
#define MOV_TRUN_SAMPLE_SIZE
uint32_t tmcd_flags
tmcd track flags
static float distance(float x, float y, int band)
static int parse_timecode_in_framenum_format(AVFormatContext *s, AVStream *st, int64_t value, int flags)
uint8_t tmcd_nb_frames
tmcd number of frames per tick / second
Submix element as defined in section 3.7 of IAMF.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
static int mov_parse_cdsc_streams(AVFormatContext *s)
AVStereo3DType
List of possible 3D Types.
const FFInputFormat ff_mov_demuxer
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
uint32_t min_sample_duration
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
const struct MP4TrackKindMapping ff_mov_track_kind_table[]
static AVStream * get_curr_st(MOVContext *c)
Get the current stream in the parsing process.
static uint64_t mov_dts_channel_layout_to_mask(unsigned int code)
unsigned int stts_allocated_size
static int cenc_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *sample, uint8_t *input, int size)
union AVStreamGroup::@461 params
Group type-specific parameters.
#define MKTAG(a, b, c, d)
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
unsigned int sync_group_count
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
unsigned int samples_per_frame
unsigned int tts_allocated_size
static int mov_read_ispe(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVRational ambient_light_y
Normalized y chromaticity coordinate of the environmental ambient light in the nominal viewing enviro...
static int mov_read_iref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVIAMFMixPresentation * mix
mix backs cmix iff the AVIAMFMixPresentation is owned by this structure.
static int mov_read_clap(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_mfra(MOVContext *c, AVIOContext *f)
static int mov_metadata_int8_no_padding(MOVContext *c, AVIOContext *pb, unsigned len, const char *key)
unsigned int idx
Index of the stream in the group this tile references.
static MOVFragmentStreamInfo * get_frag_stream_info(MOVFragmentIndex *frag_index, int index, int id)
AVCodecParameters * codecpar
static int mov_read_kind(MOVContext *c, AVIOContext *pb, MOVAtom atom)
unsigned int el_index
Index of the enhancement layer stream in AVStreamGroup.
#define MOV_TRUN_SAMPLE_CTS
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
#define MOV_ISMV_TTML_TAG
unsigned int mix_presentation_id
int initial_padding
Number of padding audio samples at the start.
static int mov_read_st3d(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_imir(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int is_open_key_sample(const MOVStreamContext *sc, int sample)
static int mov_read_dvc1(MOVContext *c, AVIOContext *pb, MOVAtom atom)
const char * av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
static int64_t mov_read_atom_into_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom, AVCodecParameters *par, uint8_t *buf)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_RB64
int32_t yaw
Rotation around the up vector [-180, 180].
static void mov_read_chapters(AVFormatContext *s)
AVEncryptionInfo * default_encrypted_sample
char * av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum_arg)
Load timecode string in buf.
#define AV_DICT_DONT_STRDUP_KEY
Take ownership of a key that's been allocated with av_malloc() or another memory allocation function.
int64_t next_root_atom
offset of the next root atom
int found_iinf
'iinf' atom has been found
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...
static int cenc_scheme_decrypt(MOVContext *c, MOVStreamContext *sc, AVEncryptionInfo *sample, uint8_t *input, int size)
static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc, int64_t size)
void ff_iamf_read_deinit(IAMFDemuxContext *c)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
uint8_t * av_encryption_init_info_add_side_data(const AVEncryptionInitInfo *info, size_t *side_data_size)
Allocates and initializes side data that holds a copy of the given encryption init info.
#define av_fourcc2str(fourcc)
int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, int64_t size)
Read 'chan' tag from the input stream.
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
static int mov_read_pitm(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
int ffindex
AVStream index.
static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)