Unified · Split
| @@ -15,6 +15,9 @@ libavutil: 2014-08-09 · 14 unmodified lines | ||
| 15 | 15 | |
| 16 | 16 | API changes, most recent first: |
| 17 | 17 | |
| 18 | +2014-10-02 - xxxxxxx - lavu 54.8.100 - avstring.h | |
| 19 | + Add av_match_list() | |
| 20 | + | |
| 18 | 21 | 2014-09-24 - xxxxxxx - libpostproc 53.1.100 |
| 19 | 22 | Add visualization support |
| 20 | 23 | |
| @@ -80,28 +80,14 @@ void av_register_output_format(AVOutputFormat *format) · 79 unmodified lines | ||
| 80 | 80 | |
| 81 | 81 | int av_match_ext(const char *filename, const char *extensions) |
| 82 | 82 | { |
| 83 | − const char *ext, *p; | |
| 84 | − char ext1[32], *q; | |
| 83 | + const char *ext; | |
| 85 | 84 | |
| 86 | 85 | if (!filename) |
| 87 | 86 | return 0; |
| 88 | 87 | |
| 89 | 88 | ext = strrchr(filename, '.'); |
| 90 | − if (ext) { | |
| 91 | − ext++; | |
| 92 | − p = extensions; | |
| 93 | − for (;;) { | |
| 94 | − q = ext1; | |
| 95 | − while (*p != '\0' && *p != ',' && q - ext1 < sizeof(ext1) - 1) | |
| 96 | − *q++ = *p++; | |
| 97 | − *q = '\0'; | |
| 98 | − if (!av_strcasecmp(ext1, ext)) | |
| 99 | − return 1; | |
| 100 | − if (*p == '\0') | |
| 101 | − break; | |
| 102 | − p++; | |
| 103 | − } | |
| 104 | − } | |
| 89 | + if (ext) | |
| 90 | + return av_match_list(ext + 1, extensions, ','); | |
| 105 | 91 | return 0; |
| 106 | 92 | } |
| 107 | 93 | |
| @@ -402,6 +402,27 @@ end: · 401 unmodified lines | ||
| 402 | 402 | return ret; |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | +int av_match_list(const char *name, const char *list, char separator) | |
| 406 | +{ | |
| 407 | + const char *p; | |
| 408 | + char ext1[128], *q; | |
| 409 | + int i; | |
| 410 | + | |
| 411 | + p = list; | |
| 412 | + for (i = 1;; i++) { | |
| 413 | + q = ext1; | |
| 414 | + while (*p != '\0' && *p != separator && q - ext1 < sizeof(ext1) - 1) | |
| 415 | + *q++ = *p++; | |
| 416 | + *q = '\0'; | |
| 417 | + if (!av_strcasecmp(ext1, name)) | |
| 418 | + return i; | |
| 419 | + if (*p == '\0') | |
| 420 | + break; | |
| 421 | + p++; | |
| 422 | + } | |
| 423 | + return 0; | |
| 424 | +} | |
| 425 | + | |
| 405 | 426 | #ifdef TEST |
| 406 | 427 | |
| 407 | 428 | int main(void) |
| @@ -357,6 +357,13 @@ int av_escape(char **dst, const char *src, const char *special_chars, · 356 unmodified lines | ||
| 357 | 357 | int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end, |
| 358 | 358 | unsigned int flags); |
| 359 | 359 | |
| 360 | +/** | |
| 361 | + * Check if a name is in a list. | |
| 362 | + * @returns 0 if not found, or the 1 based index where it has been found in the | |
| 363 | + * list. | |
| 364 | + */ | |
| 365 | +int av_match_list(const char *name, const char *list, char separator); | |
| 366 | + | |
| 360 | 367 | /** |
| 361 | 368 | * @} |
| 362 | 369 | */ |
| @@ -56,8 +56,8 @@ · 55 unmodified lines | ||
| 56 | 56 | */ |
| 57 | 57 | |
| 58 | 58 | #define LIBAVUTIL_VERSION_MAJOR 54 |
| 59 | −#define LIBAVUTIL_VERSION_MINOR 7 | |
| 60 | −#define LIBAVUTIL_VERSION_MICRO 101 | |
| 59 | +#define LIBAVUTIL_VERSION_MINOR 8 | |
| 60 | +#define LIBAVUTIL_VERSION_MICRO 100 | |
| 61 | 61 | |
| 62 | 62 | #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ |
| 63 | 63 | LIBAVUTIL_VERSION_MINOR, \ |