[FFmpeg-devel] [PATCH 08/10] avio: avio_ prefixes for url_*_dyn_buf functions
Anton Khirnov
anton
Sat Feb 19 12:42:52 CET 2011
---
ffserver.c | 34 +++++++++++++++++-----------------
libavformat/asfenc.c | 12 ++++++------
libavformat/avc.c | 4 ++--
libavformat/avio.h | 13 ++++++++-----
libavformat/aviobuf.c | 21 +++++++++++++++++----
libavformat/matroskaenc.c | 8 ++++----
libavformat/movenc.c | 4 ++--
libavformat/movenchint.c | 10 +++++-----
libavformat/mp3enc.c | 4 ++--
libavformat/nutenc.c | 22 +++++++++++-----------
libavformat/oggenc.c | 4 ++--
libavformat/rtpdec.c | 14 +++++++-------
libavformat/rtpdec_asf.c | 8 ++++----
libavformat/rtpdec_latm.c | 8 ++++----
libavformat/rtpdec_svq3.c | 8 ++++----
libavformat/rtpdec_vp8.c | 6 +++---
libavformat/rtpdec_xiph.c | 6 +++---
libavformat/rtpenc_chain.c | 4 ++--
libavformat/rtsp.c | 2 +-
libavformat/rtspenc.c | 6 +++---
20 files changed, 107 insertions(+), 91 deletions(-)
diff --git a/ffserver.c b/ffserver.c
index c2563b7..afaf958 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -869,10 +869,10 @@ static void close_connection(HTTPContext *c)
if (!c->last_packet_sent && c->state == HTTPSTATE_SEND_DATA_TRAILER) {
if (ctx->oformat) {
/* prepare header */
- if (url_open_dyn_buf(&ctx->pb) >= 0) {
+ if (avio_open_dyn_buf(&ctx->pb) >= 0) {
av_write_trailer(ctx);
av_freep(&c->pb_buffer);
- url_close_dyn_buf(ctx->pb, &c->pb_buffer);
+ avio_close_dyn_buf(ctx->pb, &c->pb_buffer);
}
}
}
@@ -1873,7 +1873,7 @@ static void compute_status(HTTPContext *c)
int i, len;
AVIOContext *pb;
- if (url_open_dyn_buf(&pb) < 0) {
+ if (avio_open_dyn_buf(&pb) < 0) {
/* XXX: return an error ? */
c->buffer_ptr = c->buffer;
c->buffer_end = c->buffer;
@@ -2101,7 +2101,7 @@ static void compute_status(HTTPContext *c)
url_fprintf(pb, "<hr size=1 noshade>Generated at %s", p);
url_fprintf(pb, "</body>\n</html>\n");
- len = url_close_dyn_buf(pb, &c->pb_buffer);
+ len = avio_close_dyn_buf(pb, &c->pb_buffer);
c->buffer_ptr = c->pb_buffer;
c->buffer_end = c->pb_buffer + len;
}
@@ -2256,7 +2256,7 @@ static int http_prepare_data(HTTPContext *c)
c->got_key_frame = 0;
/* prepare header and save header data in a stream */
- if (url_open_dyn_buf(&c->fmt_ctx.pb) < 0) {
+ if (avio_open_dyn_buf(&c->fmt_ctx.pb) < 0) {
/* XXX: potential leak */
return -1;
}
@@ -2277,7 +2277,7 @@ static int http_prepare_data(HTTPContext *c)
}
av_metadata_free(&c->fmt_ctx.metadata);
- len = url_close_dyn_buf(c->fmt_ctx.pb, &c->pb_buffer);
+ len = avio_close_dyn_buf(c->fmt_ctx.pb, &c->pb_buffer);
c->buffer_ptr = c->pb_buffer;
c->buffer_end = c->pb_buffer + len;
@@ -2389,9 +2389,9 @@ static int http_prepare_data(HTTPContext *c)
max_packet_size = RTSP_TCP_MAX_PACKET_SIZE;
else
max_packet_size = url_get_max_packet_size(c->rtp_handles[c->packet_stream_index]);
- ret = url_open_dyn_packet_buf(&ctx->pb, max_packet_size);
+ ret = avio_open_dyn_packet_buf(&ctx->pb, max_packet_size);
} else {
- ret = url_open_dyn_buf(&ctx->pb);
+ ret = avio_open_dyn_buf(&ctx->pb);
}
if (ret < 0) {
/* XXX: potential leak */
@@ -2410,7 +2410,7 @@ static int http_prepare_data(HTTPContext *c)
c->state = HTTPSTATE_SEND_DATA_TRAILER;
}
- len = url_close_dyn_buf(ctx->pb, &c->pb_buffer);
+ len = avio_close_dyn_buf(ctx->pb, &c->pb_buffer);
c->cur_frame_bytes = len;
c->buffer_ptr = c->pb_buffer;
c->buffer_end = c->pb_buffer + len;
@@ -2432,13 +2432,13 @@ static int http_prepare_data(HTTPContext *c)
return -1;
ctx = &c->fmt_ctx;
/* prepare header */
- if (url_open_dyn_buf(&ctx->pb) < 0) {
+ if (avio_open_dyn_buf(&ctx->pb) < 0) {
/* XXX: potential leak */
return -1;
}
c->fmt_ctx.pb->is_streamed = 1;
av_write_trailer(ctx);
- len = url_close_dyn_buf(ctx->pb, &c->pb_buffer);
+ len = avio_close_dyn_buf(ctx->pb, &c->pb_buffer);
c->buffer_ptr = c->pb_buffer;
c->buffer_end = c->pb_buffer + len;
@@ -2503,7 +2503,7 @@ static int http_send_data(HTTPContext *c)
/* if already sending something, then wait. */
if (rtsp_c->state != RTSPSTATE_WAIT_REQUEST)
break;
- if (url_open_dyn_buf(&pb) < 0)
+ if (avio_open_dyn_buf(&pb) < 0)
goto fail1;
interleaved_index = c->packet_stream_index * 2;
/* RTCP packets are sent at odd indexes */
@@ -2518,7 +2518,7 @@ static int http_send_data(HTTPContext *c)
/* write RTP packet data */
c->buffer_ptr += 4;
avio_put_buffer(pb, c->buffer_ptr, len);
- size = url_close_dyn_buf(pb, &c->packet_buffer);
+ size = avio_close_dyn_buf(pb, &c->packet_buffer);
/* prepare asynchronous TCP sending */
rtsp_c->packet_buffer_ptr = c->packet_buffer;
rtsp_c->packet_buffer_end = c->packet_buffer + size;
@@ -2849,7 +2849,7 @@ static int rtsp_parse_request(HTTPContext *c)
av_strlcpy(c->url, url, sizeof(c->url));
av_strlcpy(c->protocol, protocol, sizeof(c->protocol));
- if (url_open_dyn_buf(&c->pb) < 0) {
+ if (avio_open_dyn_buf(&c->pb) < 0) {
/* XXX: cannot do more */
c->pb = NULL; /* safety */
return -1;
@@ -2906,7 +2906,7 @@ static int rtsp_parse_request(HTTPContext *c)
rtsp_reply_error(c, RTSP_STATUS_METHOD);
the_end:
- len = url_close_dyn_buf(c->pb, &c->pb_buffer);
+ len = avio_close_dyn_buf(c->pb, &c->pb_buffer);
c->pb = NULL; /* safety */
if (len < 0) {
/* XXX: cannot do more */
@@ -3443,7 +3443,7 @@ static int rtp_new_av_stream(HTTPContext *c,
c->stream->filename, stream_index, c->protocol);
/* normally, no packets should be output here, but the packet size may be checked */
- if (url_open_dyn_packet_buf(&ctx->pb, max_packet_size) < 0) {
+ if (avio_open_dyn_packet_buf(&ctx->pb, max_packet_size) < 0) {
/* XXX: close stream */
goto fail;
}
@@ -3455,7 +3455,7 @@ static int rtp_new_av_stream(HTTPContext *c,
av_free(ctx);
return -1;
}
- url_close_dyn_buf(ctx->pb, &dummy_buf);
+ avio_close_dyn_buf(ctx->pb, &dummy_buf);
av_free(dummy_buf);
c->rtp_ctx[stream_index] = ctx;
diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c
index 85a5e14..01a017c 100644
--- a/libavformat/asfenc.c
+++ b/libavformat/asfenc.c
@@ -233,11 +233,11 @@ static void put_str16(AVIOContext *s, const char *tag)
int len;
uint8_t *pb;
AVIOContext *dyn_buf;
- if (url_open_dyn_buf(&dyn_buf) < 0)
+ if (avio_open_dyn_buf(&dyn_buf) < 0)
return;
avio_put_str16le(dyn_buf, tag);
- len = url_close_dyn_buf(dyn_buf, &pb);
+ len = avio_close_dyn_buf(dyn_buf, &pb);
avio_put_le16(s, len);
avio_put_buffer(s, pb, len);
av_freep(&pb);
@@ -365,7 +365,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
uint8_t *buf;
AVIOContext *dyn_buf;
- if (url_open_dyn_buf(&dyn_buf) < 0)
+ if (avio_open_dyn_buf(&dyn_buf) < 0)
return AVERROR(ENOMEM);
hpos = put_header(pb, &ff_asf_comment_header);
@@ -374,7 +374,7 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
len = tags[n] ? avio_put_str16le(dyn_buf, tags[n]->value) : 0;
avio_put_le16(pb, len);
}
- len = url_close_dyn_buf(dyn_buf, &buf);
+ len = avio_close_dyn_buf(dyn_buf, &buf);
avio_put_buffer(pb, buf, len);
av_freep(&buf);
end_header(pb, hpos);
@@ -496,11 +496,11 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
else
desc = p ? p->name : enc->codec_name;
- if ( url_open_dyn_buf(&dyn_buf) < 0)
+ if ( avio_open_dyn_buf(&dyn_buf) < 0)
return AVERROR(ENOMEM);
avio_put_str16le(dyn_buf, desc);
- len = url_close_dyn_buf(dyn_buf, &buf);
+ len = avio_close_dyn_buf(dyn_buf, &buf);
avio_put_le16(pb, len / 2); // "number of characters" = length in bytes / 2
avio_put_buffer(pb, buf, len);
diff --git a/libavformat/avc.c b/libavformat/avc.c
index 1432516..93e98e5 100644
--- a/libavformat/avc.c
+++ b/libavformat/avc.c
@@ -89,14 +89,14 @@ int ff_avc_parse_nal_units(AVIOContext *pb, const uint8_t *buf_in, int size)
int ff_avc_parse_nal_units_buf(const uint8_t *buf_in, uint8_t **buf, int *size)
{
AVIOContext *pb;
- int ret = url_open_dyn_buf(&pb);
+ int ret = avio_open_dyn_buf(&pb);
if(ret < 0)
return ret;
ff_avc_parse_nal_units(pb, buf_in, *size);
av_freep(buf);
- *size = url_close_dyn_buf(pb, buf);
+ *size = avio_close_dyn_buf(pb, buf);
return 0;
}
diff --git a/libavformat/avio.h b/libavformat/avio.h
index fd66c5d..50f27de 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -445,6 +445,9 @@ attribute_deprecated int url_ferror(AVIOContext *s);
attribute_deprecated int av_url_read_fpause(AVIOContext *h, int pause);
attribute_deprecated int64_t av_url_read_fseek(AVIOContext *h, int stream_index,
int64_t timestamp, int flags);
+attribute_deprecated int url_open_dyn_buf(AVIOContext **s);
+attribute_deprecated int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
+attribute_deprecated int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
/**
* @}
*/
@@ -655,7 +658,7 @@ int url_close_buf(AVIOContext *s);
* @param s new IO context
* @return zero if no error.
*/
-int url_open_dyn_buf(AVIOContext **s);
+int avio_open_dyn_buf(AVIOContext **s);
/**
* Open a write only packetized memory stream with a maximum packet
@@ -666,19 +669,19 @@ int url_open_dyn_buf(AVIOContext **s);
* @param max_packet_size maximum packet size (must be > 0)
* @return zero if no error.
*/
-int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
+int avio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size);
/**
* Return the written size and a pointer to the buffer. The buffer
* must be freed with av_free(). If the buffer is opened with
- * url_open_dyn_buf, then padding of FF_INPUT_BUFFER_PADDING_SIZE is
- * added; if opened with url_open_dyn_packet_buf, no padding is added.
+ * avio_open_dyn_buf, then padding of FF_INPUT_BUFFER_PADDING_SIZE is
+ * added; if opened with avio_open_dyn_packet_buf, no padding is added.
*
* @param s IO context
* @param pbuffer pointer to a byte buffer
* @return the length of the byte buffer
*/
-int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
+int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer);
unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf,
unsigned int len);
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index a52735f..adcd3c1 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -385,6 +385,19 @@ int64_t av_url_read_fseek(AVIOContext *s, int stream_index, int64_t timestamp, i
{
return avio_read_fseek(s, stream_index, timestamp, flags);
}
+
+int url_open_dyn_buf(AVIOContext **s)
+{
+ return avio_open_dyn_buf(s);
+}
+int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)
+{
+ return avio_open_dyn_packet_buf(s, max_packet_size);
+}
+int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
+{
+ return avio_close_dyn_buf(s, pbuffer);
+}
#endif
int avio_put_str(AVIOContext *s, const char *str)
@@ -970,7 +983,7 @@ int64_t avio_read_fseek(AVIOContext *s, int stream_index,
return ret;
}
-/* url_open_dyn_buf and url_close_dyn_buf are used in rtp.c to send a response
+/* avio_open_dyn_buf and avio_close_dyn_buf are used in rtp.c to send a response
* back to the server even if CONFIG_MUXERS is false. */
#if CONFIG_MUXERS || CONFIG_NETWORK
/* buffer handling */
@@ -1092,19 +1105,19 @@ static int url_open_dyn_buf_internal(AVIOContext **s, int max_packet_size)
return ret;
}
-int url_open_dyn_buf(AVIOContext **s)
+int avio_open_dyn_buf(AVIOContext **s)
{
return url_open_dyn_buf_internal(s, 0);
}
-int url_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)
+int avio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)
{
if (max_packet_size <= 0)
return -1;
return url_open_dyn_buf_internal(s, max_packet_size);
}
-int url_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
+int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
{
DynBuffer *d = s->opaque;
int size;
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index e71ce1b..9005202 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -469,7 +469,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecCo
uint8_t *codecpriv;
int ret, codecpriv_size;
- ret = url_open_dyn_buf(&dyn_cp);
+ ret = avio_open_dyn_buf(&dyn_cp);
if(ret < 0)
return ret;
@@ -512,7 +512,7 @@ static int mkv_write_codecprivate(AVFormatContext *s, AVIOContext *pb, AVCodecCo
ff_put_wav_header(dyn_cp, codec);
}
- codecpriv_size = url_close_dyn_buf(dyn_cp, &codecpriv);
+ codecpriv_size = avio_close_dyn_buf(dyn_cp, &codecpriv);
if (codecpriv_size)
put_ebml_binary(pb, MATROSKA_ID_CODECPRIVATE, codecpriv, codecpriv_size);
av_free(codecpriv);
@@ -1017,7 +1017,7 @@ static void mkv_flush_dynbuf(AVFormatContext *s)
if (!mkv->dyn_bc)
return;
- bufsize = url_close_dyn_buf(mkv->dyn_bc, &dyn_buf);
+ bufsize = avio_close_dyn_buf(mkv->dyn_bc, &dyn_buf);
avio_put_buffer(s->pb, dyn_buf, bufsize);
av_free(dyn_buf);
mkv->dyn_bc = NULL;
@@ -1040,7 +1040,7 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt)
if (url_is_streamed(s->pb)) {
if (!mkv->dyn_bc)
- url_open_dyn_buf(&mkv->dyn_bc);
+ avio_open_dyn_buf(&mkv->dyn_bc);
pb = mkv->dyn_bc;
}
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 37c4f97..d9cebe6 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1614,7 +1614,7 @@ static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
return 0;
}
- ret = url_open_dyn_buf(&pb_buf);
+ ret = avio_open_dyn_buf(&pb_buf);
if(ret < 0)
return ret;
@@ -1645,7 +1645,7 @@ static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
if (s->nb_chapters)
mov_write_chpl_tag(pb_buf, s);
- if ((size = url_close_dyn_buf(pb_buf, &buf)) > 0) {
+ if ((size = avio_close_dyn_buf(pb_buf, &buf)) > 0) {
avio_put_be32(pb, size+8);
avio_put_tag(pb, "udta");
avio_put_buffer(pb, buf, size);
diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c
index e8582e8..12836b9 100644
--- a/libavformat/movenchint.c
+++ b/libavformat/movenchint.c
@@ -408,8 +408,8 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt,
/* Fetch the output from the RTP muxer, open a new output buffer
* for next time. */
- size = url_close_dyn_buf(rtp_ctx->pb, &buf);
- if ((ret = url_open_dyn_packet_buf(&rtp_ctx->pb,
+ size = avio_close_dyn_buf(rtp_ctx->pb, &buf);
+ if ((ret = avio_open_dyn_packet_buf(&rtp_ctx->pb,
RTP_MAX_PACKET_SIZE)) < 0)
goto done;
@@ -417,14 +417,14 @@ int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt,
goto done;
/* Open a buffer for writing the hint */
- if ((ret = url_open_dyn_buf(&hintbuf)) < 0)
+ if ((ret = avio_open_dyn_buf(&hintbuf)) < 0)
goto done;
av_init_packet(&hint_pkt);
count = write_hint_packets(hintbuf, buf, size, trk, &hint_pkt.dts);
av_freep(&buf);
/* Write the hint data into the hint track */
- hint_pkt.size = size = url_close_dyn_buf(hintbuf, &buf);
+ hint_pkt.size = size = avio_close_dyn_buf(hintbuf, &buf);
hint_pkt.data = buf;
hint_pkt.pts = hint_pkt.dts;
hint_pkt.stream_index = track_index;
@@ -448,7 +448,7 @@ void ff_mov_close_hinting(MOVTrack *track) {
return;
if (rtp_ctx->pb) {
av_write_trailer(rtp_ctx);
- url_close_dyn_buf(rtp_ctx->pb, &ptr);
+ avio_close_dyn_buf(rtp_ctx->pb, &ptr);
av_free(ptr);
}
avformat_free_context(rtp_ctx);
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index a3fe0e5..69034e7 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -95,7 +95,7 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2
uint8_t *pb;
int (*put)(AVIOContext*, const char*);
AVIOContext *dyn_buf;
- if (url_open_dyn_buf(&dyn_buf) < 0)
+ if (avio_open_dyn_buf(&dyn_buf) < 0)
return AVERROR(ENOMEM);
/* check if the strings are ASCII-only and use UTF16 only if
@@ -114,7 +114,7 @@ static int id3v2_put_ttag(AVFormatContext *s, const char *str1, const char *str2
put(dyn_buf, str1);
if (str2)
put(dyn_buf, str2);
- len = url_close_dyn_buf(dyn_buf, &pb);
+ len = avio_close_dyn_buf(dyn_buf, &pb);
avio_put_be32(s->pb, tag);
id3v2_put_size(s, len);
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 052c833..06004e9 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -280,7 +280,7 @@ static inline void put_s_trace(AVIOContext *bc, int64_t v, char *file, char *fun
//FIXME remove calculate_checksum
static void put_packet(NUTContext *nut, AVIOContext *bc, AVIOContext *dyn_bc, int calculate_checksum, uint64_t startcode){
uint8_t *dyn_buf=NULL;
- int dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf);
+ int dyn_size= avio_close_dyn_buf(dyn_bc, &dyn_buf);
int forw_ptr= dyn_size + 4*calculate_checksum;
if(forw_ptr > 4096)
@@ -435,7 +435,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc){
AVIOContext *dyn_bc;
uint8_t *dyn_buf=NULL;
int count=0, dyn_size;
- int ret = url_open_dyn_buf(&dyn_bc);
+ int ret = avio_open_dyn_buf(&dyn_bc);
if(ret < 0)
return ret;
@@ -449,7 +449,7 @@ static int write_globalinfo(NUTContext *nut, AVIOContext *bc){
ff_put_v(bc, count);
- dyn_size= url_close_dyn_buf(dyn_bc, &dyn_buf);
+ dyn_size= avio_close_dyn_buf(dyn_bc, &dyn_buf);
avio_put_buffer(bc, dyn_buf, dyn_size);
av_free(dyn_buf);
return 0;
@@ -461,7 +461,7 @@ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id){
AVIOContext *dyn_bc;
uint8_t *dyn_buf=NULL;
int count=0, dyn_size, i;
- int ret = url_open_dyn_buf(&dyn_bc);
+ int ret = avio_open_dyn_buf(&dyn_bc);
if(ret < 0)
return ret;
@@ -469,7 +469,7 @@ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id){
if (st->disposition & ff_nut_dispositions[i].flag)
count += add_info(dyn_bc, "Disposition", ff_nut_dispositions[i].str);
}
- dyn_size = url_close_dyn_buf(dyn_bc, &dyn_buf);
+ dyn_size = avio_close_dyn_buf(dyn_bc, &dyn_buf);
if (count) {
ff_put_v(bc, stream_id + 1); //stream_id_plus1
@@ -493,14 +493,14 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){
ff_metadata_conv_ctx(avctx, ff_nut_metadata_conv, NULL);
- ret = url_open_dyn_buf(&dyn_bc);
+ ret = avio_open_dyn_buf(&dyn_bc);
if(ret < 0)
return ret;
write_mainheader(nut, dyn_bc);
put_packet(nut, bc, dyn_bc, 1, MAIN_STARTCODE);
for (i=0; i < nut->avf->nb_streams; i++){
- ret = url_open_dyn_buf(&dyn_bc);
+ ret = avio_open_dyn_buf(&dyn_bc);
if(ret < 0)
return ret;
if ((ret = write_streamheader(avctx, dyn_bc, nut->avf->streams[i], i)) < 0)
@@ -508,14 +508,14 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){
put_packet(nut, bc, dyn_bc, 1, STREAM_STARTCODE);
}
- ret = url_open_dyn_buf(&dyn_bc);
+ ret = avio_open_dyn_buf(&dyn_bc);
if(ret < 0)
return ret;
write_globalinfo(nut, dyn_bc);
put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
for (i = 0; i < nut->avf->nb_streams; i++) {
- ret = url_open_dyn_buf(&dyn_bc);
+ ret = avio_open_dyn_buf(&dyn_bc);
if(ret < 0)
return ret;
ret = write_streaminfo(nut, dyn_bc, i);
@@ -525,7 +525,7 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){
put_packet(nut, bc, dyn_bc, 1, INFO_STARTCODE);
else {
uint8_t* buf;
- url_close_dyn_buf(dyn_bc, &buf);
+ avio_close_dyn_buf(dyn_bc, &buf);
av_free(buf);
}
}
@@ -669,7 +669,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
NULL);
nut->last_syncpoint_pos= avio_ftell(bc);
- ret = url_open_dyn_buf(&dyn_bc);
+ ret = avio_open_dyn_buf(&dyn_bc);
if(ret < 0)
return ret;
put_tt(nut, nus, dyn_bc, pkt->dts);
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 2aed2a0..34b45fa 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -81,7 +81,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
int ret, size;
uint8_t *buf;
- ret = url_open_dyn_buf(&pb);
+ ret = avio_open_dyn_buf(&pb);
if (ret < 0)
return ret;
init_checksum(pb, ff_crc04C11DB7_update, 0);
@@ -100,7 +100,7 @@ static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags)
ogg_update_checksum(s, pb, crc_offset);
put_flush_packet(pb);
- size = url_close_dyn_buf(pb, &buf);
+ size = avio_close_dyn_buf(pb, &buf);
if (size < 0)
return size;
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index f2b84dd..e4a817b 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -41,7 +41,7 @@
buffer to 'rtp_write_packet' contains all the packets for ONE
frame. Each packet should have a four byte header containing
the length in big endian format (same trick as
- 'url_open_dyn_packet_buf')
+ 'avio_open_dyn_packet_buf')
*/
static RTPDynamicProtocolHandler ff_realmedia_mp3_dynamic_handler = {
@@ -264,7 +264,7 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
return -1;
s->last_octet_count = s->octet_count;
- if (url_open_dyn_buf(&pb) < 0)
+ if (avio_open_dyn_buf(&pb) < 0)
return -1;
// Receiver Report
@@ -321,7 +321,7 @@ int rtp_check_and_send_back_rr(RTPDemuxContext *s, int count)
}
put_flush_packet(pb);
- len = url_close_dyn_buf(pb, &buf);
+ len = avio_close_dyn_buf(pb, &buf);
if ((len > 0) && buf) {
int result;
av_dlog(s->ic, "sending %d bytes of RR\n", len);
@@ -339,7 +339,7 @@ void rtp_send_punch_packets(URLContext* rtp_handle)
int len;
/* Send a small RTP packet */
- if (url_open_dyn_buf(&pb) < 0)
+ if (avio_open_dyn_buf(&pb) < 0)
return;
avio_put_byte(pb, (RTP_VERSION << 6));
@@ -349,13 +349,13 @@ void rtp_send_punch_packets(URLContext* rtp_handle)
avio_put_be32(pb, 0); /* SSRC */
put_flush_packet(pb);
- len = url_close_dyn_buf(pb, &buf);
+ len = avio_close_dyn_buf(pb, &buf);
if ((len > 0) && buf)
url_write(rtp_handle, buf, len);
av_free(buf);
/* Send a minimal RTCP RR */
- if (url_open_dyn_buf(&pb) < 0)
+ if (avio_open_dyn_buf(&pb) < 0)
return;
avio_put_byte(pb, (RTP_VERSION << 6));
@@ -364,7 +364,7 @@ void rtp_send_punch_packets(URLContext* rtp_handle)
avio_put_be32(pb, 0); /* our own SSRC */
put_flush_packet(pb);
- len = url_close_dyn_buf(pb, &buf);
+ len = avio_close_dyn_buf(pb, &buf);
if ((len > 0) && buf)
url_write(rtp_handle, buf, len);
av_free(buf);
diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c
index 35338ed..56435a9 100644
--- a/libavformat/rtpdec_asf.c
+++ b/libavformat/rtpdec_asf.c
@@ -202,12 +202,12 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
*/
if (asf->pktbuf && len_off != avio_ftell(asf->pktbuf)) {
uint8_t *p;
- url_close_dyn_buf(asf->pktbuf, &p);
+ avio_close_dyn_buf(asf->pktbuf, &p);
asf->pktbuf = NULL;
av_free(p);
}
if (!len_off && !asf->pktbuf &&
- (res = url_open_dyn_buf(&asf->pktbuf)) < 0)
+ (res = avio_open_dyn_buf(&asf->pktbuf)) < 0)
return res;
if (!asf->pktbuf)
return AVERROR(EIO);
@@ -216,7 +216,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
avio_fskip(pb, len - off);
if (!(flags & RTP_FLAG_MARKER))
return -1;
- out_len = url_close_dyn_buf(asf->pktbuf, &asf->buf);
+ out_len = avio_close_dyn_buf(asf->pktbuf, &asf->buf);
asf->pktbuf = NULL;
} else {
/**
@@ -271,7 +271,7 @@ static void asfrtp_free_context(PayloadContext *asf)
{
if (asf->pktbuf) {
uint8_t *p = NULL;
- url_close_dyn_buf(asf->pktbuf, &p);
+ avio_close_dyn_buf(asf->pktbuf, &p);
asf->pktbuf = NULL;
av_free(p);
}
diff --git a/libavformat/rtpdec_latm.c b/libavformat/rtpdec_latm.c
index 0be6aea..298faaf 100644
--- a/libavformat/rtpdec_latm.c
+++ b/libavformat/rtpdec_latm.c
@@ -43,7 +43,7 @@ static void latm_free_context(PayloadContext *data)
return;
if (data->dyn_buf) {
uint8_t *p;
- url_close_dyn_buf(data->dyn_buf, &p);
+ avio_close_dyn_buf(data->dyn_buf, &p);
av_free(p);
}
av_free(data->buf);
@@ -60,12 +60,12 @@ static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data,
if (!data->dyn_buf || data->timestamp != *timestamp) {
av_freep(&data->buf);
if (data->dyn_buf)
- url_close_dyn_buf(data->dyn_buf, &data->buf);
+ avio_close_dyn_buf(data->dyn_buf, &data->buf);
data->dyn_buf = NULL;
av_freep(&data->buf);
data->timestamp = *timestamp;
- if ((ret = url_open_dyn_buf(&data->dyn_buf)) < 0)
+ if ((ret = avio_open_dyn_buf(&data->dyn_buf)) < 0)
return ret;
}
avio_put_buffer(data->dyn_buf, buf, len);
@@ -73,7 +73,7 @@ static int latm_parse_packet(AVFormatContext *ctx, PayloadContext *data,
if (!(flags & RTP_FLAG_MARKER))
return AVERROR(EAGAIN);
av_free(data->buf);
- data->len = url_close_dyn_buf(data->dyn_buf, &data->buf);
+ data->len = avio_close_dyn_buf(data->dyn_buf, &data->buf);
data->dyn_buf = NULL;
data->pos = 0;
}
diff --git a/libavformat/rtpdec_svq3.c b/libavformat/rtpdec_svq3.c
index d06e3f0..76325a6 100644
--- a/libavformat/rtpdec_svq3.c
+++ b/libavformat/rtpdec_svq3.c
@@ -83,10 +83,10 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv,
if (sv->pktbuf) {
uint8_t *tmp;
- url_close_dyn_buf(sv->pktbuf, &tmp);
+ avio_close_dyn_buf(sv->pktbuf, &tmp);
av_free(tmp);
}
- if ((res = url_open_dyn_buf(&sv->pktbuf)) < 0)
+ if ((res = avio_open_dyn_buf(&sv->pktbuf)) < 0)
return res;
sv->timestamp = *timestamp;
}
@@ -100,7 +100,7 @@ static int svq3_parse_packet (AVFormatContext *s, PayloadContext *sv,
av_init_packet(pkt);
pkt->stream_index = st->index;
*timestamp = sv->timestamp;
- pkt->size = url_close_dyn_buf(sv->pktbuf, &pkt->data);
+ pkt->size = avio_close_dyn_buf(sv->pktbuf, &pkt->data);
pkt->destruct = av_destruct_packet;
sv->pktbuf = NULL;
return 0;
@@ -118,7 +118,7 @@ static void svq3_extradata_free(PayloadContext *sv)
{
if (sv->pktbuf) {
uint8_t *buf;
- url_close_dyn_buf(sv->pktbuf, &buf);
+ avio_close_dyn_buf(sv->pktbuf, &buf);
av_free(buf);
}
av_free(sv);
diff --git a/libavformat/rtpdec_vp8.c b/libavformat/rtpdec_vp8.c
index 47199ae..c23511d 100644
--- a/libavformat/rtpdec_vp8.c
+++ b/libavformat/rtpdec_vp8.c
@@ -41,7 +41,7 @@ static void prepare_packet(AVPacket *pkt, PayloadContext *vp8, int stream)
av_init_packet(pkt);
pkt->stream_index = stream;
pkt->flags = vp8->is_keyframe ? AV_PKT_FLAG_KEY : 0;
- pkt->size = url_close_dyn_buf(vp8->data, &pkt->data);
+ pkt->size = avio_close_dyn_buf(vp8->data, &pkt->data);
pkt->destruct = av_destruct_packet;
vp8->data = NULL;
}
@@ -85,7 +85,7 @@ static int vp8_handle_packet(AVFormatContext *ctx,
// that for the next av_get_packet call
ret = end_packet ? 1 : 0;
}
- if ((res = url_open_dyn_buf(&vp8->data)) < 0)
+ if ((res = avio_open_dyn_buf(&vp8->data)) < 0)
return res;
vp8->is_keyframe = *buf & 1;
vp8->timestamp = ts;
@@ -138,7 +138,7 @@ static void vp8_free_context(PayloadContext *vp8)
{
if (vp8->data) {
uint8_t *tmp;
- url_close_dyn_buf(vp8->data, &tmp);
+ avio_close_dyn_buf(vp8->data, &tmp);
av_free(tmp);
}
av_free(vp8);
diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c
index 51d7d6b..96b80a5 100644
--- a/libavformat/rtpdec_xiph.c
+++ b/libavformat/rtpdec_xiph.c
@@ -57,7 +57,7 @@ static inline void free_fragment_if_needed(PayloadContext * data)
{
if (data->fragment) {
uint8_t* p;
- url_close_dyn_buf(data->fragment, &p);
+ avio_close_dyn_buf(data->fragment, &p);
av_free(p);
data->fragment = NULL;
}
@@ -176,7 +176,7 @@ static int xiph_handle_packet(AVFormatContext * ctx,
// end packet has been lost somewhere, so drop buffered data
free_fragment_if_needed(data);
- if((res = url_open_dyn_buf(&data->fragment)) < 0)
+ if((res = avio_open_dyn_buf(&data->fragment)) < 0)
return res;
avio_put_buffer(data->fragment, buf, pkt_len);
@@ -203,7 +203,7 @@ static int xiph_handle_packet(AVFormatContext * ctx,
if (fragmented == 3) {
// end of xiph data packet
av_init_packet(pkt);
- pkt->size = url_close_dyn_buf(data->fragment, &pkt->data);
+ pkt->size = avio_close_dyn_buf(data->fragment, &pkt->data);
if (pkt->size < 0) {
av_log(ctx, AV_LOG_ERROR,
diff --git a/libavformat/rtpenc_chain.c b/libavformat/rtpenc_chain.c
index 63918ad..6dd0dd5 100644
--- a/libavformat/rtpenc_chain.c
+++ b/libavformat/rtpenc_chain.c
@@ -55,7 +55,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
if (handle) {
url_fdopen(&rtpctx->pb, handle);
} else
- url_open_dyn_packet_buf(&rtpctx->pb, packet_size);
+ avio_open_dyn_packet_buf(&rtpctx->pb, packet_size);
ret = av_write_header(rtpctx);
if (ret) {
@@ -63,7 +63,7 @@ AVFormatContext *ff_rtp_chain_mux_open(AVFormatContext *s, AVStream *st,
url_fclose(rtpctx->pb);
} else {
uint8_t *ptr;
- url_close_dyn_buf(rtpctx->pb, &ptr);
+ avio_close_dyn_buf(rtpctx->pb, &ptr);
av_free(ptr);
}
avformat_free_context(rtpctx);
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index a5b3755..5e7a363 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -494,7 +494,7 @@ void ff_rtsp_undo_setup(AVFormatContext *s)
av_write_trailer(rtpctx);
if (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP) {
uint8_t *ptr;
- url_close_dyn_buf(rtpctx->pb, &ptr);
+ avio_close_dyn_buf(rtpctx->pb, &ptr);
av_free(ptr);
} else {
url_fclose(rtpctx->pb);
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c
index 34deeeb..0f1eb65 100644
--- a/libavformat/rtspenc.c
+++ b/libavformat/rtspenc.c
@@ -136,14 +136,14 @@ static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st)
int size;
uint8_t *interleave_header, *interleaved_packet;
- size = url_close_dyn_buf(rtpctx->pb, &buf);
+ size = avio_close_dyn_buf(rtpctx->pb, &buf);
ptr = buf;
while (size > 4) {
uint32_t packet_len = AV_RB32(ptr);
int id;
/* The interleaving header is exactly 4 bytes, which happens to be
* the same size as the packet length header from
- * url_open_dyn_packet_buf. So by writing the interleaving header
+ * avio_open_dyn_packet_buf. So by writing the interleaving header
* over these bytes, we get a consecutive interleaved packet
* that can be written in one call. */
interleaved_packet = interleave_header = ptr;
@@ -163,7 +163,7 @@ static int tcp_write_packet(AVFormatContext *s, RTSPStream *rtsp_st)
size -= packet_len;
}
av_free(buf);
- url_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE);
+ avio_open_dyn_packet_buf(&rtpctx->pb, RTSP_TCP_MAX_PACKET_SIZE);
return 0;
}
--
1.7.2.3
More information about the ffmpeg-devel
mailing list