mirror of https://github.com/mpv-player/mpv
demux_mkv: better behavior/warnings on partial files/unseekable streams
demux_mkv may seek to the end of the file to read certain headers (which should probably be called "footers", but in theory they are just headers that have been placed at the end of the file unfortunately). This commit changes behavior not to seek if the stream is not marked as seekable. Before this, it only checked whether the stream size was unknown (end negative). In practice it doesn't make much of a difference, since seekable usually equals known stream size. Also improve the wording, and distinguish between actual incomplete files, and unseekable ones.
This commit is contained in:
parent
1f76e69145
commit
07d9ca5ee3
|
@ -2104,13 +2104,16 @@ static int demux_mkv_open(demuxer_t *demuxer, enum demux_check check)
|
||||||
if (elem->parsed)
|
if (elem->parsed)
|
||||||
continue;
|
continue;
|
||||||
// Warn against incomplete files and skip headers outside of range.
|
// Warn against incomplete files and skip headers outside of range.
|
||||||
if (elem->pos >= end) {
|
if (elem->pos >= end || !s->seekable) {
|
||||||
elem->parsed = true; // don't bother if file is incomplete
|
elem->parsed = true; // don't bother if file is incomplete
|
||||||
if (!mkv_d->eof_warning && !(mkv_d->probably_webm_dash_init &&
|
if (end < 0 || !s->seekable) {
|
||||||
elem->pos == end))
|
MP_WARN(demuxer, "Stream is not seekable or unknown size, "
|
||||||
|
"not reading mkv metadata at end of file.\n");
|
||||||
|
} else if (!mkv_d->eof_warning &&
|
||||||
|
!(mkv_d->probably_webm_dash_init && elem->pos == end))
|
||||||
{
|
{
|
||||||
MP_WARN(demuxer, "SeekHead position beyond "
|
MP_WARN(demuxer, "mkv metadata beyond end of file - incomplete "
|
||||||
"end of file - incomplete file?\n");
|
"file?\n");
|
||||||
mkv_d->eof_warning = true;
|
mkv_d->eof_warning = true;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue