summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
Diffstat (limited to 'demux')
-rw-r--r--demux/demux.c1
-rw-r--r--demux/demux_lavf.c1
-rw-r--r--demux/stheader.h2
3 files changed, 4 insertions, 0 deletions
diff --git a/demux/demux.c b/demux/demux.c
index e5cd4d53fe..7c563e9625 100644
--- a/demux/demux.c
+++ b/demux/demux.c
@@ -190,6 +190,7 @@ struct sh_stream *new_sh_stream(demuxer_t *demuxer, enum stream_type type)
*sh = (struct sh_stream) {
.type = type,
.index = demuxer->num_streams,
+ .ff_index = demuxer->num_streams,
.demuxer_id = demuxer_id, // may be overwritten by demuxer
.ds = talloc(sh, struct demux_stream),
};
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 85db0692e8..553e43aea0 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -587,6 +587,7 @@ static void handle_stream(demuxer_t *demuxer, int i)
MP_TARRAY_APPEND(priv, priv->streams, priv->num_streams, sh);
if (sh) {
+ sh->ff_index = st->index;
sh->codec = mp_codec_from_av_codec_id(codec->codec_id);
sh->lav_headers = codec;
diff --git a/demux/stheader.h b/demux/stheader.h
index 7c9b182f4b..2b5b43702f 100644
--- a/demux/stheader.h
+++ b/demux/stheader.h
@@ -36,6 +36,8 @@ struct sh_stream {
// Demuxer/format specific ID. Corresponds to the stream IDs as encoded in
// some file formats (e.g. MPEG), or an index chosen by demux.c.
int demuxer_id;
+ // FFmpeg stream index (AVFormatContext.streams[index]), or equivalent.
+ int ff_index;
// One of these is non-NULL, the others are NULL, depending on the stream
// type.
struct sh_audio *audio;