Go to the documentation of this file.
32 #include "config_components.h"
82 #define EBML_UNKNOWN_LENGTH UINT64_MAX
83 #define NEEDS_CHECKING 2
87 #define SKIP_THRESHOLD 1024 * 1024
90 #define UNKNOWN_EQUIV 50 * 1024
146 typedef struct Ebml {
437 #define CHILD_OF(parent) { .def = { .n = parent } }
869 "Seek to desired resync point failed. Seeking to "
870 "earliest point available instead.\n");
872 last_pos + 1), SEEK_SET);
908 int max_size, uint64_t *number,
int eof_forbidden)
922 if (!total ||
read > max_size) {
926 "0x00 at pos %"PRId64
" (0x%"PRIx64
") invalid as first byte "
927 "of an EBML number\n",
pos,
pos);
930 "Length %d indicated by an EBML number's first byte 0x%02x "
931 "at pos %"PRId64
" (0x%"PRIx64
") exceeds max length %d.\n",
940 total = (total << 8) |
avio_r8(pb);
955 "Read error at pos. %"PRIu64
" (0x%"PRIx64
")\n",
961 "at pos. %"PRIu64
" (0x%"PRIx64
")\n",
pos,
pos);
976 if (res > 0 && *number + 1 == 1ULL << (7 * res))
986 uint64_t default_value, uint64_t *num)
991 *num = default_value;
997 *num = (*num << 8) |
avio_r8(pb);
1012 *num = default_value;
1019 *num = ((uint64_t)*num << 8) |
avio_r8(pb);
1030 double default_value,
double *num)
1033 *num = default_value;
1035 }
else if (
size == 4) {
1037 }
else if (
size == 8) {
1050 const char *default_value,
char **str)
1055 if (
size == 0 && default_value) {
1121 level->length = length;
1141 *num = unum - ((1LL << (7 * res - 1)) - 1);
1172 *(uint64_t *)dst =
syntax[
i].def.u;
1178 *(
double *) dst =
syntax[
i].def.f;
1211 return id && (
bits + 7) / 8 == (8 -
bits % 8);
1291 "at pos. %"PRIu64
" (0x%"PRIx64
")\n",
pos,
pos);
1298 pos_alt =
pos + res;
1321 "%"PRId64
"\n",
id,
pos);
1331 if ((
unsigned)
list->nb_elem + 1 >= UINT_MAX /
syntax->list_elem_size)
1334 &
list->alloc_elem_size,
1335 (
list->nb_elem + 1) *
syntax->list_elem_size);
1338 list->elem = newelem;
1355 uint64_t elem_end = pos_alt + length,
1358 if (elem_end < level_end) {
1360 }
else if (elem_end == level_end) {
1364 "Element at 0x%"PRIx64
" ending at 0x%"PRIx64
" exceeds "
1365 "containing master element ending at 0x%"PRIx64
"\n",
1366 pos, elem_end, level_end);
1373 "at 0x%"PRIx64
" inside parent with finite size\n",
pos);
1383 "Found unknown-length element 0x%"PRIX32
" other than "
1384 "a cluster at 0x%"PRIx64
". Spec-incompliant, but "
1385 "parsing will nevertheless be attempted.\n",
id,
pos);
1392 if (max_lengths[
syntax->type] && length > max_lengths[
syntax->type]) {
1395 "Invalid length 0x%"PRIx64
" > 0x%"PRIx64
" for element "
1396 "with ID 0x%"PRIX32
" at 0x%"PRIx64
"\n",
1397 length, max_lengths[
syntax->type],
id,
pos);
1400 "Element with ID 0x%"PRIX32
" at pos. 0x%"PRIx64
" has "
1401 "unknown length, yet the length of an element of its "
1402 "type must be known.\n",
id,
pos);
1405 "Found unknown-length element with ID 0x%"PRIX32
" at "
1406 "pos. 0x%"PRIx64
" for which no syntax for parsing is "
1407 "available.\n",
id,
pos);
1444 "Unknown element %"PRIX32
" at pos. 0x%"PRIx64
" with "
1445 "length 0x%"PRIx64
" considered as invalid data. Last "
1446 "known good position 0x%"PRIx64
", %d unknown elements"
1492 if (!level1_elem->
pos) {
1495 }
else if (level1_elem->
pos !=
pos)
1513 if ((res2 =
avio_skip(pb, length - 1)) >= 0) {
1552 if (elem->
count != UINT_MAX)
1575 void *data_off = (
char *)
data +
syntax[
i].data_offset;
1586 if (
syntax[
i].list_elem_size) {
1588 char *ptr =
list->elem;
1589 for (j = 0; j <
list->nb_elem;
1590 j++, ptr +=
syntax[
i].list_elem_size)
1594 list->alloc_elem_size = 0;
1609 int len_mask = 0x80,
size = 1, n = 1,
i;
1617 while (
size <= 8 && !(total & len_mask)) {
1623 total &= (len_mask - 1);
1625 total = (total << 8) | p->
buf[4 + n++];
1627 if (total + 1 == 1ULL << (7 *
size)){
1642 if (total < probelen)
1644 for (n = 4 +
size; n <= 4 +
size + total - probelen; n++)
1660 if (tracks[
i].num == num)
1671 uint8_t *
data = *buf;
1672 int isize = *buf_size;
1673 uint8_t *pkt_data =
NULL;
1675 int pkt_size = isize;
1679 if (pkt_size >= 10000000
U)
1682 switch (encodings[0].compression.algo) {
1688 if (header_size && !
header) {
1696 pkt_size = isize + header_size;
1701 memcpy(pkt_data,
header, header_size);
1702 memcpy(pkt_data + header_size,
data, isize);
1708 olen = pkt_size *= 3;
1715 pkt_data = newpktdata;
1727 z_stream zstream = { 0 };
1728 if (!pkt_size || inflateInit(&zstream) != Z_OK)
1730 zstream.next_in =
data;
1731 zstream.avail_in = isize;
1736 inflateEnd(&zstream);
1740 pkt_data = newpktdata;
1741 zstream.avail_out = pkt_size - zstream.total_out;
1742 zstream.next_out = pkt_data + zstream.total_out;
1744 }
while (
result == Z_OK && pkt_size < 10000000);
1745 pkt_size = zstream.total_out;
1746 inflateEnd(&zstream);
1747 if (
result != Z_STREAM_END) {
1748 if (
result == Z_MEM_ERROR)
1760 bz_stream bzstream = { 0 };
1761 if (!pkt_size || BZ2_bzDecompressInit(&bzstream, 0, 0) != BZ_OK)
1763 bzstream.next_in =
data;
1764 bzstream.avail_in = isize;
1769 BZ2_bzDecompressEnd(&bzstream);
1773 pkt_data = newpktdata;
1774 bzstream.avail_out = pkt_size - bzstream.total_out_lo32;
1775 bzstream.next_out = pkt_data + bzstream.total_out_lo32;
1776 result = BZ2_bzDecompress(&bzstream);
1777 }
while (
result == BZ_OK && pkt_size < 10000000);
1778 pkt_size = bzstream.total_out_lo32;
1779 BZ2_bzDecompressEnd(&bzstream);
1780 if (
result != BZ_STREAM_END) {
1781 if (
result == BZ_MEM_ERROR)
1797 *buf_size = pkt_size;
1812 for (
i = 0;
i <
list->nb_elem;
i++) {
1813 const char *lang = tags[
i].
lang &&
1814 strcmp(tags[
i].lang,
"und") ? tags[
i].
lang :
NULL;
1816 if (!tags[
i].
name) {
1824 if (tags[
i].def || !lang) {
1826 if (tags[
i].sub.nb_elem)
1833 if (tags[
i].sub.nb_elem)
1847 if (tags[
i].target.attachuid) {
1851 if (attachment[j].
uid == tags[
i].target.attachuid &&
1852 attachment[j].stream) {
1854 &attachment[j].stream->metadata,
NULL);
1860 "The tags at index %d refer to a "
1861 "non-existent attachment %"PRId64
".\n",
1862 i, tags[
i].target.attachuid);
1864 }
else if (tags[
i].target.chapteruid) {
1868 if (chapter[j].
uid == tags[
i].target.chapteruid &&
1869 chapter[j].chapter) {
1871 &chapter[j].chapter->metadata,
NULL);
1877 "The tags at index %d refer to a non-existent chapter "
1879 i, tags[
i].target.chapteruid);
1881 }
else if (tags[
i].target.trackuid) {
1885 if (track[j].
uid == tags[
i].target.trackuid &&
1888 &track[j].stream->metadata,
NULL);
1894 "The tags at index %d refer to a non-existent track "
1896 i, tags[
i].target.trackuid);
1900 tags[
i].target.type);
1919 "Max EBML element depth (%d) reached, "
1952 for (
i = 0;
i < seekhead_list->
nb_elem;
i++) {
1954 uint32_t
id = seekheads[
i].
id;
1962 if (!elem || elem->
parsed)
1985 uint64_t index_scale = 1;
1991 index_list = &matroska->
index;
2002 for (j = 0; j < pos_list->
nb_elem; j++) {
2005 if (track && track->
stream)
2034 unsigned nb_encodings,
2036 char **key_id_base64,
void *logctx)
2038 if (nb_encodings > 1) {
2040 "Multiple combined encodings not supported\n");
2045 if (encodings->
type) {
2051 if (!*key_id_base64)
2058 encodings->
scope = 0;
2070 encodings->
scope = 0;
2081 "Failed to decode codec private data\n");
2099 encodings->
scope & 1 &&
2109 static const char *
const aac_profiles[] = {
"MAIN",
"LC",
"SSR" };
2155 int block_last, block_type, block_size;
2161 if (block_size >
size)
2170 chmask =
av_dict_get(dict,
"WAVEFORMATEXTENSIBLE_CHANNEL_MASK",
NULL, 0);
2175 "Invalid value of WAVEFORMATEXTENSIBLE_CHANNEL_MASK\n");
2191 int minor, micro, bttb = 0;
2195 if (matroska->
muxingapp && sscanf(matroska->
muxingapp,
"Lavf57.%d.%d", &minor, µ) == 2)
2196 bttb = (minor >= 36 && minor <= 51 && micro >= 100);
2198 switch (field_order) {
2217 int *h_width,
int *h_height)
2219 switch (stereo_mode) {
2243 static const struct {
2246 } stereo_mode_conv [] = {
2247 #define STEREO_MODE_CONV(STEREOMODETYPE, STEREO3DTYPE, FLAGS, WDIV, HDIV, WEBM) \
2248 [(STEREOMODETYPE)] = { .type = (STEREO3DTYPE), .flags = (FLAGS) },
2249 #define NOTHING(STEREOMODETYPE, WDIV, HDIV, WEBM)
2258 stereo->
type = stereo_mode_conv[stereo_mode].type;
2259 stereo->
flags = stereo_mode_conv[stereo_mode].flags;
2273 int has_mastering_primaries, has_mastering_luminance;
2278 mastering_meta = &
color->mastering_meta;
2280 has_mastering_primaries =
2281 mastering_meta->
r_x > 0 && mastering_meta->
r_y > 0 &&
2282 mastering_meta->
g_x > 0 && mastering_meta->
g_y > 0 &&
2283 mastering_meta->
b_x > 0 && mastering_meta->
b_y > 0 &&
2307 (
color->chroma_siting_vert - 1) << 7);
2323 if (has_mastering_primaries || has_mastering_luminance) {
2333 if (has_mastering_primaries) {
2344 if (has_mastering_luminance) {
2358 double pitch = proj->
pitch, yaw = proj->
yaw, roll = proj->
roll;
2362 if (pitch == 0.0 && yaw == 0.0 && roll == 0.0)
2367 if (pitch != 0.0 || (yaw != 0.0 && yaw != 180.0 && yaw != -180.0) ||
2370 "projection in stream %u (yaw %f, pitch %f, roll %f)\n",
2371 st->
index, yaw, pitch, roll);
2400 const uint8_t *priv_data = mkv_projection->
private.
data;
2402 size_t spherical_size;
2403 uint32_t l = 0, t = 0,
r = 0,
b = 0;
2404 uint32_t padding = 0;
2406 if (mkv_projection->
private.
size && priv_data[0] != 0) {
2421 if (
b >= UINT_MAX - t ||
r >= UINT_MAX - l) {
2423 "Invalid bounding rectangle coordinates "
2424 "%"PRIu32
",%"PRIu32
",%"PRIu32
",%"PRIu32
"\n",
2433 if (l || t ||
r ||
b)
2446 "Unknown spherical cubemap layout %"PRIu32
"\n",
layout);
2450 padding =
AV_RB32(priv_data + 8);
2458 "Unknown spherical metadata type %"PRIu64
"\n",
2501 for (
int i = 0;
i < mappings_list->
nb_elem;
i++) {
2505 switch (mapping->
type) {
2508 "Explicit block Addition Mapping type \"Use BlockAddIDValue\", value %"PRIu64
","
2509 " name \"%s\" found.\n", mapping->
value, mapping->
name ? mapping->
name :
"");
2517 "Invalid Block Addition Value 0x%"PRIx64
" for Block Addition Mapping Type "
2518 "0x%"PRIx64
", name \"%s\"\n", mapping->
value, mapping->
type,
2519 mapping->
name ? mapping->
name :
"");
2532 "Unknown Block Addition Mapping type 0x%"PRIx64
", value %"PRIu64
", name \"%s\"\n",
2534 if (mapping->
value < 2) {
2537 "Invalid Block Addition value 0x%"PRIu64
" for unknown Block Addition Mapping "
2538 "type %"PRIx64
", name \"%s\"\n", mapping->
value, mapping->
type,
2539 mapping->
name ? mapping->
name :
"");
2585 #define AAC_MAX_EXTRADATA_SIZE 5
2586 #define TTA_EXTRADATA_SIZE 22
2587 #define WAVPACK_EXTRADATA_SIZE 2
2596 int extradata_size = 0;
2599 if (!strcmp(track->
codec_id,
"A_MS/ACM") &&
2610 }
else if (!strcmp(track->
codec_id,
"A_QUICKTIME") &&
2615 uint16_t sample_size;
2622 if (sample_size == 8) {
2625 }
else if (sample_size == 16) {
2631 fourcc ==
MKTAG(
's',
'o',
'w',
't')) && sample_size == 8)
2674 extradata[0] = (
profile << 3) | ((sri & 0x0E) >> 1);
2675 extradata[1] = ((sri & 0x01) << 7) | (track->
audio.
channels << 3);
2676 if (strstr(track->
codec_id,
"SBR")) {
2678 extradata[2] = 0x56;
2679 extradata[3] = 0xE5;
2680 extradata[4] = 0x80 | (sri << 3);
2707 "Too large audio channel number %"PRIu64
2708 " or bitdepth %"PRIu64
". Skipping track.\n",
2719 bytestream_put_be32(&ptr,
AV_RB32(
"TTA1"));
2720 bytestream_put_le16(&ptr, 1);
2747 flavor = bytestream_get_be16(&ptr);
2766 static const int sipr_bit_rate[4] = { 6504, 8496, 5000, 16000 };
2770 par->
bit_rate = sipr_bit_rate[flavor];
2775 *extradata_offset = 78;
2801 "in absence of valid CodecPrivate.\n");
2808 if (extradata_size > 0) {
2812 memcpy(par->
extradata, extradata, extradata_size);
2828 s, extradata_offset);
2850 (
AVRational){1, par->codec_id == AV_CODEC_ID_OPUS ?
2851 48000 : par->sample_rate});
2865 int *extradata_offset)
2867 if (!strcmp(track->
codec_id,
"V_MS/VFW/FOURCC") &&
2877 *extradata_offset = 40;
2879 }
else if (!strcmp(track->
codec_id,
"V_QUICKTIME") &&
2914 *extradata_offset = 26;
2934 int *extradata_offset)
2938 int display_width_mul = 1;
2939 int display_height_mul = 1;
2961 &display_width_mul, &display_height_mul);
2980 #if FF_API_R_FRAME_RATE
3002 snprintf(buf,
sizeof(buf),
"%s_%d",
3005 if (
planes[j].
uid == tracks[k].
uid && tracks[k].stream) {
3007 "stereo_mode", buf, 0);
3041 switch (data_component_id) {
3045 if (component_tag >= 0x30 && component_tag <= 0x37) {
3052 if (component_tag == 0x87) {
3062 "Unknown ARIB caption profile utilized: %02x / %04x\n",
3063 component_tag, data_component_id);
3069 if (!strcmp(track->
codec_id,
"D_WEBVTT/CAPTIONS")) {
3071 }
else if (!strcmp(track->
codec_id,
"D_WEBVTT/DESCRIPTIONS")) {
3073 }
else if (!strcmp(track->
codec_id,
"D_WEBVTT/METADATA")) {
3093 int extradata_offset = 0;
3095 char* key_id_base64 =
NULL;
3103 "Unknown or unsupported track type %"PRIu64
"\n",
3122 "Invalid sample rate %f, defaulting to 8000 instead.\n",
3130 if (default_duration > UINT64_MAX || default_duration < 0) {
3132 "Invalid frame rate %e. Cannot calculate default duration.\n",
3148 track, &key_id_base64, matroska->
ctx);
3182 if (key_id_base64) {
3188 if (strcmp(track->
language,
"und"))
3194 "Track TimestampScale too small %f, assuming 1.0.\n",
3203 1000 * 1000 * 1000);
3216 s, &extradata_offset);
3240 "Unknown/unsupported AVCodecID %s.\n", track->
codec_id);
3267 uint64_t max_start = 0;
3282 ebml.
max_size >
sizeof(uint64_t) ||
3286 "EBML version %"PRIu64
", doctype %s, doc version %"PRIu64,
3292 "EBML header using unsupported features\n"
3293 "(EBML version %"PRIu64
", doctype %s, doc version %"PRIu64
")\n",
3347 attachments = attachments_list->
elem;
3348 for (j = 0; j < attachments_list->
nb_elem; j++) {
3349 if (!(attachments[j].filename && attachments[j].mime &&
3350 attachments[j].bin.data && attachments[j].bin.size > 0)) {
3369 attachments[j].
stream = st;
3380 attachments[j].bin.size);
3392 chapters = chapters_list->
elem;
3395 (max_start == 0 || chapters[
i].start > max_start)) {
3401 max_start = chapters[
i].
start;
3449 uint32_t lace_size[256],
int *laces)
3452 uint8_t *
data = *buf;
3456 lace_size[0] =
size;
3472 for (n = 0; n < *laces - 1; n++) {
3480 lace_size[n] +=
temp;
3483 }
while (
temp == 0xff);
3488 lace_size[n] =
size - total;
3493 if (
size % (*laces))
3495 for (n = 0; n < *laces; n++)
3496 lace_size[n] =
size / *laces;
3513 total = lace_size[0] = num;
3515 for (n = 1; n < *laces - 1; n++) {
3521 if (lace_size[n - 1] + snum > (uint64_t)INT_MAX)
3524 lace_size[n] = lace_size[n - 1] + snum;
3525 total += lace_size[n];
3533 lace_size[*laces - 1] =
size - total;
3545 uint8_t *
data,
int size, uint64_t timecode,
3560 if (
size < cfs *
h / 2) {
3562 "Corrupt int4 RM-style audio packet size\n");
3565 for (x = 0; x <
h / 2; x++)
3566 memcpy(track->
audio.
buf + x * 2 *
w + y * cfs,
3567 data + x * cfs, cfs);
3571 "Corrupt sipr RM-style audio packet size\n");
3578 "Corrupt generic RM-style audio packet size\n");
3581 for (x = 0; x <
w /
sps; x++)
3583 sps * (
h * x + ((
h + 1) / 2) * (y & 1) + (y >> 1)),
3624 uint8_t *dst =
NULL;
3642 while (srclen >= 8) {
3652 multiblock = (
flags & 0x1800) != 0x1800;
3664 if (blocksize > srclen) {
3675 dstlen += blocksize + 32;
3686 memcpy(dst +
offset + 32,
src, blocksize);
3689 srclen -= blocksize;
3690 offset += blocksize + 32;
3709 int dstlen = *
size + 8;
3717 memcpy(dst + 8, *
data, dstlen - 8);
3729 uint8_t *
data,
int data_len,
3735 uint8_t *
id, *settings, *text, *buf;
3736 int id_len, settings_len, text_len;
3744 q =
data + data_len;
3749 if (*p ==
'\r' || *p ==
'\n') {
3758 if (p >= q || *p !=
'\n')
3765 if (*p ==
'\r' || *p ==
'\n') {
3766 settings_len = p - settings;
3774 if (p >= q || *p !=
'\n')
3780 while (text_len > 0) {
3781 const int len = text_len - 1;
3782 const uint8_t
c = p[
len];
3783 if (
c !=
'\r' &&
c !=
'\n')
3796 memcpy(
pkt->
data, text, text_len);
3806 memcpy(buf,
id, id_len);
3809 if (settings_len > 0) {
3817 memcpy(buf, settings, settings_len);
3843 const uint8_t *
data,
int size, uint64_t
id)
3853 "BlockAddID %"PRIu64
" is higher than the reported MaxBlockAdditionID %"PRIu64
" "
3860 for (
int i = 0;
i < mappings_list->
nb_elem;
i++) {
3861 if (
id != mappings[
i].
value)
3863 mapping = &mappings[
i];
3867 if (
id != 1 && !matroska->
is_webm && !mapping) {
3872 if (mapping && mapping->
type)
3878 int country_code, provider_code;
3879 int provider_oriented_code, application_identifier;
3880 size_t hdrplus_size;
3889 country_code = bytestream2_get_byteu(&bc);
3890 provider_code = bytestream2_get_be16u(&bc);
3896 provider_oriented_code = bytestream2_get_be16u(&bc);
3897 application_identifier = bytestream2_get_byteu(&bc);
3899 if (provider_oriented_code != 1 || application_identifier != 4)
3909 (uint8_t *)hdrplus, hdrplus_size)) < 0) {
3934 uint64_t timecode, uint64_t lace_duration,
3939 uint8_t *pkt_data =
data;
3947 "Error parsing a wavpack block.\n");
3960 "Error parsing a prores block.\n");
3968 if (!pkt_size && !nb_blockmore)
3974 "Unexpected BlockAdditions found in a Block from Track with TrackNumber %"PRIu64
" "
3975 "where MaxBlockAdditionID is 0\n", track->
num);
3998 for (
int i = 0;
i < nb_blockmore;
i++) {
4012 if (discard_padding) {
4023 if (discard_padding > 0) {
4024 AV_WL32(side_data + 4, discard_padding);
4026 AV_WL32(side_data, -discard_padding);
4064 uint32_t lace_size[256];
4065 int n,
flags, laces = 0;
4067 int trust_default_duration;
4079 if (!track ||
size < 3)
4082 if (!(st = track->
stream)) {
4084 "No stream associated to TrackNumber %"PRIu64
". "
4085 "Ignoring Block with this TrackNumber.\n", num);
4091 if (block_duration > INT64_MAX)
4092 block_duration = INT64_MAX;
4101 if (cluster_time != (uint64_t) -1 &&
4102 (block_time >= 0 || cluster_time >= -block_time)) {
4103 uint64_t timecode_cluster_in_track_tb = (
double) cluster_time / track->
time_scale;
4106 timecode < track->end_timecode)
4124 else if (!
ffstream(st)->skip_to_keyframe) {
4131 &pb.
pub, lace_size, &laces);
4142 trust_default_duration = 0;
4146 if (!block_duration && trust_default_duration)
4149 if (cluster_time != (uint64_t)-1 && (block_time >= 0 || cluster_time >= -block_time))
4153 for (n = 0; n < laces; n++) {
4154 int64_t lace_duration = block_duration*(n+1) / laces - block_duration*n / laces;
4155 uint8_t *out_data =
data;
4180 timecode, lace_duration,
4190 blockmore, nb_blockmore,
4197 timecode = lace_duration ? timecode + lace_duration :
AV_NOPTS_VALUE;
4229 if (res >= 0 &&
block->bin.size > 0) {
4236 block->blockmore.nb_elem, cluster->
pos,
4237 block->discard_padding);
4247 "end of segment.\n");
4283 AVStream *st =
s->streams[stream_index];
4362 #if CONFIG_WEBM_DASH_MANIFEST_DEMUXER
4384 return (CueDesc) {-1, -1, -1, -1};
4385 for (
i = 1;
i < nb_index_entries;
i++) {
4386 if (index_entries[
i - 1].timestamp * matroska->
time_scale <= ts &&
4387 index_entries[
i].timestamp * matroska->
time_scale > ts) {
4392 if (index_entries[
i].timestamp > matroska->
duration)
4393 return (CueDesc) {-1, -1, -1, -1};
4396 if (
i != nb_index_entries - 1) {
4415 int64_t cluster_pos, before_pos;
4428 uint64_t cluster_id, cluster_length;
4434 if (
read < 0 || cluster_id != 0xF43B675)
4448 cluster_pos += 4 +
read + cluster_length;
4461 static int buffer_size_after_time_downloaded(
int64_t time_ns,
double search_sec,
int64_t bps,
4462 double min_buffer,
double*
buffer,
4466 double nano_seconds_per_second = 1000000000.0;
4467 double time_sec = time_ns / nano_seconds_per_second;
4469 int64_t time_to_search_ns = (
int64_t)(search_sec * nano_seconds_per_second);
4470 int64_t end_time_ns = time_ns + time_to_search_ns;
4471 double sec_downloaded = 0.0;
4472 CueDesc desc_curr = get_cue_desc(
s, time_ns, cues_start);
4473 if (desc_curr.start_time_ns == -1)
4475 *sec_to_download = 0.0;
4478 if (time_ns > desc_curr.start_time_ns) {
4479 int64_t cue_nano = desc_curr.end_time_ns - time_ns;
4480 double percent = (
double)(cue_nano) / (desc_curr.end_time_ns - desc_curr.start_time_ns);
4481 double cueBytes = (desc_curr.end_offset - desc_curr.start_offset) * percent;
4482 double timeToDownload = (cueBytes * 8.0) /
bps;
4484 sec_downloaded += (cue_nano / nano_seconds_per_second) - timeToDownload;
4485 *sec_to_download += timeToDownload;
4488 if (desc_curr.end_time_ns >= end_time_ns) {
4489 double desc_end_time_sec = desc_curr.end_time_ns / nano_seconds_per_second;
4490 double percent_to_sub = search_sec / (desc_end_time_sec - time_sec);
4491 sec_downloaded = percent_to_sub * sec_downloaded;
4492 *sec_to_download = percent_to_sub * *sec_to_download;
4495 if ((sec_downloaded + *
buffer) <= min_buffer) {
4500 desc_curr = get_cue_desc(
s, desc_curr.end_time_ns, cues_start);
4503 while (desc_curr.start_time_ns != -1) {
4504 int64_t desc_bytes = desc_curr.end_offset - desc_curr.start_offset;
4505 int64_t desc_ns = desc_curr.end_time_ns - desc_curr.start_time_ns;
4506 double desc_sec = desc_ns / nano_seconds_per_second;
4507 double bits = (desc_bytes * 8.0);
4508 double time_to_download =
bits /
bps;
4510 sec_downloaded += desc_sec - time_to_download;
4511 *sec_to_download += time_to_download;
4513 if (desc_curr.end_time_ns >= end_time_ns) {
4514 double desc_end_time_sec = desc_curr.end_time_ns / nano_seconds_per_second;
4515 double percent_to_sub = search_sec / (desc_end_time_sec - time_sec);
4516 sec_downloaded = percent_to_sub * sec_downloaded;
4517 *sec_to_download = percent_to_sub * *sec_to_download;
4519 if ((sec_downloaded + *
buffer) <= min_buffer)
4524 if ((sec_downloaded + *
buffer) <= min_buffer) {
4529 desc_curr = get_cue_desc(
s, desc_curr.end_time_ns, cues_start);
4547 double bandwidth = 0.0;
4550 int64_t prebuffer_ns = 1000000000;
4552 double nano_seconds_per_second = 1000000000.0;
4554 double prebuffer_bytes = 0.0;
4555 int64_t temp_prebuffer_ns = prebuffer_ns;
4557 double pre_sec, prebuffer, bits_per_second;
4558 CueDesc desc_beg = get_cue_desc(
s, time_ns, cues_start);
4560 CueDesc desc_end = desc_beg;
4562 if (time_ns > INT64_MAX - prebuffer_ns)
4564 prebuffered_ns = time_ns + prebuffer_ns;
4568 while (desc_end.start_time_ns != -1 && desc_end.end_time_ns < prebuffered_ns) {
4570 prebuffer_bytes += desc_end.end_offset - desc_end.start_offset;
4571 temp_prebuffer_ns -= desc_end.end_time_ns - desc_end.start_time_ns;
4572 desc_end = get_cue_desc(
s, desc_end.end_time_ns, cues_start);
4574 if (desc_end.start_time_ns == -1) {
4578 bits_per_second = 0.0;
4582 pre_bytes = desc_end.end_offset - desc_end.start_offset;
4583 pre_ns = desc_end.end_time_ns - desc_end.start_time_ns;
4586 pre_sec = pre_ns / nano_seconds_per_second;
4588 pre_bytes * ((temp_prebuffer_ns / nano_seconds_per_second) / pre_sec);
4590 prebuffer = prebuffer_ns / nano_seconds_per_second;
4593 bits_per_second = 0.0;
4595 int64_t desc_bytes = desc_end.end_offset - desc_beg.start_offset;
4596 int64_t desc_ns = desc_end.end_time_ns - desc_beg.start_time_ns;
4597 double desc_sec, calc_bits_per_second, percent, mod_bits_per_second;
4598 if (desc_bytes <= 0)
4601 desc_sec = desc_ns / nano_seconds_per_second;
4602 calc_bits_per_second = (desc_bytes * 8) / desc_sec;
4605 percent = (desc_bytes - prebuffer_bytes) / desc_bytes;
4606 mod_bits_per_second = calc_bits_per_second * percent;
4608 if (prebuffer < desc_sec) {
4615 const double min_buffer = 0.0;
4616 double buffer = prebuffer;
4617 double sec_to_download = 0.0;
4619 int rv = buffer_size_after_time_downloaded(prebuffered_ns, search_sec,
bps,
4620 min_buffer, &
buffer, &sec_to_download,
4624 }
else if (rv == 0) {
4630 desc_end = get_cue_desc(
s, desc_end.end_time_ns, cues_start);
4631 }
while (desc_end.start_time_ns != -1);
4633 if (bandwidth < bits_per_second) bandwidth = bits_per_second;
4647 int64_t cues_start = -1, cues_end = -1, before_pos, bandwidth;
4656 if (
i >= seekhead_list->
nb_elem)
return -1;
4660 if (
avio_seek(matroska->
ctx->
pb, cues_start, SEEK_SET) == cues_start) {
4664 uint64_t cues_length, cues_id;
4672 cues_end = cues_start + 4 + bytes_read + cues_length - 1;
4675 if (cues_start == -1 || cues_end == -1)
return -1;
4691 if (cues_start <= init_range)
4695 bandwidth = webm_dash_manifest_compute_bandwidth(
s, cues_start);
4696 if (bandwidth < 0)
return -1;
4712 bprint.str[--bprint.len] =
'\0';
4751 buf = strrchr(
s->url,
'/');
4760 ret = webm_dash_manifest_cues(
s, init_range);
4780 #define OFFSET(x) offsetof(MatroskaDemuxContext, x)
4795 .
p.
name =
"webm_dash_manifest",
4807 .
p.
name =
"matroska,webm",
4809 .p.extensions =
"mkv,mk3d,mka,mks,webm",
4810 .p.mime_type =
"audio/webm,audio/x-matroska,video/webm,video/x-matroska",
#define MATROSKA_ID_ENCODINGENCRYPTION
AVChapter * avpriv_new_chapter(AVFormatContext *s, int64_t id, AVRational time_base, int64_t start, int64_t end, const char *title)
Add a new chapter.
#define MATROSKA_ID_TAGTARGETS_ATTACHUID
#define MATROSKA_ID_CHAPCOUNTRY
static EbmlSyntax matroska_block_addition_mapping[5]
static int ebml_read_master(MatroskaDemuxContext *matroska, uint64_t length, int64_t pos)
static int ebml_read_binary(AVIOContext *pb, int length, int64_t pos, EbmlBin *bin)
@ 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.
#define MATROSKA_ID_VIDEODISPLAYUNIT
static const CodecMime mkv_image_mime_tags[]
static int matroska_parse_laces(MatroskaDemuxContext *matroska, uint8_t **buf, int size, int type, AVIOContext *pb, uint32_t lace_size[256], int *laces)
#define MATROSKA_ID_CODECPRIVATE
#define MATROSKA_ID_TRACKNUMBER
#define MATROSKA_ID_TRACKFLAGVISUALIMPAIRED
@ MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_RL
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_BPRINT_SIZE_UNLIMITED
#define MATROSKA_ID_CHAPSTRING
#define MATROSKA_BLOCK_ADD_ID_OPAQUE
#define MATROSKA_ID_ENCODINGSIGHASHALGO
int avpriv_packet_list_put(PacketList *packet_buffer, AVPacket *pkt, int(*copy)(AVPacket *dst, const AVPacket *src), int flags)
Append an AVPacket to the list.
#define MATROSKA_ID_TAGTARGETS
AVSphericalProjection
Projection of the video surface(s) on a sphere.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
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
#define MATROSKA_ID_CLUSTERTIMECODE
int avpriv_packet_list_get(PacketList *pkt_buffer, AVPacket *pkt)
Remove the oldest AVPacket in the list and return it.
static EbmlSyntax matroska_attachment[]
#define AV_EF_EXPLODE
abort decoding on minor error detection
static EbmlSyntax ebml_header[]
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
#define MATROSKA_ID_TITLE
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 int matroska_parse_block_additional(MatroskaDemuxContext *matroska, MatroskaTrack *track, AVPacket *pkt, const uint8_t *data, int size, uint64_t id)
static int matroska_parse_tracks(AVFormatContext *s)
enum AVMediaType codec_type
General type of the encoded data.
enum AVSphericalProjection projection
Projection type.
MatroskaTrackOperation operation
uint32_t bound_bottom
Distance from the bottom edge.
#define MATROSKA_ID_CODECDECODEALL
void ff_rm_reorder_sipr_data(uint8_t *buf, int sub_packet_h, int framesize)
Perform 4-bit block reordering for SIPR data.
#define MATROSKA_ID_VIDEOCOLORMASTERINGMETA
static int ebml_read_ascii(AVIOContext *pb, int size, const char *default_value, char **str)
static int matroska_parse_block(MatroskaDemuxContext *matroska, AVBufferRef *buf, uint8_t *data, int size, int64_t pos, uint64_t cluster_time, uint64_t block_duration, int is_keyframe, MatroskaBlockMore *blockmore, int nb_blockmore, int64_t cluster_pos, int64_t discard_padding)
#define MATROSKA_ID_CHAPTERFLAGENABLED
static int matroska_parse_prores(MatroskaTrack *track, uint8_t **data, int *size)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
This struct describes the properties of an encoded stream.
static int segment_start(AVFormatContext *s, int write_header)
#define EBML_ID_EBMLMAXSIZELENGTH
enum AVColorSpace color_space
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define MATROSKA_ID_TRACKOPERATION
static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb, int max_size, uint64_t *number, int eof_forbidden)
static int matroska_parse_frame(MatroskaDemuxContext *matroska, MatroskaTrack *track, AVStream *st, AVBufferRef *buf, uint8_t *data, int pkt_size, uint64_t timecode, uint64_t lace_duration, int64_t pos, int is_keyframe, MatroskaBlockMore *blockmore, int nb_blockmore, int64_t discard_padding)
@ MATROSKA_VIDEO_FIELDORDER_PROGRESSIVE
#define MATROSKA_ID_TRACKFLAGTEXTDESCRIPTIONS
#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.
#define MATROSKA_ID_VIDEOPIXELWIDTH
#define TTA_EXTRADATA_SIZE
@ MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_LR
#define MATROSKA_ID_AUDIOSAMPLINGFREQ
@ 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 matroska_resync(MatroskaDemuxContext *matroska, int64_t last_pos)
@ MATROSKA_VIDEO_PROJECTION_TYPE_RECTANGULAR
static EbmlSyntax matroska_track_combine_planes[2]
#define MATROSKA_ID_DISCARDPADDING
@ MATROSKA_VIDEO_FIELDORDER_BB
static EbmlSyntax matroska_cluster_parsing[8]
const struct EbmlSyntax * n
#define MATROSKA_ID_EDITIONFLAGORDERED
#define MATROSKA_ID_DURATION
char * av_asprintf(const char *fmt,...)
#define MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT
static int matroska_read_header(AVFormatContext *s)
static MatroskaTrack * matroska_find_track_by_num(MatroskaDemuxContext *matroska, uint64_t num)
#define MATROSKA_ID_VIDEOCOLORPRIMARIES
static EbmlSyntax matroska_chapters[2]
@ MATROSKA_VIDEO_DISPLAYUNIT_PIXELS
#define MATROSKA_ID_ENCODINGSIGNATURE
#define MATROSKA_ID_SEGMENT
#define MATROSKA_ID_BLKADDIDTYPE
unsigned MaxCLL
Max content light level (cd/m^2).
#define MATROSKA_ID_CHAPTERS
#define MATROSKA_ID_VIDEOCOLOR_BY
This structure stores auxiliary information for decoding, presenting, or otherwise processing the cod...
#define MATROSKA_ID_BLOCKDURATION
@ AVCOL_RANGE_JPEG
Full range content.
#define MATROSKA_ID_VIDEOCOLORRANGE
int strict_std_compliance
Allow non-standard and experimental extension.
#define MATROSKA_ID_BLOCK
void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip)
Flip the input matrix horizontally and/or vertically.
#define MATROSKA_ID_TRACKDEFAULTDURATION
static EbmlSyntax matroska_track_encodings[2]
static EbmlSyntax matroska_tags[2]
#define MATROSKA_ID_TAGTARGETS_TYPE
int seek_preroll
Audio only.
static const char *const matroska_video_stereo_plane[MATROSKA_VIDEO_STEREO_PLANE_COUNT]
static int matroska_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
AVRational avg_frame_rate
Average framerate.
static int matroska_read_close(AVFormatContext *s)
#define MATROSKA_ID_ENCODINGSCOPE
@ MATROSKA_VIDEO_INTERLACE_FLAG_INTERLACED
#define MATROSKA_ID_DATEUTC
#define FF_COMPLIANCE_STRICT
Strictly conform to all the things in the spec no matter what consequences.
#define MATROSKA_ID_VIDEOCOLORCHROMASUBHORZ
int error
contains the error code or 0 if no error happened
#define AAC_MAX_EXTRADATA_SIZE
@ MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_LR
int ff_get_wav_header(void *logctx, AVIOContext *pb, AVCodecParameters *par, int size, int big_endian)
#define AV_LOG_VERBOSE
Detailed information.
static int mkv_parse_video_codec(MatroskaTrack *track, AVCodecParameters *par, const MatroskaDemuxContext *matroska, int *extradata_offset)
#define MATROSKA_ID_VIDEOPIXELCROPT
#define MATROSKA_ID_VIDEOPIXELCROPB
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.
#define MATROSKA_ID_VIDEOCOLORCBSUBVERT
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
@ AV_SPHERICAL_EQUIRECTANGULAR_TILE
Video represents a portion of a sphere mapped on a flat surface using equirectangular projection.
static int mkv_parse_video_projection(AVStream *st, const MatroskaTrack *track, void *logctx)
@ MATROSKA_COLOUR_CHROMASITINGHORZ_UNDETERMINED
void ffio_init_read_context(FFIOContext *s, const uint8_t *buffer, int buffer_size)
Wrap a buffer in an AVIOContext for reading.
int buf_size
Size of buf except extra allocated bytes.
enum AVChannelOrder order
Channel order used in this layout.
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
static EbmlSyntax matroska_blockadditions[2]
#define MATROSKA_ID_CUETIME
#define AV_PROFILE_ARIB_PROFILE_C
static int matroska_read_packet(AVFormatContext *s, AVPacket *pkt)
#define MATROSKA_ID_CUERELATIVEPOSITION
int nb_channels
Number of channels in this layout.
static void bit_depth(AudioStatsContext *s, const uint64_t *const mask, uint8_t *depth)
@ AV_SPHERICAL_EQUIRECTANGULAR
Video represents a sphere mapped on a flat surface using equirectangular projection.
#define MATROSKA_ID_CHAPLANG
static int ebml_parse(MatroskaDemuxContext *matroska, EbmlSyntax *syntax, void *data)
#define MATROSKA_ID_CUEDURATION
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
void avpriv_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp)
Update cur_dts of all streams based on the given timestamp and AVStream.
@ MATROSKA_VIDEO_STEREOMODE_TYPE_ROW_INTERLEAVED_LR
#define MATROSKA_ID_VIDEOCOLORBITSPERCHANNEL
static EbmlSyntax matroska_segment[9]
static void matroska_metadata_creation_time(AVDictionary **metadata, int64_t date_utc)
@ AV_FIELD_BT
Bottom coded first, top displayed first.
@ MATROSKA_VIDEO_DISPLAYUNIT_UNKNOWN
Content light level needed by to transmit HDR over HDMI (CTA-861.3).
#define MATROSKA_ID_VIDEOCOLOR_LUMINANCEMAX
#define update_pos(td, mb_y, mb_x)
@ MATROSKA_VIDEO_STEREOMODE_TYPE_ANAGLYPH_GREEN_MAG
static EbmlSyntax matroska_track_encoding_compression[]
enum AVColorPrimaries color_primaries
#define MATROSKA_ID_VIDEOCOLOR_WHITEY
EbmlList block_addition_mappings
#define AV_PROFILE_ARIB_PROFILE_A
@ AVCOL_SPC_RESERVED
reserved for future use by ITU-T and ISO/IEC just like 15-255 are
@ AV_FIELD_TT
Top coded_first, top displayed first.
static int ebml_read_sint(AVIOContext *pb, int size, int64_t default_value, int64_t *num)
#define NOTHING(STEREOMODETYPE, WDIV, HDIV, WEBM)
static EbmlSyntax ebml_syntax[3]
#define MATROSKA_ID_AUDIOOUTSAMPLINGFREQ
@ MATROSKA_BLOCK_ADD_ID_TYPE_DEFAULT
#define MATROSKA_ID_VIDEOPROJECTIONPRIVATE
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.
@ AV_PKT_DATA_PALETTE
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette.
MatroskaCluster current_cluster
@ MATROSKA_VIDEO_STEREOMODE_TYPE_MONO
#define MATROSKA_ID_ENCODINGSIGALGO
#define MATROSKA_ID_VIDEOASPECTRATIO
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
MatroskaLevel1Element level1_elems[64]
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
#define MATROSKA_ID_CHAPTERDISPLAY
static void inflate(uint8_t *dst, const uint8_t *p1, int width, int threshold, const uint8_t *coordinates[], int coord, int maxc)
int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Add an index entry into a sorted list.
#define MATROSKA_ID_TRACKUID
#define MATROSKA_ID_ENCODINGSIGKEYID
#define EBML_ID_DOCTYPEVERSION
static av_cold int read_close(AVFormatContext *ctx)
@ MATROSKA_COLOUR_CHROMASITINGVERT_NB
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
const char *const ff_matroska_video_stereo_mode[MATROSKA_VIDEO_STEREOMODE_TYPE_NB]
static int mkv_parse_block_addition_mappings(AVFormatContext *s, AVStream *st, MatroskaTrack *track)
static int matroska_probe(const AVProbeData *p)
@ MATROSKA_BLOCK_ADD_ID_TYPE_ITU_T_T35
@ MATROSKA_VIDEO_STEREOMODE_TYPE_CHECKERBOARD_RL
static EbmlSyntax matroska_segments[]
static const char *const matroska_doctypes[]
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
static int mka_parse_audio_codec(MatroskaTrack *track, AVCodecParameters *par, const MatroskaDemuxContext *matroska, AVFormatContext *s, int *extradata_offset)
#define MATROSKA_ID_VIDEOALPHAMODE
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
static int mkv_parse_video_color(AVStream *st, const MatroskaTrack *track)
MatroskaMasteringMeta mastering_meta
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
#define MATROSKA_ID_VIDEOCOLOR_WHITEX
@ AV_FIELD_TB
Top coded first, bottom displayed first.
@ MATROSKA_TRACK_TYPE_METADATA
static EbmlSyntax matroska_tag[3]
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
@ MATROSKA_VIDEO_FIELDORDER_TT
MatroskaLevel levels[EBML_MAX_DEPTH]
@ AV_PKT_DATA_WEBVTT_SETTINGS
The optional settings (rendering instructions) that immediately follow the timestamp specifier of a W...
MatroskaVideoStereoModeType
enum AVColorTransferCharacteristic color_trc
#define MATROSKA_ID_BLKADDIDNAME
#define MATROSKA_ID_BLOCKADDITIONAL
static int ebml_parse_nest(MatroskaDemuxContext *matroska, EbmlSyntax *syntax, void *data)
unsigned int avio_rb32(AVIOContext *s)
static int matroska_parse_seekhead_entry(MatroskaDemuxContext *matroska, int64_t pos)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define MATROSKA_ID_TRACKCONTENTENCODING
#define FF_ARRAY_ELEMS(a)
uint64_t bits_per_channel
#define MATROSKA_ID_TAGDEFAULT_BUG
#define MATROSKA_ID_CODECDOWNLOADURL
#define MATROSKA_ID_VIDEOFIELDORDER
#define AV_PROFILE_UNKNOWN
static EbmlSyntax matroska_info[]
#define MATROSKA_ID_VIDEOPIXELCROPR
@ MATROSKA_COLOUR_CHROMASITINGHORZ_NB
static EbmlSyntax matroska_index_entry[3]
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
#define EBML_ID_EBMLMAXIDLENGTH
static const uint16_t mask[17]
int frame_size
Audio only.
static int matroska_parse_cluster(MatroskaDemuxContext *matroska)
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int ff_add_attached_pic(AVFormatContext *s, AVStream *st, AVIOContext *pb, AVBufferRef **buf, int size)
Add an attached pic to an AVStream.
static int ebml_read_float(AVIOContext *pb, int size, double default_value, double *num)
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.
static MatroskaLevel1Element * matroska_find_level1_elem(MatroskaDemuxContext *matroska, uint32_t id, int64_t pos)
@ MATROSKA_COLOUR_CHROMASITINGVERT_UNDETERMINED
#define MATROSKA_ID_FILEUID
@ MATROSKA_VIDEO_INTERLACE_FLAG_PROGRESSIVE
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
#define MATROSKA_ID_VIDEODISPLAYWIDTH
int flags
Flags modifying the (de)muxer behaviour.
@ MATROSKA_VIDEO_FIELDORDER_BT
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
uint32_t bound_top
Distance from the top edge.
#define MATROSKA_ID_TAGNAME
@ AV_CHANNEL_ORDER_UNSPEC
Only the channel count is specified, without any further information about the channel order.
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 MATROSKA_ID_TIMECODESCALE
static EbmlSyntax matroska_cluster_enter[]
#define MATROSKA_ID_CLUSTERPOSITION
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.
#define MATROSKA_ID_CUETRACKPOSITION
union CountedElement::@322 el
#define MATROSKA_ID_SEEKENTRY
static int matroska_decode_buffer(uint8_t **buf, int *buf_size, MatroskaTrack *track)
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define MATROSKA_ID_TRACKTYPE
int64_t data_offset
offset of the first packet
@ MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_LR
#define MATROSKA_ID_SEGMENTUID
static EbmlSyntax matroska_track[33]
static int mkv_parse_subtitle_codec(MatroskaTrack *track, AVStream *st, AVCodecParameters *par, const MatroskaDemuxContext *matroska)
#define MATROSKA_ID_TRACKBLKADDMAPPING
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
static EbmlSyntax matroska_track_video_projection[]
@ 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.
#define WAVPACK_EXTRADATA_SIZE
#define MATROSKA_ID_AUDIOCHANNELS
#define MATROSKA_ID_BLKADDIDVALUE
uint64_t chroma_siting_vert
@ MATROSKA_VIDEO_STEREOMODE_TYPE_ANAGLYPH_CYAN_RED
int nb_coded_side_data
Amount of entries in coded_side_data.
#define MATROSKA_ID_VIDEOSTEREOMODE
static void matroska_clear_queue(MatroskaDemuxContext *matroska)
@ AV_CODEC_ID_ARIB_CAPTION
int flags
Additional information about the frame packing.
#define MATROSKA_ID_VIDEOCOLORSPACE
#define MATROSKA_ID_TRACKNAME
#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...
enum AVStreamParseType need_parsing
static void matroska_convert_tag(AVFormatContext *s, EbmlList *list, AVDictionary **metadata, char *prefix)
#define EBML_ID_DOCTYPEREADVERSION
@ AVDISCARD_ALL
discard all
static int matroska_parse_content_encodings(MatroskaTrackEncoding *encodings, unsigned nb_encodings, MatroskaTrack *track, char **key_id_base64, void *logctx)
#define MATROSKA_ID_CODECSTATE
#define MATROSKA_ID_TRACKFLAGHEARINGIMPAIRED
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
@ MATROSKA_VIDEO_STEREOMODE_TYPE_TOP_BOTTOM
#define LIBAVUTIL_VERSION_INT
#define MATROSKA_ID_ENCODINGENCALGO
static int read_header(FFV1Context *f)
#define MATROSKA_ID_BLOCKGROUP
#define MATROSKA_ID_VIDEOCOLOR_LUMINANCEMIN
Describe the class of an AVClass context structure.
and forward the result(frame or status change) to the corresponding input. If nothing is possible
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
#define MATROSKA_ID_ATTACHMENTS
#define STEREOMODE_STEREO3D_MAPPING(MAP, MKV_ONLY)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define MATROSKA_ID_CHAPTERATOM
static EbmlSyntax * ebml_parse_id(EbmlSyntax *syntax, uint32_t id)
#define MATROSKA_ID_TRACKCONTENTENCODINGS
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
static void matroska_parse_cues(MatroskaDemuxContext *matroska)
@ MATROSKA_TRACK_TYPE_AUDIO
#define MATROSKA_ID_EDITIONUID
#define MATROSKA_ID_TRACKFLAGORIGINAL
static int matroska_reset_status(MatroskaDemuxContext *matroska, uint32_t id, int64_t position)
const FFInputFormat ff_matroska_demuxer
static void matroska_execute_seekhead(MatroskaDemuxContext *matroska)
static int matroska_ebmlnum_sint(MatroskaDemuxContext *matroska, AVIOContext *pb, int64_t *num)
#define MATROSKA_ID_ENCODINGORDER
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.
Rational number (pair of numerator and denominator).
static int matroska_parse_webvtt(MatroskaDemuxContext *matroska, MatroskaTrack *track, AVStream *st, uint8_t *data, int data_len, uint64_t timecode, uint64_t duration, int64_t pos)
#define MATROSKA_ID_WRITINGAPP
#define MATROSKA_ID_VIDEOCOLOR_GY
static EbmlSyntax matroska_track_operation[2]
@ MATROSKA_VIDEO_STEREOMODE_TYPE_BOTTOM_TOP
const char * av_default_item_name(void *ptr)
Return the context name.
uint64_t avio_rb64(AVIOContext *s)
AVIOContext * pb
I/O context.
static int mkv_field_order(const MatroskaDemuxContext *matroska, uint64_t field_order)
#define MATROSKA_ID_SIMPLETAG
#define MATROSKA_ID_TRACKPLANEUID
#define MATROSKA_ID_VIDEOPROJECTION
This structure contains the data a format has to probe a file.
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 list
#define MATROSKA_ID_SEEKID
#define FLAC_STREAMINFO_SIZE
#define MATROSKA_ID_CHAPTERTIMESTART
const AVCodecTag ff_codec_movvideo_tags[]
#define MATROSKA_ID_CUEBLOCKNUMBER
uint64_t flag_hearingimpaired
@ MATROSKA_TRACK_TYPE_VIDEO
AVChannelLayout ch_layout
Audio only.
enum AVChromaLocation av_chroma_location_pos_to_enum(int xpos, int ypos)
Converts swscale x/y chroma position to AVChromaLocation.
#define MATROSKA_ID_FILEMIMETYPE
#define MATROSKA_ID_VIDEODISPLAYHEIGHT
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
#define MATROSKA_ID_TRACKAUDIO
@ AVCOL_RANGE_UNSPECIFIED
static EbmlSyntax matroska_index_pos[]
const AVCodecTag ff_codec_movaudio_tags[]
MatroskaTrackCompression compression
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
Audio only.
AVBufferRef * av_buffer_create(uint8_t *data, size_t size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
const uint8_t ff_log2_tab[256]
AVCodecID
Identify the syntax and semantics of the bitstream.
#define MATROSKA_ID_VIDEOCOLORMAXCLL
@ AV_PKT_DATA_SPHERICAL
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
#define MATROSKA_ID_TRACKENTRY
int extradata_size
Size of the extradata content in bytes.
static EbmlSyntax matroska_track_encoding_encryption[]
uint64_t default_duration
static int ebml_read_uint(AVIOContext *pb, int size, uint64_t default_value, uint64_t *num)
#define MATROSKA_ID_TAGDEFAULT
@ MATROSKA_TRACK_ENCODING_COMP_BZLIB
const OptionDef options[]
#define MATROSKA_ID_AUDIOBITDEPTH
uint64_t flag_visualimpaired
@ MATROSKA_VIDEO_STEREOMODE_TYPE_LEFT_RIGHT
#define MATROSKA_ID_TRACKFLAGDEFAULT
int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen)
Decodes LZO 1x compressed data.
@ AV_SPHERICAL_CUBEMAP
Video frame is split into 6 faces of a cube, and arranged on a 3x2 layout.
#define MATROSKA_ID_ENCODINGCOMPALGO
#define MATROSKA_ID_TRACKFLAGCOMMENTARY
uint64_t flag_textdescriptions
#define STEREO_MODE_CONV(STEREOMODETYPE, STEREO3DTYPE, FLAGS, WDIV, HDIV, WEBM)
#define MATROSKA_ID_TRACKFLAGLACING
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
AVPacket * parse_pkt
The generic code uses this as a temporary packet to parse packets or for muxing, especially flushing.
uint64_t matrix_coefficients
#define MATROSKA_ID_VIDEOCOLOR_GX
static int mkv_create_display_matrix(AVStream *st, const MatroskaTrackVideoProjection *proj, void *logctx)
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
void avpriv_packet_list_free(PacketList *pkt_buf)
Wipe the list and unref all the packets in it.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
static void matroska_convert_tags(AVFormatContext *s)
uint32_t bound_right
Distance from the right edge.
@ AV_PKT_DATA_DYNAMIC_HDR10_PLUS
HDR10+ dynamic metadata associated with a video frame.
MatroskaTrackEncryption encryption
#define MATROSKA_ID_TRACKFLAGENABLED
#define MATROSKA_ID_FILEDATA
uint64_t max_block_additional_id
#define MATROSKA_ID_VIDEOPROJECTIONPOSEPITCH
@ MATROSKA_VIDEO_FIELDORDER_UNDETERMINED
#define MATROSKA_ID_BLOCKMORE
static int mka_parse_audio(MatroskaTrack *track, AVStream *st, AVCodecParameters *par, const MatroskaDemuxContext *matroska, AVFormatContext *s, int *extradata_offset)
@ MATROSKA_BLOCK_ADD_ID_TYPE_OPAQUE
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)
static void mkv_stereo_mode_display_mul(int stereo_mode, int *h_width, int *h_height)
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.
#define MATROSKA_ID_VIDEOCOLORMAXFALL
static EbmlSyntax matroska_attachments[2]
static const struct TransferCharacteristics transfer_characteristics[AVCOL_TRC_NB]
int profile
Codec-specific bitstream restrictions that the stream conforms to.
#define EBML_UNKNOWN_LENGTH
#define MATROSKA_ID_VIDEOCOLORCBSUBHORZ
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
#define INITIALIZATION_RANGE
#define MATROSKA_ID_POINTENTRY
static const uint8_t header[24]
#define MATROSKA_ID_BLKADDIDEXTRADATA
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
int avio_r8(AVIOContext *s)
static EbmlSyntax matroska_simpletag[]
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
#define MATROSKA_ID_ENCODINGTYPE
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.
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
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.
uint64_t codec_delay_in_track_tb
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
#define MATROSKA_ID_VIDEOPIXELHEIGHT
uint64_t chroma_siting_horz
#define MATROSKA_ID_VIDEOFRAMERATE
#define AV_LOG_INFO
Standard information.
static int matroska_aac_sri(int samplerate)
#define MATROSKA_ID_MUXINGAPP
#define MATROSKA_ID_EDITIONFLAGDEFAULT
int error_recognition
Error recognition; higher values will detect more errors but may misdetect some more or less valid pa...
#define MATROSKA_ID_TRACKPLANETYPE
int skip_to_keyframe
Indicates that everything up to the next keyframe should be discarded.
int ffio_limit(AVIOContext *s, int size)
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
#define MATROSKA_ID_CODECINFOURL
#define MATROSKA_ID_FILEDESC
#define MATROSKA_ID_VIDEOPROJECTIONTYPE
#define MATROSKA_ID_FILENAME
#define AV_BASE64_SIZE(x)
Calculate the output size needed to base64-encode x bytes to a null-terminated string.
int32_t roll
Rotation around the forward vector [-180, 180].
#define MATROSKA_ID_CODECID
union EbmlSyntax::@323 def
static EbmlSyntax matroska_track_video[19]
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_LZO_OUTPUT_PADDING
static EbmlSyntax matroska_track_audio[]
int ff_isom_parse_dvcc_dvvc(void *logctx, AVStream *st, const uint8_t *buf_ptr, uint64_t size)
static EbmlSyntax matroska_tagtargets[]
@ MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP
#define AV_TIME_BASE
Internal time base represented as integer.
#define MATROSKA_ID_CUECLUSTERPOSITION
@ MATROSKA_TRACK_ENCODING_COMP_ZLIB
int block_align
Audio only.
#define MATROSKA_ID_CHAPTERPHYSEQUIV
MatroskaTrackVideoProjection projection
#define av_malloc_array(a, b)
#define MATROSKA_ID_CUETRACK
@ AV_FIELD_BB
Bottom coded first, bottom displayed first.
#define MATROSKA_ID_SEEKPOSITION
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define MATROSKA_ID_CLUSTER
#define MATROSKA_ID_TRACKLANGUAGE
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
@ AVMEDIA_TYPE_ATTACHMENT
Opaque data information usually sparse.
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
#define MATROSKA_ID_VIDEOFLAGINTERLACED
static EbmlSyntax matroska_chapter[6]
const AVMetadataConv ff_mkv_metadata_conv[]
enum AVColorRange color_range
Video only.
static int get_qt_codec(MatroskaTrack *track, uint32_t *fourcc, enum AVCodecID *codec_id)
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
Rescale a 64-bit integer with rounding to nearest.
AVPacketSideData * coded_side_data
Additional data associated with the entire stream.
#define MATROSKA_ID_EDITIONFLAGHIDDEN
#define MATROSKA_ID_CHAPTERUID
unsigned int alloc_elem_size
static EbmlSyntax matroska_index[2]
enum AVFieldOrder field_order
Video only.
This struct represents dynamic metadata for color volume transform - application 4 of SMPTE 2094-40:2...
@ MATROSKA_VIDEO_STEREOMODE_TYPE_RIGHT_LEFT
static EbmlSyntax matroska_mastering_meta[]
#define MATROSKA_ID_VIDEOPROJECTIONPOSEYAW
Undefined Behavior In the C language
static EbmlSyntax matroska_track_video_color[15]
int disposition
Stream disposition - a combination of AV_DISPOSITION_* flags.
@ AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL
Data found in BlockAdditional element of matroska container.
static const CodecMime mkv_mime_tags[]
static int mkv_parse_video(MatroskaTrack *track, AVStream *st, AVCodecParameters *par, const MatroskaDemuxContext *matroska, int *extradata_offset)
AVStereo3D * av_stereo3d_alloc(void)
Allocate an AVStereo3D structure and set its fields to default values.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
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].
@ FLAC_METADATA_TYPE_VORBIS_COMMENT
#define MATROSKA_ID_TRACKCOMBINEPLANES
enum AVStereo3DType type
How views are packed within the video.
int av_channel_layout_check(const AVChannelLayout *channel_layout)
Check whether a channel layout is valid, i.e.
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
static EbmlSyntax matroska_blockmore[]
#define MATROSKA_ID_VIDEOCOLOR_BX
#define MATROSKA_ID_TAGSTRING
#define MATROSKA_ID_VIDEOCOLORMATRIXCOEFF
void av_bprintf(AVBPrint *buf, const char *fmt,...)
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.
#define MATROSKA_ID_SIMPLEBLOCK
#define MATROSKA_ID_TRACKPLANE
#define AV_INPUT_BUFFER_PADDING_SIZE
#define MATROSKA_ID_VIDEOPIXELCROPL
@ MATROSKA_BLOCK_ADD_ID_TYPE_DVVC
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
enum AVChromaLocation chroma_location
@ MATROSKA_VIDEO_STEREOMODE_TYPE_COL_INTERLEAVED_RL
#define MATROSKA_ID_CODECNAME
@ AV_PKT_DATA_WEBVTT_IDENTIFIER
The optional first identifier line of a WebVTT cue.
static const AVClass webm_dash_class
#define MATROSKA_ID_EDITIONENTRY
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 keep it simple and lowercase description are in without and describe what they for example set the foo of the bar offset is the offset of the field in your see the OFFSET() macro
static const ParseSyntax syntax[]
static EbmlSyntax matroska_seekhead_entry[]
int index
stream index in AVFormatContext
#define MATROSKA_ID_TRACKMAXCACHE
static EbmlSyntax matroska_seekhead[2]
const AVCodecTag ff_codec_bmp_tags[]
static void matroska_add_index_entries(MatroskaDemuxContext *matroska)
#define MATROSKA_ID_TRACKMAXBLKADDID
static EbmlSyntax matroska_blockgroup[8]
#define MATROSKA_ID_TAGTARGETS_TYPEVALUE
#define EBML_ID_EBMLVERSION
#define MATROSKA_ID_CLUSTERPREVSIZE
#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
const unsigned char ff_sipr_subpk_size[4]
#define MATROSKA_ID_TAGLANG
static int is_ebml_id_valid(uint32_t id)
#define MATROSKA_VIDEO_STEREO_PLANE_COUNT
static int mkv_parse_dvcc_dvvc(AVFormatContext *s, AVStream *st, const MatroskaTrack *track, EbmlBin *bin)
#define MATROSKA_ID_VIDEOCOLOR
static EbmlSyntax matroska_tracks[2]
#define MATROSKA_ID_VIDEOCOLORTRANSFERCHARACTERISTICS
A Quick Description Of Rate Distortion Theory We want to encode a video
#define MATROSKA_ID_VIDEOCOLOR_RX
static int matroska_parse_wavpack(MatroskaTrack *track, uint8_t **data, int *size)
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
@ MATROSKA_TRACK_TYPE_SUBTITLE
static av_const int sign_extend(int val, unsigned bits)
AVRational r_frame_rate
Real base framerate of the stream.
#define AV_LZO_OUTPUT_FULL
decoded data did not fit into output buffer
@ AV_PKT_DATA_SKIP_SAMPLES
Recommmends skipping the specified number of samples.
int eof_reached
true if was unable to read due to error or eof
char * av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size)
Encode data to base64 and null-terminate.
Filter the word “frame” indicates either a video frame or a group of audio samples
#define MATROSKA_ID_VIDEOCOLORCHROMASUBVERT
@ MATROSKA_VIDEO_PROJECTION_TYPE_EQUIRECTANGULAR
int64_t duration
Duration of the stream, in AV_TIME_BASE fractional seconds.
static int matroska_parse_rm_audio(MatroskaDemuxContext *matroska, MatroskaTrack *track, AVStream *st, uint8_t *data, int size, uint64_t timecode, int64_t pos)
int av_buffer_realloc(AVBufferRef **pbuf, size_t size)
Reallocate a given buffer.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
#define MATROSKA_ID_VIDEOCOLORCHROMASITINGHORZ
@ MATROSKA_TRACK_ENCODING_COMP_LZO
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
const int ff_mpeg4audio_sample_rates[16]
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.
AVSphericalMapping * av_spherical_alloc(size_t *size)
Allocate a AVSphericalVideo structure and initialize its fields to default values.
char * av_strdup(const char *s)
Duplicate a string.
#define AV_OPT_FLAG_DECODING_PARAM
A generic parameter which can be set by the user for demuxing or decoding.
#define MATROSKA_ID_BLOCKREFERENCE
static int read_probe(const AVProbeData *p)
int bits_per_coded_sample
The number of bits per sample in the codedwords.
A reference to a data buffer.
#define MATROSKA_ID_VIDEOCOLOR_RY
@ MATROSKA_VIDEO_FIELDORDER_TB
#define ITU_T_T35_COUNTRY_CODE_US
uint32_t bound_left
Distance from the left edge.
#define MATROSKA_ID_TRACKVIDEO
@ MATROSKA_VIDEO_STEREOMODE_TYPE_BOTH_EYES_BLOCK_RL
unsigned char * buffer
Start of the buffer.
const CodecTags ff_mkv_codec_tags[]
static const struct @386 planes[]
#define MATROSKA_ID_TRACKFLAGFORCED
@ MATROSKA_VIDEO_STEREOMODE_TYPE_NB
#define EBML_ID_EBMLREADVERSION
static int matroska_deliver_packet(MatroskaDemuxContext *matroska, AVPacket *pkt)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
uint32_t palette[AVPALETTE_COUNT]
#define ITU_T_T35_PROVIDER_CODE_SMTPE
unsigned MaxFALL
Max average light level per frame (cd/m^2).
This structure stores compressed data.
#define MATROSKA_ID_ENCODINGENCAESSETTINGS
#define MATROSKA_ID_CHAPTERFLAGHIDDEN
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define MATROSKA_ID_ATTACHEDFILE
int64_t pos
byte position in stream, -1 if unknown
#define MATROSKA_ID_TRACKMINCACHE
#define MATROSKA_ID_CODECDELAY
uint64_t transfer_characteristics
static int mkv_stereo3d_conv(AVStream *st, MatroskaVideoStereoModeType stereo_mode)
static EbmlSyntax matroska_track_plane[]
#define MATROSKA_ID_ENCODINGCOMPRESSION
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define flags(name, subs,...)
#define MATROSKA_ID_TAGTARGETS_TRACKUID
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
int64_t bit_rate
The average bitrate of the encoded data (in bits per second).
The exact code depends on how similar the blocks are and how related they are to the block
CountedElement flag_original
#define MATROSKA_ID_CHAPTERTIMEEND
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static EbmlSyntax matroska_track_encoding[6]
static EbmlSyntax matroska_chapter_display[]
#define MKTAG(a, b, c, d)
#define MATROSKA_ID_TRACKS
#define MATROSKA_ID_ENCODINGENCKEYID
static void ebml_free(EbmlSyntax *syntax, void *data)
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
void ff_reduce_index(AVFormatContext *s, int stream_index)
Ensure the index uses less memory than the maximum specified in AVFormatContext.max_index_size by dis...
#define MATROSKA_ID_ENCODINGCOMPSETTINGS
int cues_parsing_deferred
int ff_vorbis_comment(AVFormatContext *ms, AVDictionary **m, const uint8_t *buf, int size, int parse_picture)
Parse Vorbis comments.
#define MATROSKA_ID_SEEKPREROLL
unsigned char * buf_ptr
Current position in the buffer.
#define MATROSKA_ID_SEEKHEAD
@ MATROSKA_BLOCK_ADD_ID_TYPE_DVCC
uint64_t skip_to_timecode
int initial_padding
Audio only.
#define MATROSKA_ID_VIDEOPROJECTIONPOSEROLL
#define MATROSKA_ID_BLOCKADDID
This structure describes how to handle spherical videos, outlining information about projection,...
int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp)
Set a dictionary value to an ISO-8601 compliant timestamp string.
static void BS_FUNC() skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
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].
#define MATROSKA_ID_TAGTARGETS_CHAPTERUID
static int ebml_read_length(MatroskaDemuxContext *matroska, AVIOContext *pb, uint64_t *number)
Read a EBML length value.
static uint32_t BS_FUNC() read(BSCTX *bc, unsigned int n)
Return n bits from the buffer, n has to be in the 0-32 range.
#define MATROSKA_ID_TRACKTIMECODESCALE
static EbmlSyntax matroska_chapter_entry[9]
@ MATROSKA_VIDEO_PROJECTION_TYPE_CUBEMAP
static int matroska_aac_profile(char *codec_id)
static int is_keyframe(NalUnitType naltype)
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
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
#define av_fourcc2str(fourcc)
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
static int matroska_parse_flac(AVFormatContext *s, MatroskaTrack *track, int *offset)
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
#define MATROSKA_ID_BLOCKADDITIONS
@ MATROSKA_VIDEO_INTERLACE_FLAG_UNDETERMINED