summaryrefslogtreecommitdiff
path: root/libavformat/format.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-09-30 19:00:52 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-10-02 18:51:05 +0200
commit0d92b0d5f445d4f26fb9d9d7cbf83c415c8d2279 (patch)
tree7bc1f0d1806583d4f387a366d00964016c0f35de /libavformat/format.c
parent6ea357ea83e3a821c43e05a324f7bcaa3d73076e (diff)
avutil/avstring: Factor av_match_list() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/format.c')
-rw-r--r--libavformat/format.c20
1 files changed, 3 insertions, 17 deletions
diff --git a/libavformat/format.c b/libavformat/format.c
index 1026c8f7a7..2d56e6d545 100644
--- a/libavformat/format.c
+++ b/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_list(ext + 1, extensions, ',');
return 0;
}