![]() |
![]() |
![]() |
GStreamer 0.11 Core Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
#include <gst/gst.h> GstBufferPool; struct GstBufferPoolClass; enum GstBufferPoolFlags; GstBufferPoolParams; GstBufferPool * gst_buffer_pool_new (void
); gboolean gst_buffer_pool_config_get (GstStructure *config
,const GstCaps **caps
,guint *size
,guint *min_buffers
,guint *max_buffers
,guint *prefix
,guint *align
); void gst_buffer_pool_config_set (GstStructure *config
,const GstCaps *caps
,guint size
,guint min_buffers
,guint max_buffers
,guint prefix
,guint align
); GstStructure * gst_buffer_pool_get_config (GstBufferPool *pool
); gboolean gst_buffer_pool_set_config (GstBufferPool *pool
,GstStructure *config
); gboolean gst_buffer_pool_set_active (GstBufferPool *pool
,gboolean active
); GstFlowReturn gst_buffer_pool_acquire_buffer (GstBufferPool *pool
,GstBuffer **buffer
,GstBufferPoolParams *params
); void gst_buffer_pool_release_buffer (GstBufferPool *pool
,GstBuffer *buffer
);
typedef struct { GstObject object; } GstBufferPool;
The structure of a GstBufferPool. Use the associated macros to access the public variables.
GstObject |
the parent structure |
struct GstBufferPoolClass { GstObjectClass object_class; /* vmethods */ const gchar ** (*get_options) (GstBufferPool *pool); gboolean (*set_config) (GstBufferPool *pool, GstStructure *config); gboolean (*start) (GstBufferPool *pool); gboolean (*stop) (GstBufferPool *pool); GstFlowReturn (*acquire_buffer) (GstBufferPool *pool, GstBuffer **buffer, GstBufferPoolParams *params); GstFlowReturn (*alloc_buffer) (GstBufferPool *pool, GstBuffer **buffer, GstBufferPoolParams *params); void (*reset_buffer) (GstBufferPool *pool, GstBuffer *buffer, GstBufferPoolParams *params); void (*release_buffer) (GstBufferPool *pool, GstBuffer *buffer); void (*free_buffer) (GstBufferPool *pool, GstBuffer *buffer); gpointer _gst_reserved[GST_PADDING]; };
The GstBufferPool class.
GstObjectClass |
Object parent class |
get a list of options supported by this pool | |
apply the bufferpool configuration. The default configuration will parse the default config parameters | |
start the bufferpool. The default implementation will preallocate min-buffers buffers and put them in the queue | |
stop the bufferpool. the default implementation will free the preallocated buffers. This function is called when all the buffers are returned to the pool. | |
get a new buffer from the pool. The default implementation will take a buffer from the queue and optionally wait for a buffer to be released when there are no buffers available. | |
allocate a buffer. the default implementation allocates buffers from the default memory allocator and with the configured size, prefix and alignment. | |
reset the buffer to its state when it was freshly allocated. The default implementation will clear the flags and timestamps. | |
release a buffer back in the pool. The default implementation will put the buffer back in the queue and notify any blocking acquire_buffer calls. | |
free a buffer. The default implementation unrefs the buffer. | |
gpointer |
typedef enum { GST_BUFFER_POOL_FLAG_NONE = 0, GST_BUFFER_POOL_FLAG_KEY_UNIT = (1 << 0), GST_BUFFER_POOL_FLAG_DONTWAIT = (1 << 1), GST_BUFFER_POOL_FLAG_DISCONT = (1 << 2), GST_BUFFER_POOL_FLAG_LAST = (1 << 16), } GstBufferPoolFlags;
Additional flags to control the allocation of a buffer
typedef struct { GstFormat format; gint64 start; gint64 stop; GstBufferPoolFlags flags; } GstBufferPoolParams;
Parameters passed to the gst_buffer_pool_acquire_buffer()
function to control the
allocation of the buffer.
The default implementation ignores the start
and stop
members but other
implementations can use this extra information to decide what buffer to
return.
GstFormat |
the format of start and stop
|
gint64 |
the start position |
gint64 |
the stop position |
GstBufferPoolFlags |
additional flags |
GstBufferPool * gst_buffer_pool_new (void
);
Creates a new GstBufferPool instance.
Returns : |
a new GstBufferPool instance |
gboolean gst_buffer_pool_config_get (GstStructure *config
,const GstCaps **caps
,guint *size
,guint *min_buffers
,guint *max_buffers
,guint *prefix
,guint *align
);
Get the configuration values from config
.
|
a GstBufferPool configuration |
|
the caps of buffers |
|
the size of each buffer, not including prefix |
|
the minimum amount of buffers to allocate. |
|
the maximum amount of buffers to allocate or 0 for unlimited. |
|
prefix each buffer with this many bytes |
|
alignment of the buffer data. |
void gst_buffer_pool_config_set (GstStructure *config
,const GstCaps *caps
,guint size
,guint min_buffers
,guint max_buffers
,guint prefix
,guint align
);
Configure config
with the given parameters.
|
a GstBufferPool configuration |
|
caps for the buffers |
|
the size of each buffer, not including prefix |
|
the minimum amount of buffers to allocate. |
|
the maximum amount of buffers to allocate or 0 for unlimited. |
|
prefix each buffer with this many bytes |
|
alignment of the buffer data. |
GstStructure * gst_buffer_pool_get_config (GstBufferPool *pool
);
Get a copy of the current configuration of the pool. This configuration
can either be modified and used for the gst_buffer_pool_set_config()
call
or it must be freed after usage.
|
a GstBufferPool |
Returns : |
a copy of the current configuration of pool . use
gst_structure_free() after usage or gst_buffer_pool_set_config() . |
gboolean gst_buffer_pool_set_config (GstBufferPool *pool
,GstStructure *config
);
Set the configuration of the pool. The pool must be inactive and all buffers allocated form 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()
. This function takes ownership of config
.
|
a GstBufferPool |
|
a GstStructure |
Returns : |
TRUE when the configuration could be set. |
gboolean gst_buffer_pool_set_active (GstBufferPool *pool
,gboolean active
);
Control the active state of pool
. When the pool is active, new calls to
gst_buffer_pool_acquire_buffer()
will return with GST_FLOW_WRONG_STATE.
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.
|
a GstBufferPool |
|
the new active state |
Returns : |
FALSE when the pool was not configured or when preallocation of the
buffers failed. |
GstFlowReturn gst_buffer_pool_acquire_buffer (GstBufferPool *pool
,GstBuffer **buffer
,GstBufferPoolParams *params
);
Acquire a buffer from pool
. buffer
should point to a memory location that
can hold a pointer to the new buffer.
params
can be NULL or contain optional parameters to influence the allocation.
|
a GstBufferPool |
|
a location for a GstBuffer |
|
parameters. |
Returns : |
a GstFlowReturn such as GST_FLOW_WRONG_STATE when the pool is inactive. |
void gst_buffer_pool_release_buffer (GstBufferPool *pool
,GstBuffer *buffer
);
Release 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.
|
a GstBufferPool |
|
a GstBuffer |