GStreamer 学习记录 - GstBufferPool

GstBufferPool — Pool for buffers

 

Description

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

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 a 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.

Use gst_object_unref() to release the reference to a bufferpool. If the refcount of the pool reaches 0, the pool will be freed.

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值