]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Add AVClass to URLContext at next major version bump
authorsuperdump <superdump@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Mon, 10 Mar 2008 19:03:39 +0000 (19:03 +0000)
committersuperdump <superdump@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Mon, 10 Mar 2008 19:03:39 +0000 (19:03 +0000)
Patch by Björn Axelsson (bjorn axelsson intinor se)

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@12411 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

libavformat/avio.c
libavformat/avio.h

index 5f5bff158cdeb19ff5f7c00bd0e483512d96c745..b6478c4f3b717f0514d23b23d4f53dee3437f451 100644 (file)
  */
 #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;
index 9443cb017bc767dcf31924487ae862dc83f63f80..e8a8bc6062b80b70f9c06c4a25f0bde7af5ab7be 100644 (file)
@@ -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 */