Revision bc371aca
libavformat/applehttpproto.c | ||
---|---|---|
241 | 241 |
|
242 | 242 |
start: |
243 | 243 |
if (s->seg_hd) { |
244 |
ret = url_read(s->seg_hd, buf, size); |
|
244 |
ret = ffurl_read(s->seg_hd, buf, size);
|
|
245 | 245 |
if (ret > 0) |
246 | 246 |
return ret; |
247 | 247 |
} |
libavformat/avio.c | ||
---|---|---|
180 | 180 |
{ |
181 | 181 |
return ffurl_open(puc, filename, flags); |
182 | 182 |
} |
183 |
int url_read(URLContext *h, unsigned char *buf, int size) |
|
184 |
{ |
|
185 |
return ffurl_read(h, buf, size); |
|
186 |
} |
|
183 | 187 |
#endif |
184 | 188 |
|
185 | 189 |
#define URL_SCHEME_CHARS \ |
... | ... | |
258 | 262 |
return len; |
259 | 263 |
} |
260 | 264 |
|
261 |
int url_read(URLContext *h, unsigned char *buf, int size) |
|
265 |
int ffurl_read(URLContext *h, unsigned char *buf, int size)
|
|
262 | 266 |
{ |
263 | 267 |
if (h->flags & URL_WRONLY) |
264 | 268 |
return AVERROR(EIO); |
libavformat/avio.h | ||
---|---|---|
105 | 105 |
attribute_deprecated int url_alloc(URLContext **h, const char *url, int flags); |
106 | 106 |
attribute_deprecated int url_connect(URLContext *h); |
107 | 107 |
attribute_deprecated int url_open(URLContext **h, const char *url, int flags); |
108 |
attribute_deprecated int url_read(URLContext *h, unsigned char *buf, int size); |
|
108 | 109 |
#endif |
109 | 110 |
|
110 | 111 |
/** |
111 |
* Read up to size bytes from the resource accessed by h, and store |
|
112 |
* the read bytes in buf. |
|
113 |
* |
|
114 |
* @return The number of bytes actually read, or a negative value |
|
115 |
* corresponding to an AVERROR code in case of error. A value of zero |
|
116 |
* indicates that it is not possible to read more from the accessed |
|
117 |
* resource (except if the value of the size argument is also zero). |
|
118 |
*/ |
|
119 |
int url_read(URLContext *h, unsigned char *buf, int size); |
|
120 |
|
|
121 |
/** |
|
122 | 112 |
* Read as many bytes as possible (up to size), calling the |
123 | 113 |
* read function multiple times if necessary. |
124 | 114 |
* This makes special short-read handling in applications |
libavformat/aviobuf.c | ||
---|---|---|
846 | 846 |
|
847 | 847 |
if (ffio_init_context(*s, buffer, buffer_size, |
848 | 848 |
(h->flags & URL_WRONLY || h->flags & URL_RDWR), h, |
849 |
url_read, url_write, url_seek) < 0) { |
|
849 |
ffurl_read, url_write, url_seek) < 0) {
|
|
850 | 850 |
av_free(buffer); |
851 | 851 |
av_freep(s); |
852 | 852 |
return AVERROR(EIO); |
libavformat/concat.c | ||
---|---|---|
136 | 136 |
size_t i = data->current; |
137 | 137 |
|
138 | 138 |
while (size > 0) { |
139 |
result = url_read(nodes[i].uc, buf, size); |
|
139 |
result = ffurl_read(nodes[i].uc, buf, size);
|
|
140 | 140 |
if (result < 0) |
141 | 141 |
return total ? total : result; |
142 | 142 |
if (!result) |
libavformat/gopher.c | ||
---|---|---|
115 | 115 |
static int gopher_read(URLContext *h, uint8_t *buf, int size) |
116 | 116 |
{ |
117 | 117 |
GopherContext *s = h->priv_data; |
118 |
int len = url_read(s->hd, buf, size); |
|
118 |
int len = ffurl_read(s->hd, buf, size);
|
|
119 | 119 |
return len; |
120 | 120 |
} |
121 | 121 |
|
libavformat/http.c | ||
---|---|---|
171 | 171 |
{ |
172 | 172 |
int len; |
173 | 173 |
if (s->buf_ptr >= s->buf_end) { |
174 |
len = url_read(s->hd, s->buffer, BUFFER_SIZE); |
|
174 |
len = ffurl_read(s->hd, s->buffer, BUFFER_SIZE);
|
|
175 | 175 |
if (len < 0) { |
176 | 176 |
return AVERROR(EIO); |
177 | 177 |
} else if (len == 0) { |
... | ... | |
407 | 407 |
} else { |
408 | 408 |
if (!s->willclose && s->filesize >= 0 && s->off >= s->filesize) |
409 | 409 |
return AVERROR_EOF; |
410 |
len = url_read(s->hd, buf, size); |
|
410 |
len = ffurl_read(s->hd, buf, size);
|
|
411 | 411 |
} |
412 | 412 |
if (len > 0) { |
413 | 413 |
s->off += len; |
libavformat/rtmppkt.c | ||
---|---|---|
25 | 25 |
|
26 | 26 |
#include "rtmppkt.h" |
27 | 27 |
#include "flv.h" |
28 |
#include "url.h" |
|
28 | 29 |
|
29 | 30 |
void ff_amf_write_bool(uint8_t **dst, int val) |
30 | 31 |
{ |
... | ... | |
78 | 79 |
enum RTMPPacketType type; |
79 | 80 |
int size = 0; |
80 | 81 |
|
81 |
if (url_read(h, &hdr, 1) != 1) |
|
82 |
if (ffurl_read(h, &hdr, 1) != 1)
|
|
82 | 83 |
return AVERROR(EIO); |
83 | 84 |
size++; |
84 | 85 |
channel_id = hdr & 0x3F; |
libavformat/rtsp.c | ||
---|---|---|
1594 | 1594 |
rtsp_st = rt->rtsp_streams[i]; |
1595 | 1595 |
if (rtsp_st->rtp_handle) { |
1596 | 1596 |
if (p[j].revents & POLLIN || p[j+1].revents & POLLIN) { |
1597 |
ret = url_read(rtsp_st->rtp_handle, buf, buf_size); |
|
1597 |
ret = ffurl_read(rtsp_st->rtp_handle, buf, buf_size);
|
|
1598 | 1598 |
if (ret > 0) { |
1599 | 1599 |
*prtsp_st = rtsp_st; |
1600 | 1600 |
return ret; |
... | ... | |
1868 | 1868 |
goto fail; |
1869 | 1869 |
|
1870 | 1870 |
while (1) { |
1871 |
ret = url_read(in, recvbuf, sizeof(recvbuf)); |
|
1871 |
ret = ffurl_read(in, recvbuf, sizeof(recvbuf));
|
|
1872 | 1872 |
if (ret == AVERROR(EAGAIN)) |
1873 | 1873 |
continue; |
1874 | 1874 |
if (ret < 0) |
libavformat/sapdec.c | ||
---|---|---|
93 | 93 |
int addr_type, auth_len; |
94 | 94 |
int pos; |
95 | 95 |
|
96 |
ret = url_read(sap->ann_fd, recvbuf, sizeof(recvbuf) - 1); |
|
96 |
ret = ffurl_read(sap->ann_fd, recvbuf, sizeof(recvbuf) - 1);
|
|
97 | 97 |
if (ret == AVERROR(EAGAIN)) |
98 | 98 |
continue; |
99 | 99 |
if (ret < 0) |
... | ... | |
195 | 195 |
n = poll(&p, 1, 0); |
196 | 196 |
if (n <= 0 || !(p.revents & POLLIN)) |
197 | 197 |
break; |
198 |
ret = url_read(sap->ann_fd, recvbuf, sizeof(recvbuf)); |
|
198 |
ret = ffurl_read(sap->ann_fd, recvbuf, sizeof(recvbuf));
|
|
199 | 199 |
if (ret >= 8) { |
200 | 200 |
uint16_t hash = AV_RB16(&recvbuf[2]); |
201 | 201 |
/* Should ideally check the source IP address, too */ |
libavformat/url.h | ||
---|---|---|
58 | 58 |
*/ |
59 | 59 |
int ffurl_open(URLContext **h, const char *url, int flags); |
60 | 60 |
|
61 |
/** |
|
62 |
* Read up to size bytes from the resource accessed by h, and store |
|
63 |
* the read bytes in buf. |
|
64 |
* |
|
65 |
* @return The number of bytes actually read, or a negative value |
|
66 |
* corresponding to an AVERROR code in case of error. A value of zero |
|
67 |
* indicates that it is not possible to read more from the accessed |
|
68 |
* resource (except if the value of the size argument is also zero). |
|
69 |
*/ |
|
70 |
int ffurl_read(URLContext *h, unsigned char *buf, int size); |
|
71 |
|
|
61 | 72 |
#endif //AVFORMAT_URL_H |
Also available in: Unified diff