diff avio.c @ 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 7a9a045dcdc3
children ce8070648576
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;