mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +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
|
* Returns: a pointer to an XML document
|
||||||
*/
|
*/
|
||||||
xmlDocPtr
|
xmlDocPtr
|
||||||
gst_xml_write (GstElement *element)
|
gst_xml_write_ns (GstElement *element, gint num_ns, GstXMLNs ns[])
|
||||||
{
|
{
|
||||||
xmlDocPtr doc;
|
xmlDocPtr doc;
|
||||||
xmlNodePtr elementnode;
|
xmlNodePtr elementnode;
|
||||||
xmlNsPtr ns;
|
xmlNsPtr gst_ns;
|
||||||
|
|
||||||
doc = xmlNewDoc ("1.0");
|
doc = xmlNewDoc ("1.0");
|
||||||
|
|
||||||
doc->xmlRootNode = xmlNewDocNode (doc, NULL, "gstreamer", NULL);
|
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);
|
gst_object_save_thyself (GST_OBJECT (element), elementnode);
|
||||||
|
|
||||||
return doc;
|
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:
|
* gst_xml_write_file:
|
||||||
* @element: The element to write out
|
* @element: The element to write out
|
||||||
|
@ -137,7 +151,7 @@ gst_xml_write (GstElement *element)
|
||||||
* Returns: number of bytes written on success, -1 otherwise.
|
* Returns: number of bytes written on success, -1 otherwise.
|
||||||
*/
|
*/
|
||||||
gint
|
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;
|
xmlDocPtr cur;
|
||||||
#ifdef HAVE_LIBXML2
|
#ifdef HAVE_LIBXML2
|
||||||
|
@ -188,6 +202,22 @@ gst_xml_write_file (GstElement *element, FILE *out)
|
||||||
return ret;
|
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:
|
* gst_xml_parse_doc:
|
||||||
* @xml: a pointer to a GstXML object
|
* @xml: a pointer to a GstXML object
|
||||||
|
|
|
@ -50,6 +50,13 @@ struct _GstXML {
|
||||||
xmlNsPtr ns;
|
xmlNsPtr ns;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct _GstXMLNs GstXMLNs;
|
||||||
|
|
||||||
|
struct _GstXMLNs {
|
||||||
|
gchar *href;
|
||||||
|
gchar *prefix;
|
||||||
|
};
|
||||||
|
|
||||||
struct _GstXMLClass {
|
struct _GstXMLClass {
|
||||||
GstObjectClass parent_class;
|
GstObjectClass parent_class;
|
||||||
|
|
||||||
|
@ -63,9 +70,11 @@ GType gst_xml_get_type (void);
|
||||||
|
|
||||||
/* create an XML document out of a pipeline */
|
/* create an XML document out of a pipeline */
|
||||||
xmlDocPtr gst_xml_write (GstElement *element);
|
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 */
|
/* 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 (GstElement *element, FILE *out);
|
||||||
|
gint gst_xml_write_file_ns (GstElement *element, FILE *out, gint num_ns, GstXMLNs ns[]);
|
||||||
|
|
||||||
GstXML* gst_xml_new (void);
|
GstXML* gst_xml_new (void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue