![]() |
![]() |
![]() |
GStreamer 0.10 Core Reference Manual | ![]() |
---|---|---|---|---|
#include <gst/gst.h> GstXML; xmlDocPtr gst_xml_write (GstElement *element); gint gst_xml_write_file (GstElement *element, FILE *out); GstXML* gst_xml_new (void); gboolean gst_xml_parse_doc (GstXML *xml, xmlDocPtr doc, const guchar *root); gboolean gst_xml_parse_file (GstXML *xml, const guchar *fname, const guchar *root); gboolean gst_xml_parse_memory (GstXML *xml, guchar *buffer, guint size, const gchar *root); GstElement* gst_xml_get_element (GstXML *xml, const guchar *name); GList* gst_xml_get_topelements (GstXML *xml); GstElement* gst_xml_make_element (xmlNodePtr cur, GstObject *parent);
"object-loaded" void user_function (GstXML *xml, GstObject *object, gpointer xml_node, gpointer user_data) : Run last
GStreamer pipelines can be saved to xml files using gst_xml_write_file()
.
They can be loaded back using gst_xml_parse_doc()
/ gst_xml_parse_file()
/
gst_xml_parse_memory()
.
Additionally one can load saved pipelines into the gst-editor to inspect the
graph.
GstElement implementations need to override gst_object_save_thyself()
and
gst_object_restore_thyself()
.
xmlDocPtr gst_xml_write (GstElement *element);
Converts the given element into an XML presentation.
element
:element
The element to write out
The element to write out
Returns :Returns a pointer to an XML document
a pointer to an XML document
element : |
The element to write out |
Returns : | a pointer to an XML document |
gint gst_xml_write_file (GstElement *element, FILE *out);
Converts the given element into XML and writes the formatted XML to an open file.
element
:element
The element to write out
The element to write out
out
:out
an open file, like stdout
an open file, like stdout
Returns :Returns number of bytes written on success, -1 otherwise.
number of bytes written on success, -1 otherwise.
element : |
The element to write out |
out : |
an open file, like stdout |
Returns : | number of bytes written on success, -1 otherwise. |
GstXML* gst_xml_new (void);
Create a new GstXML parser object.
Returns : | a pointer to a new GstXML object. |
gboolean gst_xml_parse_doc (GstXML *xml, xmlDocPtr doc, const guchar *root);
Fills the GstXML object with the elements from the xmlDocPtr.
xml
:xml
a pointer to a GstXML object
a pointer to a GstXML object
doc
:doc
a pointer to an xml document to parse
a pointer to an xml document to parse
root
:root
The name of the root object to build
The name of the root object to build
Returns :Returns TRUE on success, FALSE otherwise
TRUE on success, FALSE otherwise
xml : |
a pointer to a GstXML object |
doc : |
a pointer to an xml document to parse |
root : |
The name of the root object to build |
Returns : | TRUE on success, FALSE otherwise |
gboolean gst_xml_parse_file (GstXML *xml, const guchar *fname, const guchar *root);
Fills the GstXML object with the corresponding elements from the XML file fname. Optionally it will only build the element from the element node root (if it is not NULL). This feature is useful if you only want to build a specific element from an XML file but not the pipeline it is embedded in.
Pass "-" as fname to read from stdin. You can also pass a URI of any format that libxml supports, including http.
xml
:xml
a pointer to a GstXML object
a pointer to a GstXML object
fname
:fname
The filename with the xml description
The filename with the xml description
root
:root
The name of the root object to build
The name of the root object to build
Returns :Returns TRUE on success, FALSE otherwise
TRUE on success, FALSE otherwise
xml : |
a pointer to a GstXML object |
fname : |
The filename with the xml description |
root : |
The name of the root object to build |
Returns : | TRUE on success, FALSE otherwise |
gboolean gst_xml_parse_memory (GstXML *xml, guchar *buffer, guint size, const gchar *root);
Fills the GstXML object with the corresponding elements from an in memory XML buffer.
xml
:xml
a pointer to a GstXML object
a pointer to a GstXML object
buffer
:buffer
a pointer to the in memory XML buffer
a pointer to the in memory XML buffer
size
:size
the size of the buffer
the size of the buffer
root
:root
the name of the root objects to build
the name of the root objects to build
Returns :Returns TRUE on success
TRUE on success
xml : |
a pointer to a GstXML object |
buffer : |
a pointer to the in memory XML buffer |
size : |
the size of the buffer |
root : |
the name of the root objects to build |
Returns : | TRUE on success |
GstElement* gst_xml_get_element (GstXML *xml, const guchar *name);
This function is used to get a pointer to the GstElement corresponding to name in the pipeline description. You would use this if you have to do anything to the element after loading.
xml
:xml
The GstXML to get the element from
The GstXML to get the element from
name
:name
The name of element to retrieve
The name of element to retrieve
Returns :Returns a pointer to a new GstElement, caller owns returned reference.
a pointer to a new GstElement, caller owns returned reference.
xml : |
The GstXML to get the element from |
name : |
The name of element to retrieve |
Returns : | a pointer to a new GstElement, caller owns returned reference. |
GList* gst_xml_get_topelements (GstXML *xml);
Retrieve a list of toplevel elements.
xml
:xml
The GstXML to get the elements from
The GstXML to get the elements from
Returns :Returns a GList of top-level elements. The caller does not own a copy
of the list and must not free or modify the list. The caller also does not
own a reference to any of the elements in the list and should obtain its own
reference using gst_object_ref()
if necessary.
a GList of top-level elements. The caller does not own a copy
of the list and must not free or modify the list. The caller also does not
own a reference to any of the elements in the list and should obtain its own
reference using gst_object_ref()
if necessary.
gst_object_ref()
gst_object_ref()
xml : |
The GstXML to get the elements from |
Returns : | a GList of top-level elements. The caller does not own a copy
of the list and must not free or modify the list. The caller also does not
own a reference to any of the elements in the list and should obtain its own
reference using gst_object_ref() if necessary.
|
GstElement* gst_xml_make_element (xmlNodePtr cur, GstObject *parent);
Load the element from the XML description
cur
:cur
the xml node
the xml node
parent
:parent
the parent of this object when it's loaded
the parent of this object when it's loaded
Returns :Returns the new element
the new element
cur : |
the xml node |
parent : |
the parent of this object when it's loaded |
Returns : | the new element |
void user_function (GstXML *xml, GstObject *object, gpointer xml_node, gpointer user_data) : Run last
Signals that a new object has been deserialized.
xml
:xml
the xml persistence instance
the xml persistence instance
object
:object
the object that has been loaded
the object that has been loaded
xml_node
:xml_node
the related xml_node pointer to the document tree
the related xml_node pointer to the document tree
user_data
:user_data
user data set when the signal handler was connected.user data set when the signal handler was connected.
xml : |
the xml persistence instance |
object : |
the object that has been loaded |
xml_node : |
the related xml_node pointer to the document tree |
user_data : |
user data set when the signal handler was connected. |