mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-14 11:25:39 +00:00
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:
parent
fb871eec23
commit
41ebd85275
16 changed files with 77 additions and 26 deletions
|
@ -21,6 +21,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//#define GST_DEBUG_ENABLED
|
//#define GST_DEBUG_ENABLED
|
||||||
|
#include "config.h"
|
||||||
#include "gst_private.h"
|
#include "gst_private.h"
|
||||||
|
|
||||||
#include "gstbin.h"
|
#include "gstbin.h"
|
||||||
|
@ -467,7 +468,7 @@ gst_bin_restore_thyself (GstElement *element,
|
||||||
GHashTable *elements)
|
GHashTable *elements)
|
||||||
{
|
{
|
||||||
GstBin *bin = GST_BIN (element);
|
GstBin *bin = GST_BIN (element);
|
||||||
xmlNodePtr field = parent->childs;
|
xmlNodePtr field = parent->xmlChildrenNode;
|
||||||
xmlNodePtr childlist;
|
xmlNodePtr childlist;
|
||||||
|
|
||||||
// g_print("gstbin: restore \"%s\"\n", gst_element_get_name (element));
|
// g_print("gstbin: restore \"%s\"\n", gst_element_get_name (element));
|
||||||
|
@ -475,7 +476,7 @@ gst_bin_restore_thyself (GstElement *element,
|
||||||
while (field) {
|
while (field) {
|
||||||
if (!strcmp (field->name, "children")) {
|
if (!strcmp (field->name, "children")) {
|
||||||
GST_INFO_ELEMENT (GST_CAT_XML, element, "loading children");
|
GST_INFO_ELEMENT (GST_CAT_XML, element, "loading children");
|
||||||
childlist = field->childs;
|
childlist = field->xmlChildrenNode;
|
||||||
while (childlist) {
|
while (childlist) {
|
||||||
if (!strcmp (childlist->name, "element")) {
|
if (!strcmp (childlist->name, "element")) {
|
||||||
GstElement *element = gst_element_load_thyself (childlist, elements);
|
GstElement *element = gst_element_load_thyself (childlist, elements);
|
||||||
|
|
|
@ -312,7 +312,8 @@ gst_caps_check_compatibility (GstCaps *fromcaps, GstCaps *tocaps)
|
||||||
g_return_val_if_fail (tocaps != NULL, FALSE);
|
g_return_val_if_fail (tocaps != NULL, FALSE);
|
||||||
|
|
||||||
if (fromcaps->id != tocaps->id) {
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,7 +401,7 @@ GstCaps*
|
||||||
gst_caps_load_thyself (xmlNodePtr parent)
|
gst_caps_load_thyself (xmlNodePtr parent)
|
||||||
{
|
{
|
||||||
GstCaps *caps = g_new0 (GstCaps, 1);
|
GstCaps *caps = g_new0 (GstCaps, 1);
|
||||||
xmlNodePtr field = parent->childs;
|
xmlNodePtr field = parent->xmlChildrenNode;
|
||||||
gchar *content;
|
gchar *content;
|
||||||
|
|
||||||
while (field) {
|
while (field) {
|
||||||
|
|
|
@ -26,6 +26,13 @@
|
||||||
|
|
||||||
#include <parser.h> // NOTE: this is xml-config's fault
|
#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>
|
#include <gst/gstprops.h>
|
||||||
|
|
||||||
typedef struct _GstCaps GstCaps;
|
typedef struct _GstCaps GstCaps;
|
||||||
|
|
|
@ -716,7 +716,7 @@ GstElement*
|
||||||
gst_element_load_thyself (xmlNodePtr parent,
|
gst_element_load_thyself (xmlNodePtr parent,
|
||||||
GHashTable *elements)
|
GHashTable *elements)
|
||||||
{
|
{
|
||||||
xmlNodePtr children = parent->childs;
|
xmlNodePtr children = parent->xmlChildrenNode;
|
||||||
GstElement *element;
|
GstElement *element;
|
||||||
GstElementClass *oclass;
|
GstElementClass *oclass;
|
||||||
guchar *name = NULL;
|
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);
|
g_hash_table_insert (elements, g_strdup (gst_element_get_name (element)), element);
|
||||||
|
|
||||||
// we have the element now, set the arguments
|
// we have the element now, set the arguments
|
||||||
children = parent->childs;
|
children = parent->xmlChildrenNode;
|
||||||
|
|
||||||
while (children) {
|
while (children) {
|
||||||
if (!strcmp (children->name, "arg")) {
|
if (!strcmp (children->name, "arg")) {
|
||||||
xmlNodePtr child = children->childs;
|
xmlNodePtr child = children->xmlChildrenNode;
|
||||||
|
|
||||||
while (child) {
|
while (child) {
|
||||||
if (!strcmp (child->name, "name")) {
|
if (!strcmp (child->name, "name")) {
|
||||||
|
@ -835,7 +835,7 @@ gst_element_load_thyself (xmlNodePtr parent,
|
||||||
children = children->next;
|
children = children->next;
|
||||||
}
|
}
|
||||||
// we have the element now, set the pads
|
// we have the element now, set the pads
|
||||||
children = parent->childs;
|
children = parent->xmlChildrenNode;
|
||||||
|
|
||||||
while (children) {
|
while (children) {
|
||||||
if (!strcmp (children->name, "pad")) {
|
if (!strcmp (children->name, "pad")) {
|
||||||
|
|
|
@ -26,6 +26,13 @@
|
||||||
|
|
||||||
#include <parser.h> // NOTE: this is xml-config's fault
|
#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/gstobject.h>
|
||||||
#include <gst/gstpad.h>
|
#include <gst/gstpad.h>
|
||||||
#include <gst/cothreads.h>
|
#include <gst/cothreads.h>
|
||||||
|
|
|
@ -387,7 +387,7 @@ GstElementFactory *
|
||||||
gst_elementfactory_load_thyself (xmlNodePtr parent)
|
gst_elementfactory_load_thyself (xmlNodePtr parent)
|
||||||
{
|
{
|
||||||
GstElementFactory *factory = g_new0(GstElementFactory, 1);
|
GstElementFactory *factory = g_new0(GstElementFactory, 1);
|
||||||
xmlNodePtr children = parent->childs;
|
xmlNodePtr children = parent->xmlChildrenNode;
|
||||||
factory->details = g_new0(GstElementDetails, 1);
|
factory->details = g_new0(GstElementDetails, 1);
|
||||||
factory->padtemplates = NULL;
|
factory->padtemplates = NULL;
|
||||||
|
|
||||||
|
|
|
@ -754,7 +754,7 @@ gst_pad_load_and_connect (xmlNodePtr parent,
|
||||||
GstObject *element,
|
GstObject *element,
|
||||||
GHashTable *elements)
|
GHashTable *elements)
|
||||||
{
|
{
|
||||||
xmlNodePtr field = parent->childs;
|
xmlNodePtr field = parent->xmlChildrenNode;
|
||||||
GstPad *pad = NULL, *targetpad;
|
GstPad *pad = NULL, *targetpad;
|
||||||
guchar *peer = NULL;
|
guchar *peer = NULL;
|
||||||
gchar **split;
|
gchar **split;
|
||||||
|
@ -1006,7 +1006,7 @@ gst_padtemplate_save_thyself (GstPadTemplate *pad, xmlNodePtr parent)
|
||||||
GstPadTemplate*
|
GstPadTemplate*
|
||||||
gst_padtemplate_load_thyself (xmlNodePtr parent)
|
gst_padtemplate_load_thyself (xmlNodePtr parent)
|
||||||
{
|
{
|
||||||
xmlNodePtr field = parent->childs;
|
xmlNodePtr field = parent->xmlChildrenNode;
|
||||||
GstPadTemplate *factory = g_new0 (GstPadTemplate, 1);
|
GstPadTemplate *factory = g_new0 (GstPadTemplate, 1);
|
||||||
|
|
||||||
while (field) {
|
while (field) {
|
||||||
|
|
|
@ -26,6 +26,13 @@
|
||||||
|
|
||||||
#include <parser.h> // NOTE: This is xml-config's fault
|
#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/gstobject.h>
|
||||||
#include <gst/gstbuffer.h>
|
#include <gst/gstbuffer.h>
|
||||||
#include <gst/cothreads.h>
|
#include <gst/cothreads.h>
|
||||||
|
|
|
@ -87,14 +87,14 @@ _gst_plugin_initialize (void)
|
||||||
|
|
||||||
doc = xmlParseFile (GST_CONFIG_DIR"/reg.xml");
|
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"))) {
|
!plugin_times_older_than(get_time(GST_CONFIG_DIR"/reg.xml"))) {
|
||||||
if (_gst_warn_old_registry)
|
if (_gst_warn_old_registry)
|
||||||
g_warning ("gstplugin: registry needs rebuild\n");
|
g_warning ("gstplugin: registry needs rebuild\n");
|
||||||
gst_plugin_load_all ();
|
gst_plugin_load_all ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gst_plugin_load_thyself (doc->root);
|
gst_plugin_load_thyself (doc->xmlRootNode);
|
||||||
|
|
||||||
xmlFreeDoc (doc);
|
xmlFreeDoc (doc);
|
||||||
}
|
}
|
||||||
|
@ -767,10 +767,10 @@ gst_plugin_load_thyself (xmlNodePtr parent)
|
||||||
gint typecount = 0;
|
gint typecount = 0;
|
||||||
gchar *pluginname;
|
gchar *pluginname;
|
||||||
|
|
||||||
kinderen = parent->childs; // Dutch invasion :-)
|
kinderen = parent->xmlChildrenNode; // Dutch invasion :-)
|
||||||
while (kinderen) {
|
while (kinderen) {
|
||||||
if (!strcmp(kinderen->name, "plugin")) {
|
if (!strcmp(kinderen->name, "plugin")) {
|
||||||
xmlNodePtr field = kinderen->childs;
|
xmlNodePtr field = kinderen->xmlChildrenNode;
|
||||||
GstPlugin *plugin = g_new0 (GstPlugin, 1);
|
GstPlugin *plugin = g_new0 (GstPlugin, 1);
|
||||||
plugin->elements = NULL;
|
plugin->elements = NULL;
|
||||||
plugin->types = NULL;
|
plugin->types = NULL;
|
||||||
|
|
|
@ -27,6 +27,13 @@
|
||||||
#include <gmodule.h>
|
#include <gmodule.h>
|
||||||
#include <parser.h> // NOTE: this is xml-config's fault
|
#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/gsttype.h>
|
||||||
#include <gst/gstelement.h>
|
#include <gst/gstelement.h>
|
||||||
|
|
||||||
|
|
|
@ -446,12 +446,17 @@ gst_props_check_compatibility (GstProps *fromprops, GstProps *toprops)
|
||||||
else goto end;
|
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);
|
sourcelist = g_list_next (sourcelist);
|
||||||
sinklist = g_list_next (sinklist);
|
sinklist = g_list_next (sinklist);
|
||||||
}
|
}
|
||||||
if (sinklist) {
|
if (sinklist && compatible) {
|
||||||
GstPropsEntry *entry2;
|
GstPropsEntry *entry2;
|
||||||
entry2 = (GstPropsEntry *)sinklist->data;
|
entry2 = (GstPropsEntry *)sinklist->data;
|
||||||
missing++;
|
missing++;
|
||||||
|
@ -612,13 +617,13 @@ GstProps*
|
||||||
gst_props_load_thyself (xmlNodePtr parent)
|
gst_props_load_thyself (xmlNodePtr parent)
|
||||||
{
|
{
|
||||||
GstProps *props = g_new0 (GstProps, 1);
|
GstProps *props = g_new0 (GstProps, 1);
|
||||||
xmlNodePtr field = parent->childs;
|
xmlNodePtr field = parent->xmlChildrenNode;
|
||||||
gchar *prop;
|
gchar *prop;
|
||||||
|
|
||||||
while (field) {
|
while (field) {
|
||||||
if (!strcmp (field->name, "list")) {
|
if (!strcmp (field->name, "list")) {
|
||||||
GstPropsEntry *entry;
|
GstPropsEntry *entry;
|
||||||
xmlNodePtr subfield = field->childs;
|
xmlNodePtr subfield = field->xmlChildrenNode;
|
||||||
|
|
||||||
entry = g_new0 (GstPropsEntry, 1);
|
entry = g_new0 (GstPropsEntry, 1);
|
||||||
entry->propstype = GST_PROPS_LIST_ID_NUM;
|
entry->propstype = GST_PROPS_LIST_ID_NUM;
|
||||||
|
|
|
@ -27,6 +27,13 @@
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <parser.h> // NOTE: this is xml-config's fault
|
#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 struct _GstProps GstProps;
|
||||||
typedef gpointer GstPropsFactoryEntry;
|
typedef gpointer GstPropsFactoryEntry;
|
||||||
|
|
|
@ -267,7 +267,7 @@ gst_typefactory_load_thyself (xmlNodePtr parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
GstTypeFactory *factory = g_new0 (GstTypeFactory, 1);
|
GstTypeFactory *factory = g_new0 (GstTypeFactory, 1);
|
||||||
xmlNodePtr field = parent->childs;
|
xmlNodePtr field = parent->xmlChildrenNode;
|
||||||
factory->typefindfunc = NULL;
|
factory->typefindfunc = NULL;
|
||||||
|
|
||||||
while (field) {
|
while (field) {
|
||||||
|
|
|
@ -77,9 +77,9 @@ gst_xml_write (GstElement *element)
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
|
|
||||||
doc = xmlNewDoc ("1.0");
|
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;
|
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);
|
g_print("gstxml: XML file \"%s\" could not be read\n", fname);
|
||||||
return NULL;
|
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);
|
g_print("gstxml: XML file \"%s\" is in wrong format\n", fname);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ gst_xml_new (const guchar *fname, const guchar *root)
|
||||||
|
|
||||||
xml->topelements = NULL;
|
xml->topelements = NULL;
|
||||||
|
|
||||||
field = doc->root->childs;
|
field = doc->xmlRootNode->xmlChildrenNode;
|
||||||
|
|
||||||
while (field) {
|
while (field) {
|
||||||
if (!strcmp(field->name, "element")) {
|
if (!strcmp(field->name, "element")) {
|
||||||
|
|
|
@ -25,6 +25,15 @@
|
||||||
|
|
||||||
//#include <gnome-xml/parser.h>
|
//#include <gnome-xml/parser.h>
|
||||||
#include <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>
|
#include <gst/gstelement.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -207,8 +207,8 @@ int main(int argc,char *argv[])
|
||||||
|
|
||||||
// Read the plugins
|
// Read the plugins
|
||||||
doc = xmlNewDoc("1.0");
|
doc = xmlNewDoc("1.0");
|
||||||
doc->root = xmlNewDocNode(doc, NULL, "GST-PluginRegistry", NULL);
|
doc->xmlRootNode = xmlNewDocNode(doc, NULL, "GST-PluginRegistry", NULL);
|
||||||
gst_plugin_save_thyself(doc->root);
|
gst_plugin_save_thyself(doc->xmlRootNode);
|
||||||
|
|
||||||
// Save the registry to a tmp file.
|
// Save the registry to a tmp file.
|
||||||
save_registry(GLOBAL_REGISTRY_FILE_TMP, &doc);
|
save_registry(GLOBAL_REGISTRY_FILE_TMP, &doc);
|
||||||
|
|
Loading…
Reference in a new issue