Gst.Object¶
- Subclasses:
Gst.Allocator
,Gst.BufferPool
,Gst.Bus
,Gst.Clock
,Gst.ControlBinding
,Gst.ControlSource
,Gst.Device
,Gst.DeviceMonitor
,Gst.DeviceProvider
,Gst.Element
,Gst.Pad
,Gst.PadTemplate
,Gst.Plugin
,Gst.PluginFeature
,Gst.Registry
,Gst.Stream
,Gst.StreamCollection
,Gst.Task
,Gst.TaskPool
,Gst.Tracer
,Gst.TracerRecord
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/c |
The name of the object |
||
r/w |
The parent of the object |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The deep notify signal is used to be notified of property changes. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
control_bindings |
[ |
r |
|
control_rate |
r |
||
flags |
r |
flags for this object |
|
last_sync |
r |
||
lock |
r |
object LOCK |
|
name |
r |
The name of the object |
|
object |
r |
||
parent |
r |
this object’s parent, weak ref |
Class Details¶
- class Gst.Object(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
Gst.Object
provides a root for the object hierarchy tree filed in by the GStreamer library. It is currently a thin wrapper on top ofGObject.InitiallyUnowned
. It is an abstract class that is not very usable on its own.Gst.Object
gives us basic refcounting, parenting functionality and locking. Most of the functions are just extended for special GStreamer needs and can be found under the same name in the base class ofGst.Object
which isGObject.Object
(e.g.GObject.Object.ref
() becomesGst.Object.ref
()).Since
Gst.Object
derives fromGObject.InitiallyUnowned
, it also inherits the floating reference. Be aware that functions such asGst.Bin.add
() andGst.Element.add_pad
() take ownership of the floating reference.In contrast to
GObject.Object
instances,Gst.Object
adds a name property. The functionsGst.Object.set_name
() andGst.Object.get_name
() are used to set/get the name of the object.- controlled properties
Controlled properties offers a lightweight way to adjust gobject properties over stream-time. It works by using time-stamped value pairs that are queued for element-properties. At run-time the elements continuously pull value changes for the current stream-time.
What needs to be changed in a
Gst.Element
? Very little - it is just two steps to make a plugin controllable!mark gobject-properties paramspecs that make sense to be controlled, by
Gst.PARAM_CONTROLLABLE
.when processing data (get, chain, loop function) at the beginning call
Gst.Object.sync_values
(element,timestamp). This will make the controller update allGObject.Object
properties that are under its control with the current values based on the timestamp.
What needs to be done in applications? Again it’s not a lot to change.
create a
Gst.ControlSource
. csource = gst_interpolation_control_source_new (); g_object_set (csource, “mode”, GST_INTERPOLATION_MODE_LINEAR,None
);Attach the
Gst.ControlSource
on the controller to a property.Gst.Object.add_control_binding
(object, gst_direct_control_binding_new (object, “prop1”, csource));Set the control values gst_timed_value_control_source_set ((GstTimedValueControlSource *)csource,0 *
Gst.SECOND
, value1); gst_timed_value_control_source_set ((GstTimedValueControlSource *)csource,1 *Gst.SECOND
, value2);start your pipeline
- classmethod check_uniqueness(list, name)[source]¶
- Parameters:
list ([
Gst.Object
]) – a list ofGst.Object
to check throughname (
str
) – the name to search for
- Returns:
True
if aGst.Object
named name does not appear in list,False
if it does.MT safe. Grabs and releases the LOCK of each object in the list.
- Return type:
Checks to see if there is any object named name in list. This function does not do any locking of any kind. You might want to protect the provided list with the lock of the owner of the list. This function will lock each
Gst.Object
in the list to compare the name, so be careful when passing a list with a locked object.
- classmethod default_deep_notify(object, orig, pspec, excluded_props)[source]¶
- Parameters:
object (
GObject.Object
) – theGObject.Object
that signalled the notify.orig (
Gst.Object
) – aGst.Object
that initiated the notify.pspec (
GObject.ParamSpec
) – aGObject.ParamSpec
of the property.excluded_props ([
str
] orNone
) – a set of user-specified properties to exclude orNone
to show all changes.
A default deep_notify signal callback for an object. The user data should contain a pointer to an array of strings that should be excluded from the notify. The default handler will print the new value of the property using g_print.
MT safe. This function grabs and releases object's LOCK for getting its path string.
- classmethod replace(oldobj, newobj)[source]¶
- Parameters:
oldobj (
Gst.Object
orNone
) – pointer to a place of aGst.Object
to replacenewobj (
Gst.Object
orNone
) – a newGst.Object
- Returns:
True
if newobj was different from oldobj- oldobj:
pointer to a place of a
Gst.Object
to replace
- Return type:
(
bool
, oldobj:Gst.Object
orNone
)
Atomically modifies a pointer to point to a new object. The reference count of oldobj is decreased and the reference count of newobj is increased.
Either newobj and the value pointed to by oldobj may be
None
.
- add_control_binding(binding)[source]¶
- Parameters:
binding (
Gst.ControlBinding
) – theGst.ControlBinding
that should be used- Returns:
False
if the given binding has not been setup for this object or has been setup for a non suitable property,True
otherwise.- Return type:
Attach the
Gst.ControlBinding
to the object. If there already was aGst.ControlBinding
for this property it will be replaced.The object’s reference count will be incremented, and any floating reference will be removed (see gst_object_ref_sink())
- default_error(error, debug)[source]¶
- Parameters:
error (
GLib.Error
) – theGLib.Error
.debug (
str
orNone
) – an additional debug information string, orNone
A default error function that uses g_printerr() to display the error message and the optional debug string..
The default handler will simply print the error string using g_print.
- get_control_binding(property_name)[source]¶
- Parameters:
property_name (
str
) – name of the property- Returns:
the
Gst.ControlBinding
for property_name orNone
if the property is not controlled.- Return type:
Gets the corresponding
Gst.ControlBinding
for the property. This should be unreferenced again after use.
- get_control_rate()[source]¶
- Returns:
the control rate in nanoseconds
- Return type:
Obtain the control-rate for this self. Audio processing
Gst.Element
objects will use this rate to sub-divide their processing loop and callGst.Object.sync_values
() in between. The length of the processing segment should be up to control-rate nanoseconds.If the self is not under property control, this will return
Gst.CLOCK_TIME_NONE
. This allows the element to avoid the sub-dividing.The control-rate is not expected to change if the element is in
Gst.State.PAUSED
orGst.State.PLAYING
.
- get_g_value_array(property_name, timestamp, interval, values)[source]¶
- Parameters:
property_name (
str
) – the name of the property to gettimestamp (
int
) – the time that should be processedinterval (
int
) – the time spacing between subsequent valuesvalues ([
GObject.Value
]) – array to put control-values in
- Returns:
- Return type:
Gets a number of
GObject.Values
for the given controlled property starting at the requested time. The array values need to hold enough space for n_values ofGObject.Value
.This function is useful if one wants to e.g. draw a graph of the control curve or apply a control curve sample by sample.
- get_name()[source]¶
- Returns:
the name of self.
GLib.free
() after usage.MT safe. This function grabs and releases self's LOCK.
- Return type:
Returns a copy of the name of self. Caller should
GLib.free
() the return value after usage. For a nameless object, this returnsNone
, which you can safelyGLib.free
() as well.Free-function:
GLib.free
- get_parent()[source]¶
- Returns:
parent of self, this can be
None
if self has no parent. unref after usage.MT safe. Grabs and releases self's LOCK.
- Return type:
Gst.Object
orNone
Returns the parent of self. This function increases the refcount of the parent object so you should
Gst.Object.unref
() it after usage.
- get_path_string()[source]¶
- Returns:
a string describing the path of self. You must
GLib.free
() the string after usage.MT safe. Grabs and releases the
Gst.Object
's LOCK for all objects in the hierarchy.- Return type:
Generates a string describing the path of self in the object hierarchy. Only useful (or used) for debugging.
Free-function:
GLib.free
- get_value(property_name, timestamp)[source]¶
- Parameters:
- Returns:
the
GObject.Value
of the property at the given time, orNone
if the property isn’t controlled.- Return type:
Gets the value for the given controlled property at the requested time.
- has_ancestor(ancestor)[source]¶
- Parameters:
ancestor (
Gst.Object
) – aGst.Object
to check as ancestor- Returns:
True
if ancestor is an ancestor of self.- Return type:
Check if self has an ancestor ancestor somewhere up in the hierarchy. One can e.g. check if a
Gst.Element
is inside aGst.Pipeline
.Deprecated since version ???: Use
Gst.Object.has_as_ancestor
() instead. MT safe. Grabs and releases object's locks.
- has_as_ancestor(ancestor)[source]¶
- Parameters:
ancestor (
Gst.Object
) – aGst.Object
to check as ancestor- Returns:
True
if ancestor is an ancestor of self.MT safe. Grabs and releases self's locks.
- Return type:
Check if self has an ancestor ancestor somewhere up in the hierarchy. One can e.g. check if a
Gst.Element
is inside aGst.Pipeline
.
- has_as_parent(parent)[source]¶
- Parameters:
parent (
Gst.Object
) – aGst.Object
to check as parent- Returns:
False
if either self or parent isNone
.True
if parent is the parent of self. OtherwiseFalse
.MT safe. Grabs and releases self's locks.
- Return type:
Check if parent is the parent of self. E.g. a
Gst.Element
can check if it owns a givenGst.Pad
.New in version 1.6.
- ref()[source]¶
- Returns:
A pointer to self
- Return type:
Increments the reference count on self. This function does not take the lock on self because it relies on atomic refcounting.
This object returns the input parameter to ease writing constructs like : result =
Gst.Object.ref
(object->parent);
- remove_control_binding(binding)[source]¶
- Parameters:
binding (
Gst.ControlBinding
) – the binding- Returns:
True
if the binding could be removed.- Return type:
Removes the corresponding
Gst.ControlBinding
. If it was the last ref of the binding, it will be disposed.
- set_control_binding_disabled(property_name, disabled)[source]¶
- Parameters:
This function is used to disable the control bindings on a property for some time, i.e.
Gst.Object.sync_values
() will do nothing for the property.
- set_control_bindings_disabled(disabled)[source]¶
- Parameters:
disabled (
bool
) – boolean that specifies whether to disable the controller or not.
This function is used to disable all controlled properties of the self for some time, i.e.
Gst.Object.sync_values
() will do nothing.
- set_control_rate(control_rate)[source]¶
- Parameters:
control_rate (
int
) – the new control-rate in nanoseconds.
Change the control-rate for this self. Audio processing
Gst.Element
objects will use this rate to sub-divide their processing loop and callGst.Object.sync_values
() in between. The length of the processing segment should be up to control-rate nanoseconds.The control-rate should not change if the element is in
Gst.State.PAUSED
orGst.State.PLAYING
.
- set_name(name)[source]¶
- Parameters:
- Returns:
True
if the name could be set. Since Objects that have a parent cannot be renamed, this function returnsFalse
in those cases.MT safe. This function grabs and releases self's LOCK.
- Return type:
Sets the name of self, or gives self a guaranteed unique name (if name is
None
). This function makes a copy of the provided name, so the caller retains ownership of the name it sent.
- set_parent(parent)[source]¶
- Parameters:
parent (
Gst.Object
) – new parent of object- Returns:
True
if parent could be set orFalse
when self already had a parent or self and parent are the same.MT safe. Grabs and releases self's LOCK.
- Return type:
Sets the parent of self to parent. The object’s reference count will be incremented, and any floating reference will be removed (see gst_object_ref_sink()).
- suggest_next_sync()[source]¶
- Returns:
Returns the suggested timestamp or
Gst.CLOCK_TIME_NONE
if no control-rate was set.- Return type:
Returns a suggestion for timestamps where buffers should be split to get best controller results.
- sync_values(timestamp)[source]¶
- Parameters:
timestamp (
int
) – the time that should be processed- Returns:
True
if the controller values could be applied to the object properties,False
otherwise- Return type:
Sets the properties of the object, according to the
Gst.ControlSources
that (maybe) handle them and for the given timestamp.If this function fails, it is most likely the application developers fault. Most probably the control sources are not setup correctly.
- unparent()[source]¶
Clear the parent of self, removing the associated reference. This function decreases the refcount of self.
MT safe. Grabs and releases self's lock.
- unref()[source]¶
Decrements the reference count on self. If reference count hits zero, destroy self. This function does not take the lock on self as it relies on atomic refcounting.
The unref method should never be called with the LOCK held since this might deadlock the dispose function.
- do_deep_notify(orig, pspec) virtual¶
- Parameters:
orig (
Gst.Object
) –pspec (
GObject.ParamSpec
) –
default signal handler
Signal Details¶
- Gst.Object.signals.deep_notify(object, prop_object, prop)¶
- Signal Name:
deep-notify
- Flags:
- Parameters:
object (
Gst.Object
) – The object which received the signalprop_object (
Gst.Object
) – the object that originated the signalprop (
GObject.ParamSpec
) – the property that changed
The deep notify signal is used to be notified of property changes. It is typically attached to the toplevel bin to receive notifications from all the elements contained in that bin.
Property Details¶
- Gst.Object.props.name¶
-
The name of the object
- Gst.Object.props.parent¶
- Name:
parent
- Type:
- Default Value:
- Flags:
The parent of the object. Please note, that when changing the ‘parent’ property, we don’t emit
GObject.Object
::notify
andGst.Object
::deep-notify
signals due to locking issues. In some cases one can useGst.Bin
::element-added
orGst.Bin
::element-removed
signals on the parent to achieve a similar effect.