Mercurial > libavformat.hg
changeset 3136:e38d5357f0d0 libavformat
Add AVClass to URLContext at next major version bump
Patch by Bj«Órn Axelsson (bjorn axelsson intinor se)
author | superdump |
---|---|
date | Mon, 10 Mar 2008 19:03:39 +0000 |
parents | cf8df6a00eb5 |
children | 20db4653d696 |
files | avio.c avio.h |
diffstat | 2 files changed, 22 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/avio.c Mon Mar 10 18:42:09 2008 +0000 +++ b/avio.c Mon Mar 10 19:03:39 2008 +0000 @@ -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 @@ 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;
--- a/avio.h Mon Mar 10 18:42:09 2008 +0000 +++ b/avio.h Mon Mar 10 19:03:39 2008 +0000 @@ -37,6 +37,9 @@ * 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 */