From: Wim T. <wt...@us...> - 2003-06-09 12:28:20
|
CVS Root: /cvsroot/gstreamer Module: gstreamer Changes by: wtay Date: Mon Jun 09 2003 05:28:18 PDT Log message: added new method and type to add namespaces to xml files. No actual code is implemented yet. Modified files: gst : gstxml.c gstxml.h Links: http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstxml.c.diff?r1=1.35&r2=1.36 http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/gst/gstxml.h.diff?r1=1.21&r2=1.22 ====Begin Diffs==== Index: gstxml.c =================================================================== RCS file: /cvsroot/gstreamer/gstreamer/gst/gstxml.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- gstxml.c 8 Jan 2003 22:45:46 -0000 1.35 +++ gstxml.c 9 Jun 2003 12:28:05 -0000 1.36 @@ -107,19 +107,19 @@ * Returns: a pointer to an XML document */ xmlDocPtr -gst_xml_write (GstElement *element) +gst_xml_write_ns (GstElement *element, gint num_ns, GstXMLNs ns[]) { xmlDocPtr doc; xmlNodePtr elementnode; - xmlNsPtr ns; + xmlNsPtr gst_ns; doc = xmlNewDoc ("1.0"); doc->xmlRootNode = xmlNewDocNode (doc, NULL, "gstreamer", NULL); - ns = xmlNewNs (doc->xmlRootNode, "http://gstreamer.net/gst-core/1.0/", "gst"); + gst_ns = xmlNewNs (doc->xmlRootNode, "http://gstreamer.net/gst-core/1.0/", "gst"); - elementnode = xmlNewChild (doc->xmlRootNode, ns, "element", NULL); + elementnode = xmlNewChild (doc->xmlRootNode, gst_ns, "element", NULL); gst_object_save_thyself (GST_OBJECT (element), elementnode); @@ -127,6 +127,20 @@ } /** + * gst_xml_write: + * @element: The element to write out + * + * Converts the given element into an XML presentation. + * + * Returns: a pointer to an XML document + */ +xmlDocPtr +gst_xml_write (GstElement *element) +{ + return gst_xml_write_ns (element, 0, NULL); +} + +/** * gst_xml_write_file: * @element: The element to write out * @out: an open file, like stdout @@ -137,7 +151,7 @@ * Returns: number of bytes written on success, -1 otherwise. */ gint -gst_xml_write_file (GstElement *element, FILE *out) +gst_xml_write_file_ns (GstElement *element, FILE *out, gint num_ns, GstXMLNs ns[]) { xmlDocPtr cur; #ifdef HAVE_LIBXML2 @@ -186,6 +200,22 @@ #endif return ret; +} + +/** + * gst_xml_write_file: + * @element: The element to write out + * @out: an open file, like stdout + * + * Converts the given element into XML and writes the formatted XML to an open + * file. + * + * Returns: number of bytes written on success, -1 otherwise. + */ +gint +gst_xml_write_file (GstElement *element, FILE *out) +{ + return gst_xml_write_file_ns (element, out, 0, NULL); } /** Index: gstxml.h =================================================================== RCS file: /cvsroot/gstreamer/gstreamer/gst/gstxml.h,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- gstxml.h 19 Dec 2002 21:31:02 -0000 1.21 +++ gstxml.h 9 Jun 2003 12:28:06 -0000 1.22 @@ -50,6 +50,13 @@ xmlNsPtr ns; }; +typedef struct _GstXMLNs GstXMLNs; + +struct _GstXMLNs { + gchar *href; + gchar *prefix; +}; + struct _GstXMLClass { GstObjectClass parent_class; @@ -63,9 +70,11 @@ /* create an XML document out of a pipeline */ xmlDocPtr gst_xml_write (GstElement *element); +xmlDocPtr gst_xml_write_ns (GstElement *element, gint num_ns, GstXMLNs ns[]); /* write a formatted representation of a pipeline to an open file */ gint gst_xml_write_file (GstElement *element, FILE *out); +gint gst_xml_write_file_ns (GstElement *element, FILE *out, gint num_ns, GstXMLNs ns[]); GstXML* gst_xml_new (void); |