summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
Diffstat (limited to 'demux')
-rw-r--r--demux/demux.c9
-rw-r--r--demux/demux_mkv.c1
-rw-r--r--demux/demux_timeline.c2
3 files changed, 3 insertions, 9 deletions
diff --git a/demux/demux.c b/demux/demux.c
index 40439b32a8..813cb1aa23 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -980,13 +980,6 @@ static void demux_add_sh_stream_locked(struct demux_internal *in,
if (sh->ff_index < 0)
sh->ff_index = sh->index;
- if (sh->demuxer_id < 0) {
- sh->demuxer_id = 0;
- for (int n = 0; n < in->num_streams; n++) {
- if (in->streams[n]->type == sh->type)
- sh->demuxer_id += 1;
- }
- }
MP_TARRAY_APPEND(in, in->streams, in->num_streams, sh);
assert(in->streams[sh->index] == sh);
@@ -3762,6 +3755,8 @@ static bool queue_seek(struct demux_internal *in, double seek_pts, int flags,
struct sh_stream *demuxer_stream_by_demuxer_id(struct demuxer *d,
enum stream_type t, int id)
{
+ if (id < 0)
+ return NULL;
int num = demux_get_num_stream(d);
for (int n = 0; n < num; n++) {
struct sh_stream *s = demux_get_stream(d, n);
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index 4c5f376137..99e481bc7d 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -1286,7 +1286,6 @@ static void add_coverart(struct demuxer *demuxer)
if (!codec)
continue;
struct sh_stream *sh = demux_alloc_sh_stream(STREAM_VIDEO);
- sh->demuxer_id = -1 - sh->index; // don't clash with mkv IDs
sh->codec->codec = codec;
sh->attached_picture = new_demux_packet_from(att->data, att->data_size);
if (sh->attached_picture) {
diff --git a/demux/demux_timeline.c b/demux/demux_timeline.c
index aefca9f1c9..f8f096c464 100644
--- a/demux/demux_timeline.c
+++ b/demux/demux_timeline.c
@@ -133,7 +133,7 @@ static void associate_streams(struct demuxer *demuxer,
// Matching by demuxer ID is supposedly useful and preferable for
// ordered chapters.
- if (sh->demuxer_id == vs->sh->demuxer_id)
+ if (sh->demuxer_id >= 0 && sh->demuxer_id == vs->sh->demuxer_id)
other = vs;
}