Gst::ElementFactory Class Reference

Gst::ElementFactory — Create Gst::Element from a factory. More...

#include <elementfactory.h>

Inheritance diagram for Gst::ElementFactory:

Gst::PluginFeature Gst::Object

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::Elementcreate_named_element (const Glib::ustring& name)
 Create a new element of the type defined by the given elementfactory.
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.
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
<const Gst::PadTemplate >> 
get_static_pad_templates ()
 Gets the List of Gst::StaticPadTemplate for this factory.

Static Public Member Functions

static Glib::RefPtr
<Gst::ElementFactory
find (const Glib::ustring& name)
 Search for an element factory of the given name.
static Glib::RefPtr<Gst::Elementcreate_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::Elementcreate_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.

Related Functions

(Note that these are not member functions.)

Glib::RefPtr<Gst::ElementFactorywrap (GstElementFactory* object, bool take_copy=false)
 A Glib::wrap() method for this object.


Detailed Description

Gst::ElementFactory — Create Gst::Element 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_caps ( const Glib::RefPtr<const Gst::Caps>&  caps  )  const

Checks if the factory can sink the given capability.

Parameters:
caps The caps to check.
Returns:
True if it can sink the capabilities.

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

Checks if the factory can source the given capability.

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  )  [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.

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.

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.
Returns:
New Gst::Element or 0 if the element couldn't be created.

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.

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.

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<const Gst::PadTemplate>> Gst::ElementFactory::get_static_pad_templates (  ) 

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

Returns:
The padtemplates.

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.

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

Provides access to the underlying C GObject.

Reimplemented from Gst::PluginFeature.

GstElementFactory* Gst::ElementFactory::gobj (  )  [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.
Since: 0.10.14.


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:

Generated on Thu Jan 15 09:33:12 2009 for gstreamermm by  doxygen 1.5.7.1