summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-10-01 20:48:45 +0200
committerwm4 <wm4@nowhere>2019-10-01 21:27:25 +0200
commit07d9ca5ee30e6ba31beaae329408997e817eb193 (patch)
treeba58260740dd07214a2fb4d216d3efbb182bdbc4 /demux
parent1f76e6914596868e53b5ed4f50353ba44177ab4c (diff)
downloadmpv-07d9ca5ee30e6ba31beaae329408997e817eb193.tar.bz2
mpv-07d9ca5ee30e6ba31beaae329408997e817eb193.tar.xz
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.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_mkv.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index 65c3559f55..b174d260a6 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -2104,13 +2104,16 @@ static int demux_mkv_open(demuxer_t *demuxer, enum demux_check check)
if (elem->parsed)
continue;
// 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
- if (!mkv_d->eof_warning && !(mkv_d->probably_webm_dash_init &&
- elem->pos == end))
+ if (end < 0 || !s->seekable) {
+ 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 "
- "end of file - incomplete file?\n");
+ MP_WARN(demuxer, "mkv metadata beyond end of file - incomplete "
+ "file?\n");
mkv_d->eof_warning = true;
}
continue;