Next: , Previous: Gst, Up: Top


46 GstXML

XML save/restore operations of pipelines

46.1 Overview

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.

<gst-element> implementations need to override gst-object-save-thyself and gst-object-restore-thyself.

46.2 Usage

— Class: <gst-xml>

This <gobject> class defines no properties, other than those defined by its superclasses.

— Signal on <gst-xml>: object-loaded (arg0 <gst-object>) (arg1 <gpointer>)

Signals that a new object has been deserialized.

— Function: gst-xml-write (element <gst-element>)   (ret <xml-doc-ptr>)

Converts the given element into an XML presentation.

element
The element to write out
ret
a pointer to an XML document
— Function: gst-xml-write-file (element <gst-element>) (out <file*>)   (ret int)

Converts the given element into XML and writes the formatted XML to an open file.

element
The element to write out
out
an open file, like stdout
ret
number of bytes written on success, -1 otherwise.
— Function: gst-xml-new   (ret <gst-xml>)

Create a new GstXML parser object.

ret
a pointer to a new GstXML object.
— Function: gst-xml-parse-doc (self <gst-xml>) (doc <xml-doc-ptr>) (root <guchar*>)   (ret bool)
— Method: parse-doc

Fills the GstXML object with the elements from the xmlDocPtr.

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
ret
TRUE on success, FALSE otherwise
— Function: gst-xml-parse-file (self <gst-xml>) (fname <guchar*>) (root <guchar*>)   (ret bool)
— Method: parse-file

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
a pointer to a GstXML object
fname
The filename with the xml description
root
The name of the root object to build
ret
TRUE on success, FALSE otherwise
— Function: gst-xml-parse-memory (self <gst-xml>) (buffer <guchar*>) (size unsigned-int) (root mchars)   (ret bool)
— Method: parse-memory

Fills the GstXML object with the corresponding elements from an in memory XML buffer.

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
ret
TRUE on success
— Function: gst-xml-get-element (self <gst-xml>) (name <guchar*>)   (ret <gst-element>)
— Method: get-element

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
The GstXML to get the element from
name
The name of element to retrieve
ret
a pointer to a new GstElement, caller owns returned reference.
— Function: gst-xml-get-topelements (self <gst-xml>)   (ret glist-of)
— Method: get-topelements

Retrieve a list of toplevel elements.

xml
The GstXML to get the elements from
ret
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.
— Function: gst-xml-make-element (cur <xml-node-ptr>) (parent <gst-object>)   (ret <gst-element>)

Load the element from the XML description

cur
the xml node
parent
the parent of this object when it's loaded
ret
the new element