strcpy(input_filename, c->stream->feed->feed_filename);
buf_size = FFM_PACKET_SIZE;
/* compute position (absolute time) */
- if (find_info_tag(buf, sizeof(buf), "date", info)) {
+ if (av_find_info_tag(buf, sizeof(buf), "date", info)) {
if ((ret = av_parse_time(&stream_pos, buf, 0)) < 0)
return ret;
- } else if (find_info_tag(buf, sizeof(buf), "buffer", info)) {
+ } else if (av_find_info_tag(buf, sizeof(buf), "buffer", info)) {
int prebuffer = strtol(buf, 0, 10);
stream_pos = av_gettime() - prebuffer * (int64_t)1000000;
} else
strcpy(input_filename, c->stream->feed_filename);
buf_size = 0;
/* compute position (relative time) */
- if (find_info_tag(buf, sizeof(buf), "date", info)) {
+ if (av_find_info_tag(buf, sizeof(buf), "date", info)) {
if ((ret = av_parse_time(&stream_pos, buf, 1)) < 0)
return ret;
} else
int ffm_write_write_index(int fd, int64_t pos);
void ffm_set_write_index(AVFormatContext *s, int64_t pos, int64_t file_size);
+#if FF_API_FIND_INFO_TAG
/**
- * Attempt to find a specific tag in a URL.
- *
- * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done.
- * Return 1 if found.
+ * @deprecated use av_find_info_tag in libavutil instead.
*/
-int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
+attribute_deprecated int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
+#endif
/**
* Return in 'buf' the path with '%d' replaced by a number.
* RTP protocol
*/
+#include "libavutil/parseutils.h"
#include "libavutil/avstring.h"
#include "avformat.h"
#include "rtpdec.h"
p = strchr(uri, '?');
if (p) {
- if (find_info_tag(buf, sizeof(buf), "ttl", p)) {
+ if (av_find_info_tag(buf, sizeof(buf), "ttl", p)) {
ttl = strtol(buf, NULL, 10);
}
- if (find_info_tag(buf, sizeof(buf), "rtcpport", p)) {
+ if (av_find_info_tag(buf, sizeof(buf), "rtcpport", p)) {
rtcp_port = strtol(buf, NULL, 10);
}
- if (find_info_tag(buf, sizeof(buf), "localport", p)) {
+ if (av_find_info_tag(buf, sizeof(buf), "localport", p)) {
local_rtp_port = strtol(buf, NULL, 10);
}
- if (find_info_tag(buf, sizeof(buf), "localrtpport", p)) {
+ if (av_find_info_tag(buf, sizeof(buf), "localrtpport", p)) {
local_rtp_port = strtol(buf, NULL, 10);
}
- if (find_info_tag(buf, sizeof(buf), "localrtcpport", p)) {
+ if (av_find_info_tag(buf, sizeof(buf), "localrtcpport", p)) {
local_rtcp_port = strtol(buf, NULL, 10);
}
- if (find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
+ if (av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
max_packet_size = strtol(buf, NULL, 10);
}
- if (find_info_tag(buf, sizeof(buf), "connect", p)) {
+ if (av_find_info_tag(buf, sizeof(buf), "connect", p)) {
connect = strtol(buf, NULL, 10);
}
}
*/
#include "avformat.h"
+#include "libavutil/parseutils.h"
#include "libavutil/random_seed.h"
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
option_list = strrchr(path, '?');
if (option_list) {
char buf[50];
- if (find_info_tag(buf, sizeof(buf), "announce_port", option_list)) {
+ if (av_find_info_tag(buf, sizeof(buf), "announce_port", option_list)) {
port = strtol(buf, NULL, 10);
}
- if (find_info_tag(buf, sizeof(buf), "same_port", option_list)) {
+ if (av_find_info_tag(buf, sizeof(buf), "same_port", option_list)) {
same_port = strtol(buf, NULL, 10);
}
- if (find_info_tag(buf, sizeof(buf), "ttl", option_list)) {
+ if (av_find_info_tag(buf, sizeof(buf), "ttl", option_list)) {
ttl = strtol(buf, NULL, 10);
}
- if (find_info_tag(buf, sizeof(buf), "announce_addr", option_list)) {
+ if (av_find_info_tag(buf, sizeof(buf), "announce_addr", option_list)) {
av_strlcpy(announce_addr, buf, sizeof(announce_addr));
}
}
#include <string.h>
#include "libavutil/avstring.h"
#include "libavutil/base64.h"
+#include "libavutil/parseutils.h"
#include "libavcodec/xiph.h"
#include "avformat.h"
#include "internal.h"
if (p) {
char buff[64];
- if (find_info_tag(buff, sizeof(buff), "ttl", p)) {
+ if (av_find_info_tag(buff, sizeof(buff), "ttl", p)) {
*ttl = strtol(buff, NULL, 10);
} else {
*ttl = 5;
#define _BSD_SOURCE /* Needed for using struct ip_mreq with recent glibc */
#define _DARWIN_C_SOURCE /* Needed for using IP_MULTICAST_TTL on OS X */
#include "avformat.h"
+#include "libavutil/parseutils.h"
#include <unistd.h>
#include "internal.h"
#include "network.h"
s->is_multicast = ff_is_multicast_address((struct sockaddr*) &s->dest_addr);
p = strchr(uri, '?');
if (p) {
- if (find_info_tag(buf, sizeof(buf), "connect", p)) {
+ if (av_find_info_tag(buf, sizeof(buf), "connect", p)) {
int was_connected = s->is_connected;
s->is_connected = strtol(buf, NULL, 10);
if (s->is_connected && !was_connected) {
p = strchr(uri, '?');
if (p) {
- if (find_info_tag(buf, sizeof(buf), "reuse", p)) {
+ if (av_find_info_tag(buf, sizeof(buf), "reuse", p)) {
const char *endptr=NULL;
s->reuse_socket = strtol(buf, &endptr, 10);
/* assume if no digits were found it is a request to enable it */
s->reuse_socket = 1;
reuse_specified = 1;
}
- if (find_info_tag(buf, sizeof(buf), "ttl", p)) {
+ if (av_find_info_tag(buf, sizeof(buf), "ttl", p)) {
s->ttl = strtol(buf, NULL, 10);
}
- if (find_info_tag(buf, sizeof(buf), "localport", p)) {
+ if (av_find_info_tag(buf, sizeof(buf), "localport", p)) {
s->local_port = strtol(buf, NULL, 10);
}
- if (find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
+ if (av_find_info_tag(buf, sizeof(buf), "pkt_size", p)) {
h->max_packet_size = strtol(buf, NULL, 10);
}
- if (find_info_tag(buf, sizeof(buf), "buffer_size", p)) {
+ if (av_find_info_tag(buf, sizeof(buf), "buffer_size", p)) {
s->buffer_size = strtol(buf, NULL, 10);
}
- if (find_info_tag(buf, sizeof(buf), "connect", p)) {
+ if (av_find_info_tag(buf, sizeof(buf), "connect", p)) {
s->is_connected = strtol(buf, NULL, 10);
}
}
}
#endif
+#if FF_API_FIND_INFO_TAG
+#include "libavutil/parseutils.h"
+
int 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;
+ return av_find_info_tag(arg, arg_size, tag1, info);
}
+#endif
int av_get_frame_filename(char *buf, int buf_size,
const char *path, int number)
#ifndef FF_API_PARSE_DATE
#define FF_API_PARSE_DATE (LIBAVFORMAT_VERSION_MAJOR < 54)
#endif
+#ifndef FF_API_FIND_INFO_TAG
+#define FF_API_FIND_INFO_TAG (LIBAVFORMAT_VERSION_MAJOR < 54)
+#endif
#endif //AVFORMAT_VERSION_H
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
*/
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 */