gstreamermm: Gst::ElementFactory Class Reference

gstreamermm 0.10.11

- Main Page
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Related Functions
Gst::ElementFactory Class Reference

A class that creates Gst::Element objects from a factory. More...

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

List of all members.

## Public Member Functions
virtual | ~ElementFactory ()
GstElementFactory* | gobj ()
| Provides access to the underlying C GObject.
const GstElementFactory* | gobj () const
| Provides access to the underlying C GObject.
GstElementFactory* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr< Gst::Element > | create_named_element (const Glib::ustring& name)
| Create a new element of the type defined by the given elementfactory.
bool | can_sink_all_caps (const Glib::RefPtr< const Gst::Caps >& caps) const
| Checks if the factory can sink all possible capabilities.
bool | can_src_all_caps (const Glib::RefPtr< const Gst::Caps >& caps) const
| Checks if the factory can src all possible capabilities.
bool | can_sink_any_caps (const Glib::RefPtr< const Gst::Caps >& caps) const
| Checks if the factory can sink any possible capability.
bool | can_src_any_caps (const Glib::RefPtr< const Gst::Caps >& caps) const
| Checks if the factory can src any possible capability.
GType | get_element_type () const
| Get the Type for elements managed by this factory.
Glib::ustring | get_long_name () const
| Gets the longname for this factory.
Glib::ustring | get_kclass () const
| Gets the class for this factory.
Glib::ustring | get_description () const
| Gets the description for this factory.
Glib::ustring | get_author () const
| Gets the author for this factory.
Glib::ustring | get_documentation_uri () const
| Gets documentation uri for this factory if set.
Glib::ustring | get_icon_name () const
| Gets icon name for this factory if set.
guint | get_num_pad_templates () const
| Gets the number of pad_templates in this factory.
int | get_uri_type () const
| Gets the type of URIs the element supports or Gst::URI_UNKNOWN if none.
Glib::StringArrayHandle | get_uri_protocols () const
| Gets a `0`-terminated array of protocols this element supports or `0` if no protocols are supported.
bool | has_interface (const Glib::ustring& name) const
| Check if factory implements the interface with name interfacename.
bool | can_sink_caps (const Glib::RefPtr< const Gst::Caps >& caps) const
| Checks if the factory can sink the given capability.
bool | can_src_caps (const Glib::RefPtr< const Gst::Caps >& caps) const
| Checks if the factory can source the given capability.
Glib::ListHandle< Glib::RefPtr < Gst::PadTemplate > > | get_static_pad_templates ()
| Gets the List of Gst::StaticPadTemplate for this factory.
Glib::ListHandle< Glib::RefPtr < const Gst::PadTemplate > > | get_static_pad_templates () const
| Gets the List of Gst::StaticPadTemplate for this factory.
bool | is_type (ElementFactoryListType type) const
| Check if factory is of the given types.
## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.
static bool | register_element (const Glib::RefPtr< Gst::Plugin >& plugin, const Glib::ustring& name, guint rank, GType type)
| Create a new elementfactory capable of instantiating objects of the type and add the factory to plugin.
static Glib::RefPtr < Gst::ElementFactory > | find (const Glib::ustring& name)
| Search for an element factory of the given name.
static Glib::RefPtr< Gst::Element > | create_element (const Glib::ustring& factory_name, const Glib::ustring& name)
| Create a new element of the type defined by the given element factory.
static Glib::RefPtr< Gst::Element > | create_element (const Glib::ustring& factory_name)
| Create a new element of the type defined by the given element factory, with a guaranteed unique name consisting of the element factory name and a number.
static std::vector < Glib::RefPtr < Gst::ElementFactory > > | filter (const std::vector< Glib::RefPtr< Gst::ElementFactory > >& list, const Glib::RefPtr< const Gst::Caps >& caps, PadDirection direction, bool subsetonly)
| Filter out all the elementfactories in list that can handle caps in the given direction.
static std::vector < Glib::RefPtr < Gst::ElementFactory > > | get_elements (ElementFactoryListType type, Rank minrank)
| Get a list of factories that match the given type.
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gst::ElementFactory > | wrap (GstElementFactory* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

A class that creates Gst::Element objects from a factory.

Gst::ElementFactory is used to create instances of elements. A Gst::ElementFactory can be added to a Gst::Plugin as it is also a Gst::PluginFeature. Use find() to get a particular element factory. Use create_named_element() and the create_element() functions to create element instances.

The following code example shows you how to create a 'filesrc' element.

     #include <gstreamermm.h>
     #include <iostream>

      int main (int argc, char *argc[])
      {
        Glib::RefPtr<Gst::Element> src;
        Glib::RefPtr<Gst::ElementFactory> srcfactory;

        Gst::init(&argc,&argv);

        srcfactory = Gst::ElementFactory::find("filesrc");

        if(!srcfactory)
        {
          std::cout << "Could not find factory 'filesrc'" << std::endl;
          exit(1);
        }

        src = srcfactory->create_named_element("src");

        if(!src)
        {
          std::cout << "Could not create element 'src'" << std::endl;
          exit(1);
        }
        ...
      }

## Constructor & Destructor Documentation

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

## Member Function Documentation

bool Gst::ElementFactory::can_sink_all_caps | ( | const Glib::RefPtr< const Gst::Caps >& | caps | ) | const

Checks if the factory can sink all possible capabilities.

Parameters:

  caps | The caps to check.

Returns:
  `true` if the caps are fully compatible.

bool Gst::ElementFactory::can_sink_any_caps | ( | const Glib::RefPtr< const Gst::Caps >& | caps | ) | const

Checks if the factory can sink any possible capability.

Parameters:

  caps | The caps to check.

Returns:
  `true` if the caps have a common subset.

bool Gst::ElementFactory::can_sink_caps | ( | const Glib::RefPtr< const Gst::Caps >& | caps | ) | const

Checks if the factory can sink the given capability.

Deprecated: use can_sink_all_caps() instead.

Parameters:

  caps | The caps to check.

Returns:
  `true` if it can sink the capabilities.

bool Gst::ElementFactory::can_src_all_caps | ( | const Glib::RefPtr< const Gst::Caps >& | caps | ) | const

Checks if the factory can src all possible capabilities.

Parameters:

  caps | The caps to check.

Returns:
  `true` if the caps are fully compatible.

bool Gst::ElementFactory::can_src_any_caps | ( | const Glib::RefPtr< const Gst::Caps >& | caps | ) | const

Checks if the factory can src any possible capability.

Parameters:

  caps | The caps to check.

Returns:
  `true` if the caps have a common subset.

bool Gst::ElementFactory::can_src_caps | ( | const Glib::RefPtr< const Gst::Caps >& | caps | ) | const

Checks if the factory can source the given capability.

Deprecated: use can_src_all_caps() instead.

Parameters:

  caps | The caps to check.

Returns:
  `true` if it can src the capabilities.

static Glib::RefPtr<Gst::Element> Gst::ElementFactory::create_element | ( | const Glib::ustring & | factory_name,
|  | const Glib::ustring & | name
| ) |  | `[static]`

Create a new element of the type defined by the given element factory.

Parameters:

  factoryname | A named factory to instantiate.
  name | Name of new element.

Returns:
  New Gst::Element or `0` if unable to create element.

static Glib::RefPtr<Gst::Element> Gst::ElementFactory::create_element | ( | const Glib::ustring & | factory_name | ) | `[static]`

Create a new element of the type defined by the given element factory, with a guaranteed unique name consisting of the element factory name and a number.

Parameters:

  factoryname | A named factory to instantiate.
  name | Name of new element.

Returns:
  New Gst::Element or an empty RefPtr if unable to create element.

Glib::RefPtr<Gst::Element> Gst::ElementFactory::create_named_element | ( | const Glib::ustring & | name | ) |

Create a new element of the type defined by the given elementfactory.

It will be given the name supplied, since all elements require a name as their first argument.

Parameters:

  name | Name of new element, or `0` to automatically create a unique name.

Returns:
  New Gst::Element or `0` if the element couldn't be created.

static std::vector< Glib::RefPtr<Gst::ElementFactory> > Gst::ElementFactory::filter | ( | const std::vector< Glib::RefPtr< Gst::ElementFactory > >& | list,
|  | const Glib::RefPtr< const Gst::Caps >& | caps,
|  | PadDirection | direction,
|  | bool | subsetonly
| ) |  | `[static]`

Filter out all the elementfactories in list that can handle caps in the given direction.

If subsetonly is `true`, then only the elements whose pads templates are a complete superset of caps will be returned. Else any element whose pad templates caps can intersect with caps will be returned.

Parameters:

  list | A List of Gst::ElementFactory to filter.
  caps | A Gst::Caps.
  direction | A Gst::PadDirection to filter on.
  subsetonly | Whether to filter on caps subsets or not.

Returns:
  A List of Gst::ElementFactory elements that match the given requisits. Use #gst_plugin_feature_list_free after usage.

static Glib::RefPtr<Gst::ElementFactory> Gst::ElementFactory::find | ( | const Glib::ustring & | name | ) | `[static]`

Search for an element factory of the given name.

Refs the returned element factory; caller is responsible for unreffing.

Parameters:

  name | Name of factory to find.

Returns:
  Gst::ElementFactory if found, `0` otherwise.

Glib::ustring Gst::ElementFactory::get_author | ( |  | ) | const

Gets the author for this factory.

Returns:
  The author.

Glib::ustring Gst::ElementFactory::get_description | ( |  | ) | const

Gets the description for this factory.

Returns:
  The description.

Glib::ustring Gst::ElementFactory::get_documentation_uri | ( |  | ) | const

Gets documentation uri for this factory if set.

Returns:
  The documentation uri.

GType Gst::ElementFactory::get_element_type | ( |  | ) | const

Get the Type for elements managed by this factory.

The type can only be retrieved if the element factory is loaded, which can be assured with Gst::PluginFeature::load().

Returns:
  The Type for elements managed by this factory or 0 if the factory is not loaded.

static std::vector< Glib::RefPtr<Gst::ElementFactory> > Gst::ElementFactory::get_elements | ( | ElementFactoryListType | type,
|  | Rank | minrank
| ) |  | `[static]`

Get a list of factories that match the given type.

Only elements with a rank greater or equal to minrank will be returned. The list of factories is returned by decreasing rank.

Parameters:

  type | A Gst::ElementFactoryListType.
  minrank | Minimum rank.

Returns:
  A List of Gst::ElementFactory elements. Use Gst::PluginFeature::list_free() after usage.

Glib::ustring Gst::ElementFactory::get_icon_name | ( |  | ) | const

Gets icon name for this factory if set.

Returns:
  The icon name.

Glib::ustring Gst::ElementFactory::get_kclass | ( |  | ) | const

Gets the class for this factory.

Returns:
  The class.

Glib::ustring Gst::ElementFactory::get_long_name | ( |  | ) | const

Gets the longname for this factory.

Returns:
  The longname.

guint Gst::ElementFactory::get_num_pad_templates | ( |  | ) | const

Gets the number of pad_templates in this factory.

Returns:
  The number of pad_templates.

Glib::ListHandle< Glib::RefPtr<Gst::PadTemplate> > Gst::ElementFactory::get_static_pad_templates | ( |  | ) |

Gets the List of Gst::StaticPadTemplate for this factory.

Returns:
  The static pad templates.

Glib::ListHandle< Glib::RefPtr<const Gst::PadTemplate> > Gst::ElementFactory::get_static_pad_templates | ( |  | ) | const

Gets the List of Gst::StaticPadTemplate for this factory.

Returns:
  The static pad templates.

static GType Gst::ElementFactory::get_type | ( |  | ) | `[static]`

Get the GType for this class, for use with the underlying GObject type system.

Reimplemented from Gst::PluginFeature.

Glib::StringArrayHandle Gst::ElementFactory::get_uri_protocols | ( |  | ) | const

Gets a `0`-terminated array of protocols this element supports or `0` if no protocols are supported.

You may not change the contents of the returned array, as it is still owned by the element factory. Use Glib::strdupv() to make a copy of the protocol string array if you need to.

Returns:
  The supported protocols or `0`.

int Gst::ElementFactory::get_uri_type | ( |  | ) | const

Gets the type of URIs the element supports or Gst::URI_UNKNOWN if none.

Returns:
  Type of URIs this element supports.

GstElementFactory* Gst::ElementFactory::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gst::PluginFeature.

const GstElementFactory* Gst::ElementFactory::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gst::PluginFeature.

GstElementFactory* Gst::ElementFactory::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::PluginFeature.

bool Gst::ElementFactory::has_interface | ( | const Glib::ustring & | name | ) | const

Check if factory implements the interface with name interfacename.

Parameters:

  interfacename | An interface name.

Returns:
  #`true` when factory implement the interface.

bool Gst::ElementFactory::is_type | ( | ElementFactoryListType | type | ) | const

Check if factory is of the given types.

Parameters:

  type | A Gst::ElementFactoryListType.

Returns:
  `true` if factory is of type.

static bool Gst::ElementFactory::register_element | ( | const Glib::RefPtr< Gst::Plugin >& | plugin,
|  | const Glib::ustring & | name,
|  | guint | rank,
|  | GType | type
| ) |  | `[static]`

Create a new elementfactory capable of instantiating objects of the type and add the factory to plugin.

Parameters:

  plugin | Gst::Plugin to register the element with, or `0` for a static element (note that passing `0` only works in GStreamer 0.10.13 and later).
  name | Name of elements of this type.
  rank | Rank of element (higher rank means more importance when autoplugging).
  type | GType of element to register.

Returns:
  `true`, if the registering succeeded, `false` on error.

## Friends And Related Function Documentation

Glib::RefPtr< Gst::ElementFactory > wrap | ( | GstElementFactory * | 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/elementfactory.h