summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2011-03-03 16:31:49 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2011-03-04 10:15:36 +0100
commitbe5d5587b7c3c55ebb2bbb23f3e155524bb831af (patch)
tree390cd5ab52b5b5832910f85e12a2b424e08010ea
parent4bbd340c3fdf982d55074fbb5e531df6e27184d3 (diff)
bufferpool: add caps to the config
Add the caps to the configuration parameters of the pool. Initialize the private data
-rw-r--r--gst/gstbufferpool.c25
-rw-r--r--gst/gstbufferpool.h8
-rw-r--r--gst/gstquark.c2
-rw-r--r--gst/gstquark.h15
4 files changed, 28 insertions, 22 deletions
diff --git a/gst/gstbufferpool.c b/gst/gstbufferpool.c
index de04b3ebc..2dda89ebd 100644
--- a/gst/gstbufferpool.c
+++ b/gst/gstbufferpool.c
@@ -83,6 +83,8 @@ gst_buffer_pool_class_init (GstBufferPoolClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
+ g_type_class_add_private (klass, sizeof (GstBufferPoolPrivate));
+
gobject_class->finalize = gst_buffer_pool_finalize;
klass->start = default_start;
@@ -108,7 +110,7 @@ gst_buffer_pool_init (GstBufferPool * pool)
pool->configured = FALSE;
pool->started = FALSE;
pool->config = gst_structure_id_empty_new (GST_QUARK (BUFFER_POOL_CONFIG));
- gst_buffer_pool_config_set (pool->config, 0, 0, 0, 0, 0, 1);
+ gst_buffer_pool_config_set (pool->config, NULL, 0, 0, 0, 0, 0, 1);
GST_DEBUG_OBJECT (pool, "created");
}
@@ -362,11 +364,12 @@ static gboolean
default_set_config (GstBufferPool * pool, GstStructure * config)
{
GstBufferPoolPrivate *priv = pool->priv;
+ const GstCaps *caps;
guint size, min_buffers, max_buffers;
guint prefix, postfix, align;
/* parse the config and keep around */
- if (!gst_buffer_pool_config_get (config, &size, &min_buffers,
+ if (!gst_buffer_pool_config_get (config, &caps, &size, &min_buffers,
&max_buffers, &prefix, &postfix, &align))
goto wrong_config;
@@ -492,13 +495,14 @@ gst_buffer_pool_get_config (GstBufferPool * pool)
* Configure @config with the given parameters.
*/
void
-gst_buffer_pool_config_set (GstStructure * config, guint size,
- guint min_buffers, guint max_buffers, guint prefix, guint postfix,
- guint align)
+gst_buffer_pool_config_set (GstStructure * config, const GstCaps * caps,
+ guint size, guint min_buffers, guint max_buffers, guint prefix,
+ guint postfix, guint align)
{
g_return_if_fail (config != NULL);
gst_structure_id_set (config,
+ GST_QUARK (CAPS), GST_TYPE_CAPS, caps,
GST_QUARK (SIZE), G_TYPE_UINT, size,
GST_QUARK (MIN_BUFFERS), G_TYPE_UINT, min_buffers,
GST_QUARK (MAX_BUFFERS), G_TYPE_UINT, max_buffers,
@@ -520,13 +524,14 @@ gst_buffer_pool_config_set (GstStructure * config, guint size,
* Get the configuration values from @config.
*/
gboolean
-gst_buffer_pool_config_get (GstStructure * config, guint * size,
- guint * min_buffers, guint * max_buffers, guint * prefix, guint * postfix,
- guint * align)
+gst_buffer_pool_config_get (GstStructure * config, const GstCaps ** caps,
+ guint * size, guint * min_buffers, guint * max_buffers, guint * prefix,
+ guint * postfix, guint * align)
{
g_return_val_if_fail (config != NULL, FALSE);
return gst_structure_id_get (config,
+ GST_QUARK (CAPS), GST_TYPE_CAPS, caps,
GST_QUARK (SIZE), G_TYPE_UINT, size,
GST_QUARK (MIN_BUFFERS), G_TYPE_UINT, min_buffers,
GST_QUARK (MAX_BUFFERS), G_TYPE_UINT, max_buffers,
@@ -685,8 +690,8 @@ gst_buffer_pool_release_buffer (GstBufferPool * pool, GstBuffer * buffer)
/* check that the buffer is ours, all buffers returned to the pool have the
* pool member set to NULL and the pool refcount decreased */
- if (!g_atomic_pointer_compare_and_exchange ((gpointer *) & buffer->pool, pool,
- NULL))
+ if (!g_atomic_pointer_compare_and_exchange ((gpointer *) & buffer->pool,
+ pool, NULL))
return;
pclass = GST_BUFFER_POOL_GET_CLASS (pool);
diff --git a/gst/gstbufferpool.h b/gst/gstbufferpool.h
index 17f9e516b..50c5c638f 100644
--- a/gst/gstbufferpool.h
+++ b/gst/gstbufferpool.h
@@ -141,11 +141,11 @@ gboolean gst_buffer_pool_set_config (GstBufferPool *pool, GstS
GstStructure * gst_buffer_pool_get_config (GstBufferPool *pool);
/* helpers for configuring the config structure */
-void gst_buffer_pool_config_set (GstStructure *config, guint size,
- guint min_buffers, guint max_buffers,
+void gst_buffer_pool_config_set (GstStructure *config, const GstCaps *caps,
+ guint size, guint min_buffers, guint max_buffers,
guint prefix, guint postfix, guint align);
-gboolean gst_buffer_pool_config_get (GstStructure *config, guint *size,
- guint *min_buffers, guint *max_buffers,
+gboolean gst_buffer_pool_config_get (GstStructure *config, const GstCaps **caps,
+ guint *size, guint *min_buffers, guint *max_buffers,
guint *prefix, guint *postfix, guint *align);
/* buffer management */
diff --git a/gst/gstquark.c b/gst/gstquark.c
index 45ce87b2b..3068bbf7f 100644
--- a/gst/gstquark.c
+++ b/gst/gstquark.c
@@ -50,7 +50,7 @@ static const gchar *_quark_strings[] = {
"intermediate", "GstMessageStepStart", "active", "eos", "sink-message",
"message", "GstMessageQOS", "running-time", "stream-time", "jitter",
"quality", "processed", "dropped", "buffering-ranges", "GstMessageProgress",
- "code", "text", "percent", "timeout", "GstBufferPoolConfig", "size",
+ "code", "text", "percent", "timeout", "GstBufferPoolConfig", "caps", "size",
"min-buffers", "max-buffers", "prefix", "postfix", "align"
};
diff --git a/gst/gstquark.h b/gst/gstquark.h
index 95f44891b..00a77e791 100644
--- a/gst/gstquark.h
+++ b/gst/gstquark.h
@@ -133,14 +133,15 @@ typedef enum _GstQuarkId
GST_QUARK_PERCENT = 104,
GST_QUARK_TIMEOUT = 105,
GST_QUARK_BUFFER_POOL_CONFIG = 106,
- GST_QUARK_SIZE = 107,
- GST_QUARK_MIN_BUFFERS = 108,
- GST_QUARK_MAX_BUFFERS = 109,
- GST_QUARK_PREFIX = 110,
- GST_QUARK_POSTFIX = 111,
- GST_QUARK_ALIGN = 112,
+ GST_QUARK_CAPS = 107,
+ GST_QUARK_SIZE = 108,
+ GST_QUARK_MIN_BUFFERS = 109,
+ GST_QUARK_MAX_BUFFERS = 110,
+ GST_QUARK_PREFIX = 111,
+ GST_QUARK_POSTFIX = 112,
+ GST_QUARK_ALIGN = 113,
- GST_QUARK_MAX = 113
+ GST_QUARK_MAX = 114
} GstQuarkId;
extern GQuark _priv_gst_quark_table[GST_QUARK_MAX];