1 #include <string.h>
2 #include <stdlib.h>
3 #include <gst/gst.h>
5 gboolean playing;
7 G_GNUC_UNUSED static void
8 xml_loaded (GstXML * xml, GstObject * object, xmlNodePtr self, gpointer data)
9 {
10 xmlNodePtr children = self->xmlChildrenNode;
12 while (children) {
13 if (!strcmp (children->name, "comment")) {
14 xmlNodePtr nodes = children->xmlChildrenNode;
16 while (nodes) {
17 if (!strcmp (nodes->name, "text")) {
18 gchar *name = g_strdup (xmlNodeGetContent (nodes));
20 g_print ("object %s loaded with comment '%s'\n",
21 gst_object_get_name (object), name);
22 }
23 nodes = nodes->next;
24 }
25 }
26 children = children->next;
27 }
28 }
30 int
31 main (int argc, char *argv[])
32 {
33 GstXML *xml;
34 GstElement *pipeline;
35 gboolean ret;
37 gst_init (&argc, &argv);
39 xml = gst_xml_new ();
41 /* g_signal_connect (G_OBJECT (xml), "object_loaded", */
42 /* G_CALLBACK (xml_loaded), xml); */
44 if (argc == 2)
45 ret = gst_xml_parse_file (xml, argv[1], NULL);
46 else
47 ret = gst_xml_parse_file (xml, "xmlTest.gst", NULL);
49 g_assert (ret == TRUE);
51 pipeline = gst_xml_get_element (xml, "pipeline");
52 g_assert (pipeline != NULL);
54 gst_element_set_state (pipeline, GST_STATE_PLAYING);
56 while (gst_bin_iterate (GST_BIN (pipeline)));
58 gst_element_set_state (pipeline, GST_STATE_NULL);
60 exit (0);
61 }