diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2012-10-10 01:39:06 +0200 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2012-10-10 18:56:55 +0200 |
commit | b522000e9b2ca36fe5b2751096b9a5f5ed8f87e6 (patch) | |
tree | ae7c5381b40d294367055e4f4de87c90289709c8 | |
parent | 82569b01a1cb0fee29c839a264af974f9c215d74 (diff) | |
download | ffmpeg-b522000e9b2ca36fe5b2751096b9a5f5ed8f87e6.tar.gz |
avio: introduce avio_closep
-rw-r--r-- | doc/APIchanges | 3 | ||||
-rw-r--r-- | libavformat/avio.h | 15 | ||||
-rw-r--r-- | libavformat/aviobuf.c | 7 | ||||
-rw-r--r-- | libavformat/version.h | 4 |
4 files changed, 27 insertions, 2 deletions
diff --git a/doc/APIchanges b/doc/APIchanges index 76475dacaf..3e93354880 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2011-04-18 API changes, most recent first: +2012-10-xx - xxxxxxx - lavf 54.18.0 - avio.h + Add avio_closep to complement avio_close. + 2012-10-xx - xxxxxxx - lavu 51.42.0 - pixfmt.h Rename PixelFormat to AVPixelFormat and all PIX_FMT_* to AV_PIX_FMT_*. To provide backwards compatibility, PixelFormat is now #defined as diff --git a/libavformat/avio.h b/libavformat/avio.h index 96e8e1ce77..b6d3cb33b2 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -353,10 +353,25 @@ int avio_open2(AVIOContext **s, const char *url, int flags, * resource. * * @return 0 on success, an AVERROR < 0 on error. + * @see avio_closep */ int avio_close(AVIOContext *s); /** + * Close the resource accessed by the AVIOContext *s, free it + * and set the pointer pointing to it to NULL. + * This function can only be used if s was opened by avio_open(). + * + * The internal buffer is automatically flushed before closing the + * resource. + * + * @return 0 on success, an AVERROR < 0 on error. + * @see avio_close + */ +int avio_closep(AVIOContext **s); + + +/** * Open a write only memory stream. * * @param s new IO context diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 7dc66e25a6..da836c6fd5 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -768,6 +768,13 @@ int avio_close(AVIOContext *s) return ffurl_close(h); } +int avio_closep(AVIOContext **s) +{ + int ret = avio_close(*s); + *s = NULL; + return ret; +} + int avio_printf(AVIOContext *s, const char *fmt, ...) { va_list ap; diff --git a/libavformat/version.h b/libavformat/version.h index 4a4cfe3283..79dc7d1439 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -30,8 +30,8 @@ #include "libavutil/avutil.h" #define LIBAVFORMAT_VERSION_MAJOR 54 -#define LIBAVFORMAT_VERSION_MINOR 17 -#define LIBAVFORMAT_VERSION_MICRO 3 +#define LIBAVFORMAT_VERSION_MINOR 18 +#define LIBAVFORMAT_VERSION_MICRO 0 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ |