Klasse BufferPool

Alle implementierten Schnittstellen:
PointerInterface

public class BufferPool extends PropertyHolder
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_new().

Once a pool is created, it needs to be configured. A call to
gst_buffer_pool_get_config() returns the current configuration structure from
the pool. With gst_buffer_pool_config_set_params() and
gst_buffer_pool_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_buffer_pool_config_add_option(). The available options can be retrieved
with gst_buffer_pool_get_options(). Some options allow for additional
configuration properties to be set.

After the configuration structure has been configured,
gst_buffer_pool_set_config() 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_set_active(). This will preallocate the configured resources
in the pool.

When the pool is active, gst_buffer_pool_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_buffer_pool_release_buffer() when their refcount drops to 0.

The bufferpool can be deactivated again with gst_buffer_pool_set_active().
All further gst_buffer_pool_acquire_buffer() calls will return an error. When
all buffers are returned to the pool they will be freed.

https://gstreamer.freedesktop.org/documentation/gstreamer/gi-index.html

  • Konstruktordetails

    • BufferPool

      public BufferPool(PointerContainer pointer)
    • BufferPool

      public BufferPool()
      Creates a new #GstBufferPool instance.
  • Methodendetails

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getConfig

      public Structure getConfig()
      Gets a copy of the current configuration of the pool. This configuration
      can be modified and used for the gst_buffer_pool_set_config() call.
      Gibt zurück:
      a copy of the current configuration of @pool.
    • hasOption

      public boolean hasOption(@Nonnull Str option)
      Checks if the bufferpool supports @option.
      Parameter:
      option - an option
      Gibt zurück:
      %TRUE if the buffer pool contains @option.
    • hasOption

      public boolean hasOption(String option)
      Checks if the bufferpool supports @option.
      Parameter:
      option - an option
      Gibt zurück:
      %TRUE if the buffer pool contains @option.
    • isActive

      public boolean isActive()
      Checks if @pool is active. A pool can be activated with the
      gst_buffer_pool_set_active() call.
      Gibt zurück:
      %TRUE when the pool is active.
    • releaseBuffer

      public void releaseBuffer(@Nonnull Buffer buffer)
      Releases @buffer to @pool. @buffer should have previously been allocated from
      @pool with gst_buffer_pool_acquire_buffer().

      This function is usually called automatically when the last ref on @buffer
      disappears.
      Parameter:
      buffer - a #GstBuffer
    • setActive

      public boolean setActive(boolean active)
      Controls the active state of @pool. When the pool is inactive, new calls to
      gst_buffer_pool_acquire_buffer() will return with %GST_FLOW_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.
      Parameter:
      active - the new active state
      Gibt zurück:
      %FALSE when the pool was not configured or when preallocation of the buffers failed.
    • setConfig

      public boolean setConfig(@Nonnull 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.

      @config is a #GstStructure 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 gst_buffer_pool_get_config().

      This function takes ownership of @config.
      Parameter:
      config - a #GstStructure
      Gibt zurück:
      %TRUE when the configuration could be set.
    • setFlushing

      public void setFlushing(boolean flushing)
      Enables or disables the flushing state of a @pool without freeing or
      allocating buffers.
      Parameter:
      flushing - whether to start or stop flushing
    • configAddOption

      public static void configAddOption(@Nonnull Structure config, @Nonnull Str option)
      Enables the option in @config. This will instruct the @bufferpool to enable
      the specified option on the buffers that it allocates.

      The options supported by @pool can be retrieved with gst_buffer_pool_get_options().
      Parameter:
      config - a #GstBufferPool configuration
      option - an option to add
    • configGetOption

      public static Str configGetOption(@Nonnull Structure config, int index)
      Parses an available @config and gets the option at @index of the options API
      array.
      Parameter:
      config - a #GstBufferPool configuration
      index - position in the option array to read
      Gibt zurück:
      the option at @index.
    • configHasOption

      public static boolean configHasOption(@Nonnull Structure config, @Nonnull Str option)
      Checks if @config contains @option.
      Parameter:
      config - a #GstBufferPool configuration
      option - an option
      Gibt zurück:
      %TRUE if the options array contains @option.
    • configNOptions

      public static int configNOptions(@Nonnull Structure config)
      Retrieves the number of values currently stored in the options array of the
      @config structure.
      Parameter:
      config - a #GstBufferPool configuration
      Gibt zurück:
      the options array size as a #guint.
    • configSetAllocator

      public static void configSetAllocator(@Nonnull Structure config, @Nullable Allocator allocator, @Nullable AllocationParams params)
      Sets the @allocator and @params on @config.

      One of @allocator and @params can be %NULL, but not both. When @allocator
      is %NULL, the default allocator of the pool will use the values in @param
      to perform its allocation. When @param is %NULL, the pool will use the
      provided @allocator with its default #GstAllocationParams.

      A call to gst_buffer_pool_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_buffer_pool_get_config() to get the currently
      used values.
      Parameter:
      config - a #GstBufferPool configuration
      allocator - a #GstAllocator
      params - #GstAllocationParams
    • configSetParams

      public static void configSetParams(@Nonnull Structure config, @Nullable Caps caps, int size, int min_buffers, int max_buffers)
      Configures @config with the given parameters.
      Parameter:
      config - a #GstBufferPool configuration
      caps - caps for the 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.
    • configValidateParams

      public static boolean configValidateParams(@Nonnull Structure config, @Nullable Caps caps, int size, int min_buffers, int max_buffers)
      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_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.
      Parameter:
      config - a #GstBufferPool configuration
      caps - the excepted caps of buffers
      size - the expected size of each buffer, not including prefix and padding
      min_buffers - the expected minimum amount of buffers to allocate.
      max_buffers - the expect maximum amount of buffers to allocate or 0 for unlimited.
      Gibt zurück:
      %TRUE, if the parameters are valid in this context.
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()