X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gst%2Fgstbufferpool.h;h=d36d066d9d372a5799d12400ea4c5996d2eb746d;hb=706e10ad0586bf98c829cdfaa079118447b94ef5;hp=aad3b2202a0c45e095faaeff63613585d63217e1;hpb=225721f578c17acd1b76686108789cac7097d652;p=platform%2Fupstream%2Fgstreamer.git diff --git a/gst/gstbufferpool.h b/gst/gstbufferpool.h index aad3b22..d36d066 100644 --- a/gst/gstbufferpool.h +++ b/gst/gstbufferpool.h @@ -15,8 +15,8 @@ * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. */ @@ -44,8 +44,9 @@ typedef struct _GstBufferPoolClass GstBufferPoolClass; * GstBufferPoolAcquireFlags: * @GST_BUFFER_POOL_ACQUIRE_FLAG_NONE: no flags * @GST_BUFFER_POOL_ACQUIRE_FLAG_KEY_UNIT: buffer is keyframe - * @GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT: don't wait for buffer. This makes the - * acquire_buffer method return GST_FLOW_EOS. + * @GST_BUFFER_POOL_ACQUIRE_FLAG_DONTWAIT: when the bufferpool is empty, acquire_buffer + * will by default block until a buffer is released into the pool again. Setting + * this flag makes acquire_buffer return #GST_FLOW_EOS instead of blocking. * @GST_BUFFER_POOL_ACQUIRE_FLAG_DISCONT: buffer is discont * @GST_BUFFER_POOL_ACQUIRE_FLAG_LAST: last flag, subclasses can use private flags * starting from this value. @@ -60,6 +61,8 @@ typedef enum { GST_BUFFER_POOL_ACQUIRE_FLAG_LAST = (1 << 16), } GstBufferPoolAcquireFlags; +typedef struct _GstBufferPoolAcquireParams GstBufferPoolAcquireParams; + /** * GstBufferPoolAcquireParams: * @format: the format of @start and @stop @@ -74,7 +77,7 @@ typedef enum { * implementations can use this extra information to decide what buffer to * return. */ -typedef struct _GstBufferPoolAcquireParams { +struct _GstBufferPoolAcquireParams { GstFormat format; gint64 start; gint64 stop; @@ -82,7 +85,7 @@ typedef struct _GstBufferPoolAcquireParams { /*< private >*/ gpointer _gst_reserved[GST_PADDING]; -} GstBufferPoolAcquireParams; +}; /** * GST_BUFFER_POOL_IS_FLUSHING: @@ -95,7 +98,6 @@ typedef struct _GstBufferPoolAcquireParams { /** * GstBufferPool: - * @object: the parent structure * * The structure of a #GstBufferPool. Use the associated macros to access the public * variables. @@ -129,22 +131,30 @@ struct _GstBufferPool { * @alloc_buffer: 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 #GST_META_FLAG_POOLED and will not be removed from the - * buffer in @reset_buffer. + * be marked as #GST_META_FLAG_POOLED and #GST_META_FLAG_LOCKED and will + * not be removed from the buffer in @reset_buffer. The buffer should + * have the GST_BUFFER_FLAG_TAG_MEMORY cleared. * @reset_buffer: 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 #GST_META_FLAG_POOLED flag. + * will remove the metadata without the #GST_META_FLAG_POOLED flag (even + * the metadata with #GST_META_FLAG_LOCKED). If the + * #GST_BUFFER_FLAG_TAG_MEMORY was set, this function can also try to + * restore the memory and clear the #GST_BUFFER_FLAG_TAG_MEMORY again. * @release_buffer: 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. + * blocking acquire_buffer calls when the #GST_BUFFER_FLAG_TAG_MEMORY + * is not set on the buffer. If #GST_BUFFER_FLAG_TAG_MEMORY is set, the + * buffer will be freed with @free_buffer. * @free_buffer: free a buffer. The default implementation unrefs the buffer. + * @flush_start: enter the flushing state. (Since 1.4) + * @flush_stop: leave the flushign state. (Since 1.4) * * The GstBufferPool class. */ struct _GstBufferPoolClass { GstObjectClass object_class; - /* vmethods */ + /*< public >*/ const gchar ** (*get_options) (GstBufferPool *pool); gboolean (*set_config) (GstBufferPool *pool, GstStructure *config); @@ -155,50 +165,90 @@ struct _GstBufferPoolClass { GstBufferPoolAcquireParams *params); GstFlowReturn (*alloc_buffer) (GstBufferPool *pool, GstBuffer **buffer, GstBufferPoolAcquireParams *params); - void (*reset_buffer) (GstBufferPool *pool, GstBuffer *buffer, - GstBufferPoolAcquireParams *params); + void (*reset_buffer) (GstBufferPool *pool, GstBuffer *buffer); void (*release_buffer) (GstBufferPool *pool, GstBuffer *buffer); void (*free_buffer) (GstBufferPool *pool, GstBuffer *buffer); + void (*flush_start) (GstBufferPool *pool); + void (*flush_stop) (GstBufferPool *pool); /*< private >*/ - gpointer _gst_reserved[GST_PADDING]; + gpointer _gst_reserved[GST_PADDING - 2]; }; +GST_API GType gst_buffer_pool_get_type (void); /* allocation */ + +GST_API GstBufferPool * gst_buffer_pool_new (void); /* state management */ + +GST_API gboolean gst_buffer_pool_set_active (GstBufferPool *pool, gboolean active); + +GST_API gboolean gst_buffer_pool_is_active (GstBufferPool *pool); +GST_API gboolean gst_buffer_pool_set_config (GstBufferPool *pool, GstStructure *config); + +GST_API GstStructure * gst_buffer_pool_get_config (GstBufferPool *pool); +GST_API const gchar ** gst_buffer_pool_get_options (GstBufferPool *pool); + +GST_API gboolean gst_buffer_pool_has_option (GstBufferPool *pool, const gchar *option); +GST_API +void gst_buffer_pool_set_flushing (GstBufferPool *pool, gboolean flushing); /* helpers for configuring the config structure */ + +GST_API void gst_buffer_pool_config_set_params (GstStructure *config, GstCaps *caps, guint size, guint min_buffers, guint max_buffers); + +GST_API gboolean gst_buffer_pool_config_get_params (GstStructure *config, GstCaps **caps, guint *size, guint *min_buffers, guint *max_buffers); + +GST_API void gst_buffer_pool_config_set_allocator (GstStructure *config, GstAllocator *allocator, const GstAllocationParams *params); + +GST_API gboolean gst_buffer_pool_config_get_allocator (GstStructure *config, GstAllocator **allocator, GstAllocationParams *params); /* options */ + +GST_API guint gst_buffer_pool_config_n_options (GstStructure *config); + +GST_API void gst_buffer_pool_config_add_option (GstStructure *config, const gchar *option); + +GST_API const gchar * gst_buffer_pool_config_get_option (GstStructure *config, guint index); + +GST_API gboolean gst_buffer_pool_config_has_option (GstStructure *config, const gchar *option); +GST_API +gboolean gst_buffer_pool_config_validate_params (GstStructure *config, GstCaps *caps, + guint size, guint min_buffers, guint max_buffers); + /* buffer management */ + +GST_API GstFlowReturn gst_buffer_pool_acquire_buffer (GstBufferPool *pool, GstBuffer **buffer, GstBufferPoolAcquireParams *params); + +GST_API void gst_buffer_pool_release_buffer (GstBufferPool *pool, GstBuffer *buffer); G_END_DECLS