2001-12-13 19:00:58 +00:00
|
|
|
#include <string.h>
|
2001-01-01 00:42:10 +00:00
|
|
|
#include <stdlib.h>
|
2000-09-24 22:45:48 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
gboolean playing;
|
|
|
|
|
2001-01-29 00:06:02 +00:00
|
|
|
static void
|
2001-01-30 23:53:04 +00:00
|
|
|
xml_loaded (GstXML *xml, GstObject *object, xmlNodePtr self, gpointer data)
|
2000-09-24 22:45:48 +00:00
|
|
|
{
|
2001-01-30 23:53:04 +00:00
|
|
|
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;
|
2001-01-29 00:06:02 +00:00
|
|
|
}
|
2000-09-24 22:45:48 +00:00
|
|
|
}
|
|
|
|
|
2001-01-29 00:06:02 +00:00
|
|
|
int main(int argc,char *argv[])
|
2000-09-24 22:45:48 +00:00
|
|
|
{
|
|
|
|
GstXML *xml;
|
2002-01-11 15:49:47 +00:00
|
|
|
GstElement *pipeline;
|
2001-01-29 00:06:02 +00:00
|
|
|
gboolean ret;
|
2000-09-24 22:45:48 +00:00
|
|
|
|
|
|
|
gst_init(&argc,&argv);
|
|
|
|
|
2001-01-29 00:06:02 +00:00
|
|
|
xml = gst_xml_new ();
|
|
|
|
|
2002-03-19 04:10:13 +00:00
|
|
|
/* g_signal_connect (G_OBJECT (xml), "object_loaded", */
|
|
|
|
/* G_CALLBACK (xml_loaded), xml); */
|
2001-01-29 00:06:02 +00:00
|
|
|
|
2002-01-11 17:23:49 +00:00
|
|
|
if (argc == 2)
|
|
|
|
ret = gst_xml_parse_file(xml, argv[1], NULL);
|
|
|
|
else
|
|
|
|
ret = gst_xml_parse_file(xml, "xmlTest.gst", NULL);
|
|
|
|
|
2001-01-29 00:06:02 +00:00
|
|
|
g_assert (ret == TRUE);
|
2000-09-24 22:45:48 +00:00
|
|
|
|
2002-01-11 15:49:47 +00:00
|
|
|
pipeline = gst_xml_get_element(xml, "pipeline");
|
|
|
|
g_assert (pipeline != NULL);
|
2001-01-29 00:06:02 +00:00
|
|
|
|
2002-01-11 15:49:47 +00:00
|
|
|
gst_element_set_state(pipeline, GST_STATE_PLAYING);
|
2000-09-24 22:45:48 +00:00
|
|
|
|
2002-01-11 15:49:47 +00:00
|
|
|
while (gst_bin_iterate(GST_BIN(pipeline)));
|
2000-09-24 22:45:48 +00:00
|
|
|
|
2002-01-11 15:49:47 +00:00
|
|
|
gst_element_set_state(pipeline, GST_STATE_NULL);
|
2000-09-24 22:45:48 +00:00
|
|
|
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|