gstreamer/tests/old/examples/xml/runxml.c
Andy Wingo d262bea863 summary: fix xml in gstreamer 1) make clear distinction between loading xml that actually creates objects and loading...
Original commit message from CVS:
summary: fix xml in gstreamer

1) make clear distinction between loading xml that actually creates objects and loading xml that just
synchronizes properties with objects. moved most of gst_element_restore_thyself functionality to
gst_xml_make_element. this new function name can change if it sucks.
2) many various fixes. createxml and runxml work now.
3) doc updates.
4) GstSignalObject is stil broken. i have no idea what it's supposed to do.
2002-01-11 15:49:47 +00:00

56 lines
1.2 KiB
C

#include <string.h>
#include <stdlib.h>
#include <gst/gst.h>
gboolean playing;
static void
xml_loaded (GstXML *xml, GstObject *object, xmlNodePtr self, gpointer data)
{
xmlNodePtr children = self->xmlChildrenNode;
while (children) {
if (!strcmp (children->name, "comment")) {
xmlNodePtr nodes = children->xmlChildrenNode;
while (nodes) {
if (!strcmp (nodes->name, "text")) {
gchar *name = g_strdup (xmlNodeGetContent (nodes));
g_print ("object %s loaded with comment '%s'\n",
gst_object_get_name (object), name);
}
nodes = nodes->next;
}
}
children = children->next;
}
}
int main(int argc,char *argv[])
{
GstXML *xml;
GstElement *pipeline;
gboolean ret;
gst_init(&argc,&argv);
xml = gst_xml_new ();
// g_signal_connect (G_OBJECT (xml), "object_loaded",
// G_CALLBACK (xml_loaded), xml);
ret = gst_xml_parse_file(xml, "xmlTest.gst", NULL);
g_assert (ret == TRUE);
pipeline = gst_xml_get_element(xml, "pipeline");
g_assert (pipeline != NULL);
gst_element_set_state(pipeline, GST_STATE_PLAYING);
while (gst_bin_iterate(GST_BIN(pipeline)));
gst_element_set_state(pipeline, GST_STATE_NULL);
exit(0);
}