X-Git-Url: https://git.piment-noir.org/?p=deb_ffmpeg.git;a=blobdiff_plain;f=ffmpeg%2Flibavformat%2Fformat.c;h=97f5657141491a6dbb1107b458f528bcef6615f7;hp=1026c8f7a72dd672351385dee2c3aa290a398d0a;hb=f6fa7814ccfe3e76514b36cf04f5cd3cb657c8cf;hpb=2ba45a602cbfa7b771effba9b11bb4245c21bc00 diff --git a/ffmpeg/libavformat/format.c b/ffmpeg/libavformat/format.c index 1026c8f..97f5657 100644 --- a/ffmpeg/libavformat/format.c +++ b/ffmpeg/libavformat/format.c @@ -80,28 +80,14 @@ void av_register_output_format(AVOutputFormat *format) int av_match_ext(const char *filename, const char *extensions) { - const char *ext, *p; - char ext1[32], *q; + const char *ext; if (!filename) return 0; ext = strrchr(filename, '.'); - if (ext) { - ext++; - p = extensions; - for (;;) { - q = ext1; - while (*p != '\0' && *p != ',' && q - ext1 < sizeof(ext1) - 1) - *q++ = *p++; - *q = '\0'; - if (!av_strcasecmp(ext1, ext)) - return 1; - if (*p == '\0') - break; - p++; - } - } + if (ext) + return av_match_name(ext + 1, extensions); return 0; } @@ -269,8 +255,11 @@ int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, if (offset >= max_probe_size) return AVERROR(EINVAL); - if (pb->av_class) - av_opt_get(pb, "mime_type", AV_OPT_SEARCH_CHILDREN, &pd.mime_type); + if (pb->av_class) { + uint8_t *mime_type_opt = NULL; + av_opt_get(pb, "mime_type", AV_OPT_SEARCH_CHILDREN, &mime_type_opt); + pd.mime_type = (const char *)mime_type_opt; + } #if 0 if (!*fmt && pb->av_class && av_opt_get(pb, "mime_type", AV_OPT_SEARCH_CHILDREN, &mime_type) >= 0 && mime_type) { if (!av_strcasecmp(mime_type, "audio/aacp")) { @@ -334,7 +323,7 @@ fail: if (ret >= 0) ret = ret2; - av_free(pd.mime_type); + av_freep(&pd.mime_type); return ret < 0 ? ret : score; }