Fixes to work with libxml2.
authorRichard Boulton <richard@tartarus.org>
Thu, 18 Jan 2001 11:16:53 +0000 (11:16 +0000)
committerRichard Boulton <richard@tartarus.org>
Thu, 18 Jan 2001 11:16:53 +0000 (11:16 +0000)
Original commit message from CVS:
Fixes to work with libxml2.
Also improved a couple of debugging messagse.

16 files changed:
gst/gstbin.c
gst/gstcaps.c
gst/gstcaps.h
gst/gstelement.c
gst/gstelement.h
gst/gstelementfactory.c
gst/gstpad.c
gst/gstpad.h
gst/gstplugin.c
gst/gstplugin.h
gst/gstprops.c
gst/gstprops.h
gst/gsttype.c
gst/gstxml.c
gst/gstxml.h
tools/gstreamer-register.c

index be3a6fe..aa63cae 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 //#define GST_DEBUG_ENABLED
+#include "config.h"
 #include "gst_private.h"
 
 #include "gstbin.h"
@@ -467,7 +468,7 @@ gst_bin_restore_thyself (GstElement *element,
                         GHashTable *elements) 
 {
   GstBin *bin = GST_BIN (element);
-  xmlNodePtr field = parent->childs;
+  xmlNodePtr field = parent->xmlChildrenNode;
   xmlNodePtr childlist;
 
 //  g_print("gstbin: restore \"%s\"\n", gst_element_get_name (element));
@@ -475,7 +476,7 @@ gst_bin_restore_thyself (GstElement *element,
   while (field) {
     if (!strcmp (field->name, "children")) {
       GST_INFO_ELEMENT (GST_CAT_XML, element, "loading children");
-      childlist = field->childs;
+      childlist = field->xmlChildrenNode;
       while (childlist) {
         if (!strcmp (childlist->name, "element")) {
           GstElement *element = gst_element_load_thyself (childlist, elements);
index 736e5de..f8bfcb3 100644 (file)
@@ -312,7 +312,8 @@ gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps)
   g_return_val_if_fail (tocaps != NULL, FALSE);
        
   if (fromcaps->id != tocaps->id) {
-    GST_DEBUG (0,"gstcaps: mime types wrong\n");
+    GST_DEBUG (0,"gstcaps: mime types differ (%d to %d)\n",
+              fromcaps->id, tocaps->id);
     return FALSE;
   }
 
@@ -400,7 +401,7 @@ GstCaps*
 gst_caps_load_thyself (xmlNodePtr parent)
 {
   GstCaps *caps = g_new0 (GstCaps, 1);
-  xmlNodePtr field = parent->childs;
+  xmlNodePtr field = parent->xmlChildrenNode;
   gchar *content;
 
   while (field) {
index 96962b4..0150b0f 100644 (file)
 
 #include <parser.h> // NOTE: this is xml-config's fault
 
+// Include compatability defines: if libxml hasn't already defined these,
+// we have an old version 1.x
+#ifndef xmlChildrenNode
+#define xmlChildrenNode childs
+#define xmlRootNode root
+#endif
+
 #include <gst/gstprops.h>
 
 typedef struct _GstCaps GstCaps;
index 795e4b1..31c4cb2 100644 (file)
@@ -716,7 +716,7 @@ GstElement*
 gst_element_load_thyself (xmlNodePtr parent, 
                          GHashTable *elements) 
 {
-  xmlNodePtr children = parent->childs;
+  xmlNodePtr children = parent->xmlChildrenNode;
   GstElement *element;
   GstElementClass *oclass;
   guchar *name = NULL;
@@ -744,11 +744,11 @@ gst_element_load_thyself (xmlNodePtr parent,
   g_hash_table_insert (elements, g_strdup (gst_element_get_name (element)), element);
 
   // we have the element now, set the arguments 
-  children = parent->childs;
+  children = parent->xmlChildrenNode;
 
   while (children) {
     if (!strcmp (children->name, "arg")) {
-      xmlNodePtr child = children->childs;
+      xmlNodePtr child = children->xmlChildrenNode;
 
       while (child) {
         if (!strcmp (child->name, "name")) {
@@ -835,7 +835,7 @@ gst_element_load_thyself (xmlNodePtr parent,
     children = children->next;
   }
   // we have the element now, set the pads
-  children = parent->childs;
+  children = parent->xmlChildrenNode;
 
   while (children) {
     if (!strcmp (children->name, "pad")) {
index ccf8cf4..28e739e 100644 (file)
 
 #include <parser.h> // NOTE: this is xml-config's fault
 
+// Include compatability defines: if libxml hasn't already defined these,
+// we have an old version 1.x
+#ifndef xmlChildrenNode
+#define xmlChildrenNode childs
+#define xmlRootNode root
+#endif
+
 #include <gst/gstobject.h>
 #include <gst/gstpad.h>
 #include <gst/cothreads.h>
index a028df2..2d52896 100644 (file)
@@ -387,7 +387,7 @@ GstElementFactory *
 gst_elementfactory_load_thyself (xmlNodePtr parent) 
 {
   GstElementFactory *factory = g_new0(GstElementFactory, 1);
-  xmlNodePtr children = parent->childs;
+  xmlNodePtr children = parent->xmlChildrenNode;
   factory->details = g_new0(GstElementDetails, 1);
   factory->padtemplates = NULL;
 
index c6c8484..b2ce44f 100644 (file)
@@ -754,7 +754,7 @@ gst_pad_load_and_connect (xmlNodePtr parent,
                          GstObject *element, 
                          GHashTable *elements) 
 {
-  xmlNodePtr field = parent->childs;
+  xmlNodePtr field = parent->xmlChildrenNode;
   GstPad *pad = NULL, *targetpad;
   guchar *peer = NULL;
   gchar **split;
@@ -1006,7 +1006,7 @@ gst_padtemplate_save_thyself (GstPadTemplate *pad, xmlNodePtr parent)
 GstPadTemplate*   
 gst_padtemplate_load_thyself (xmlNodePtr parent)
 {
-  xmlNodePtr field = parent->childs;
+  xmlNodePtr field = parent->xmlChildrenNode;
   GstPadTemplate *factory = g_new0 (GstPadTemplate, 1);
 
   while (field) {
index bce89ab..d3e0008 100644 (file)
 
 #include <parser.h> // NOTE: This is xml-config's fault
 
+// Include compatability defines: if libxml hasn't already defined these,
+// we have an old version 1.x
+#ifndef xmlChildrenNode
+#define xmlChildrenNode childs
+#define xmlRootNode root
+#endif
+
 #include <gst/gstobject.h>
 #include <gst/gstbuffer.h>
 #include <gst/cothreads.h>
index cc7e6b9..41c45ad 100644 (file)
@@ -87,14 +87,14 @@ _gst_plugin_initialize (void)
 
   doc = xmlParseFile (GST_CONFIG_DIR"/reg.xml");
 
-  if (!doc || strcmp (doc->root->name, "GST-PluginRegistry") ||
+  if (!doc || strcmp (doc->xmlRootNode->name, "GST-PluginRegistry") ||
       !plugin_times_older_than(get_time(GST_CONFIG_DIR"/reg.xml"))) {
     if (_gst_warn_old_registry)
        g_warning ("gstplugin: registry needs rebuild\n");
     gst_plugin_load_all ();
     return;
   }
-  gst_plugin_load_thyself (doc->root);
+  gst_plugin_load_thyself (doc->xmlRootNode);
 
   xmlFreeDoc (doc);
 }
@@ -767,10 +767,10 @@ gst_plugin_load_thyself (xmlNodePtr parent)
   gint typecount = 0;
   gchar *pluginname;
   
-  kinderen = parent->childs; // Dutch invasion :-)
+  kinderen = parent->xmlChildrenNode; // Dutch invasion :-)
   while (kinderen) {
     if (!strcmp(kinderen->name, "plugin")) {
-      xmlNodePtr field = kinderen->childs;
+      xmlNodePtr field = kinderen->xmlChildrenNode;
       GstPlugin *plugin = g_new0 (GstPlugin, 1);
       plugin->elements = NULL;
       plugin->types = NULL;
index 02a9868..6a53dcd 100644 (file)
 #include <gmodule.h>
 #include <parser.h> // NOTE: this is xml-config's fault
 
+// Include compatability defines: if libxml hasn't already defined these,
+// we have an old version 1.x
+#ifndef xmlChildrenNode
+#define xmlChildrenNode childs
+#define xmlRootNode root
+#endif
+
 #include <gst/gsttype.h>
 #include <gst/gstelement.h>
 
index 87d37aa..11a5a52 100644 (file)
@@ -446,12 +446,17 @@ gst_props_check_compatibility (GstProps *fromprops, GstProps *toprops)
       else goto end;
     }
 
-    compatible &= gst_props_entry_check_compatibility (entry1, entry2);
+    if (!gst_props_entry_check_compatibility (entry1, entry2)) {
+       compatible = FALSE;
+       GST_DEBUG (0, "%s and %s are not compatible\n",
+                  g_quark_to_string (entry1->propid),
+                  g_quark_to_string (entry2->propid));
+    }
 
     sourcelist = g_list_next (sourcelist);
     sinklist = g_list_next (sinklist);
   }
-  if (sinklist) {
+  if (sinklist && compatible) {
     GstPropsEntry *entry2;
     entry2 = (GstPropsEntry *)sinklist->data;
     missing++;
@@ -612,13 +617,13 @@ GstProps*
 gst_props_load_thyself (xmlNodePtr parent)
 {
   GstProps *props = g_new0 (GstProps, 1);
-  xmlNodePtr field = parent->childs;
+  xmlNodePtr field = parent->xmlChildrenNode;
   gchar *prop;
 
   while (field) {
     if (!strcmp (field->name, "list")) {
       GstPropsEntry *entry;
-      xmlNodePtr subfield = field->childs;
+      xmlNodePtr subfield = field->xmlChildrenNode;
 
       entry = g_new0 (GstPropsEntry, 1);
       entry->propstype = GST_PROPS_LIST_ID_NUM;
index 5f30761..fe12355 100644 (file)
 #include <glib.h>
 #include <parser.h> // NOTE: this is xml-config's fault
 
+// Include compatability defines: if libxml hasn't already defined these,
+// we have an old version 1.x
+#ifndef xmlChildrenNode
+#define xmlChildrenNode childs
+#define xmlRootNode root
+#endif
+
 
 typedef struct _GstProps GstProps;
 typedef gpointer GstPropsFactoryEntry;
index af21fae..84090e7 100644 (file)
@@ -267,7 +267,7 @@ gst_typefactory_load_thyself (xmlNodePtr parent)
 {
 
   GstTypeFactory *factory = g_new0 (GstTypeFactory, 1);
-  xmlNodePtr field = parent->childs;
+  xmlNodePtr field = parent->xmlChildrenNode;
   factory->typefindfunc = NULL;
 
   while (field) {
index 61c2a22..6fba08b 100644 (file)
@@ -77,9 +77,9 @@ gst_xml_write (GstElement *element)
   xmlDocPtr doc;
 
   doc = xmlNewDoc ("1.0");
-  doc->root = xmlNewDocNode (doc, NULL, "GST-Pipeline", NULL);
+  doc->xmlRootNode = xmlNewDocNode (doc, NULL, "GST-Pipeline", NULL);
 
-  gst_element_save_thyself (element, doc->root);
+  gst_element_save_thyself (element, doc->xmlRootNode);
 
   return doc;
 }
@@ -114,7 +114,7 @@ gst_xml_new (const guchar *fname, const guchar *root)
     g_print("gstxml: XML file \"%s\" could not be read\n", fname);
     return NULL;
   }
-  if (strcmp(doc->root->name, "GST-Pipeline")) {
+  if (strcmp(doc->xmlRootNode->name, "GST-Pipeline")) {
     g_print("gstxml: XML file \"%s\" is in wrong format\n", fname);
     return NULL;
   }
@@ -123,7 +123,7 @@ gst_xml_new (const guchar *fname, const guchar *root)
 
   xml->topelements = NULL;
 
-  field = doc->root->childs;
+  field = doc->xmlRootNode->xmlChildrenNode;
   
   while (field) {
     if (!strcmp(field->name, "element")) {
index 060134a..491f4e6 100644 (file)
 
 //#include <gnome-xml/parser.h>
 #include <parser.h>
+
+// Include compatability defines: if libxml hasn't already defined these,
+// we have an old version 1.x
+#ifndef xmlChildrenNode
+#define xmlChildrenNode childs
+#define xmlRootNode root
+#endif
+
+
 #include <gst/gstelement.h>
 
 
index a434cf9..0214e99 100644 (file)
@@ -207,8 +207,8 @@ int main(int argc,char *argv[])
     
     // Read the plugins
     doc = xmlNewDoc("1.0");
-    doc->root = xmlNewDocNode(doc, NULL, "GST-PluginRegistry", NULL);
-    gst_plugin_save_thyself(doc->root);
+    doc->xmlRootNode = xmlNewDocNode(doc, NULL, "GST-PluginRegistry", NULL);
+    gst_plugin_save_thyself(doc->xmlRootNode);
 
     // Save the registry to a tmp file.
     save_registry(GLOBAL_REGISTRY_FILE_TMP, &doc);