ChildProxy

class ChildProxy(*args, **kwargs)

Implementations: Bin, Pipeline

This interface abstracts handling of property sets for elements with children. Imagine elements such as mixers or polyphonic generators. They all have multiple Pad or some kind of voice objects. Another use case are container elements like Bin. The element implementing the interface acts as a parent for those child objects.

By implementing this interface the child properties can be accessed from the parent element by using get() and set().

Property names are written as child-name::property-name. The whole naming scheme is recursive. Thus child1::child2::property is valid too, if child1 and child2 implement the ChildProxy interface.

Methods

class ChildProxy
child_added(child: Object, name: str) None

Emits the ChildProxy::child-added signal.

Parameters:
  • child – the newly added child

  • name – the name of the new child

child_removed(child: Object, name: str) None

Emits the ChildProxy::child-removed signal.

Parameters:
  • child – the removed child

  • name – the name of the old child

get_child_by_index(index: int) Object | None

Fetches a child by its number.

Parameters:

index – the child’s position in the child list

get_child_by_name(name: str) Object | None

Looks up a child element by the given name.

This virtual method has a default implementation that uses Object together with get_name(). If the interface is to be used with Object, this methods needs to be overridden.

Parameters:

name – the child’s name

get_child_by_name_recurse(name: str) Object | None

Looks up a child element by the given full-path name.

Similar to get_child_by_name(), this method searches and returns a child given a name. The difference is that this method allows a hierarchical path in the form of child1::child2::child3. In the later example this method would return a reference to child3, if found. The name should be made of element names only and should not contain any property names.

Added in version 1.22.

Parameters:

name – the full-path child’s name

get_children_count() int

Gets the number of child objects this parent contains.

get_property(name: str) Any

Gets a single property using the GstChildProxy mechanism. You are responsible for freeing it by calling unset()

Parameters:

name – name of the property

lookup(name: str) tuple[bool, Object, ParamSpec]

Looks up which object and ParamSpec would be effected by the given name.

Parameters:

name – name of the property to look up

set_property(name: str, value: Any) None

Sets a single property using the GstChildProxy mechanism.

Parameters:
  • name – name of the property to set

  • value – new Value for the property

Signals

class ChildProxy.signals
child_added(object: Object, name: str) None

Will be emitted after the object was added to the child_proxy.

Parameters:
  • object – the Object that was added

  • name – the name of the new child

child_removed(object: Object, name: str) None

Will be emitted after the object was removed from the child_proxy.

Parameters:
  • object – the Object that was removed

  • name – the name of the old child

Virtual Methods

class ChildProxy
do_child_added(child: Object, name: str) None

Emits the ChildProxy::child-added signal.

Parameters:
  • child – the newly added child

  • name – the name of the new child

do_child_removed(child: Object, name: str) None

Emits the ChildProxy::child-removed signal.

Parameters:
  • child – the removed child

  • name – the name of the old child

do_get_child_by_index(index: int) Object | None

Fetches a child by its number.

Parameters:

index – the child’s position in the child list

do_get_child_by_name(name: str) Object | None

Looks up a child element by the given name.

This virtual method has a default implementation that uses Object together with get_name(). If the interface is to be used with Object, this methods needs to be overridden.

Parameters:

name – the child’s name

do_get_children_count() int

Gets the number of child objects this parent contains.