A webserver omits the Content-Type or if mime-magic fails for unexpected reasons, probing an image HTTP URL with query parameters will fail in the extension match.
So check the protocol used is http or https, and drop anything after the first query parameter when evaluating an image URL. Signed-off-by: Vittorio Giovara <vittorio.giov...@gmail.com> --- This should be the less hack-y version, even though it does not fully address the image2 decoder. Vittorio libavformat/img2.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libavformat/img2.c b/libavformat/img2.c index 3cfc08e..698b907 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -84,13 +84,25 @@ static const IdStrMap img_tags[] = { static enum AVCodecID str2id(const IdStrMap *tags, const char *str) { + char *extra; + int len; + int is_http = av_strstart(str, "http://", NULL) || + av_strstart(str, "https://", NULL); + str = strrchr(str, '.'); if (!str) return AV_CODEC_ID_NONE; str++; + len = strlen(str); + + if (is_http) { + extra = strrchr(str, '?'); + if (extra) + len -= strlen(extra); + } while (tags->id) { - if (!av_strcasecmp(str, tags->str)) + if (!av_strncasecmp(str, tags->str, len)) return tags->id; tags++; -- 2.7.0 _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel