BufferPool

A #GstBufferPool is an object that can be used to pre-allocate and recycle buffers of the same size and with the same properties.

A #GstBufferPool is created with gst.buffer_pool.BufferPool.new_.

Once a pool is created, it needs to be configured. A call to gst.buffer_pool.BufferPool.getConfig returns the current configuration structure from the pool. With gst.buffer_pool.BufferPool.configSetParams and gst.buffer_pool.BufferPool.configSetAllocator the bufferpool parameters and allocator can be configured. Other properties can be configured in the pool depending on the pool implementation.

A bufferpool can have extra options that can be enabled with gst.buffer_pool.BufferPool.configAddOption. The available options can be retrieved with gst.buffer_pool.BufferPool.getOptions. Some options allow for additional configuration properties to be set.

After the configuration structure has been configured, gst.buffer_pool.BufferPool.setConfig updates the configuration in the pool. This can fail when the configuration structure is not accepted.

After the pool has been configured, it can be activated with gst.buffer_pool.BufferPool.setActive. This will preallocate the configured resources in the pool.

When the pool is active, gst.buffer_pool.BufferPool.acquireBuffer can be used to retrieve a buffer from the pool.

Buffers allocated from a bufferpool will automatically be returned to the pool with gst.buffer_pool.BufferPool.releaseBuffer when their refcount drops to 0.

The bufferpool can be deactivated again with gst.buffer_pool.BufferPool.setActive. All further gst.buffer_pool.BufferPool.acquireBuffer calls will return an error. When all buffers are returned to the pool they will be freed.

Constructors

this
this()

Creates a new #GstBufferPool instance.

Members

Functions

acquireBuffer
gst.types.FlowReturn acquireBuffer(gst.buffer.Buffer buffer, gst.types.BufferPoolAcquireParams params)

Acquires a buffer from pool. buffer should point to a memory location that can hold a pointer to the new buffer. When the pool is empty, this function will by default block until a buffer is released into the pool again or when the pool is set to flushing or deactivated.

getConfig
gst.structure.Structure getConfig()

Gets a copy of the current configuration of the pool. This configuration can be modified and used for the gst.buffer_pool.BufferPool.setConfig call.

getOptions
string[] getOptions()

Gets a null terminated array of string with supported bufferpool options for pool. An option would typically be enabled with gst.buffer_pool.BufferPool.configAddOption.

hasOption
bool hasOption(string option)

Checks if the bufferpool supports option.

isActive
bool isActive()

Checks if pool is active. A pool can be activated with the gst.buffer_pool.BufferPool.setActive call.

releaseBuffer
void releaseBuffer(gst.buffer.Buffer buffer)

Releases buffer to pool. buffer should have previously been allocated from pool with gst.buffer_pool.BufferPool.acquireBuffer.

setActive
bool setActive(bool active)

Controls the active state of pool. When the pool is inactive, new calls to gst.buffer_pool.BufferPool.acquireBuffer will return with gst.types.FlowReturn.Flushing.

setConfig
bool setConfig(gst.structure.Structure config)

Sets the configuration of the pool. If the pool is already configured, and the configuration hasn't changed, this function will return true. If the pool is active, this method will return false and active configuration will remain. Buffers allocated from this pool must be returned or else this function will do nothing and return false.

setFlushing
void setFlushing(bool flushing)

Enables or disables the flushing state of a pool without freeing or allocating buffers.

Static functions

configAddOption
void configAddOption(gst.structure.Structure config, string option)

Enables the option in config. This will instruct the bufferpool to enable the specified option on the buffers that it allocates.

configGetAllocator
bool configGetAllocator(gst.structure.Structure config, gst.allocator.Allocator allocator, gst.allocation_params.AllocationParams params)

Gets the allocator and params from config.

configGetOption
string configGetOption(gst.structure.Structure config, uint index)

Parses an available config and gets the option at index of the options API array.

configGetParams
bool configGetParams(gst.structure.Structure config, gst.caps.Caps caps, uint size, uint minBuffers, uint maxBuffers)

Gets the configuration values from config.

configHasOption
bool configHasOption(gst.structure.Structure config, string option)

Checks if config contains option.

configNOptions
uint configNOptions(gst.structure.Structure config)

Retrieves the number of values currently stored in the options array of the config structure.

configSetAllocator
void configSetAllocator(gst.structure.Structure config, gst.allocator.Allocator allocator, gst.allocation_params.AllocationParams params)

Sets the allocator and params on config.

configSetParams
void configSetParams(gst.structure.Structure config, gst.caps.Caps caps, uint size, uint minBuffers, uint maxBuffers)

Configures config with the given parameters.

configValidateParams
bool configValidateParams(gst.structure.Structure config, gst.caps.Caps caps, uint size, uint minBuffers, uint maxBuffers)

Validates that changes made to config are still valid in the context of the expected parameters. This function is a helper that can be used to validate changes made by a pool to a config when gst.buffer_pool.BufferPool.setConfig returns false. This expects that caps haven't changed and that min_buffers aren't lower then what we initially expected. This does not check if options or allocator parameters are still valid, won't check if size have changed, since changing the size is valid to adapt padding.

Inherited Members

From ObjectGst

checkUniqueness
bool checkUniqueness(gst.object.ObjectGst[] list, string name)

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 #GstObject in the list to compare the name, so be careful when passing a list with a locked object.

defaultDeepNotify
void defaultDeepNotify(gobject.object.ObjectG object, gst.object.ObjectGst orig, gobject.param_spec.ParamSpec pspec, string[] excludedProps)

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.

replace
bool replace(gst.object.ObjectGst oldobj, gst.object.ObjectGst newobj)

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.

addControlBinding
bool addControlBinding(gst.control_binding.ControlBinding binding)

Attach the #GstControlBinding to the object. If there already was a #GstControlBinding for this property it will be replaced.

defaultError
void defaultError(glib.error.ErrorG error, string debug_)

A default error function that uses glib.global.printerr to display the error message and the optional debug string..

getControlBinding
gst.control_binding.ControlBinding getControlBinding(string propertyName)

Gets the corresponding #GstControlBinding for the property. This should be unreferenced again after use.

getControlRate
gst.types.ClockTime getControlRate()

Obtain the control-rate for this object. Audio processing #GstElement objects will use this rate to sub-divide their processing loop and call gst.object.ObjectGst.syncValues in between. The length of the processing segment should be up to control-rate nanoseconds.

getGValueArray
bool getGValueArray(string propertyName, gst.types.ClockTime timestamp, gst.types.ClockTime interval, gobject.value.Value[] values)

Gets a number of #GValues for the given controlled property starting at the requested time. The array values need to hold enough space for n_values of #GValue.

getName
string getName()

Returns a copy of the name of object. Caller should glib.global.gfree the return value after usage. For a nameless object, this returns null, which you can safely glib.global.gfree as well.

getParent
gst.object.ObjectGst getParent()

Returns the parent of object. This function increases the refcount of the parent object so you should gst.object.ObjectGst.unref it after usage.

getPathString
string getPathString()

Generates a string describing the path of object in the object hierarchy. Only useful (or used) for debugging.

getValue
gobject.value.Value getValue(string propertyName, gst.types.ClockTime timestamp)

Gets the value for the given controlled property at the requested time.

hasActiveControlBindings
bool hasActiveControlBindings()

Check if the object has active controlled properties.

hasAncestor
bool hasAncestor(gst.object.ObjectGst ancestor)

Check if object has an ancestor ancestor somewhere up in the hierarchy. One can e.g. check if a #GstElement is inside a #GstPipeline.

hasAsAncestor
bool hasAsAncestor(gst.object.ObjectGst ancestor)

Check if object has an ancestor ancestor somewhere up in the hierarchy. One can e.g. check if a #GstElement is inside a #GstPipeline.

hasAsParent
bool hasAsParent(gst.object.ObjectGst parent)

Check if parent is the parent of object. E.g. a #GstElement can check if it owns a given #GstPad.

removeControlBinding
bool removeControlBinding(gst.control_binding.ControlBinding binding)

Removes the corresponding #GstControlBinding. If it was the last ref of the binding, it will be disposed.

setControlBindingDisabled
void setControlBindingDisabled(string propertyName, bool disabled)

This function is used to disable the control bindings on a property for some time, i.e. gst.object.ObjectGst.syncValues will do nothing for the property.

setControlBindingsDisabled
void setControlBindingsDisabled(bool disabled)

This function is used to disable all controlled properties of the object for some time, i.e. gst.object.ObjectGst.syncValues will do nothing.

setControlRate
void setControlRate(gst.types.ClockTime controlRate)

Change the control-rate for this object. Audio processing #GstElement objects will use this rate to sub-divide their processing loop and call gst.object.ObjectGst.syncValues in between. The length of the processing segment should be up to control-rate nanoseconds.

setName
bool setName(string name)

Sets the name of object, or gives object a guaranteed unique name (if name is null). This function makes a copy of the provided name, so the caller retains ownership of the name it sent.

setParent
bool setParent(gst.object.ObjectGst parent)

Sets the parent of object to parent. The object's reference count will be incremented, and any floating reference will be removed (see gst.object.ObjectGst.refSink).

suggestNextSync
gst.types.ClockTime suggestNextSync()

Returns a suggestion for timestamps where buffers should be split to get best controller results.

syncValues
bool syncValues(gst.types.ClockTime timestamp)

Sets the properties of the object, according to the #GstControlSources that (maybe) handle them and for the given timestamp.

unparent
void unparent()

Clear the parent of object, removing the associated reference. This function decreases the refcount of object.

connectDeepNotify
ulong connectDeepNotify(string detail, T callback, Flag!"After" after)

Connect to DeepNotify signal.