Gst.BufferPool¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | Gst.Object (27), GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | config_add_option(config, option) | 
| class | config_get_allocator(config) | 
| class | config_get_option(config, index) | 
| class | config_get_params(config) | 
| class | config_has_option(config, option) | 
| class | config_n_options(config) | 
| class | config_set_allocator(config, allocator, params) | 
| class | config_set_params(config, caps, size, min_buffers, max_buffers) | 
| class | config_validate_params(config, caps, size, min_buffers, max_buffers) | 
| class | new() | 
| acquire_buffer(params) | |
| get_config() | |
| get_options() | |
| has_option(option) | |
| is_active() | |
| release_buffer(buffer) | |
| set_active(active) | |
| set_config(config) | |
| set_flushing(flushing) | 
Virtual Methods¶
| Inherited: | Gst.Object (1), GObject.Object (7) | 
|---|
| do_acquire_buffer(params) | |
| do_alloc_buffer(buffer, params) | |
| do_flush_start() | |
| do_flush_stop() | |
| do_free_buffer(buffer) | |
| do_get_options() | |
| do_release_buffer(buffer) | |
| do_reset_buffer(buffer) | |
| do_set_config(config) | |
| do_start() | |
| do_stop() | 
Properties¶
| Inherited: | Gst.Object (2) | 
|---|
Signals¶
| Inherited: | Gst.Object (1), GObject.Object (1) | 
|---|
Fields¶
| Inherited: | Gst.Object (1), GObject.Object (1) | 
|---|
| Name | Type | Access | Description | 
|---|---|---|---|
| flushing | int | r | |
| object | Gst.Object | r | 
Class Details¶
- 
class Gst.BufferPool(**kwargs)¶
- Bases: - Gst.Object- Abstract: - No - Structure: - Gst.BufferPoolClass- A - Gst.BufferPoolis an object that can be used to pre-allocate and recycle buffers of the same size and with the same properties.- A - Gst.BufferPoolis created with- Gst.BufferPool.new().- Once a pool is created, it needs to be configured. A call to - Gst.BufferPool.get_config() returns the current configuration structure from the pool. With- Gst.BufferPool.config_set_params() and- Gst.BufferPool.config_set_allocator() 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.BufferPool.config_add_option(). The available options can be retrieved with- Gst.BufferPool.get_options(). Some options allow for additional configuration properties to be set.- After the configuration structure has been configured, - Gst.BufferPool.set_config() updates the configuration in the pool. This can fail when the configuration structure is not accepted.- After the a pool has been configured, it can be activated with - Gst.BufferPool.set_active(). This will preallocate the configured resources in the pool.- When the pool is active, - Gst.BufferPool.acquire_buffer() can be used to retrieve a buffer from the pool.- Buffers allocated from a bufferpool will automatically be returned to the pool with - Gst.BufferPool.release_buffer() when their refcount drops to 0.- The bufferpool can be deactivated again with - Gst.BufferPool.set_active(). All further- Gst.BufferPool.acquire_buffer() calls will return an error. When all buffers are returned to the pool they will be freed.- Use - Gst.Object.unref() to release the reference to a bufferpool. If the refcount of the pool reaches 0, the pool will be freed.- 
classmethod config_add_option(config, option)[source]¶
- Parameters: - config (Gst.Structure) – aGst.BufferPoolconfiguration
- option (str) – an option to add
 - Enabled the option in config. This will instruct the bufferpool to enable the specified option on the buffers that it allocates. - The supported options by pool can be retrieved with - Gst.BufferPool.get_options().
- config (
 - 
classmethod config_get_allocator(config)[source]¶
- Parameters: - config ( - Gst.Structure) – a- Gst.BufferPoolconfiguration- Returns: - True, if the values are set.- allocator: - a - Gst.Allocator, or- None- params: - Gst.AllocationParams, or- None- Return type: - ( - bool, allocator:- Gst.Allocatoror- None, params:- Gst.AllocationParams)- Get the allocator and params from config. 
 - 
classmethod config_get_option(config, index)[source]¶
- Parameters: - config (Gst.Structure) – aGst.BufferPoolconfiguration
- index (int) – position in the option array to read
 - Returns: - a - strof the option at index.- Return type: - Parse an available config and get the option at index of the options API array. 
- config (
 - 
classmethod config_get_params(config)[source]¶
- Parameters: - config ( - Gst.Structure) – a- Gst.BufferPoolconfiguration- Returns: - Trueif all parameters could be fetched.- caps: - the caps of buffers - size: - the size of each buffer, not including prefix and padding - min_buffers: - the minimum amount of buffers to allocate. - max_buffers: - the maximum amount of buffers to allocate or 0 for unlimited. - Return type: - ( - bool, caps:- Gst.Capsor- None, size:- int, min_buffers:- int, max_buffers:- int)- Get the configuration values from config. 
 - 
classmethod config_has_option(config, option)[source]¶
- Parameters: - config (Gst.Structure) – aGst.BufferPoolconfiguration
- option (str) – an option
 - Returns: - Trueif the options array contains option.- Return type: - Check if config contains option. 
- config (
 - 
classmethod config_n_options(config)[source]¶
- Parameters: - config ( - Gst.Structure) – a- Gst.BufferPoolconfiguration- Returns: - the options array size as a - int.- Return type: - int- Retrieve the number of values currently stored in the options array of the config structure. 
 - 
classmethod config_set_allocator(config, allocator, params)[source]¶
- Parameters: - config (Gst.Structure) – aGst.BufferPoolconfiguration
- allocator (Gst.AllocatororNone) – aGst.Allocator
- params (Gst.AllocationParamsorNone) –Gst.AllocationParams
 - Set the allocator and params on config. - One of allocator and params can be - None, but not both. When allocator is- None, the default allocator of the pool will use the values in param to perform its allocation. When param is- None, the pool will use the provided allocator with its default- Gst.AllocationParams.- A call to - Gst.BufferPool.set_config() can update the allocator and params with the values that it is able to do. Some pools are, for example, not able to operate with different allocators or cannot allocate with the values specified in params. Use- Gst.BufferPool.get_config() to get the currently used values.
- config (
 - 
classmethod config_set_params(config, caps, size, min_buffers, max_buffers)[source]¶
- Parameters: - config (Gst.Structure) – aGst.BufferPoolconfiguration
- caps (Gst.CapsorNone) – caps for the buffers
- size (int) – the size of each buffer, not including prefix and padding
- min_buffers (int) – the minimum amount of buffers to allocate.
- max_buffers (int) – the maximum amount of buffers to allocate or 0 for unlimited.
 - Configure config with the given parameters. 
- config (
 - 
classmethod config_validate_params(config, caps, size, min_buffers, max_buffers)[source]¶
- Parameters: - config (Gst.Structure) – aGst.BufferPoolconfiguration
- caps (Gst.CapsorNone) – the excepted caps of buffers
- size (int) – the expected size of each buffer, not including prefix and padding
- min_buffers (int) – the expected minimum amount of buffers to allocate.
- max_buffers (int) – the expect maximum amount of buffers to allocate or 0 for unlimited.
 - Returns: - True, if the parameters are valid in this context.- Return type: - Validate 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.BufferPool.set_config() 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.- New in version 1.4. 
- config (
 - 
classmethod new()[source]¶
- Returns: - a new - Gst.BufferPoolinstance- Return type: - Gst.BufferPool- Creates a new - Gst.BufferPoolinstance.
 - 
acquire_buffer(params)[source]¶
- Parameters: - params ( - Gst.BufferPoolAcquireParamsor- None) – parameters.- Returns: - a - Gst.FlowReturnsuch as- Gst.FlowReturn.FLUSHINGwhen the pool is inactive.- buffer: - a location for a - Gst.Buffer- Return type: - ( - Gst.FlowReturn, buffer:- Gst.Buffer)- Acquire a buffer from self. buffer should point to a memory location that can hold a pointer to the new buffer. - params can be - Noneor contain optional parameters to influence the allocation.
 - 
get_config()[source]¶
- Returns: - a copy of the current configuration of self. use - Gst.Structure.free() after usage or- Gst.BufferPool.set_config().- Return type: - Gst.Structure- Get a copy of the current configuration of the pool. This configuration can either be modified and used for the - Gst.BufferPool.set_config() call or it must be freed after usage.
 - 
get_options()[source]¶
- Returns: - a - Noneterminated array of strings.- Return type: - [ - str]- Get a - Noneterminated array of string with supported bufferpool options for self. An option would typically be enabled with- Gst.BufferPool.config_add_option().
 - 
has_option(option)[source]¶
- Parameters: - option ( - str) – an option- Returns: - Trueif the buffer pool contains option.- Return type: - bool- Check if the bufferpool supports option. 
 - 
is_active()[source]¶
- Returns: - Truewhen the pool is active.- Return type: - bool- Check if self is active. A pool can be activated with the - Gst.BufferPool.set_active() call.
 - 
release_buffer(buffer)[source]¶
- Parameters: - buffer ( - Gst.Buffer) – a- Gst.Buffer- Release buffer to self. buffer should have previously been allocated from self with - Gst.BufferPool.acquire_buffer().- This function is usually called automatically when the last ref on buffer disappears. 
 - 
set_active(active)[source]¶
- Parameters: - active ( - bool) – the new active state- Returns: - Falsewhen the pool was not configured or when preallocation of the buffers failed.- Return type: - bool- Control the active state of self. When the pool is inactive, new calls to - Gst.BufferPool.acquire_buffer() will return with- Gst.FlowReturn.FLUSHING.- Activating the bufferpool will preallocate all resources in the pool based on the configuration of the pool. - Deactivating will free the resources again when there are no outstanding buffers. When there are outstanding buffers, they will be freed as soon as they are all returned to the pool. 
 - 
set_config(config)[source]¶
- Parameters: - config ( - Gst.Structure) – a- Gst.Structure- Returns: - Truewhen the configuration could be set.- Return type: - bool- Set the configuration of the pool. If the pool is already configured, and the configuration haven’t change, this function will return - True. If the pool is active, this method will return- Falseand active configuration will remain. Buffers allocated form this pool must be returned or else this function will do nothing and return- False.- config is a - Gst.Structurethat contains the configuration parameters for the pool. A default and mandatory set of parameters can be configured with- Gst.BufferPool.config_set_params(),- Gst.BufferPool.config_set_allocator() and- Gst.BufferPool.config_add_option().- If the parameters in config can not be set exactly, this function returns - Falseand will try to update as much state as possible. The new state can then be retrieved and refined with- Gst.BufferPool.get_config().- This function takes ownership of config. 
 - 
set_flushing(flushing)[source]¶
- Parameters: - flushing ( - bool) – whether to start or stop flushing- Enable or disable the flushing state of a self without freeing or allocating buffers. - New in version 1.4. 
 - 
do_acquire_buffer(params) virtual¶
- Parameters: - params ( - Gst.BufferPoolAcquireParamsor- None) – parameters.- Returns: - a - Gst.FlowReturnsuch as- Gst.FlowReturn.FLUSHINGwhen the pool is inactive.- buffer: - a location for a - Gst.Buffer- Return type: - ( - Gst.FlowReturn, buffer:- Gst.Buffer)- Acquire a buffer from pool. buffer should point to a memory location that can hold a pointer to the new buffer. - params can be - Noneor contain optional parameters to influence the allocation.
 - 
do_alloc_buffer(buffer, params) virtual¶
- Parameters: - buffer (Gst.Buffer) –
- params (Gst.BufferPoolAcquireParams) –
 - Return type: 
- buffer (
 - 
do_flush_start() virtual¶
 - 
do_flush_stop() virtual¶
 - 
do_free_buffer(buffer) virtual¶
- Parameters: - buffer ( - Gst.Buffer) –
 - 
do_get_options() virtual¶
- Returns: - a - Noneterminated array of strings.- Return type: - [ - str]- Get a - Noneterminated array of string with supported bufferpool options for pool. An option would typically be enabled with- Gst.BufferPool.config_add_option().
 - 
do_release_buffer(buffer) virtual¶
- Parameters: - buffer ( - Gst.Buffer) – a- Gst.Buffer- Release buffer to pool. buffer should have previously been allocated from pool with - Gst.BufferPool.acquire_buffer().- This function is usually called automatically when the last ref on buffer disappears. 
 - 
do_reset_buffer(buffer) virtual¶
- Parameters: - buffer ( - Gst.Buffer) –
 - 
do_set_config(config) virtual¶
- Parameters: - config ( - Gst.Structure) – a- Gst.Structure- Returns: - Truewhen the configuration could be set.- Return type: - bool- Set the configuration of the pool. If the pool is already configured, and the configuration haven’t change, this function will return - True. If the pool is active, this method will return- Falseand active configuration will remain. Buffers allocated form this pool must be returned or else this function will do nothing and return- False.- config is a - Gst.Structurethat contains the configuration parameters for the pool. A default and mandatory set of parameters can be configured with- Gst.BufferPool.config_set_params(),- Gst.BufferPool.config_set_allocator() and- Gst.BufferPool.config_add_option().- If the parameters in config can not be set exactly, this function returns - Falseand will try to update as much state as possible. The new state can then be retrieved and refined with- Gst.BufferPool.get_config().- This function takes ownership of config. 
 
- 
classmethod