From 5acef35f57fb1ec896de0ed572eafa1bf064506a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Axelsson?= Date: Mon, 10 Mar 2008 19:03:39 +0000 Subject: [PATCH] Add AVClass to URLContext at next major version bump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Björn Axelsson (bjorn axelsson intinor se) Originally committed as revision 12411 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/avio.c | 19 +++++++++++++++++++ libavformat/avio.h | 3 +++ 2 files changed, 22 insertions(+) diff --git a/libavformat/avio.c b/libavformat/avio.c index 5f5bff158c..b6478c4f3b 100644 --- a/libavformat/avio.c +++ b/libavformat/avio.c @@ -20,6 +20,22 @@ */ #include "avformat.h" #include "avstring.h" +#include "opt.h" + +#if LIBAVFORMAT_VERSION_MAJOR >= 53 +/** @name Logging context. */ +/*@{*/ +static const char *urlcontext_to_name(void *ptr) +{ + URLContext *h = (URLContext *)ptr; + if(h->prot) return h->prot->name; + else return "NULL"; +} +static const AVOption options[] = {{NULL}}; +static const AVClass urlcontext_class = + { "URLContext", urlcontext_to_name, options }; +/*@}*/ +#endif static int default_interrupt_cb(void); @@ -82,6 +98,9 @@ int url_open(URLContext **puc, const char *filename, int flags) err = AVERROR(ENOMEM); goto fail; } +#if LIBAVFORMAT_VERSION_MAJOR >= 53 + uc->av_class = &urlcontext_class; +#endif uc->filename = (char *) &uc[1]; strcpy(uc->filename, filename); uc->prot = up; diff --git a/libavformat/avio.h b/libavformat/avio.h index 9443cb017b..e8a8bc6062 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -37,6 +37,9 @@ typedef int64_t offset_t; * sizeof(URLContext) must not be used outside libav*. */ struct URLContext { +#if LIBAVFORMAT_VERSION_MAJOR >= 53 + const AVClass *av_class; ///< information for av_log(). Set by url_open(). +#endif struct URLProtocol *prot; int flags; int is_streamed; /**< true if streamed (no seek possible), default = false */