mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
added new method and type to add namespaces to xml files. No actual code is implemented yet.
Original commit message from CVS: added new method and type to add namespaces to xml files. No actual code is implemented yet.
This commit is contained in:
parent
31d75cf682
commit
f6de672b86
2 changed files with 44 additions and 5 deletions
40
gst/gstxml.c
40
gst/gstxml.c
|
@ -107,25 +107,39 @@ gst_xml_new (void)
|
|||
* 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);
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -137,7 +151,7 @@ gst_xml_write (GstElement *element)
|
|||
* 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
|
||||
|
@ -188,6 +202,22 @@ gst_xml_write_file (GstElement *element, FILE *out)
|
|||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_xml_parse_doc:
|
||||
* @xml: a pointer to a GstXML object
|
||||
|
|
|
@ -50,6 +50,13 @@ struct _GstXML {
|
|||
xmlNsPtr ns;
|
||||
};
|
||||
|
||||
typedef struct _GstXMLNs GstXMLNs;
|
||||
|
||||
struct _GstXMLNs {
|
||||
gchar *href;
|
||||
gchar *prefix;
|
||||
};
|
||||
|
||||
struct _GstXMLClass {
|
||||
GstObjectClass parent_class;
|
||||
|
||||
|
@ -63,9 +70,11 @@ GType gst_xml_get_type (void);
|
|||
|
||||
/* 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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue