summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavformat/avio.c6
-rw-r--r--libavformat/avio.h9
-rw-r--r--libavformat/aviobuf.c2
-rw-r--r--libavformat/gopher.c2
-rw-r--r--libavformat/http.c12
-rw-r--r--libavformat/md5proto.c2
-rw-r--r--libavformat/mmst.c2
-rw-r--r--libavformat/rtmppkt.c6
-rw-r--r--libavformat/rtmpproto.c6
-rw-r--r--libavformat/rtpdec.c9
-rw-r--r--libavformat/rtpproto.c2
-rw-r--r--libavformat/rtsp.c4
-rw-r--r--libavformat/rtspenc.c3
-rw-r--r--libavformat/sapenc.c4
-rw-r--r--libavformat/url.h8
15 files changed, 42 insertions, 35 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 4f56286f8d..568f6885df 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -188,6 +188,10 @@ int url_read_complete(URLContext *h, unsigned char *buf, int size)
{
return ffurl_read_complete(h, buf, size);
}
+int url_write(URLContext *h, const unsigned char *buf, int size)
+{
+ return ffurl_write(h, buf, size);
+}
#endif
#define URL_SCHEME_CHARS \
@@ -280,7 +284,7 @@ int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read);
}
-int url_write(URLContext *h, const unsigned char *buf, int size)
+int ffurl_write(URLContext *h, const unsigned char *buf, int size)
{
if (!(h->flags & (URL_WRONLY | URL_RDWR)))
return AVERROR(EIO);
diff --git a/libavformat/avio.h b/libavformat/avio.h
index 2b1c6ff913..41b3cafbd2 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -107,17 +107,10 @@ 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);
attribute_deprecated int url_read_complete(URLContext *h, unsigned char *buf, int size);
+attribute_deprecated int url_write(URLContext *h, const unsigned char *buf, int size);
#endif
/**
- * Write size bytes from buf to the resource accessed by h.
- *
- * @return the number of bytes actually written, or a negative value
- * corresponding to an AVERROR code in case of failure
- */
-int url_write(URLContext *h, const unsigned char *buf, int size);
-
-/**
* Passing this as the "whence" parameter to a seek function causes it to
* return the filesize without seeking anywhere. Supporting this is optional.
* If it is not supported then the seek function will return <0.
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index a8c59b7cc8..c7bdec8492 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,
- ffurl_read, url_write, url_seek) < 0) {
+ ffurl_read, ffurl_write, url_seek) < 0) {
av_free(buffer);
av_freep(s);
return AVERROR(EIO);
diff --git a/libavformat/gopher.c b/libavformat/gopher.c
index 53f7617fb1..c4c895df73 100644
--- a/libavformat/gopher.c
+++ b/libavformat/gopher.c
@@ -35,7 +35,7 @@ typedef struct {
static int gopher_write(URLContext *h, const uint8_t *buf, int size)
{
GopherContext *s = h->priv_data;
- return url_write(s->hd, buf, size);
+ return ffurl_write(s->hd, buf, size);
}
static int gopher_connect(URLContext *h, const char *path)
diff --git a/libavformat/http.c b/libavformat/http.c
index 2bd223891e..61ae3f438c 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -333,7 +333,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
authstr ? authstr : "");
av_freep(&authstr);
- if (url_write(s->hd, s->buffer, strlen(s->buffer)) < 0)
+ if (ffurl_write(s->hd, s->buffer, strlen(s->buffer)) < 0)
return AVERROR(EIO);
/* init input buffer */
@@ -427,7 +427,7 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
if (s->chunksize == -1) {
/* non-chunked data is sent without any special encoding */
- return url_write(s->hd, buf, size);
+ return ffurl_write(s->hd, buf, size);
}
/* silently ignore zero-size data since chunk encoding that would
@@ -436,9 +436,9 @@ static int http_write(URLContext *h, const uint8_t *buf, int size)
/* upload data using chunked encoding */
snprintf(temp, sizeof(temp), "%x\r\n", size);
- if ((ret = url_write(s->hd, temp, strlen(temp))) < 0 ||
- (ret = url_write(s->hd, buf, size)) < 0 ||
- (ret = url_write(s->hd, crlf, sizeof(crlf) - 1)) < 0)
+ if ((ret = ffurl_write(s->hd, temp, strlen(temp))) < 0 ||
+ (ret = ffurl_write(s->hd, buf, size)) < 0 ||
+ (ret = ffurl_write(s->hd, crlf, sizeof(crlf) - 1)) < 0)
return ret;
}
return size;
@@ -452,7 +452,7 @@ static int http_close(URLContext *h)
/* signal end of chunked encoding if used */
if ((h->flags & URL_WRONLY) && s->chunksize != -1) {
- ret = url_write(s->hd, footer, sizeof(footer) - 1);
+ ret = ffurl_write(s->hd, footer, sizeof(footer) - 1);
ret = ret > 0 ? 0 : ret;
}
diff --git a/libavformat/md5proto.c b/libavformat/md5proto.c
index 23815095d1..ae3e96de72 100644
--- a/libavformat/md5proto.c
+++ b/libavformat/md5proto.c
@@ -68,7 +68,7 @@ static int md5_close(URLContext *h)
err = ffurl_open(&out, filename, URL_WRONLY);
if (err)
return err;
- err = url_write(out, buf, i*2+1);
+ err = ffurl_write(out, buf, i*2+1);
url_close(out);
} else {
if (fwrite(buf, 1, i*2+1, stdout) < i*2+1)
diff --git a/libavformat/mmst.c b/libavformat/mmst.c
index d28a6ca6a8..b843b6472b 100644
--- a/libavformat/mmst.c
+++ b/libavformat/mmst.c
@@ -139,7 +139,7 @@ static int send_command_packet(MMSTContext *mmst)
memset(mms->write_out_ptr, 0, exact_length - len);
// write it out.
- write_result= url_write(mms->mms_hd, mms->out_buffer, exact_length);
+ write_result= ffurl_write(mms->mms_hd, mms->out_buffer, exact_length);
if(write_result != exact_length) {
av_log(NULL, AV_LOG_ERROR,
"Failed to write data of length %d: %d (%s)\n",
diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index ca2ce09ff9..63b0628799 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -215,15 +215,15 @@ int ff_rtmp_packet_write(URLContext *h, RTMPPacket *pkt,
}
prev_pkt[pkt->channel_id].extra = pkt->extra;
- url_write(h, pkt_hdr, p-pkt_hdr);
+ ffurl_write(h, pkt_hdr, p-pkt_hdr);
size = p - pkt_hdr + pkt->data_size;
while (off < pkt->data_size) {
int towrite = FFMIN(chunk_size, pkt->data_size - off);
- url_write(h, pkt->data + off, towrite);
+ ffurl_write(h, pkt->data + off, towrite);
off += towrite;
if (off < pkt->data_size) {
uint8_t marker = 0xC0 | pkt->channel_id;
- url_write(h, &marker, 1);
+ ffurl_write(h, &marker, 1);
size++;
}
}
diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index 0d1bc8e196..98babcfc3b 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -486,7 +486,7 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
tosend[i] = av_lfg_get(&rnd) >> 24;
client_pos = rtmp_handshake_imprint_with_digest(tosend + 1);
- url_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE + 1);
+ ffurl_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE + 1);
i = ffurl_read_complete(rt->stream, serverdata, RTMP_HANDSHAKE_PACKET_SIZE + 1);
if (i != RTMP_HANDSHAKE_PACKET_SIZE + 1) {
av_log(LOG_CONTEXT, AV_LOG_ERROR, "Cannot read RTMP handshake response\n");
@@ -532,9 +532,9 @@ static int rtmp_handshake(URLContext *s, RTMPContext *rt)
tosend + RTMP_HANDSHAKE_PACKET_SIZE - 32);
// write reply back to the server
- url_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE);
+ ffurl_write(rt->stream, tosend, RTMP_HANDSHAKE_PACKET_SIZE);
} else {
- url_write(rt->stream, serverdata+1, RTMP_HANDSHAKE_PACKET_SIZE);
+ ffurl_write(rt->stream, serverdata+1, RTMP_HANDSHAKE_PACKET_SIZE);
}
return 0;
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index 281f51c443..43305a30c7 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -25,6 +25,7 @@
#include "libavcodec/get_bits.h"
#include "avformat.h"
#include "mpegts.h"
+#include "url.h"
#include <unistd.h>
#include <strings.h>
@@ -325,8 +326,8 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
if ((len > 0) && buf) {
int result;
av_dlog(s->ic, "sending %d bytes of RR\n", len);
- result= url_write(s->rtp_ctx, buf, len);
- av_dlog(s->ic, "result from url_write: %d\n", result);
+ result= ffurl_write(s->rtp_ctx, buf, len);
+ av_dlog(s->ic, "result from ffurl_write: %d\n", result);
av_free(buf);
}
return 0;
@@ -351,7 +352,7 @@ void rtp_send_punch_packets(URLContext* rtp_handle)
avio_flush(pb);
len = avio_close_dyn_buf(pb, &buf);
if ((len > 0) && buf)
- url_write(rtp_handle, buf, len);
+ ffurl_write(rtp_handle, buf, len);
av_free(buf);
/* Send a minimal RTCP RR */
@@ -366,7 +367,7 @@ void rtp_send_punch_packets(URLContext* rtp_handle)
avio_flush(pb);
len = avio_close_dyn_buf(pb, &buf);
if ((len > 0) && buf)
- url_write(rtp_handle, buf, len);
+ ffurl_write(rtp_handle, buf, len);
av_free(buf);
}
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index 1691f3cb48..22e59859d3 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -297,7 +297,7 @@ static int rtp_write(URLContext *h, const uint8_t *buf, int size)
hd = s->rtp_hd;
}
- ret = url_write(hd, buf, size);
+ ret = ffurl_write(hd, buf, size);
#if 0
{
struct timespec ts;
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 15999b8617..caa66c60cc 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -983,14 +983,14 @@ static int ff_rtsp_send_cmd_with_content_async(AVFormatContext *s,
av_dlog(s, "Sending:\n%s--\n", buf);
- url_write(rt->rtsp_hd_out, out_buf, strlen(out_buf));
+ ffurl_write(rt->rtsp_hd_out, out_buf, strlen(out_buf));
if (send_content_length > 0 && send_content) {
if (rt->control_transport == RTSP_MODE_TUNNEL) {
av_log(s, AV_LOG_ERROR, "tunneling of RTSP requests "
"with content data not supported\n");
return AVERROR_PATCHWELCOME;
}
- url_write(rt->rtsp_hd_out, send_content, send_content_length);
+ ffurl_write(rt->rtsp_hd_out, send_content, send_content_length);
}
rt->last_cmd_time = av_gettime();
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c
index 7f52b1fdb1..b4b26204f9 100644
--- a/libavformat/rtspenc.c
+++ b/libavformat/rtspenc.c
@@ -32,6 +32,7 @@
#include "avio_internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/avstring.h"
+#include "url.h"
#define SDP_MAX_SIZE 16384
@@ -158,7 +159,7 @@ static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st)
interleave_header[0] = '$';
interleave_header[1] = id;
AV_WB16(interleave_header + 2, packet_len);
- url_write(rt->rtsp_hd_out, interleaved_packet, 4 + packet_len);
+ ffurl_write(rt->rtsp_hd_out, interleaved_packet, 4 + packet_len);
ptr += packet_len;
size -= packet_len;
}
diff --git a/libavformat/sapenc.c b/libavformat/sapenc.c
index c811d2f001..25354208b7 100644
--- a/libavformat/sapenc.c
+++ b/libavformat/sapenc.c
@@ -54,7 +54,7 @@ static int sap_write_close(AVFormatContext *s)
if (sap->last_time && sap->ann && sap->ann_fd) {
sap->ann[0] |= 4; /* Session deletion*/
- url_write(sap->ann_fd, sap->ann, sap->ann_size);
+ ffurl_write(sap->ann_fd, sap->ann, sap->ann_size);
}
av_freep(&sap->ann);
@@ -239,7 +239,7 @@ static int sap_write_packet(AVFormatContext *s, AVPacket *pkt)
int64_t now = av_gettime();
if (!sap->last_time || now - sap->last_time > 5000000) {
- int ret = url_write(sap->ann_fd, sap->ann, sap->ann_size);
+ int ret = ffurl_write(sap->ann_fd, sap->ann, sap->ann_size);
/* Don't abort even if we get "Destination unreachable" */
if (ret < 0 && ret != AVERROR(ECONNREFUSED))
return ret;
diff --git a/libavformat/url.h b/libavformat/url.h
index 8d1a7f702c..45bf8c9397 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -78,4 +78,12 @@ int ffurl_read(URLContext *h, unsigned char *buf, int size);
*/
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size);
+/**
+ * Write size bytes from buf to the resource accessed by h.
+ *
+ * @return the number of bytes actually written, or a negative value
+ * corresponding to an AVERROR code in case of failure
+ */
+int ffurl_write(URLContext *h, const unsigned char *buf, int size);
+
#endif //AVFORMAT_URL_H