[FFmpeg-cvslog] avio: don't replicate avio_alloc_context functionality.

Anton Khirnov git at videolan.org
Sat Jul 16 19:49:04 CEST 2011


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat May 21 19:13:22 2011 +0200| [c3bec4cd1391c7f2ca0e98713e3721d0336b49c4] | committer: Anton Khirnov

avio: don't replicate avio_alloc_context functionality.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c3bec4cd1391c7f2ca0e98713e3721d0336b49c4
---

 libavformat/aviobuf.c |   13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index fa63ddf..b5e9d4c 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -838,19 +838,12 @@ int ffio_fdopen(AVIOContext **s, URLContext *h)
     if (!buffer)
         return AVERROR(ENOMEM);
 
-    *s = av_mallocz(sizeof(AVIOContext));
-    if(!*s) {
+    *s = avio_alloc_context(buffer, buffer_size, h->flags & AVIO_FLAG_WRITE, h,
+                            ffurl_read, ffurl_write, ffurl_seek);
+    if (!*s) {
         av_free(buffer);
         return AVERROR(ENOMEM);
     }
-
-    if (ffio_init_context(*s, buffer, buffer_size,
-                      h->flags & AVIO_FLAG_WRITE, h,
-                      ffurl_read, ffurl_write, ffurl_seek) < 0) {
-        av_free(buffer);
-        av_freep(s);
-        return AVERROR(EIO);
-    }
 #if FF_API_OLD_AVIO
     (*s)->is_streamed = h->is_streamed;
 #endif



More information about the ffmpeg-cvslog mailing list