You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-05-21 16:47:28 +02:00
Move find_info_tag to lavu and add av_ prefix to it
Signed-off-by: Janne Grunau <janne-ffmpeg@jannau.net>
(cherry picked from commit ab0287fcbd)
This commit is contained in:
committed by
Michael Niedermayer
parent
9c9912b995
commit
1b98107c8d
@@ -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
|
||||
|
||||
@@ -106,4 +106,12 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen,
|
||||
*/
|
||||
int av_parse_time(int64_t *timeval, const char *timestr, int duration);
|
||||
|
||||
/**
|
||||
* Attempt to find a specific tag in a URL.
|
||||
*
|
||||
* syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done.
|
||||
* Return 1 if found.
|
||||
*/
|
||||
int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
|
||||
|
||||
#endif /* AVUTIL_PARSEUTILS_H */
|
||||
|
||||
Reference in New Issue
Block a user