Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions

# Gst::XML Class Reference

A class facilitating XML save/restore operations of pipelines. More...

Inheritance diagram for Gst::XML:
[legend]
Collaboration diagram for Gst::XML:
[legend]

List of all members.

## Public Member Functions
virtual | ~XML ()
GstXML* | gobj ()
| Provides access to the underlying C GObject.
const GstXML* | gobj () const
| Provides access to the underlying C GObject.
GstXML* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
bool | parse_doc (xmlpp::Document* doc, Glib::ustring& root)
| Fills the GstXML object with the elements from the xmlDocPtr.
bool | parse_file (const std::string& filename, const Glib::ustring& root)
| Fills the GstXML object with the corresponding elements from the XML file fname.
bool | parse_memory (const std::string& buffer, const Glib::ustring& root)
| Fills the Gst::XML object with the corresponding elements from an in memory XML buffer.
Glib::RefPtr< Gst::Element > | get_element (const Glib::ustring& name)
| This function is used to get a pointer to the GstElement corresponding to name in the pipeline description.
Glib::RefPtr< const Gst::Element > | get_element (const Glib::ustring& name) const
| This function is used to get a pointer to the GstElement corresponding to name in the pipeline description.
Glib::ListHandle< Glib::RefPtr < Gst::Element > > | get_topelements ()
| Retrieve a list of toplevel elements.
Glib::ListHandle< Glib::RefPtr < const Gst::Element > > | get_topelements () const
| Retrieve a list of toplevel elements.
Glib::SignalProxy2< void, const Glib::RefPtr < Gst::Object >&, xmlNodePtr > | signal_object_loaded ()
| Signals that a new object has been deserialized.
## Static Public Member Functions
static Glib::RefPtr< XML > | create ()
| Create a new Gst::XML parser object.
static xmlDocPtr | write (const Glib::RefPtr< const Gst::Element >& element)
| Converts the given element into an XML presentation.
static void | write_to_stream (const Glib::RefPtr< const Gst::Element >& element, std::ostream& out)
| Converts the given element into XML and writes the formatted XML to an open output stream.
static Glib::RefPtr< Gst::Element > | make_element (xmlpp::Node* curr, const Glib::RefPtr< Gst::Object >& parent)
| Load the element from the XML description.
## Protected Member Functions
| XML ()
virtual void | on_object_loaded (const Glib::RefPtr< Gst::Object >& object, xmlNodePtr xml_node)
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gst::XML > | wrap (GstXML* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

A class facilitating XML save/restore operations of pipelines.

GStreamer pipelines can be saved to xml files using write_to_stream(). They can be loaded back using parse_doc() / parse_file() / 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_vfunc() and Gst::Object::restore_vfunc().

## Constructor & Destructor Documentation

virtual Gst::XML::~XML | ( | ) | `[virtual]`

Gst::XML::XML | ( | ) | `[protected]`

## Member Function Documentation

static Glib::RefPtr<XML> Gst::XML::create | ( | ) | `[static]`

Create a new Gst::XML parser object.

Returns:
  A Glib::RefPtr<> to a new Gst::XML object.

Glib::RefPtr<Gst::Element> Gst::XML::get_element | ( | const Glib::ustring & | 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.

Parameters:

  name | The name of element to retrieve.

Returns:
  A pointer to a new GstElement, caller owns returned reference.

Glib::RefPtr<const Gst::Element> Gst::XML::get_element | ( | const Glib::ustring & | name ) | const

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.

Parameters:

  name | The name of element to retrieve.

Returns:
  A pointer to a new GstElement, caller owns returned reference.

Glib::ListHandle< Glib::RefPtr<Gst::Element> > Gst::XML::get_topelements | ( | ) |

Retrieve a list of toplevel elements.

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.

Glib::ListHandle< Glib::RefPtr<const Gst::Element> > Gst::XML::get_topelements | ( | ) | const

Retrieve a list of toplevel elements.

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.

const GstXML* Gst::XML::gobj | ( | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gst::Object.

GstXML* Gst::XML::gobj | ( | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gst::Object.

GstXML* Gst::XML::gobj_copy | ( | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

Reimplemented from Gst::Object.

static Glib::RefPtr<Gst::Element> Gst::XML::make_element | ( | xmlpp::Node * | curr,
|  | const Glib::RefPtr< Gst::Object >& | parent
| ) |  | `[static]`

Load the element from the XML description.

Parameters:

  cur | The xml node.
  parent | The parent of this object when it's loaded.

Returns:
  The new element.

virtual void Gst::XML::on_object_loaded | ( | const Glib::RefPtr< Gst::Object >& | object,
|  | xmlNodePtr | xml_node
| ) |  | `[protected, virtual]`

bool Gst::XML::parse_doc | ( | xmlpp::Document * | doc,
|  | Glib::ustring & | root
| ) |  |

Fills the GstXML object with the elements from the xmlDocPtr.

Parameters:

  doc | A pointer to an xml document to parse.
  root | The name of the root object to build.

Returns:
  `true` on success, `false` otherwise.

bool Gst::XML::parse_file | ( | const std::string & | filename,
|  | const Glib::ustring & | 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 `0`). 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.

Parameters:

  fname | The filename with the xml description.
  root | The name of the root object to build.

Returns:
  `true` on success, `false` otherwise.

bool Gst::XML::parse_memory | ( | const std::string & | buffer,
|  | const Glib::ustring & | root
| ) |  |

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

Parameters:

  buffer | The in memory XML buffer.
  root | The name of the root objects to build.

Returns:
  true on success.

Glib::SignalProxy2< void,const Glib::RefPtr<Gst::Object>&,xmlNodePtr > Gst::XML::signal_object_loaded | ( | ) |

Signals that a new object has been deserialized.

Prototype:
  `void on_my_object_loaded(const Glib::RefPtr<Gst::Object>& object, xmlNodePtr xml_node)`

static xmlDocPtr Gst::XML::write | ( | const Glib::RefPtr< const Gst::Element >& | element ) | `[static]`

Converts the given element into an XML presentation.

Parameters:

  element | The element to write out.

Returns:
  A pointer to an XML document.

static void Gst::XML::write_to_stream | ( | const Glib::RefPtr< const Gst::Element >& | element,
|  | std::ostream & | out
| ) |  | `[static]`

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

Parameters:

  element | The element to write out.
  out | An open std::ostream, like std::cout.

## Friends And Related Function Documentation

Glib::RefPtr< Gst::XML > wrap | ( | GstXML * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- gstreamermm/xml.h