[FFmpeg-cvslog] r23822 - in trunk: ffserver.c libavformat/avformat.h libavformat/gopher.c libavformat/http.c libavformat/internal.h libavformat/mmst.c libavformat/rtmpproto.c libavformat/rtpproto.c libavformat/rts...

mru subversion
Sun Jun 27 16:16:46 CEST 2010


Author: mru
Date: Sun Jun 27 16:16:46 2010
New Revision: 23822

Log:
Make ff_url_split() public

ff_url_split() is retained as an alias, as it was used by ffserver,
to avoid breaking ABI compatibility with it.

Modified:
   trunk/ffserver.c
   trunk/libavformat/avformat.h
   trunk/libavformat/gopher.c
   trunk/libavformat/http.c
   trunk/libavformat/internal.h
   trunk/libavformat/mmst.c
   trunk/libavformat/rtmpproto.c
   trunk/libavformat/rtpproto.c
   trunk/libavformat/rtsp.c
   trunk/libavformat/sdp.c
   trunk/libavformat/tcp.c
   trunk/libavformat/udp.c
   trunk/libavformat/utils.c

Modified: trunk/ffserver.c
==============================================================================
--- trunk/ffserver.c	Sun Jun 27 14:21:12 2010	(r23821)
+++ trunk/ffserver.c	Sun Jun 27 16:16:46 2010	(r23822)
@@ -2978,7 +2978,7 @@ static void rtsp_cmd_describe(HTTPContex
     struct sockaddr_in my_addr;
 
     /* find which url is asked */
-    ff_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url);
+    av_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url);
     path = path1;
     if (*path == '/')
         path++;
@@ -3055,7 +3055,7 @@ static void rtsp_cmd_setup(HTTPContext *
     RTSPActionServerSetup setup;
 
     /* find which url is asked */
-    ff_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url);
+    av_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url);
     path = path1;
     if (*path == '/')
         path++;
@@ -3198,7 +3198,7 @@ static HTTPContext *find_rtp_session_wit
         return NULL;
 
     /* find which url is asked */
-    ff_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url);
+    av_url_split(NULL, 0, NULL, 0, NULL, 0, NULL, path1, sizeof(path1), url);
     path = path1;
     if (*path == '/')
         path++;

Modified: trunk/libavformat/avformat.h
==============================================================================
--- trunk/libavformat/avformat.h	Sun Jun 27 14:21:12 2010	(r23821)
+++ trunk/libavformat/avformat.h	Sun Jun 27 16:16:46 2010	(r23822)
@@ -1185,6 +1185,32 @@ int64_t av_gen_search(AVFormatContext *s
 int av_set_parameters(AVFormatContext *s, AVFormatParameters *ap);
 
 /**
+ * Split a URL string into components.
+ *
+ * The pointers to buffers for storing individual components may be null,
+ * in order to ignore that component. Buffers for components not found are
+ * set to empty strings. If the port is not found, it is set to a negative
+ * value.
+ *
+ * @param proto the buffer for the protocol
+ * @param proto_size the size of the proto buffer
+ * @param authorization the buffer for the authorization
+ * @param authorization_size the size of the authorization buffer
+ * @param hostname the buffer for the host name
+ * @param hostname_size the size of the hostname buffer
+ * @param port_ptr a pointer to store the port number in
+ * @param path the buffer for the path
+ * @param path_size the size of the path buffer
+ * @param url the URL to split
+ */
+void av_url_split(char *proto,         int proto_size,
+                  char *authorization, int authorization_size,
+                  char *hostname,      int hostname_size,
+                  int *port_ptr,
+                  char *path,          int path_size,
+                  const char *url);
+
+/**
  * Allocates the stream private data and writes the stream header to an
  * output media file.
  *

Modified: trunk/libavformat/gopher.c
==============================================================================
--- trunk/libavformat/gopher.c	Sun Jun 27 14:21:12 2010	(r23821)
+++ trunk/libavformat/gopher.c	Sun Jun 27 16:16:46 2010	(r23822)
@@ -90,7 +90,7 @@ static int gopher_open(URLContext *h, co
     h->priv_data = s;
 
     /* needed in any case to build the host string */
-    ff_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
+    av_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
                  path, sizeof(path), uri);
 
     if (port < 0)

Modified: trunk/libavformat/http.c
==============================================================================
--- trunk/libavformat/http.c	Sun Jun 27 14:21:12 2010	(r23821)
+++ trunk/libavformat/http.c	Sun Jun 27 16:16:46 2010	(r23822)
@@ -105,12 +105,12 @@ static int http_open_cnx(URLContext *h)
     /* fill the dest addr */
  redo:
     /* needed in any case to build the host string */
-    ff_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
+    av_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
                  path1, sizeof(path1), s->location);
     ff_url_join(hoststr, sizeof(hoststr), NULL, NULL, hostname, port, NULL);
 
     if (use_proxy) {
-        ff_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
+        av_url_split(NULL, 0, auth, sizeof(auth), hostname, sizeof(hostname), &port,
                      NULL, 0, proxy_path);
         path = s->location;
     } else {

Modified: trunk/libavformat/internal.h
==============================================================================
--- trunk/libavformat/internal.h	Sun Jun 27 14:21:12 2010	(r23821)
+++ trunk/libavformat/internal.h	Sun Jun 27 16:16:46 2010	(r23822)
@@ -89,27 +89,9 @@ int ff_probe_input_buffer(ByteIOContext 
                           const char *filename, void *logctx,
                           unsigned int offset, unsigned int max_probe_size);
 
+#if LIBAVFORMAT_VERSION_MAJOR < 53
 /**
- * Splits a URL string into components. To reassemble components back into
- * a URL, use ff_url_join instead of using snprintf directly.
- *
- * The pointers to buffers for storing individual components may be null,
- * in order to ignore that component. Buffers for components not found are
- * set to empty strings. If the port isn't found, it is set to a negative
- * value.
- *
- * @see ff_url_join
- *
- * @param proto the buffer for the protocol
- * @param proto_size the size of the proto buffer
- * @param authorization the buffer for the authorization
- * @param authorization_size the size of the authorization buffer
- * @param hostname the buffer for the host name
- * @param hostname_size the size of the hostname buffer
- * @param port_ptr a pointer to store the port number in
- * @param path the buffer for the path
- * @param path_size the size of the path buffer
- * @param url the URL to split
+ * @deprecated use av_url_split() instead
  */
 void ff_url_split(char *proto, int proto_size,
                   char *authorization, int authorization_size,
@@ -117,15 +99,16 @@ void ff_url_split(char *proto, int proto
                   int *port_ptr,
                   char *path, int path_size,
                   const char *url);
+#endif
 
 /**
  * Assembles a URL string from components. This is the reverse operation
- * of ff_url_split.
+ * of av_url_split.
  *
  * Note, this requires networking to be initialized, so the caller must
  * ensure ff_network_init has been called.
  *
- * @see ff_url_split
+ * @see av_url_split
  *
  * @param str the buffer to fill with the url
  * @param size the size of the str buffer

Modified: trunk/libavformat/mmst.c
==============================================================================
--- trunk/libavformat/mmst.c	Sun Jun 27 14:21:12 2010	(r23821)
+++ trunk/libavformat/mmst.c	Sun Jun 27 16:16:46 2010	(r23822)
@@ -581,7 +581,7 @@ static int mms_open(URLContext *h, const
         return AVERROR(ENOMEM);
 
     // only for MMS over TCP, so set proto = NULL
-    ff_url_split(NULL, 0, NULL, 0,
+    av_url_split(NULL, 0, NULL, 0,
             mms->host, sizeof(mms->host), &port, mms->path,
             sizeof(mms->path), uri);
 

Modified: trunk/libavformat/rtmpproto.c
==============================================================================
--- trunk/libavformat/rtmpproto.c	Sun Jun 27 14:21:12 2010	(r23821)
+++ trunk/libavformat/rtmpproto.c	Sun Jun 27 16:16:46 2010	(r23822)
@@ -813,7 +813,7 @@ static int rtmp_open(URLContext *s, cons
     s->priv_data = rt;
     rt->is_input = !(flags & URL_WRONLY);
 
-    ff_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port,
+    av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname), &port,
                  path, sizeof(path), s->filename);
 
     if (port < 0)

Modified: trunk/libavformat/rtpproto.c
==============================================================================
--- trunk/libavformat/rtpproto.c	Sun Jun 27 14:21:12 2010	(r23821)
+++ trunk/libavformat/rtpproto.c	Sun Jun 27 16:16:46 2010	(r23822)
@@ -66,7 +66,7 @@ int rtp_set_remote_url(URLContext *h, co
     char buf[1024];
     char path[1024];
 
-    ff_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port,
+    av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port,
                  path, sizeof(path), uri);
 
     ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port, "%s", path);
@@ -146,7 +146,7 @@ static int rtp_open(URLContext *h, const
         return AVERROR(ENOMEM);
     h->priv_data = s;
 
-    ff_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &rtp_port,
+    av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &rtp_port,
                  path, sizeof(path), uri);
     /* extract parameters */
     ttl = -1;

Modified: trunk/libavformat/rtsp.c
==============================================================================
--- trunk/libavformat/rtsp.c	Sun Jun 27 14:21:12 2010	(r23821)
+++ trunk/libavformat/rtsp.c	Sun Jun 27 16:16:46 2010	(r23822)
@@ -327,7 +327,7 @@ static void sdp_parse_line(AVFormatConte
             rtsp_st = st->priv_data;
 
             /* XXX: may need to add full url resolution */
-            ff_url_split(proto, sizeof(proto), NULL, 0, NULL, 0,
+            av_url_split(proto, sizeof(proto), NULL, 0, NULL, 0,
                          NULL, NULL, 0, p);
             if (proto[0] == '\0') {
                 /* relative control URL */
@@ -1366,7 +1366,7 @@ int ff_rtsp_connect(AVFormatContext *s)
 redirect:
     rt->control_transport = RTSP_MODE_PLAIN;
     /* extract hostname and port */
-    ff_url_split(NULL, 0, auth, sizeof(auth),
+    av_url_split(NULL, 0, auth, sizeof(auth),
                  host, sizeof(host), &port, path, sizeof(path), s->filename);
     if (*auth) {
         av_strlcpy(rt->auth, auth, sizeof(rt->auth));

Modified: trunk/libavformat/sdp.c
==============================================================================
--- trunk/libavformat/sdp.c	Sun Jun 27 14:21:12 2010	(r23821)
+++ trunk/libavformat/sdp.c	Sun Jun 27 16:16:46 2010	(r23822)
@@ -109,7 +109,7 @@ static int sdp_get_address(char *dest_ad
     const char *p;
     char proto[32];
 
-    ff_url_split(proto, sizeof(proto), NULL, 0, dest_addr, size, &port, NULL, 0, url);
+    av_url_split(proto, sizeof(proto), NULL, 0, dest_addr, size, &port, NULL, 0, url);
 
     *ttl = 0;
 

Modified: trunk/libavformat/tcp.c
==============================================================================
--- trunk/libavformat/tcp.c	Sun Jun 27 14:21:12 2010	(r23821)
+++ trunk/libavformat/tcp.c	Sun Jun 27 16:16:46 2010	(r23822)
@@ -45,7 +45,7 @@ static int tcp_open(URLContext *h, const
     char hostname[1024],proto[1024],path[1024];
     char portstr[10];
 
-    ff_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname),
+    av_url_split(proto, sizeof(proto), NULL, 0, hostname, sizeof(hostname),
         &port, path, sizeof(path), uri);
     if (strcmp(proto,"tcp") || port <= 0 || port >= 65536)
         return AVERROR(EINVAL);

Modified: trunk/libavformat/udp.c
==============================================================================
--- trunk/libavformat/udp.c	Sun Jun 27 14:21:12 2010	(r23821)
+++ trunk/libavformat/udp.c	Sun Jun 27 16:16:46 2010	(r23822)
@@ -266,7 +266,7 @@ int udp_set_remote_url(URLContext *h, co
     char hostname[256];
     int port;
 
-    ff_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
+    av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
 
     /* set the destination address */
     s->dest_addr_len = udp_set_url(&s->dest_addr, hostname, port);
@@ -347,9 +347,9 @@ static int udp_open(URLContext *h, const
     }
 
     /* fill the dest addr */
-    ff_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
+    av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port, NULL, 0, uri);
 
-    /* XXX: fix ff_url_split */
+    /* XXX: fix av_url_split */
     if (hostname[0] == '\0' || hostname[0] == '?') {
         /* only accepts null hostname if input */
         if (flags & URL_WRONLY)

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	Sun Jun 27 14:21:12 2010	(r23821)
+++ trunk/libavformat/utils.c	Sun Jun 27 16:16:46 2010	(r23822)
@@ -3493,6 +3493,8 @@ void av_pkt_dump_log(void *avcl, int lev
     pkt_dump_internal(avcl, NULL, level, pkt, dump_payload);
 }
 
+#if LIBAVFORMAT_VERSION_MAJOR < 53
+attribute_deprecated
 void ff_url_split(char *proto, int proto_size,
                   char *authorization, int authorization_size,
                   char *hostname, int hostname_size,
@@ -3500,6 +3502,22 @@ void ff_url_split(char *proto, int proto
                   char *path, int path_size,
                   const char *url)
 {
+    av_url_split(proto, proto_size,
+                 authorization, authorization_size,
+                 hostname, hostname_size,
+                 port_ptr,
+                 path, path_size,
+                 url);
+}
+#endif
+
+void av_url_split(char *proto, int proto_size,
+                  char *authorization, int authorization_size,
+                  char *hostname, int hostname_size,
+                  int *port_ptr,
+                  char *path, int path_size,
+                  const char *url)
+{
     const char *p, *ls, *at, *col, *brk;
 
     if (port_ptr)               *port_ptr = -1;



More information about the ffmpeg-cvslog mailing list