Added in https://github.com/FFmpeg/FFmpeg/commit/91d96dc8ddaebe0b6cb393f672085e6bfaf15a31 The user can still turn this on via demuxer-lavf-o=extension_picky=1 if they want to. This causes quite a few problems with many HLS sources where the codecs are not known at probe time for whatever reason. Youtube for instance transports aac audio inside ".ts" extension urls which are disallowed by this option. As an aside, the FFmpeg test is also buggy and leaks a nested connection for any playlist item that fails the extension check. mpv catches this and prints "Leaking 1 nested connections (FFmpeg bug)" for every HLS stream that has at least one stream that fails the extension check.
Unified · Split
| @@ -147,6 +147,7 @@ struct format_hack { · 146 unmodified lines | |||
| 147 | bool no_seek_on_no_duration : 1; | 147 | bool no_seek_on_no_duration : 1; |
| 148 | bool readall_on_no_streamseek : 1; | 148 | bool readall_on_no_streamseek : 1; |
| 149 | bool first_frame_only : 1; | 149 | bool first_frame_only : 1; |
| 150 | bool no_ext_picky : 1; // set "extension_picky" to false | ||
| 150 | }; | 151 | }; |
| 151 | 152 | ||
| 152 | #define BLACKLIST(fmt) {fmt, .ignore = true} | 153 | #define BLACKLIST(fmt) {fmt, .ignore = true} |
| @@ -162,7 +163,7 @@ static const struct format_hack format_hacks[] = { · 9 unmodified lines | |||
| 162 | {"mp3", "audio/mpeg", 24, 0.5}, | 163 | {"mp3", "audio/mpeg", 24, 0.5}, |
| 163 | {"mp3", NULL, 24, .max_probe = true}, | 164 | {"mp3", NULL, 24, .max_probe = true}, |
| 164 | 165 | ||
| 165 | {"hls", .no_stream = true, .clear_filepos = true}, | 166 | {"hls", .no_stream = true, .clear_filepos = true, .no_ext_picky = true}, |
| 166 | {"dash", .no_stream = true, .clear_filepos = true}, | 167 | {"dash", .no_stream = true, .clear_filepos = true}, |
| 167 | {"sdp", .clear_filepos = true, .is_network = true, .no_seek = true}, | 168 | {"sdp", .clear_filepos = true, .is_network = true, .no_seek = true}, |
| 168 | {"mpeg", .use_stream_ids = true}, | 169 | {"mpeg", .use_stream_ids = true}, |
| @@ -1005,6 +1006,18 @@ static int demux_open_lavf(demuxer_t *demuxer, enum demux_check check) · 836 unmodified lines | |||
| 1005 | "analyzeduration to %f\n", analyze_duration); | 1006 | "analyzeduration to %f\n", analyze_duration); |
| 1006 | } | 1007 | } |
| 1007 | 1008 | ||
| 1009 | if (priv->format_hack.no_ext_picky) { | ||
| 1010 | bool user_set_ext_picky = false; | ||
| 1011 | for (int i = 0; lavfdopts->avopts && lavfdopts->avopts[i * 2]; i++) { | ||
| 1012 | if (bstr_startswith0(bstr0(lavfdopts->avopts[i * 2]), "extension_picky")) { | ||
| 1013 | user_set_ext_picky = true; | ||
| 1014 | break; | ||
| 1015 | } | ||
| 1016 | } | ||
| 1017 | if (!user_set_ext_picky && av_dict_set(&dopts, "extension_picky", "0", 0) >= 0) | ||
| 1018 | MP_VERBOSE(demuxer, "Option extension_picky=0 was set due to known FFmpeg bugs\n"); | ||
| 1019 | } | ||
| 1020 | |||
| 1008 | if ((priv->avif_flags & AVFMT_NOFILE) || priv->format_hack.no_stream) { | 1021 | if ((priv->avif_flags & AVFMT_NOFILE) || priv->format_hack.no_stream) { |
| 1009 | mp_setup_av_network_options(&dopts, priv->avif->name, | 1022 | mp_setup_av_network_options(&dopts, priv->avif->name, |
| 1010 | demuxer->global, demuxer->log); | 1023 | demuxer->global, demuxer->log); |