32 #include "config_components.h"
81 #define EBML_UNKNOWN_LENGTH UINT64_MAX
82 #define NEEDS_CHECKING 2
86 #define SKIP_THRESHOLD 1024 * 1024
89 #define UNKNOWN_EQUIV 50 * 1024
145 typedef struct Ebml {
436 #define CHILD_OF(parent) { .def = { .n = parent } }
839 uint32_t
id, int64_t position)
868 "Seek to desired resync point failed. Seeking to "
869 "earliest point available instead.\n");
871 last_pos + 1), SEEK_SET);
907 int max_size, uint64_t *number,
int eof_forbidden)
921 if (!total ||
read > max_size) {
925 "0x00 at pos %"PRId64
" (0x%"PRIx64
") invalid as first byte "
926 "of an EBML number\n",
pos,
pos);
929 "Length %d indicated by an EBML number's first byte 0x%02x "
930 "at pos %"PRId64
" (0x%"PRIx64
") exceeds max length %d.\n",
939 total = (total << 8) |
avio_r8(pb);
954 "Read error at pos. %"PRIu64
" (0x%"PRIx64
")\n",
960 "at pos. %"PRIu64
" (0x%"PRIx64
")\n",
pos,
pos);
975 if (res > 0 && *number + 1 == 1ULL << (7 * res))
985 uint64_t default_value, uint64_t *num)
990 *num = default_value;
996 *num = (*num << 8) |
avio_r8(pb);
1006 int64_t default_value, int64_t *num)
1011 *num = default_value;
1018 *num = ((uint64_t)*num << 8) |
avio_r8(pb);
1029 double default_value,
double *num)
1032 *num = default_value;
1034 }
else if (
size == 4) {
1036 }
else if (
size == 8) {
1049 const char *default_value,
char **str)
1054 if (
size == 0 && default_value) {
1108 uint64_t length, int64_t
pos)
1120 level->length = length;
1140 *num = unum - ((1LL << (7 * res - 1)) - 1);
1171 *(uint64_t *)dst =
syntax[
i].def.u;
1174 *(int64_t *) dst =
syntax[
i].def.i;
1177 *(
double *) dst =
syntax[
i].def.f;
1210 return id && (
bits + 7) / 8 == (8 -
bits % 8);
1218 uint32_t
id, int64_t
pos)
1290 "at pos. %"PRIu64
" (0x%"PRIx64
")\n",
pos,
pos);
1297 pos_alt =
pos + res;
1320 "%"PRId64
"\n",
id,
pos);
1330 if ((
unsigned)
list->nb_elem + 1 >= UINT_MAX /
syntax->list_elem_size)
1333 &
list->alloc_elem_size,
1334 (
list->nb_elem + 1) *
syntax->list_elem_size);
1337 list->elem = newelem;
1354 uint64_t elem_end = pos_alt + length,
1357 if (elem_end < level_end) {
1359 }
else if (elem_end == level_end) {
1363 "Element at 0x%"PRIx64
" ending at 0x%"PRIx64
" exceeds "
1364 "containing master element ending at 0x%"PRIx64
"\n",
1365 pos, elem_end, level_end);
1372 "at 0x%"PRIx64
" inside parent with finite size\n",
pos);
1382 "Found unknown-length element 0x%"PRIX32
" other than "
1383 "a cluster at 0x%"PRIx64
". Spec-incompliant, but "
1384 "parsing will nevertheless be attempted.\n",
id,
pos);
1391 if (max_lengths[
syntax->type] && length > max_lengths[
syntax->type]) {
1394 "Invalid length 0x%"PRIx64
" > 0x%"PRIx64
" for element "
1395 "with ID 0x%"PRIX32
" at 0x%"PRIx64
"\n",
1396 length, max_lengths[
syntax->type],
id,
pos);
1399 "Element with ID 0x%"PRIX32
" at pos. 0x%"PRIx64
" has "
1400 "unknown length, yet the length of an element of its "
1401 "type must be known.\n",
id,
pos);
1404 "Found unknown-length element with ID 0x%"PRIX32
" at "
1405 "pos. 0x%"PRIx64
" for which no syntax for parsing is "
1406 "available.\n",
id,
pos);
1443 "Unknown element %"PRIX32
" at pos. 0x%"PRIx64
" with "
1444 "length 0x%"PRIx64
" considered as invalid data. Last "
1445 "known good position 0x%"PRIx64
", %d unknown elements"
1491 if (!level1_elem->
pos) {
1494 }
else if (level1_elem->
pos !=
pos)
1512 if ((res2 =
avio_skip(pb, length - 1)) >= 0) {
1551 if (elem->
count != UINT_MAX)
1574 void *data_off = (
char *)
data +
syntax[
i].data_offset;
1585 if (
syntax[
i].list_elem_size) {
1587 char *ptr =
list->elem;
1588 for (j = 0; j <
list->nb_elem;
1589 j++, ptr +=
syntax[
i].list_elem_size)
1593 list->alloc_elem_size = 0;
1608 int len_mask = 0x80,
size = 1, n = 1,
i;
1616 while (
size <= 8 && !(total & len_mask)) {
1622 total &= (len_mask - 1);
1624 total = (total << 8) | p->
buf[4 + n++];
1626 if (total + 1 == 1ULL << (7 *
size)){
1641 if (total < probelen)
1643 for (n = 4 +
size; n <= 4 +
size + total - probelen; n++)
1659 if (tracks[
i].num == num)
1670 uint8_t *
data = *buf;
1671 int isize = *buf_size;
1672 uint8_t *pkt_data =
NULL;
1674 int pkt_size = isize;
1678 if (pkt_size >= 10000000
U)
1681 switch (encodings[0].compression.algo) {
1687 if (header_size && !
header) {
1695 pkt_size = isize + header_size;
1700 memcpy(pkt_data,
header, header_size);
1701 memcpy(pkt_data + header_size,
data, isize);
1707 olen = pkt_size *= 3;
1714 pkt_data = newpktdata;
1726 z_stream zstream = { 0 };
1727 if (!pkt_size || inflateInit(&zstream) != Z_OK)
1729 zstream.next_in =
data;
1730 zstream.avail_in = isize;
1735 inflateEnd(&zstream);
1739 pkt_data = newpktdata;
1740 zstream.avail_out = pkt_size - zstream.total_out;
1741 zstream.next_out = pkt_data + zstream.total_out;
1743 }
while (
result == Z_OK && pkt_size < 10000000);
1744 pkt_size = zstream.total_out;
1745 inflateEnd(&zstream);
1746 if (
result != Z_STREAM_END) {
1747 if (
result == Z_MEM_ERROR)
1759 bz_stream bzstream = { 0 };
1760 if (!pkt_size || BZ2_bzDecompressInit(&bzstream, 0, 0) != BZ_OK)
1762 bzstream.next_in =
data;
1763 bzstream.avail_in = isize;
1768 BZ2_bzDecompressEnd(&bzstream);
1772 pkt_data = newpktdata;
1773 bzstream.avail_out = pkt_size - bzstream.total_out_lo32;
1774 bzstream.next_out = pkt_data + bzstream.total_out_lo32;
1775 result = BZ2_bzDecompress(&bzstream);
1776 }
while (
result == BZ_OK && pkt_size < 10000000);
1777 pkt_size = bzstream.total_out_lo32;
1778 BZ2_bzDecompressEnd(&bzstream);
1779 if (
result != BZ_STREAM_END) {
1780 if (
result == BZ_MEM_ERROR)
1796 *buf_size = pkt_size;
1811 for (
i = 0;
i <
list->nb_elem;
i++) {
1812 const char *lang = tags[
i].
lang &&
1813 strcmp(tags[
i].lang,
"und") ? tags[
i].
lang :
NULL;
1815 if (!tags[
i].
name) {
1823 if (tags[
i].def || !lang) {
1825 if (tags[
i].sub.nb_elem)
1832 if (tags[
i].sub.nb_elem)
1846 if (tags[
i].target.attachuid) {
1850 if (attachment[j].
uid == tags[
i].target.attachuid &&
1851 attachment[j].stream) {
1853 &attachment[j].stream->metadata,
NULL);
1859 "The tags at index %d refer to a "
1860 "non-existent attachment %"PRId64
".\n",
1861 i, tags[
i].target.attachuid);
1863 }
else if (tags[
i].target.chapteruid) {
1867 if (chapter[j].
uid == tags[
i].target.chapteruid &&
1868 chapter[j].chapter) {
1870 &chapter[j].chapter->metadata,
NULL);
1876 "The tags at index %d refer to a non-existent chapter "
1878 i, tags[
i].target.chapteruid);
1880 }
else if (tags[
i].target.trackuid) {
1884 if (track[j].
uid == tags[
i].target.trackuid &&
1887 &track[j].stream->metadata,
NULL);
1893 "The tags at index %d refer to a non-existent track "
1895 i, tags[
i].target.trackuid);
1899 tags[
i].target.type);
1918 "Max EBML element depth (%d) reached, "
1951 for (
i = 0;
i < seekhead_list->
nb_elem;
i++) {
1953 uint32_t
id = seekheads[
i].
id;
1961 if (!elem || elem->
parsed)
1984 uint64_t index_scale = 1;
1990 index_list = &matroska->
index;
2001 for (j = 0; j < pos_list->
nb_elem; j++) {
2004 if (track && track->
stream)
2033 unsigned nb_encodings,
2035 char **key_id_base64,
void *logctx)
2037 if (nb_encodings > 1) {
2039 "Multiple combined encodings not supported");
2044 if (encodings->
type) {
2050 if (!*key_id_base64)
2057 encodings->
scope = 0;
2069 encodings->
scope = 0;
2080 "Failed to decode codec private data\n");
2098 encodings->
scope & 1 &&
2108 static const char *
const aac_profiles[] = {
"MAIN",
"LC",
"SSR" };
2154 int block_last, block_type, block_size;
2160 if (block_size >
size)
2169 chmask =
av_dict_get(dict,
"WAVEFORMATEXTENSIBLE_CHANNEL_MASK",
NULL, 0);
2174 "Invalid value of WAVEFORMATEXTENSIBLE_CHANNEL_MASK\n");
2190 int minor, micro, bttb = 0;
2194 if (matroska->
muxingapp && sscanf(matroska->
muxingapp,
"Lavf57.%d.%d", &minor, µ) == 2)
2195 bttb = (minor >= 36 && minor <= 51 && micro >= 100);
2197 switch (field_order) {
2216 int *h_width,
int *h_height)
2218 switch (stereo_mode) {
2242 static const struct {
2245 } stereo_mode_conv [] = {
2246 #define STEREO_MODE_CONV(STEREOMODETYPE, STEREO3DTYPE, FLAGS, WDIV, HDIV, WEBM) \
2247 [(STEREOMODETYPE)] = { .type = (STEREO3DTYPE), .flags = (FLAGS) },
2248 #define NOTHING(STEREOMODETYPE, WDIV, HDIV, WEBM)
2257 stereo->
type = stereo_mode_conv[stereo_mode].type;
2258 stereo->
flags = stereo_mode_conv[stereo_mode].flags;
2272 int has_mastering_primaries, has_mastering_luminance;
2277 mastering_meta = &
color->mastering_meta;
2279 has_mastering_primaries =
2280 mastering_meta->
r_x > 0 && mastering_meta->
r_y > 0 &&
2281 mastering_meta->
g_x > 0 && mastering_meta->
g_y > 0 &&
2282 mastering_meta->
b_x > 0 && mastering_meta->
b_y > 0 &&
2306 (
color->chroma_siting_vert - 1) << 7);
2322 if (has_mastering_primaries || has_mastering_luminance) {
2332 if (has_mastering_primaries) {
2343 if (has_mastering_luminance) {
2357 double pitch = proj->
pitch, yaw = proj->
yaw, roll = proj->
roll;
2361 if (pitch == 0.0 && yaw == 0.0 && roll == 0.0)
2366 if (pitch != 0.0 || (yaw != 0.0 && yaw != 180.0 && yaw != -180.0) ||
2369 "projection in stream %u (yaw %f, pitch %f, roll %f)\n",
2370 st->
index, yaw, pitch, roll);
2399 const uint8_t *priv_data = mkv_projection->
private.
data;
2401 size_t spherical_size;
2402 uint32_t l = 0, t = 0,
r = 0,
b = 0;
2403 uint32_t padding = 0;
2405 if (mkv_projection->
private.
size && priv_data[0] != 0) {
2420 if (
b >= UINT_MAX - t ||
r >= UINT_MAX - l) {
2422 "Invalid bounding rectangle coordinates "
2423 "%"PRIu32
",%"PRIu32
",%"PRIu32
",%"PRIu32
"\n",
2432 if (l || t ||
r ||
b)
2445 "Unknown spherical cubemap layout %"PRIu32
"\n",
layout);
2449 padding =
AV_RB32(priv_data + 8);
2457 "Unknown spherical metadata type %"PRIu64
"\n",
2500 for (
int i = 0;
i < mappings_list->
nb_elem;
i++) {
2504 switch (mapping->
type) {
2507 "Explicit block Addition Mapping type \"Use BlockAddIDValue\", value %"PRIu64
","
2508 " name \"%s\" found.\n", mapping->
value, mapping->
name ? mapping->
name :
"");
2516 "Invalid Block Addition Value 0x%"PRIx64
" for Block Addition Mapping Type "
2517 "0x%"PRIx64
", name \"%s\"\n", mapping->
value, mapping->
type,
2518 mapping->
name ? mapping->
name :
"");
2531 "Unknown Block Addition Mapping type 0x%"PRIx64
", value %"PRIu64
", name \"%s\"\n",
2533 if (mapping->
value < 2) {
2536 "Invalid Block Addition value 0x%"PRIu64
" for unknown Block Addition Mapping "
2537 "type %"PRIx64
", name \"%s\"\n", mapping->
value, mapping->
type,
2538 mapping->
name ? mapping->
name :
"");
2584 #define AAC_MAX_EXTRADATA_SIZE 5
2585 #define TTA_EXTRADATA_SIZE 22
2586 #define WAVPACK_EXTRADATA_SIZE 2
2595 int extradata_size = 0;
2598 if (!strcmp(track->
codec_id,
"A_MS/ACM") &&
2609 }
else if (!strcmp(track->
codec_id,
"A_QUICKTIME") &&
2614 uint16_t sample_size;
2621 if (sample_size == 8) {
2624 }
else if (sample_size == 16) {
2630 fourcc ==
MKTAG(
's',
'o',
'w',
't')) && sample_size == 8)
2673 extradata[0] = (
profile << 3) | ((sri & 0x0E) >> 1);
2674 extradata[1] = ((sri & 0x01) << 7) | (track->
audio.
channels << 3);
2675 if (strstr(track->
codec_id,
"SBR")) {
2677 extradata[2] = 0x56;
2678 extradata[3] = 0xE5;
2679 extradata[4] = 0x80 | (sri << 3);
2706 "Too large audio channel number %"PRIu64
2707 " or bitdepth %"PRIu64
". Skipping track.\n",
2718 bytestream_put_be32(&ptr,
AV_RB32(
"TTA1"));
2719 bytestream_put_le16(&ptr, 1);
2746 flavor = bytestream_get_be16(&ptr);
2765 static const int sipr_bit_rate[4] = { 6504, 8496, 5000, 16000 };
2769 par->
bit_rate = sipr_bit_rate[flavor];
2774 *extradata_offset = 78;
2792 "in absence of valid CodecPrivate.\n");
2799 if (extradata_size > 0) {
2803 memcpy(par->
extradata, extradata, extradata_size);
2819 s, extradata_offset);
2841 (
AVRational){1, par->codec_id == AV_CODEC_ID_OPUS ?
2842 48000 : par->sample_rate});
2856 int *extradata_offset)
2858 if (!strcmp(track->
codec_id,
"V_MS/VFW/FOURCC") &&
2868 *extradata_offset = 40;
2870 }
else if (!strcmp(track->
codec_id,
"V_QUICKTIME") &&
2905 *extradata_offset = 26;
2925 int *extradata_offset)
2929 int display_width_mul = 1;
2930 int display_height_mul = 1;
2952 &display_width_mul, &display_height_mul);
2971 #if FF_API_R_FRAME_RATE
2993 snprintf(buf,
sizeof(buf),
"%s_%d",
2996 if (
planes[j].
uid == tracks[k].
uid && tracks[k].stream) {
2998 "stereo_mode", buf, 0);
3032 switch (data_component_id) {
3036 if (component_tag >= 0x30 && component_tag <= 0x37) {
3043 if (component_tag == 0x87) {
3053 "Unknown ARIB caption profile utilized: %02x / %04x\n",
3054 component_tag, data_component_id);
3060 if (!strcmp(track->
codec_id,
"D_WEBVTT/CAPTIONS")) {
3062 }
else if (!strcmp(track->
codec_id,
"D_WEBVTT/DESCRIPTIONS")) {
3064 }
else if (!strcmp(track->
codec_id,
"D_WEBVTT/METADATA")) {
3084 int extradata_offset = 0;
3086 char* key_id_base64 =
NULL;
3094 "Unknown or unsupported track type %"PRIu64
"\n",
3113 "Invalid sample rate %f, defaulting to 8000 instead.\n",
3121 if (default_duration > UINT64_MAX || default_duration < 0) {
3123 "Invalid frame rate %e. Cannot calculate default duration.\n",
3139 track, &key_id_base64, matroska->
ctx);
3173 if (key_id_base64) {
3179 if (strcmp(track->
language,
"und"))
3185 "Track TimestampScale too small %f, assuming 1.0.\n",
3194 1000 * 1000 * 1000);
3207 s, &extradata_offset);
3231 "Unknown/unsupported AVCodecID %s.\n", track->
codec_id);
3258 uint64_t max_start = 0;
3273 ebml.
max_size >
sizeof(uint64_t) ||
3277 "EBML version %"PRIu64
", doctype %s, doc version %"PRIu64,
3283 "EBML header using unsupported features\n"
3284 "(EBML version %"PRIu64
", doctype %s, doc version %"PRIu64
")\n",
3338 attachments = attachments_list->
elem;
3339 for (j = 0; j < attachments_list->
nb_elem; j++) {
3340 if (!(attachments[j].filename && attachments[j].mime &&
3341 attachments[j].bin.data && attachments[j].bin.size > 0)) {
3360 attachments[j].
stream = st;
3371 attachments[j].bin.size);
3383 chapters = chapters_list->
elem;
3386 (max_start == 0 || chapters[
i].start > max_start)) {
3392 max_start = chapters[
i].
start;
3440 uint32_t lace_size[256],
int *laces)
3443 uint8_t *
data = *buf;
3447 lace_size[0] =
size;
3463 for (n = 0; n < *laces - 1; n++) {
3471 lace_size[n] +=
temp;
3474 }
while (
temp == 0xff);
3479 lace_size[n] =
size - total;
3484 if (
size % (*laces))
3486 for (n = 0; n < *laces; n++)
3487 lace_size[n] =
size / *laces;
3504 total = lace_size[0] = num;
3506 for (n = 1; n < *laces - 1; n++) {
3512 if (lace_size[n - 1] + snum > (uint64_t)INT_MAX)
3515 lace_size[n] = lace_size[n - 1] + snum;
3516 total += lace_size[n];
3524 lace_size[*laces - 1] =
size - total;
3536 uint8_t *
data,
int size, uint64_t timecode,
3551 if (
size < cfs *
h / 2) {
3553 "Corrupt int4 RM-style audio packet size\n");
3556 for (x = 0; x <
h / 2; x++)
3557 memcpy(track->
audio.
buf + x * 2 *
w + y * cfs,
3558 data + x * cfs, cfs);
3562 "Corrupt sipr RM-style audio packet size\n");
3569 "Corrupt generic RM-style audio packet size\n");
3572 for (x = 0; x <
w /
sps; x++)
3574 sps * (
h * x + ((
h + 1) / 2) * (y & 1) + (y >> 1)),
3615 uint8_t *dst =
NULL;
3633 while (srclen >= 8) {
3643 multiblock = (
flags & 0x1800) != 0x1800;
3655 if (blocksize > srclen) {
3666 dstlen += blocksize + 32;
3677 memcpy(dst +
offset + 32,
src, blocksize);
3680 srclen -= blocksize;
3681 offset += blocksize + 32;
3700 int dstlen = *
size + 8;
3708 memcpy(dst + 8, *
data, dstlen - 8);
3720 uint8_t *
data,
int data_len,
3726 uint8_t *
id, *settings, *text, *buf;
3727 int id_len, settings_len, text_len;
3735 q =
data + data_len;
3740 if (*p ==
'\r' || *p ==
'\n') {
3749 if (p >= q || *p !=
'\n')
3756 if (*p ==
'\r' || *p ==
'\n') {
3757 settings_len = p - settings;
3765 if (p >= q || *p !=
'\n')
3771 while (text_len > 0) {
3772 const int len = text_len - 1;
3773 const uint8_t
c = p[
len];
3774 if (
c !=
'\r' &&
c !=
'\n')
3787 memcpy(
pkt->
data, text, text_len);
3797 memcpy(buf,
id, id_len);
3800 if (settings_len > 0) {
3808 memcpy(buf, settings, settings_len);
3834 const uint8_t *
data,
int size, uint64_t
id)
3844 "BlockAddID %"PRIu64
" is higher than the reported MaxBlockAdditionID %"PRIu64
" "
3851 for (
int i = 0;
i < mappings_list->
nb_elem;
i++) {
3852 if (
id != mappings[
i].
value)
3854 mapping = &mappings[
i];
3858 if (
id != 1 && !matroska->
is_webm && !mapping) {
3863 if (mapping && mapping->
type)
3869 int country_code, provider_code;
3870 int provider_oriented_code, application_identifier;
3871 size_t hdrplus_size;
3880 country_code = bytestream2_get_byteu(&bc);
3881 provider_code = bytestream2_get_be16u(&bc);
3883 if (country_code != 0xB5 || provider_code != 0x3C)
3886 provider_oriented_code = bytestream2_get_be16u(&bc);
3887 application_identifier = bytestream2_get_byteu(&bc);
3889 if (provider_oriented_code != 1 || application_identifier != 4)
3899 (uint8_t *)hdrplus, hdrplus_size)) < 0) {
3924 uint64_t timecode, uint64_t lace_duration,
3927 int64_t discard_padding)
3929 uint8_t *pkt_data =
data;
3937 "Error parsing a wavpack block.\n");
3950 "Error parsing a prores block.\n");
3958 if (!pkt_size && !nb_blockmore)
3964 "Unexpected BlockAdditions found in a Block from Track with TrackNumber %"PRIu64
" "
3965 "where MaxBlockAdditionID is 0\n", track->
num);
3988 for (
int i = 0;
i < nb_blockmore;
i++) {
4002 if (discard_padding) {
4013 if (discard_padding > 0) {
4014 AV_WL32(side_data + 4, discard_padding);
4016 AV_WL32(side_data, -discard_padding);
4043 int size, int64_t
pos, uint64_t cluster_time,
4046 int64_t cluster_pos, int64_t discard_padding)
4054 uint32_t lace_size[256];
4055 int n,
flags, laces = 0;
4057 int trust_default_duration;
4069 if (!track ||
size < 3)
4072 if (!(st = track->
stream)) {
4074 "No stream associated to TrackNumber %"PRIu64
". "
4075 "Ignoring Block with this TrackNumber.\n", num);
4081 if (block_duration > INT64_MAX)
4082 block_duration = INT64_MAX;
4091 if (cluster_time != (uint64_t) -1 &&
4092 (block_time >= 0 || cluster_time >= -block_time)) {
4093 uint64_t timecode_cluster_in_track_tb = (
double) cluster_time / track->
time_scale;
4096 timecode < track->end_timecode)
4114 else if (!
ffstream(st)->skip_to_keyframe) {
4121 &pb.
pub, lace_size, &laces);
4132 trust_default_duration = 0;
4136 if (!block_duration && trust_default_duration)
4139 if (cluster_time != (uint64_t)-1 && (block_time >= 0 || cluster_time >= -block_time))
4143 for (n = 0; n < laces; n++) {
4144 int64_t lace_duration = block_duration*(n+1) / laces - block_duration*n / laces;
4145 uint8_t *out_data =
data;
4170 timecode, lace_duration,
4180 blockmore, nb_blockmore,
4187 timecode = lace_duration ? timecode + lace_duration :
AV_NOPTS_VALUE;
4219 if (res >= 0 &&
block->bin.size > 0) {
4226 block->blockmore.nb_elem, cluster->
pos,
4227 block->discard_padding);
4237 "end of segment.\n");
4269 int64_t timestamp,
int flags)
4273 AVStream *st =
s->streams[stream_index];
4352 #if CONFIG_WEBM_DASH_MANIFEST_DEMUXER
4354 int64_t start_time_ns;
4355 int64_t end_time_ns;
4356 int64_t start_offset;
4365 static CueDesc get_cue_desc(
AVFormatContext *
s, int64_t ts, int64_t cues_start) {
4374 return (CueDesc) {-1, -1, -1, -1};
4375 for (
i = 1;
i < nb_index_entries;
i++) {
4376 if (index_entries[
i - 1].timestamp * matroska->
time_scale <= ts &&
4377 index_entries[
i].timestamp * matroska->
time_scale > ts) {
4382 if (index_entries[
i].timestamp > matroska->
duration)
4383 return (CueDesc) {-1, -1, -1, -1};
4386 if (
i != nb_index_entries - 1) {
4405 int64_t cluster_pos, before_pos;