bufferpool: add gst_buffer_pool_is_active()
authorWim Taymans <wim.taymans@collabora.co.uk>
Thu, 4 Aug 2011 08:54:29 +0000 (10:54 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Thu, 4 Aug 2011 08:54:29 +0000 (10:54 +0200)
gst/gstbufferpool.c
gst/gstbufferpool.h
win32/common/libgstreamer.def

index 19a0ee4..1701106 100644 (file)
@@ -293,6 +293,13 @@ do_stop (GstBufferPool * pool)
  * 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.
+ *
  * Returns: %FALSE when the pool was not configured or when preallocation of the
  * buffers failed.
  */
@@ -368,6 +375,27 @@ stop_failed:
   }
 }
 
+/**
+ * gst_buffer_pool_is_active:
+ * @pool: a #GstBufferPool
+ *
+ * Check if @pool is active. A pool can be activated with the
+ * gst_buffer_pool_set_active() call.
+ *
+ * Returns: %TRUE when the pool is active.
+ */
+gboolean
+gst_buffer_pool_is_active (GstBufferPool * pool)
+{
+  gboolean res;
+
+  GST_BUFFER_POOL_LOCK (pool);
+  res = pool->active;
+  GST_BUFFER_POOL_UNLOCK (pool);
+
+  return res;
+}
+
 static gboolean
 default_set_config (GstBufferPool * pool, GstStructure * config)
 {
index 115b052..4d6ce6d 100644 (file)
@@ -179,6 +179,7 @@ GstBufferPool *  gst_buffer_pool_new  (void);
 
 /* state management */
 gboolean         gst_buffer_pool_set_active      (GstBufferPool *pool, gboolean active);
+gboolean         gst_buffer_pool_is_active       (GstBufferPool *pool);
 
 gboolean         gst_buffer_pool_set_config      (GstBufferPool *pool, GstStructure *config);
 GstStructure *   gst_buffer_pool_get_config      (GstBufferPool *pool);
index 35ad278..76e02f0 100644 (file)
@@ -135,6 +135,7 @@ EXPORTS
        gst_buffer_pool_get_options
        gst_buffer_pool_get_type
        gst_buffer_pool_has_option
+       gst_buffer_pool_is_active
        gst_buffer_pool_new
        gst_buffer_pool_release_buffer
        gst_buffer_pool_set_active