[FFmpeg-cvslog] avio: make url_read() internal.

Anton Khirnov git at videolan.org
Tue Apr 5 02:33:09 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Mar 31 16:31:43 2011 +0200| [bc371aca468c3dd8d1a8cb2b44c99798f232b145] | committer: Anton Khirnov

avio: make url_read() internal.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bc371aca468c3dd8d1a8cb2b44c99798f232b145
---

 libavformat/applehttpproto.c |    2 +-
 libavformat/avio.c           |    6 +++++-
 libavformat/avio.h           |   12 +-----------
 libavformat/aviobuf.c        |    2 +-
 libavformat/concat.c         |    2 +-
 libavformat/gopher.c         |    2 +-
 libavformat/http.c           |    4 ++--
 libavformat/rtmppkt.c        |    3 ++-
 libavformat/rtsp.c           |    4 ++--
 libavformat/sapdec.c         |    4 ++--
 libavformat/url.h            |   11 +++++++++++
 11 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c
index 7e89534..fbc243e 100644
--- a/libavformat/applehttpproto.c
+++ b/libavformat/applehttpproto.c
@@ -241,7 +241,7 @@ static int applehttp_read(URLContext *h, uint8_t *buf, int size)
 
 start:
     if (s->seg_hd) {
-        ret = url_read(s->seg_hd, buf, size);
+        ret = ffurl_read(s->seg_hd, buf, size);
         if (ret > 0)
             return ret;
     }
diff --git a/libavformat/avio.c b/libavformat/avio.c
index a14ea76..0e1ebaa 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -180,6 +180,10 @@ int url_open(URLContext **puc, const char *filename, int flags)
 {
     return ffurl_open(puc, filename, flags);
 }
+int url_read(URLContext *h, unsigned char *buf, int size)
+{
+    return ffurl_read(h, buf, size);
+}
 #endif
 
 #define URL_SCHEME_CHARS                        \
@@ -258,7 +262,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
     return len;
 }
 
-int url_read(URLContext *h, unsigned char *buf, int size)
+int ffurl_read(URLContext *h, unsigned char *buf, int size)
 {
     if (h->flags & URL_WRONLY)
         return AVERROR(EIO);
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 02d05f6..84062eb 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -105,20 +105,10 @@ attribute_deprecated int url_open_protocol (URLContext **puc, struct URLProtocol
 attribute_deprecated int url_alloc(URLContext **h, const char *url, int flags);
 attribute_deprecated int url_connect(URLContext *h);
 attribute_deprecated int url_open(URLContext **h, const char *url, int flags);
+attribute_deprecated int url_read(URLContext *h, unsigned char *buf, int size);
 #endif
 
 /**
- * Read up to size bytes from the resource accessed by h, and store
- * the read bytes in buf.
- *
- * @return The number of bytes actually read, or a negative value
- * corresponding to an AVERROR code in case of error. A value of zero
- * indicates that it is not possible to read more from the accessed
- * resource (except if the value of the size argument is also zero).
- */
-int url_read(URLContext *h, unsigned char *buf, int size);
-
-/**
  * Read as many bytes as possible (up to size), calling the
  * read function multiple times if necessary.
  * This makes special short-read handling in applications
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 1ae1049..a8c59b7 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -846,7 +846,7 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
 
     if (ffio_init_context(*s, buffer, buffer_size,
                       (h->flags & URL_WRONLY || h->flags & URL_RDWR), h,
-                      url_read, url_write, url_seek) < 0) {
+                      ffurl_read, url_write, url_seek) < 0) {
         av_free(buffer);
         av_freep(s);
         return AVERROR(EIO);
diff --git a/libavformat/concat.c b/libavformat/concat.c
index e99ded2..8147fda 100644
--- a/libavformat/concat.c
+++ b/libavformat/concat.c
@@ -136,7 +136,7 @@ static int concat_read(URLContext *h, unsigned char *buf, int size)
     size_t i = data->current;
 
     while (size > 0) {
-        result = url_read(nodes[i].uc, buf, size);
+        result = ffurl_read(nodes[i].uc, buf, size);
         if (result < 0)
             return total ? total : result;
         if (!result)
diff --git a/libavformat/gopher.c b/libavformat/gopher.c
index c2e290d..53f7617 100644
--- a/libavformat/gopher.c
+++ b/libavformat/gopher.c
@@ -115,7 +115,7 @@ static int gopher_open(URLContext *h, const char *uri, int flags)
 static int gopher_read(URLContext *h, uint8_t *buf, int size)
 {
     GopherContext *s = h->priv_data;
-    int len = url_read(s->hd, buf, size);
+    int len = ffurl_read(s->hd, buf, size);
     return len;
 }
 
diff --git a/libavformat/http.c b/libavformat/http.c
index b02de27..2bd2238 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -171,7 +171,7 @@ static int http_getc(HTTPContext *s)
 {
     int len;
     if (s->buf_ptr >= s->buf_end) {
-        len = url_read(s->hd, s->buffer, BUFFER_SIZE);
+        len = ffurl_read(s->hd, s->buffer, BUFFER_SIZE);
         if (len < 0) {
             return AVERROR(EIO);
         } else if (len == 0) {
@@ -407,7 +407,7 @@ static int http_read(URLContext *h, uint8_t *buf, int size)
     } else {
         if (!s->willclose && s->filesize >= 0 && s->off >= s->filesize)
             return AVERROR_EOF;
-        len = url_read(s->hd, buf, size);
+        len = ffurl_read(s->hd, buf, size);
     }
     if (len > 0) {
         s->off += len;
diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index 7df3d52..b979566 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -25,6 +25,7 @@
 
 #include "rtmppkt.h"
 #include "flv.h"
+#include "url.h"
 
 void ff_amf_write_bool(uint8_t **dst, int val)
 {
@@ -78,7 +79,7 @@ int ff_rtmp_packet_read(URLContext *h, RTMPPacket *p,
     enum RTMPPacketType type;
     int size = 0;
 
-    if (url_read(h, &hdr, 1) != 1)
+    if (ffurl_read(h, &hdr, 1) != 1)
         return AVERROR(EIO);
     size++;
     channel_id = hdr & 0x3F;
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 30deecc..cf36814 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1594,7 +1594,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
                 rtsp_st = rt->rtsp_streams[i];
                 if (rtsp_st->rtp_handle) {
                     if (p[j].revents & POLLIN || p[j+1].revents & POLLIN) {
-                        ret = url_read(rtsp_st->rtp_handle, buf, buf_size);
+                        ret = ffurl_read(rtsp_st->rtp_handle, buf, buf_size);
                         if (ret > 0) {
                             *prtsp_st = rtsp_st;
                             return ret;
@@ -1868,7 +1868,7 @@ static int rtp_read_header(AVFormatContext *s,
         goto fail;
 
     while (1) {
-        ret = url_read(in, recvbuf, sizeof(recvbuf));
+        ret = ffurl_read(in, recvbuf, sizeof(recvbuf));
         if (ret == AVERROR(EAGAIN))
             continue;
         if (ret < 0)
diff --git a/libavformat/sapdec.c b/libavformat/sapdec.c
index c85039f..c8cbde8 100644
--- a/libavformat/sapdec.c
+++ b/libavformat/sapdec.c
@@ -93,7 +93,7 @@ static int sap_read_header(AVFormatContext *s,
         int addr_type, auth_len;
         int pos;
 
-        ret = url_read(sap->ann_fd, recvbuf, sizeof(recvbuf) - 1);
+        ret = ffurl_read(sap->ann_fd, recvbuf, sizeof(recvbuf) - 1);
         if (ret == AVERROR(EAGAIN))
             continue;
         if (ret < 0)
@@ -195,7 +195,7 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt)
         n = poll(&p, 1, 0);
         if (n <= 0 || !(p.revents & POLLIN))
             break;
-        ret = url_read(sap->ann_fd, recvbuf, sizeof(recvbuf));
+        ret = ffurl_read(sap->ann_fd, recvbuf, sizeof(recvbuf));
         if (ret >= 8) {
             uint16_t hash = AV_RB16(&recvbuf[2]);
             /* Should ideally check the source IP address, too */
diff --git a/libavformat/url.h b/libavformat/url.h
index af7dc5c..799b80c 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -58,4 +58,15 @@ int ffurl_connect(URLContext *h);
  */
 int ffurl_open(URLContext **h, const char *url, int flags);
 
+/**
+ * Read up to size bytes from the resource accessed by h, and store
+ * the read bytes in buf.
+ *
+ * @return The number of bytes actually read, or a negative value
+ * corresponding to an AVERROR code in case of error. A value of zero
+ * indicates that it is not possible to read more from the accessed
+ * resource (except if the value of the size argument is also zero).
+ */
+int ffurl_read(URLContext *h, unsigned char *buf, int size);
+
 #endif //AVFORMAT_URL_H



More information about the ffmpeg-cvslog mailing list