Trait gstreamer::subclass::prelude::BufferPoolImpl

source ·
pub trait BufferPoolImpl: BufferPoolImplExt + GstObjectImpl + Send + Sync {
    // Provided methods
    fn acquire_buffer(
        &self,
        params: Option<&BufferPoolAcquireParams>,
    ) -> Result<Buffer, FlowError> { ... }
    fn alloc_buffer(
        &self,
        params: Option<&BufferPoolAcquireParams>,
    ) -> Result<Buffer, FlowError> { ... }
    fn flush_start(&self) { ... }
    fn flush_stop(&self) { ... }
    fn free_buffer(&self, buffer: Buffer) { ... }
    fn release_buffer(&self, buffer: Buffer) { ... }
    fn reset_buffer(&self, buffer: &mut BufferRef) { ... }
    fn start(&self) -> bool { ... }
    fn stop(&self) -> bool { ... }
    fn options() -> &'static [&'static str] { ... }
    fn set_config(&self, config: &mut BufferPoolConfigRef) -> bool { ... }
}

Provided Methods§

source

fn acquire_buffer( &self, params: Option<&BufferPoolAcquireParams>, ) -> Result<Buffer, FlowError>

Acquires a buffer from self. 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.

params can contain optional parameters to influence the allocation.

§params

parameters.

§Returns

a FlowReturn such as FlowReturn::Flushing when the pool is inactive.

§buffer

a location for a Buffer

source

fn alloc_buffer( &self, params: Option<&BufferPoolAcquireParams>, ) -> Result<Buffer, FlowError>

Allocate a buffer. the default implementation allocates buffers from the configured memory allocator and with the configured parameters. All metadata that is present on the allocated buffer will be marked as MetaFlags::POOLED and MetaFlags::LOCKED and will not be removed from the buffer in GstBufferPoolClass::reset_buffer. The buffer should have the BufferFlags::TAG_MEMORY cleared.

§params

parameters.

§Returns

a FlowReturn to indicate whether the allocation was successful.

§buffer

a location for a Buffer

source

fn flush_start(&self)

Enter the flushing state.

source

fn flush_stop(&self)

Leave the flushing state.

source

fn free_buffer(&self, buffer: Buffer)

Free a buffer. The default implementation unrefs the buffer.

§buffer

the Buffer to free

source

fn release_buffer(&self, buffer: Buffer)

Releases buffer to self. buffer should have previously been allocated from self with BufferPoolExtManual::acquire_buffer().

This function is usually called automatically when the last ref on buffer disappears.

§buffer

a Buffer

source

fn reset_buffer(&self, buffer: &mut BufferRef)

Reset the buffer to its state when it was freshly allocated. The default implementation will clear the flags, timestamps and will remove the metadata without the MetaFlags::POOLED flag (even the metadata with MetaFlags::LOCKED). If the BufferFlags::TAG_MEMORY was set, this function can also try to restore the memory and clear the BufferFlags::TAG_MEMORY again.

§buffer

the Buffer to reset

source

fn start(&self) -> bool

Start the bufferpool. The default implementation will preallocate min-buffers buffers and put them in the queue.

Subclasses do not need to chain up to the parent’s default implementation if they don’t want min-buffers based preallocation.

§Returns

whether the pool could be started.

source

fn stop(&self) -> bool

Stop the bufferpool. the default implementation will free the preallocated buffers. This function is called when all the buffers are returned to the pool.

§Returns

whether the pool could be stopped.

source

fn options() -> &'static [&'static str]

Gets a None terminated array of string with supported bufferpool options for self. An option would typically be enabled with gst_buffer_pool_config_add_option().

§Returns

a None terminated array of strings.

source

fn set_config(&self, config: &mut BufferPoolConfigRef) -> bool

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.

config is a Structure that contains the configuration parameters for the pool. A default and mandatory set of parameters can be configured with gst_buffer_pool_config_set_params(), gst_buffer_pool_config_set_allocator() and gst_buffer_pool_config_add_option().

If the parameters in config can not be set exactly, this function returns false and will try to update as much state as possible. The new state can then be retrieved and refined with BufferPoolExtManual::config().

This function takes ownership of config.

§config

a Structure

§Returns

true when the configuration could be set.

Object Safety§

This trait is not object safe.

Implementors§