71 #define EBML_UNKNOWN_LENGTH UINT64_MAX
72 #define NEEDS_CHECKING 2
76 #define SKIP_THRESHOLD 1024 * 1024
79 #define UNKNOWN_EQUIV 50 * 1024
124 typedef struct Ebml {
393 #define CHILD_OF(parent) { .def = { .n = parent } }
779 uint32_t
id, int64_t position)
808 "Seek to desired resync point failed. Seeking to "
809 "earliest point available instead.\n");
811 last_pos + 1), SEEK_SET);
847 int max_size, uint64_t *number,
int eof_forbidden)
861 if (!total || read > max_size) {
865 "0x00 at pos %"PRId64
" (0x%"PRIx64
") invalid as first byte "
866 "of an EBML number\n",
pos,
pos);
869 "Length %d indicated by an EBML number's first byte 0x%02x "
870 "at pos %"PRId64
" (0x%"PRIx64
") exceeds max length %d.\n",
879 total = (total << 8) |
avio_r8(pb);
894 "Read error at pos. %"PRIu64
" (0x%"PRIx64
")\n",
900 "at pos. %"PRIu64
" (0x%"PRIx64
")\n",
pos,
pos);
915 if (res > 0 && *number + 1 == 1ULL << (7 * res))
931 *num = (*num << 8) |
avio_r8(pb);
951 *num = ((uint64_t)*num << 8) |
avio_r8(pb);
1032 uint64_t length, int64_t
pos)
1044 level->length = length;
1064 *num = unum - ((1LL << (7 * res - 1)) - 1);
1078 for (
i = 0; syntax[
i].
id;
i++)
1079 if (
id == syntax[
i].
id)
1091 for (
int i = 0; syntax[
i].
id;
i++)
1092 switch (syntax[
i].
type) {
1097 *(int64_t *) ((
char *)
data + syntax[
i].data_offset) = syntax[
i].
def.
i;
1105 if (syntax[
i].def.
s) {
1133 return id && (
bits + 7) / 8 == (8 -
bits % 8);
1141 uint32_t
id, int64_t
pos)
1213 "at pos. %"PRIu64
" (0x%"PRIx64
")\n",
pos,
pos);
1220 pos_alt =
pos + res;
1233 while (syntax->
def.
n) {
1243 "%"PRId64
"\n",
id,
pos);
1256 &
list->alloc_elem_size,
1260 list->elem = newelem;
1277 uint64_t elem_end = pos_alt + length,
1280 if (elem_end < level_end) {
1282 }
else if (elem_end == level_end) {
1286 "Element at 0x%"PRIx64
" ending at 0x%"PRIx64
" exceeds "
1287 "containing master element ending at 0x%"PRIx64
"\n",
1288 pos, elem_end, level_end);
1295 "at 0x%"PRIx64
" inside parent with finite size\n",
pos);
1305 "Found unknown-length element 0x%"PRIX32
" other than "
1306 "a cluster at 0x%"PRIx64
". Spec-incompliant, but "
1307 "parsing will nevertheless be attempted.\n",
id,
pos);
1314 if (max_lengths[syntax->
type] && length > max_lengths[syntax->
type]) {
1317 "Invalid length 0x%"PRIx64
" > 0x%"PRIx64
" for element "
1318 "with ID 0x%"PRIX32
" at 0x%"PRIx64
"\n",
1319 length, max_lengths[syntax->
type],
id,
pos);
1322 "Element with ID 0x%"PRIX32
" at pos. 0x%"PRIx64
" has "
1323 "unknown length, yet the length of an element of its "
1324 "type must be known.\n",
id,
pos);
1327 "Found unknown-length element with ID 0x%"PRIX32
" at "
1328 "pos. 0x%"PRIx64
" for which no syntax for parsing is "
1329 "available.\n",
id,
pos);
1366 "Unknown element %"PRIX32
" at pos. 0x%"PRIx64
" with "
1367 "length 0x%"PRIx64
" considered as invalid data. Last "
1368 "known good position 0x%"PRIx64
", %d unknown elements"
1387 switch (syntax->
type) {
1414 if (!level1_elem->
pos) {
1417 }
else if (level1_elem->
pos !=
pos)
1435 if ((res2 =
avio_skip(pb, length - 1)) >= 0) {
1490 for (
i = 0; syntax[
i].
id;
i++) {
1491 void *data_off = (
char *)
data + syntax[
i].data_offset;
1492 switch (syntax[
i].
type) {
1502 if (syntax[
i].list_elem_size) {
1504 char *ptr =
list->elem;
1505 for (j = 0; j <
list->nb_elem;
1510 list->alloc_elem_size = 0;
1525 int len_mask = 0x80,
size = 1, n = 1,
i;
1533 while (
size <= 8 && !(total & len_mask)) {
1539 total &= (len_mask - 1);
1541 total = (total << 8) | p->
buf[4 + n++];
1543 if (total + 1 == 1ULL << (7 *
size)){
1558 if (total < probelen)
1560 for (n = 4 +
size; n <= 4 +
size + total - probelen; n++)
1576 if (tracks[
i].num == num)
1588 int isize = *buf_size;
1591 int pkt_size = isize;
1595 if (pkt_size >= 10000000
U)
1598 switch (encodings[0].compression.algo) {
1604 if (header_size && !
header) {
1612 pkt_size = isize + header_size;
1617 memcpy(pkt_data,
header, header_size);
1618 memcpy(pkt_data + header_size,
data, isize);
1625 olen = pkt_size *= 3;
1632 pkt_data = newpktdata;
1645 z_stream zstream = { 0 };
1646 if (!pkt_size || inflateInit(&zstream) != Z_OK)
1648 zstream.next_in =
data;
1649 zstream.avail_in = isize;
1654 inflateEnd(&zstream);
1658 pkt_data = newpktdata;
1659 zstream.avail_out = pkt_size - zstream.total_out;
1660 zstream.next_out = pkt_data + zstream.total_out;
1662 }
while (
result == Z_OK && pkt_size < 10000000);
1663 pkt_size = zstream.total_out;
1664 inflateEnd(&zstream);
1665 if (
result != Z_STREAM_END) {
1666 if (
result == Z_MEM_ERROR)
1678 bz_stream bzstream = { 0 };
1679 if (!pkt_size || BZ2_bzDecompressInit(&bzstream, 0, 0) != BZ_OK)
1681 bzstream.next_in =
data;
1682 bzstream.avail_in = isize;
1687 BZ2_bzDecompressEnd(&bzstream);
1691 pkt_data = newpktdata;
1692 bzstream.avail_out = pkt_size - bzstream.total_out_lo32;
1693 bzstream.next_out = pkt_data + bzstream.total_out_lo32;
1694 result = BZ2_bzDecompress(&bzstream);
1695 }
while (
result == BZ_OK && pkt_size < 10000000);
1696 pkt_size = bzstream.total_out_lo32;
1697 BZ2_bzDecompressEnd(&bzstream);
1698 if (
result != BZ_STREAM_END) {
1699 if (
result == BZ_MEM_ERROR)
1715 *buf_size = pkt_size;
1730 for (
i = 0;
i <
list->nb_elem;
i++) {
1731 const char *lang = tags[
i].
lang &&
1732 strcmp(tags[
i].lang,
"und") ? tags[
i].
lang :
NULL;
1734 if (!tags[
i].
name) {
1742 if (tags[
i].def || !lang) {
1744 if (tags[
i].sub.nb_elem)
1751 if (tags[
i].sub.nb_elem)
1765 if (tags[
i].target.attachuid) {
1769 if (attachment[j].
uid == tags[
i].target.attachuid &&
1770 attachment[j].stream) {
1772 &attachment[j].stream->metadata,
NULL);
1778 "The tags at index %d refer to a "
1779 "non-existent attachment %"PRId64
".\n",
1780 i, tags[
i].target.attachuid);
1782 }
else if (tags[
i].target.chapteruid) {
1786 if (chapter[j].
uid == tags[
i].target.chapteruid &&
1787 chapter[j].chapter) {
1789 &chapter[j].chapter->metadata,
NULL);
1795 "The tags at index %d refer to a non-existent chapter "
1797 i, tags[
i].target.chapteruid);
1799 }
else if (tags[
i].target.trackuid) {
1803 if (track[j].
uid == tags[
i].target.trackuid &&
1806 &track[j].stream->metadata,
NULL);
1812 "The tags at index %d refer to a non-existent track "
1814 i, tags[
i].target.trackuid);
1818 tags[
i].target.type);
1837 "Max EBML element depth (%d) reached, "
1870 for (
i = 0;
i < seekhead_list->
nb_elem;
i++) {
1872 uint32_t
id = seekheads[
i].
id;
1880 if (!elem || elem->
parsed)
1903 uint64_t index_scale = 1;
1909 index_list = &matroska->
index;
1920 for (j = 0; j < pos_list->
nb_elem; j++) {
1923 if (track && track->
stream)
1953 static const char *
const aac_profiles[] = {
"MAIN",
"LC",
"SSR" };
1999 int block_last, block_type, block_size;
2005 if (block_size >
size)
2014 chmask =
av_dict_get(dict,
"WAVEFORMATEXTENSIBLE_CHANNEL_MASK",
NULL, 0);
2019 "Invalid value of WAVEFORMATEXTENSIBLE_CHANNEL_MASK\n");
2040 bttb = (
major == 57 &&
minor >= 36 && minor <= 51 && micro >= 100);
2042 switch (field_order) {
2061 int *h_width,
int *h_height)
2063 switch (stereo_mode) {
2088 int has_mastering_primaries, has_mastering_luminance;
2093 mastering_meta = &
color->mastering_meta;
2095 has_mastering_primaries =
2096 mastering_meta->
r_x > 0 && mastering_meta->
r_y > 0 &&
2097 mastering_meta->
g_x > 0 && mastering_meta->
g_y > 0 &&
2098 mastering_meta->
b_x > 0 && mastering_meta->
b_y > 0 &&
2100 has_mastering_luminance = mastering_meta->
max_luminance > 0;
2119 (
color->chroma_siting_vert - 1) << 7);
2137 if (has_mastering_primaries || has_mastering_luminance) {
2146 if (has_mastering_primaries) {
2157 if (has_mastering_luminance) {
2173 size_t spherical_size;
2174 uint32_t l = 0, t = 0,
r = 0,
b = 0;
2175 uint32_t padding = 0;
2178 if (mkv_projection->
private.
size && priv_data[0] != 0) {
2191 if (
b >= UINT_MAX - t ||
r >= UINT_MAX - l) {
2193 "Invalid bounding rectangle coordinates "
2194 "%"PRIu32
",%"PRIu32
",%"PRIu32
",%"PRIu32
"\n",
2203 if (l || t ||
r ||
b)
2216 "Unknown spherical cubemap layout %"PRIu32
"\n",
layout);
2220 padding =
AV_RB32(priv_data + 8);
2231 "Unknown spherical metadata type %"PRIu64
"\n",
2305 int extradata_size = 0;
2306 int extradata_offset = 0;
2309 char* key_id_base64 =
NULL;
2318 "Unknown or unsupported track type %"PRIu64
"\n",
2337 "Invalid sample rate %f, defaulting to 8000 instead.\n",
2345 if (default_duration > UINT64_MAX || default_duration < 0) {
2347 "Invalid frame rate %e. Cannot calculate default duration.\n",
2363 if (encodings_list->
nb_elem > 1) {
2365 "Multiple combined encodings not supported");
2366 }
else if (encodings_list->
nb_elem == 1) {
2367 if (encodings[0].
type) {
2368 if (encodings[0].encryption.key_id.size > 0) {
2371 const int b64_size =
AV_BASE64_SIZE(encodings[0].encryption.key_id.size);
2373 if (key_id_base64 ==
NULL)
2377 encodings[0].encryption.key_id.data,
2378 encodings[0].encryption.key_id.size);
2380 encodings[0].
scope = 0;
2382 "Unsupported encoding type");
2395 encodings[0].
scope = 0;
2397 "Unsupported encoding type");
2407 "Failed to decode codec private data\n");
2426 encodings[0].
scope & 1 &&
2445 if (key_id_base64) {
2451 if (!strcmp(track->
codec_id,
"V_MS/VFW/FOURCC") &&
2462 extradata_offset = 40;
2463 }
else if (!strcmp(track->
codec_id,
"A_MS/ACM") &&
2476 }
else if (!strcmp(track->
codec_id,
"A_QUICKTIME")
2480 uint16_t sample_size;
2486 if (sample_size == 8) {
2489 }
else if (sample_size == 16) {
2498 }
else if (!strcmp(track->
codec_id,
"V_QUICKTIME") &&
2554 extradata[0] = (
profile << 3) | ((sri & 0x0E) >> 1);
2555 extradata[1] = ((sri & 0x01) << 7) | (track->
audio.
channels << 3);
2556 if (strstr(track->
codec_id,
"SBR")) {
2558 extradata[2] = 0x56;
2559 extradata[3] = 0xE5;
2560 extradata[4] = 0x80 | (sri << 3);
2573 AV_WB32(extradata, extradata_size);
2574 memcpy(&extradata[4],
"alac", 4);
2583 "Too large audio channel number %"PRIu64
2584 " or bitdepth %"PRIu64
". Skipping track.\n",
2593 extradata_size = 22;
2598 bytestream_put_be32(&ptr,
AV_RB32(
"TTA1"));
2599 bytestream_put_le16(&ptr, 1);
2610 extradata_offset = 26;
2644 static const int sipr_bit_rate[4] = { 6504, 8496, 5000, 16000 };
2653 extradata_offset = 78;
2665 "in absence of valid CodecPrivate.\n");
2680 extradata_offset = 4;
2686 "Unknown/unsupported AVCodecID %s.\n", track->
codec_id);
2691 1000 * 1000 * 1000);
2700 if (strcmp(track->
language,
"und"))
2724 int display_width_mul = 1;
2725 int display_height_mul = 1;
2756 #if FF_API_R_FRAME_RATE
2776 snprintf(buf,
sizeof(buf),
"%s_%d",
2779 if (
planes[j].
uid == tracks[k].
uid && tracks[k].stream) {
2781 "stereo_mode", buf, 0);
2815 (
AVRational){1, st->codecpar->codec_id == AV_CODEC_ID_OPUS ?
2816 48000 : st->codecpar->sample_rate});
2826 if (!strcmp(track->
codec_id,
"D_WEBVTT/CAPTIONS")) {
2828 }
else if (!strcmp(track->
codec_id,
"D_WEBVTT/DESCRIPTIONS")) {
2830 }
else if (!strcmp(track->
codec_id,
"D_WEBVTT/METADATA")) {
2848 uint64_t max_start = 0;
2863 ebml.
max_size >
sizeof(uint64_t) ||
2867 "EBML version %"PRIu64
", doctype %s, doc version %"PRIu64,
2873 "EBML header using unsupported features\n"
2874 "(EBML version %"PRIu64
", doctype %s, doc version %"PRIu64
")\n",
2924 attachments = attachments_list->
elem;
2925 for (j = 0; j < attachments_list->
nb_elem; j++) {
2926 if (!(attachments[j].filename && attachments[j].mime &&
2927 attachments[j].bin.data && attachments[j].bin.size > 0)) {
2947 attachments[j].
stream = st;
2967 attachments[j].bin.size);
2980 chapters = chapters_list->
elem;
2983 (max_start == 0 || chapters[
i].start > max_start)) {
2989 max_start = chapters[
i].
start;
3009 if (matroska->
queue) {
3040 uint32_t lace_size[256],
int *laces)
3047 lace_size[0] =
size;
3063 for (n = 0; n < *laces - 1; n++) {
3071 lace_size[n] +=
temp;
3074 }
while (
temp == 0xff);
3079 lace_size[n] =
size - total;
3084 if (
size % (*laces))
3086 for (n = 0; n < *laces; n++)
3087 lace_size[n] =
size / *laces;
3104 total = lace_size[0] = num;
3106 for (n = 1; n < *laces - 1; n++) {
3112 if (lace_size[n - 1] + snum > (uint64_t)INT_MAX)
3115 lace_size[n] = lace_size[n - 1] + snum;
3116 total += lace_size[n];
3124 lace_size[*laces - 1] =
size - total;
3151 if (
size < cfs *
h / 2) {
3153 "Corrupt int4 RM-style audio packet size\n");
3156 for (x = 0; x <
h / 2; x++)
3157 memcpy(track->
audio.
buf + x * 2 *
w + y * cfs,
3158 data + x * cfs, cfs);
3162 "Corrupt sipr RM-style audio packet size\n");
3169 "Corrupt generic RM-style audio packet size\n");
3172 for (x = 0; x <
w /
sps; x++)
3174 sps * (
h * x + ((
h + 1) / 2) * (y & 1) + (y >> 1)),
3233 while (srclen >= 8) {
3243 multiblock = (
flags & 0x1800) != 0x1800;
3255 if (blocksize > srclen) {
3266 dstlen += blocksize + 32;
3277 memcpy(dst +
offset + 32,
src, blocksize);
3280 srclen -= blocksize;
3281 offset += blocksize + 32;
3300 int dstlen = *
size + 8;
3308 memcpy(dst + 8, *
data, dstlen - 8);
3327 int id_len, settings_len, text_len;
3335 q =
data + data_len;
3340 if (*p ==
'\r' || *p ==
'\n') {
3349 if (p >= q || *p !=
'\n')
3356 if (*p ==
'\r' || *p ==
'\n') {
3357 settings_len = p - settings;
3365 if (p >= q || *p !=
'\n')
3371 while (text_len > 0) {
3372 const int len = text_len - 1;
3374 if (
c !=
'\r' &&
c !=
'\n')
3387 memcpy(
pkt->
data, text, text_len);
3397 memcpy(buf,
id, id_len);
3400 if (settings_len > 0) {
3408 memcpy(buf, settings, settings_len);
3435 uint64_t timecode, uint64_t lace_duration,
3437 uint8_t *additional, uint64_t additional_id,
int additional_size,
3438 int64_t discard_padding)
3448 "Error parsing a wavpack block.\n");
3461 "Error parsing a prores block.\n");
3469 if (!pkt_size && !additional_size)
3489 if (additional_size > 0) {
3492 additional_size + 8);
3497 AV_WB64(side_data, additional_id);
3498 memcpy(side_data + 8, additional, additional_size);
3501 if (discard_padding) {
3512 if (discard_padding > 0) {
3513 AV_WL32(side_data + 4, discard_padding);
3515 AV_WL32(side_data, -discard_padding);
3526 #if FF_API_CONVERGENCE_DURATION
3529 pkt->convergence_duration = lace_duration;
3550 int size, int64_t
pos, uint64_t cluster_time,
3552 uint8_t *additional, uint64_t additional_id,
int additional_size,
3553 int64_t cluster_pos, int64_t discard_padding)
3561 uint32_t lace_size[256];
3562 int n,
flags, laces = 0;
3564 int trust_default_duration = 1;
3574 if (!track ||
size < 3)
3577 if (!(st = track->
stream)) {
3579 "No stream associated to TrackNumber %"PRIu64
". "
3580 "Ignoring Block with this TrackNumber.\n", num);
3586 if (block_duration > INT64_MAX)
3587 block_duration = INT64_MAX;
3596 if (cluster_time != (uint64_t) -1 &&
3597 (block_time >= 0 || cluster_time >= -block_time)) {
3600 timecode < track->end_timecode)
3625 &pb, lace_size, &laces);
3635 trust_default_duration = 0;
3639 if (!block_duration && trust_default_duration)
3642 if (cluster_time != (uint64_t)-1 && (block_time >= 0 || cluster_time >= -block_time))
3646 for (n = 0; n < laces; n++) {
3647 int64_t lace_duration = block_duration*(n+1) / laces - block_duration*n / laces;
3673 timecode, lace_duration,
3683 additional, additional_id, additional_size,
3690 timecode = lace_duration ? timecode + lace_duration :
AV_NOPTS_VALUE;
3722 if (res >= 0 &&
block->bin.size > 0) {
3731 block->additional.size, cluster->
pos,
3732 block->discard_padding);
3742 "end of segment.\n");
3774 int64_t timestamp,
int flags)
3778 AVStream *st =
s->streams[stream_index];
3854 int64_t start_time_ns;
3855 int64_t end_time_ns;
3856 int64_t start_offset;
3868 int nb_index_entries =
s->streams[0]->nb_index_entries;
3872 return (
CueDesc) {-1, -1, -1, -1};
3873 for (
i = 1;
i < nb_index_entries;
i++) {
3874 if (index_entries[
i - 1].timestamp * matroska->
time_scale <= ts &&
3875 index_entries[
i].timestamp * matroska->
time_scale > ts) {
3882 if (
i != nb_index_entries - 1) {
3899 int64_t cluster_pos, before_pos;
3901 if (
s->streams[0]->nb_index_entries <= 0)
return 0;
3904 if (
index < 0)
return 0;
3905 cluster_pos =
s->streams[0]->index_entries[
index].pos;
3908 uint64_t cluster_id, cluster_length;
3914 if (read < 0 || cluster_id != 0xF43B675)
3928 cluster_pos += 4 + read + cluster_length;
3942 double min_buffer,
double*
buffer,
3946 double nano_seconds_per_second = 1000000000.0;
3947 double time_sec = time_ns / nano_seconds_per_second;
3949 int64_t time_to_search_ns = (int64_t)(search_sec * nano_seconds_per_second);
3950 int64_t end_time_ns = time_ns + time_to_search_ns;
3951 double sec_downloaded = 0.0;
3955 *sec_to_download = 0.0;
3959 int64_t cue_nano = desc_curr.
end_time_ns - time_ns;
3962 double timeToDownload = (cueBytes * 8.0) /
bps;
3964 sec_downloaded += (cue_nano / nano_seconds_per_second) - timeToDownload;
3965 *sec_to_download += timeToDownload;
3969 double desc_end_time_sec = desc_curr.
end_time_ns / nano_seconds_per_second;
3970 double percent_to_sub = search_sec / (desc_end_time_sec - time_sec);
3971 sec_downloaded = percent_to_sub * sec_downloaded;
3972 *sec_to_download = percent_to_sub * *sec_to_download;
3975 if ((sec_downloaded + *
buffer) <= min_buffer) {
3986 double desc_sec = desc_ns / nano_seconds_per_second;
3987 double bits = (desc_bytes * 8.0);
3988 double time_to_download =
bits /
bps;
3990 sec_downloaded += desc_sec - time_to_download;
3991 *sec_to_download += time_to_download;
3994 double desc_end_time_sec = desc_curr.
end_time_ns / nano_seconds_per_second;
3995 double percent_to_sub = search_sec / (desc_end_time_sec - time_sec);
3996 sec_downloaded = percent_to_sub * sec_downloaded;
3997 *sec_to_download = percent_to_sub * *sec_to_download;
3999 if ((sec_downloaded + *
buffer) <= min_buffer)
4004 if ((sec_downloaded + *
buffer) <= min_buffer) {
4026 double bandwidth = 0.0;
4030 int64_t prebuffer_ns = 1000000000;
4032 double nano_seconds_per_second = 1000000000.0;
4033 int64_t prebuffered_ns = time_ns + prebuffer_ns;
4034 double prebuffer_bytes = 0.0;
4035 int64_t temp_prebuffer_ns = prebuffer_ns;
4036 int64_t pre_bytes, pre_ns;
4037 double pre_sec, prebuffer, bits_per_second;
4055 bits_per_second = 0.0;
4063 pre_sec = pre_ns / nano_seconds_per_second;
4065 pre_bytes * ((temp_prebuffer_ns / nano_seconds_per_second) / pre_sec);
4067 prebuffer = prebuffer_ns / nano_seconds_per_second;
4070 bits_per_second = 0.0;
4074 double desc_sec, calc_bits_per_second, percent, mod_bits_per_second;
4075 if (desc_bytes <= 0)
4078 desc_sec = desc_ns / nano_seconds_per_second;
4079 calc_bits_per_second = (desc_bytes * 8) / desc_sec;
4082 percent = (desc_bytes - prebuffer_bytes) / desc_bytes;
4083 mod_bits_per_second = calc_bits_per_second * percent;
4085 if (prebuffer < desc_sec) {
4091 int64_t
bps = (int64_t)(mod_bits_per_second) + 1;
4092 const double min_buffer = 0.0;
4093 double buffer = prebuffer;
4094 double sec_to_download = 0.0;
4097 min_buffer, &
buffer, &sec_to_download,
4101 }
else if (rv == 0) {
4102 bits_per_second = (double)(
bps);
4110 if (bandwidth < bits_per_second) bandwidth = bits_per_second;
4112 return (int64_t)bandwidth;
4121 int64_t cues_start = -1, cues_end = -1, before_pos, bandwidth;
4130 if (
i >= seekhead_list->
nb_elem)
return -1;
4134 if (
avio_seek(matroska->
ctx->
pb, cues_start, SEEK_SET) == cues_start) {
4138 uint64_t cues_length, cues_id;
4146 cues_end = cues_start + 4 + bytes_read + cues_length - 1;
4149 if (cues_start == -1 || cues_end == -1)
return -1;
4162 if (cues_start <= init_range)
4167 if (bandwidth < 0)
return -1;
4176 if (!buf)
return -1;
4178 for (
i = 0;
i <
s->streams[0]->nb_index_entries;
i++) {
4180 "%" PRId64
"%s",
s->streams[0]->index_entries[
i].timestamp,
4181 i !=
s->streams[0]->nb_index_entries - 1 ?
"," :
"");
4182 if (
ret <= 0 || (
ret == 20 &&
i ==
s->streams[0]->nb_index_entries - 1)) {
4228 buf = strrchr(
s->url,
'/');
4260 #define OFFSET(x) offsetof(MatroskaDemuxContext, x)
4275 .
name =
"matroska,webm",
4277 .extensions =
"mkv,mk3d,mka,mks",
4284 .mime_type =
"audio/webm,audio/x-matroska,video/webm,video/x-matroska"
4288 .
name =
"webm_dash_manifest",