mirror of https://git.ffmpeg.org/ffmpeg.git
avutil/avstring: Reimplement av_match_list()
av_match_list() is only used for whitelists, fix it so it works with multi-named formats like "mov,mp4,m4a,3gp,3g2,mj2" Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
cebe8c8095
commit
3c0b98dced
|
@ -404,22 +404,21 @@ end:
|
||||||
|
|
||||||
int av_match_list(const char *name, const char *list, char separator)
|
int av_match_list(const char *name, const char *list, char separator)
|
||||||
{
|
{
|
||||||
const char *p;
|
const char *p, *q;
|
||||||
char ext1[128], *q;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
p = list;
|
for (p = name; p && *p; ) {
|
||||||
for (i = 1;; i++) {
|
for (q = list; q && *q; ) {
|
||||||
q = ext1;
|
int k;
|
||||||
while (*p != '\0' && *p != separator && q - ext1 < sizeof(ext1) - 1)
|
for (k = 0; p[k] == q[k] || (p[k]*q[k] == 0 && p[k]+q[k] == ','); k++)
|
||||||
*q++ = *p++;
|
if (k && (!p[k] || p[k] == ','))
|
||||||
*q = '\0';
|
return 1;
|
||||||
if (!av_strcasecmp(ext1, name))
|
q = strchr(q, ',');
|
||||||
return i;
|
q += !!q;
|
||||||
if (*p == '\0')
|
}
|
||||||
break;
|
p = strchr(p, ',');
|
||||||
p++;
|
p += !!p;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue