[11/13] avio: deprecate url_open_buf

Message ID 1300131546-2880-11-git-send-email-anton@khirnov.net
State Committed
Headers show

Commit Message

Anton Khirnov March 14, 2011, 7:39 p.m.
It's only used in one place and does the same thing as
avio_alloc_context.
---
 ffserver.c            |    3 ++-
 libavformat/avio.h    |    4 ++--
 libavformat/aviobuf.c |    2 ++
 3 files changed, 6 insertions(+), 3 deletions(-)

Comments

Ronald Bultje March 17, 2011, 2:50 a.m. | #1
Hi,

On Mon, Mar 14, 2011 at 3:39 PM, Anton Khirnov <anton@khirnov.net> wrote:
> It's only used in one place and does the same thing as
> avio_alloc_context.
> ---
>  ffserver.c            |    3 ++-
>  libavformat/avio.h    |    4 ++--
>  libavformat/aviobuf.c |    2 ++
>  3 files changed, 6 insertions(+), 3 deletions(-)

Nice catch, queued.

Ronald

Patch

diff --git a/ffserver.c b/ffserver.c
index d875553..c43f0a8 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -2721,7 +2721,8 @@  static int http_receive_data(HTTPContext *c)
             if (!fmt_in)
                 goto fail;
 
-            url_open_buf(&pb, c->buffer, c->buffer_end - c->buffer, URL_RDONLY);
+            pb = avio_alloc_context(c->buffer, c->buffer_end - c->buffer,
+                                    0, NULL, NULL, NULL, NULL);
             pb->seekable = AVIO_SEEK_NONE;
 
             if (av_open_input_stream(&s, pb, c->stream->feed_filename, fmt_in, NULL) < 0) {
diff --git a/libavformat/avio.h b/libavformat/avio.h
index dabe9ff..72907c2 100644
--- a/libavformat/avio.h
+++ b/libavformat/avio.h
@@ -645,9 +645,9 @@  URLContext *url_fileno(AVIOContext *s);
  * @deprecated use AVIOContext.max_packet_size directly.
  */
 attribute_deprecated int url_fget_max_packet_size(AVIOContext *s);
-#endif
 
-int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags);
+attribute_deprecated int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags);
+#endif
 
 /** return the written or read size */
 int url_close_buf(AVIOContext *s);
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index 0da445a..c7a1acc 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -1011,6 +1011,7 @@  int64_t ffio_read_seek(AVIOContext *s, int stream_index,
  * back to the server even if CONFIG_MUXERS is false. */
 #if CONFIG_MUXERS || CONFIG_NETWORK
 /* buffer handling */
+#if FF_API_OLD_AVIO
 int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags)
 {
     int ret;
@@ -1024,6 +1025,7 @@  int url_open_buf(AVIOContext **s, uint8_t *buf, int buf_size, int flags)
         av_freep(s);
     return ret;
 }
+#endif
 
 int url_close_buf(AVIOContext *s)
 {