diff options
Diffstat (limited to 'libavutil/parseutils.c')
-rw-r--r-- | libavutil/parseutils.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c index 8e09dade62..d67d31bffe 100644 --- a/libavutil/parseutils.c +++ b/libavutil/parseutils.c @@ -608,6 +608,45 @@ int av_parse_time(int64_t *timeval, const char *datestr, int duration) return 0; } +int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info) +{ + const char *p; + char tag[128], *q; + + p = info; + if (*p == '?') + p++; + for(;;) { + q = tag; + while (*p != '\0' && *p != '=' && *p != '&') { + if ((q - tag) < sizeof(tag) - 1) + *q++ = *p; + p++; + } + *q = '\0'; + q = arg; + if (*p == '=') { + p++; + while (*p != '&' && *p != '\0') { + if ((q - arg) < arg_size - 1) { + if (*p == '+') + *q++ = ' '; + else + *q++ = *p; + } + p++; + } + } + *q = '\0'; + if (!strcmp(tag, tag1)) + return 1; + if (*p != '&') + break; + p++; + } + return 0; +} + #ifdef TEST #undef printf |