summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-05-26 01:11:23 +0200
committersfan5 <sfan5@live.de>2023-05-30 10:54:21 +0200
commitf79458476b88e02c79ed6777941bb3a53f1e130a (patch)
tree9c69146f87303b8af2b92594b876ff0e5421b426 /demux
parentbc28dce303a4abcc8ec2f1fd941bc1bfd02e6f79 (diff)
downloadmpv-f79458476b88e02c79ed6777941bb3a53f1e130a.tar.bz2
mpv-f79458476b88e02c79ed6777941bb3a53f1e130a.tar.xz
demux/demux_lavf: strip URL parameters before matching extension
Unfortunately Content-Type matching seems to be not enough as there are mistagged streams. Try to match extension and pass-through URL. Fixes #11700
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_lavf.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c
index 2925bd67f9..822e712aab 100644
--- a/demux/demux_lavf.c
+++ b/demux/demux_lavf.c
@@ -466,9 +466,12 @@ static int lavf_check_file(demuxer_t *demuxer, enum demux_check check)
}
}
+ // HLS streams seems to be not well tagged, so matching mime type is not
+ // enough. Strip URL parameters and match extension.
+ bstr ext = bstr_get_ext(bstr_split(bstr0(priv->filename), "?#", NULL));
AVProbeData avpd = {
// Disable file-extension matching with normal checks, except for HLS
- .filename = av_match_ext(priv->filename, "m3u8,m3u") ||
+ .filename = !bstrcasecmp0(ext, "m3u8") || !bstrcasecmp0(ext, "m3u") ||
check <= DEMUX_CHECK_REQUEST ? priv->filename : "",
.buf_size = 0,
.buf = av_mallocz(PROBE_BUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE),