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;
}
{
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 \
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);
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
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);
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)
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;
}
{
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) {
} 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;
#include "rtmppkt.h"
#include "flv.h"
+#include "url.h"
void ff_amf_write_bool(uint8_t **dst, int val)
{
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;
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;
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)
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)
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 */
*/
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