gstreamer/examples/xml/runxml.c
Andy Wingo 70cfc6cb4d new parser that uses flex and bison
Original commit message from CVS:
* new parser that uses flex and bison
- doesn't do dynamic pipelines yet...
* added GErrors to the gst_parse_launch[v] api
* added --gst-mask-help command line option
* fixed -o option for gst-launch
* GstElement api change:
- gst_element_get_pad
- gst_element_get_request_pad, gst_element_get_static_pad
- gst_element_get_compatible_pad
- gst_element_get_compatible_static_pad, gst_element_get_compatible_request_pad
- gst_element_[dis]connect -> gst_element_[dis]connect_pads
- gst_element_[dis]connect_elements -> gst_element_[dis]connect
* manual update
* example, tool, and doc updates for the api changes
- no more plugin docs in the core docs, plugins require a more
extensive doc system
2002-04-07 23:32:16 +00:00

60 lines
1.3 KiB
C

#include <string.h>
#include <stdlib.h>
#include <gst/gst.h>
gboolean playing;
G_GNUC_UNUSED 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); */
if (argc == 2)
ret = gst_xml_parse_file(xml, argv[1], NULL);
else
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);
}