Fixes to work with libxml2.

Original commit message from CVS:
Fixes to work with libxml2.
Also improved a couple of debugging messagse.
This commit is contained in:
Richard Boulton 2001-01-18 11:16:53 +00:00
parent fb871eec23
commit 41ebd85275
16 changed files with 77 additions and 26 deletions

View 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);

View 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) {

View file

@ -26,6 +26,13 @@
#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;

View 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")) {

View file

@ -26,6 +26,13 @@
#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>

View 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;

View 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) {

View file

@ -26,6 +26,13 @@
#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>

View 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;

View file

@ -27,6 +27,13 @@
#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>

View 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;

View file

@ -27,6 +27,13 @@
#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;

View 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) {

View 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")) {

View file

@ -25,6 +25,15 @@
//#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>

View 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);