1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-30 03:32:50 +00:00

demux_mkv: index all packets

Instead of indexing only 1 packet per cluster (which is enough for
working seeking), add every packet to the index.

Since on seek, we go through every single index entry, this probably
makes seeking slower. On the other hand, this code is used for files
without index only (e.g. incomplete files), so it probably doesn't
matter much.

Preparation for the following commits.
This commit is contained in:
wm4 2014-11-05 20:42:20 +01:00
parent ea613c2592
commit 8f992515cd

View File

@ -678,10 +678,8 @@ static void add_block_position(demuxer_t *demuxer, struct mkv_track *track,
return;
if (track->last_index_entry != (size_t)-1) {
mkv_index_t *index = &mkv_d->indexes[track->last_index_entry];
// filepos is always the cluster position, which can contain multiple
// blocks with different timecodes - one is enough.
// Also, never add block which are already covered by the index.
if (index->filepos == filepos || index->timecode >= timecode)
// Never add blocks which are already covered by the index.
if (index->timecode >= timecode)
return;
}
cue_index_add(demuxer, track->tnum, filepos, timecode);