diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-03-31 16:31:43 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2011-04-04 17:45:20 +0200 |
commit | bc371aca468c3dd8d1a8cb2b44c99798f232b145 (patch) | |
tree | 00455bb9d3db8113fbc18b885deffef20752add8 /libavformat | |
parent | 0589da0aa525e4ba7c554408339fa3e862402af5 (diff) | |
download | ffmpeg-bc371aca468c3dd8d1a8cb2b44c99798f232b145.tar.gz |
avio: make url_read() internal.
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/applehttpproto.c | 2 | ||||
-rw-r--r-- | libavformat/avio.c | 6 | ||||
-rw-r--r-- | libavformat/avio.h | 12 | ||||
-rw-r--r-- | libavformat/aviobuf.c | 2 | ||||
-rw-r--r-- | libavformat/concat.c | 2 | ||||
-rw-r--r-- | libavformat/gopher.c | 2 | ||||
-rw-r--r-- | libavformat/http.c | 4 | ||||
-rw-r--r-- | libavformat/rtmppkt.c | 3 | ||||
-rw-r--r-- | libavformat/rtsp.c | 4 | ||||
-rw-r--r-- | libavformat/sapdec.c | 4 | ||||
-rw-r--r-- | libavformat/url.h | 11 |
11 files changed, 29 insertions, 23 deletions
diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c index 7e89534f88..fbc243e534 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 a14ea767bc..0e1ebaacdd 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 02d05f64cb..84062eb3ce 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 1ae104942c..a8c59b7cc8 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 e99ded2edf..8147fda6c3 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 c2e290d077..53f7617fb1 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 b02de279f2..2bd223891e 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 7df3d52e7c..b979566972 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 30deeccf93..cf36814afa 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 c85039f4da..c8cbde8e44 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 af7dc5c4b6..799b80c395 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 |