From d60bbd86e35f3368fcda861099fa8e63b5bb7a7a Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 3 Dec 2019 21:15:40 +0100 Subject: demux_lavf: export demuxer_id for more formats which have it See previous commit. libavformat exports this information as AVStream.id field. The big problem is that the libavformat field is simply 0 if it's unknown (i.e. the demuxer never sets it). So it needs to remain a whitelist. Just add more formats which are known to have a meaningful ID. I considered exporting IDs for all formats, and then either leaving the values as they are, or filtering duplicate values (and choosing arbitrary but unique different IDs). But then again, I think it's sort of mpv's job to filter FFmpeg's absurd bullshit API, and it should make an effort to hide it rather than to reflect it. See: #7211 --- demux/demux_lavf.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 508b76b724..cea05634e9 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -134,7 +134,7 @@ struct format_hack { bool max_probe : 1; // use probescore only if max. probe size reached bool ignore : 1; // blacklisted bool no_stream : 1; // do not wrap struct stream as AVIOContext - bool use_stream_ids : 1; // export the native stream IDs + bool use_stream_ids : 1; // has a meaningful native stream IDs (export it) bool fully_read : 1; // set demuxer.fully_read flag bool detect_charset : 1; // format is a small text file, possibly not UTF8 bool image_format : 1; // expected to contain exactly 1 frame @@ -166,9 +166,12 @@ static const struct format_hack format_hacks[] = { {"sdp", .clear_filepos = true, .is_network = true, .no_seek = true}, {"mpeg", .use_stream_ids = true}, {"mpegts", .use_stream_ids = true}, - - {"mp4", .skipinfo = true, .fix_editlists = true, .no_pcm_seek = true}, - {"matroska", .skipinfo = true, .no_pcm_seek = true}, + {"mxf", .use_stream_ids = true}, + {"avi", .use_stream_ids = true}, + {"asf", .use_stream_ids = true}, + {"mp4", .skipinfo = true, .fix_editlists = true, .no_pcm_seek = true, + .use_stream_ids = true}, + {"matroska", .skipinfo = true, .no_pcm_seek = true, .use_stream_ids = true}, {"v4l2", .no_seek = true}, @@ -178,7 +181,7 @@ static const struct format_hack format_hacks[] = { // Some Ogg shoutcast streams are essentially concatenated OGG files. They // reset timestamps, which causes all sorts of problems. - {"ogg", .linearize_audio_ts = true}, + {"ogg", .linearize_audio_ts = true, .use_stream_ids = true}, TEXTSUB("aqtitle"), TEXTSUB("jacosub"), TEXTSUB("microdvd"), TEXTSUB("mpl2"), TEXTSUB("mpsub"), TEXTSUB("pjs"), TEXTSUB("realtext"), -- cgit v1.2.3