[FFmpeg-devel] [PATCH 3/5] lavf: add av_ prefix to find_info_tag

Anton Khirnov anton
Sun Feb 6 15:46:48 CET 2011


---
 ffserver.c             |    6 +++---
 libavformat/avformat.h |    6 +++++-
 libavformat/rtpproto.c |   14 +++++++-------
 libavformat/sapenc.c   |    8 ++++----
 libavformat/sdp.c      |    2 +-
 libavformat/udp.c      |   14 +++++++-------
 libavformat/utils.c    |    7 +++++++
 libavformat/version.h  |    3 +++
 8 files changed, 37 insertions(+), 23 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 0b3e051..f4c75d7 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -2135,11 +2135,11 @@ static int open_input_stream(HTTPContext *c, const char *info)
         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)) {
             stream_pos = av_parse_date(buf, 0);
             if (stream_pos == INT64_MIN)
                 return -1;
-        } 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
@@ -2148,7 +2148,7 @@ static int open_input_stream(HTTPContext *c, const char *info)
         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)) {
             stream_pos = av_parse_date(buf, 1);
             if (stream_pos == INT64_MIN)
                 return -1;
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 4027990..e797332 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1518,13 +1518,17 @@ int64_t ffm_read_write_index(int fd);
 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
+attribute_deprecated int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
+#endif
+
 /**
  * Attempt to find a specific tag in a URL.
  *
  * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done.
  * Return 1 if found.
  */
-int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
+int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info);
 
 /**
  * Return in 'buf' the path with '%d' replaced by a number.
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index aa2cc37..e8e807b 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -161,25 +161,25 @@ static int rtp_open(URLContext *h, const char *uri, int flags)
 
     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);
         }
     }
diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c
index 9bbacef..cb8479d 100644
--- a/libavformat/sapenc.c
+++ b/libavformat/sapenc.c
@@ -87,16 +87,16 @@ static int sap_write_header(AVFormatContext *s)
     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));
         }
     }
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 872e76c..e5867e0 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -136,7 +136,7 @@ static int sdp_get_address(char *dest_addr, int size, int *ttl, const char *url)
     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;
diff --git a/libavformat/udp.c b/libavformat/udp.c
index aa17c97..d3f8817 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -259,7 +259,7 @@ int udp_set_remote_url(URLContext *h, const char *uri)
     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) {
@@ -329,20 +329,20 @@ static int udp_open(URLContext *h, const char *uri, int flags)
 
     p = strchr(uri, '?');
     if (p) {
-        s->reuse_socket = find_info_tag(buf, sizeof(buf), "reuse", p);
-        if (find_info_tag(buf, sizeof(buf), "ttl", p)) {
+        s->reuse_socket = av_find_info_tag(buf, sizeof(buf), "reuse", 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);
         }
     }
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 2abcc1e..9ca446e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3478,8 +3478,15 @@ int64_t av_parse_date(const char *datestr, int duration)
     return negative ? -t : t;
 }
 
+#if FF_API_FIND_INFO_TAG
 int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
 {
+    return av_find_info_tag(arg, arg_size, tag1, info);
+}
+#endif
+
+int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
+{
     const char *p;
     char tag[128], *q;
 
diff --git a/libavformat/version.h b/libavformat/version.h
index 38ff76e..71bced1 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -95,5 +95,8 @@
 #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
-- 
1.7.2.3




More information about the ffmpeg-devel mailing list