:right-sidebar: True ElementFactory =================================================================== .. currentmodule:: gi.repository.Gst .. class:: ElementFactory(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gst.PluginFeature`, :class:`~gi.repository.Gst.Object`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` :obj:`~gi.repository.Gst.ElementFactory` is used to create instances of elements. A GstElementFactory can be added to a :obj:`~gi.repository.Gst.Plugin` as it is also a :obj:`~gi.repository.Gst.PluginFeature`\. Use the :func:`~gi.repository.Gst.ElementFactory.find` and :func:`~gi.repository.Gst.ElementFactory.create` functions to create element instances or use :func:`~gi.repository.Gst.ElementFactory.make` as a convenient shortcut. The following code example shows you how to create a GstFileSrc element. Using an element factory -------------------------------------------------------------------------------- .. code-block:: C :dedent: #include GstElement *src; GstElementFactory *srcfactory; gst_init (&argc, &argv); srcfactory = gst_element_factory_find ("filesrc"); g_return_if_fail (srcfactory != NULL); src = gst_element_factory_create (srcfactory, "src"); g_return_if_fail (src != NULL); ... Methods ------- .. rst-class:: interim-class .. class:: ElementFactory :no-index: .. method:: can_sink_all_caps(caps: ~gi.repository.Gst.Caps) -> bool Checks if the factory can sink all possible capabilities. :param caps: the caps to check .. method:: can_sink_any_caps(caps: ~gi.repository.Gst.Caps) -> bool Checks if the factory can sink any possible capability. :param caps: the caps to check .. method:: can_src_all_caps(caps: ~gi.repository.Gst.Caps) -> bool Checks if the factory can src all possible capabilities. :param caps: the caps to check .. method:: can_src_any_caps(caps: ~gi.repository.Gst.Caps) -> bool Checks if the factory can src any possible capability. :param caps: the caps to check .. method:: create(name: str | None = None) -> ~gi.repository.Gst.Element | None 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. :param name: name of new element, or :const:`None` to automatically create a unique name .. method:: create_with_properties(names: list[str] | None = None, values: list[~gi.repository.GObject.Value] | None = None) -> ~gi.repository.Gst.Element | None Create a new element of the type defined by the given elementfactory. The supplied list of properties, will be passed at object construction. .. versionadded:: 1.20 :param names: array of properties names :param values: array of associated properties values .. classmethod:: find() -> ~gi.repository.Gst.ElementFactory | None Search for an element factory of the given name. Refs the returned element factory; caller is responsible for unreffing. .. method:: get_element_type() -> ~gobject.GType Get the :obj:`~gi.repository.GObject.Type` for elements managed by this factory. The type can only be retrieved if the element factory is loaded, which can be assured with :func:`~gi.repository.Gst.PluginFeature.load`. .. method:: get_metadata(key: str) -> str | None Get the metadata on ``factory`` with ``key``\. :param key: a key .. method:: get_metadata_keys() -> list[str] | None Get the available keys for the metadata on ``factory``\. .. method:: get_num_pad_templates() -> int Gets the number of pad_templates in this factory. .. method:: get_skip_documentation() -> bool Queries whether registered element managed by ``factory`` needs to be excluded from documentation system or not. .. versionadded:: 1.20 .. method:: get_static_pad_templates() -> list[~gi.repository.Gst.StaticPadTemplate] Gets the ``GList`` of :obj:`~gi.repository.Gst.StaticPadTemplate` for this factory. .. method:: get_uri_protocols() -> list[str] Gets a :const:`None`-terminated array of protocols this element supports or :const:`None` 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 :func:`~gi.repository.GLib.strdupv` to make a copy of the protocol string array if you need to. .. method:: get_uri_type() -> ~gi.repository.Gst.URIType Gets the type of URIs the element supports or ``GST_URI_UNKNOWN`` if none. .. method:: has_interface(interfacename: str) -> bool Check if ``factory`` implements the interface with name ``interfacename``\. :param interfacename: an interface name .. classmethod:: list_filter(caps: ~gi.repository.Gst.Caps, direction: ~gi.repository.Gst.PadDirection, subsetonly: bool) -> list[~gi.repository.Gst.ElementFactory] Filter out all the elementfactories in ``list`` that can handle ``caps`` in the given direction. If ``subsetonly`` is :const:`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. :param caps: a :obj:`~gi.repository.Gst.Caps` :param direction: a :obj:`~gi.repository.Gst.PadDirection` to filter on :param subsetonly: whether to filter on caps subsets or not. .. classmethod:: list_get_elements(minrank: ~gi.repository.Gst.Rank) -> list[~gi.repository.Gst.ElementFactory] 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. :param minrank: Minimum rank .. method:: list_is_type(type: int) -> bool Check if ``factory`` is of the given types. :param type: a :obj:`~gi.repository.Gst.ElementFactoryListType` .. classmethod:: make(name: str | None = None) -> ~gi.repository.Gst.Element | None Create a new element of the type defined by the given element factory. If name is :const:`None`, then the element will receive a guaranteed unique name, consisting of the element factory name and a number. If name is given, it will be given the name supplied. :param name: name of new element, or :const:`None` to automatically create a unique name .. classmethod:: make_with_properties(names: list[str] | None = None, values: list[~gi.repository.GObject.Value] | None = None) -> ~gi.repository.Gst.Element | None Create a new element of the type defined by the given elementfactory. The supplied list of properties, will be passed at object construction. .. versionadded:: 1.20 :param names: array of properties names :param values: array of associated properties values