size = GST_VIDEO_INFO_SIZE (&info);
/* we need at least 2 buffer because we hold on to the last one */
- gst_query_set_allocation_params (query, size, 2, 0, 0, 0, 0, NULL);
+ gst_query_add_allocation_pool (query, NULL, size, 2, 0);
/* we support various metadata */
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);
#include <string.h>
#include <math.h>
#include <gst/video/video.h>
+#include <gst/video/gstvideometa.h>
#include <gst/video/gstvideopool.h>
#include "gstdvdec.h"
gst_dvdec_negotiate_pool (GstDVDec * dec, GstCaps * caps, GstVideoInfo * info)
{
GstQuery *query;
- GstBufferPool *pool = NULL;
- guint size, min, max, prefix, padding, alignment;
+ GstBufferPool *pool;
+ guint size, min, max;
GstStructure *config;
/* find a pool for the negotiated caps now */
query = gst_query_new_allocation (caps, TRUE);
- if (gst_pad_peer_query (dec->srcpad, query)) {
- GST_DEBUG_OBJECT (dec, "got downstream ALLOCATION hints");
+ if (!gst_pad_peer_query (dec->srcpad, query)) {
+ GST_DEBUG_OBJECT (dec, "didn't get downstream ALLOCATION hints");
+ }
+
+ if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */
- gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
- &padding, &alignment, &pool);
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
size = MAX (size, info->size);
} else {
- GST_DEBUG_OBJECT (dec, "didn't get downstream ALLOCATION hints");
+ pool = NULL;
size = info->size;
min = max = 0;
- prefix = 0;
- padding = 0;
- alignment = 0;
}
if (pool == NULL) {
/* we did not get a pool, make one ourselves then */
- pool = gst_buffer_pool_new ();
+ pool = gst_video_buffer_pool_new ();
}
- if (dec->pool)
+ if (dec->pool) {
+ gst_buffer_pool_set_active (dec->pool, FALSE);
gst_object_unref (dec->pool);
+ }
dec->pool = pool;
config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set (config, caps, size, min, max, prefix, padding,
- alignment);
- /* just set the option, if the pool can support it we will transparently use
- * it through the video info API. We could also see if the pool support this
- * option and only activate it then. */
- gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
-
+ gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 0);
+
+ if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) {
+ /* just set the option, if the pool can support it we will transparently use
+ * it through the video info API. We could also see if the pool support this
+ * option and only activate it then. */
+ gst_buffer_pool_config_add_option (config,
+ GST_BUFFER_POOL_OPTION_VIDEO_META);
+ }
gst_buffer_pool_set_config (pool, config);
+
/* and activate */
gst_buffer_pool_set_active (pool, TRUE);
{
GstCaps *target;
GstQuery *query;
- GstBufferPool *pool = NULL;
- guint size, min, max, prefix, padding, alignment;
+ GstBufferPool *pool;
+ GstStructure *config;
+ guint size, min, max;
target = gst_pad_get_current_caps (filter->srcpad);
/* find a pool for the negotiated caps now */
query = gst_query_new_allocation (target, TRUE);
- if (gst_pad_peer_query (filter->srcpad, query)) {
+ if (!gst_pad_peer_query (filter->srcpad, query)) {
+ /* not a problem, we use the query defaults */
+ GST_DEBUG_OBJECT (filter, "ALLOCATION query failed");
+ }
+
+ if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */
- gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
- &padding, &alignment, &pool);
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
} else {
+ pool = NULL;
size = info->size;
min = max = 0;
- prefix = 0;
- padding = 0;
- alignment = 0;
}
if (pool == NULL) {
- GstStructure *config;
-
/* we did not get a pool, make one ourselves then */
pool = gst_buffer_pool_new ();
-
- config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set (config, target, size, min, max, prefix,
- padding, alignment);
- gst_buffer_pool_set_config (pool, config);
}
- if (filter->pool)
+ /* and configure */
+ config = gst_buffer_pool_get_config (pool);
+ gst_buffer_pool_config_set (config, target, size, min, max, 0, 0, 0);
+ gst_buffer_pool_set_config (pool, config);
+
+ if (filter->pool) {
+ gst_buffer_pool_set_active (filter->pool, FALSE);
gst_object_unref (filter->pool);
+ }
filter->pool = pool;
/* and activate */
gst_jpeg_dec_buffer_pool (GstJpegDec * dec, GstCaps * caps)
{
GstQuery *query;
- GstBufferPool *pool = NULL;
- guint size, min, max, prefix, padding, alignment;
+ GstBufferPool *pool;
+ guint size, min, max;
GstStructure *config;
GST_DEBUG_OBJECT (dec, "setting up bufferpool");
/* find a pool for the negotiated caps now */
query = gst_query_new_allocation (caps, TRUE);
- if (gst_pad_peer_query (dec->srcpad, query)) {
+ if (!gst_pad_peer_query (dec->srcpad, query)) {
+ GST_DEBUG_OBJECT (dec, "peer query failed, using defaults");
+ }
+
+ if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */
- gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
- &padding, &alignment, &pool);
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
size = MAX (size, dec->info.size);
} else {
- GST_DEBUG_OBJECT (dec, "peer query failed, using defaults");
+ pool = NULL;
size = dec->info.size;
min = max = 0;
- prefix = 0;
- padding = 0;
- alignment = 15;
}
gst_query_unref (query);
}
config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set (config, caps, size, min, max, prefix,
- padding, alignment | 15);
+ gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 15);
/* and store */
gst_buffer_pool_set_config (pool, config);
#include <stdlib.h>
#include <string.h>
#include <gst/video/video.h>
+#include <gst/video/gstvideometa.h>
+#include <gst/video/gstvideopool.h>
#include <gst/gst-i18n-plugin.h>
GST_DEBUG_CATEGORY_STATIC (pngdec_debug);
gst_pngdec_negotiate_pool (GstPngDec * dec, GstCaps * caps, GstVideoInfo * info)
{
GstQuery *query;
- GstBufferPool *pool = NULL;
- guint size, min, max, prefix, padding, alignment;
+ GstBufferPool *pool;
+ guint size, min, max;
GstStructure *config;
/* find a pool for the negotiated caps now */
query = gst_query_new_allocation (caps, TRUE);
- if (gst_pad_peer_query (dec->srcpad, query)) {
- GST_DEBUG_OBJECT (dec, "got downstream ALLOCATION hints");
+ if (!gst_pad_peer_query (dec->srcpad, query)) {
+ GST_DEBUG_OBJECT (dec, "didn't get downstream ALLOCATION hints");
+ }
+
+ if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */
- gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
- &padding, &alignment, &pool);
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
size = MAX (size, info->size);
} else {
- GST_DEBUG_OBJECT (dec, "didn't get downstream ALLOCATION hints");
+ pool = NULL;
size = info->size;
min = max = 0;
- prefix = 0;
- padding = 0;
- alignment = 0;
}
if (pool == NULL) {
/* we did not get a pool, make one ourselves then */
- pool = gst_buffer_pool_new ();
+ pool = gst_video_buffer_pool_new ();
}
- if (dec->pool)
+ if (dec->pool) {
+ gst_buffer_pool_set_active (dec->pool, TRUE);
gst_object_unref (dec->pool);
+ }
dec->pool = pool;
config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set (config, caps, size, min, max, prefix, padding,
- alignment);
- /* just set the option, if the pool can support it we will transparently use
- * it through the video info API. We could also see if the pool support this
- * option and only activate it then. */
- gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
+ gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 0);
+ if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) {
+ /* just set the option, if the pool can support it we will transparently use
+ * it through the video info API. We could also see if the pool support this
+ * option and only activate it then. */
+ gst_buffer_pool_config_add_option (config,
+ GST_BUFFER_POOL_OPTION_VIDEO_META);
+ }
gst_buffer_pool_set_config (pool, config);
+
/* and activate */
gst_buffer_pool_set_active (pool, TRUE);
GstStructure *structure;
GstCaps *templ;
GstQuery *query;
- GstBufferPool *pool = NULL;
- guint size, min, max, prefix, padding, alignment;
+ GstBufferPool *pool;
+ GstStructure *config;
+ guint size, min, max;
templ = gst_pad_get_pad_template_caps (goom->srcpad);
/* find a pool for the negotiated caps now */
query = gst_query_new_allocation (target, TRUE);
- if (gst_pad_peer_query (goom->srcpad, query)) {
+ if (!gst_pad_peer_query (goom->srcpad, query)) {
+ /* no problem, we use the query defaults */
+ GST_DEBUG_OBJECT (goom, "ALLOCATION query failed");
+ }
+
+ if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */
- gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
- &padding, &alignment, &pool);
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
} else {
+ pool = NULL;
size = goom->outsize;
min = max = 0;
- prefix = 0;
- padding = 0;
- alignment = 0;
}
if (pool == NULL) {
- GstStructure *config;
-
/* we did not get a pool, make one ourselves then */
pool = gst_buffer_pool_new ();
-
- config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set (config, target, size, min, max, prefix,
- padding, alignment);
- gst_buffer_pool_set_config (pool, config);
}
- if (goom->pool)
+ config = gst_buffer_pool_get_config (pool);
+ gst_buffer_pool_config_set (config, target, size, min, max, 0, 0, 0);
+ gst_buffer_pool_set_config (pool, config);
+
+ if (goom->pool) {
+ gst_buffer_pool_set_active (goom->pool, FALSE);
gst_object_unref (goom->pool);
+ }
goom->pool = pool;
/* and activate */
GstCaps *templ;
GstQuery *query;
GstBufferPool *pool = NULL;
- guint size, min, max, prefix, padding, alignment;
+ GstStructure *config;
+ guint size, min, max;
templ = gst_pad_get_pad_template_caps (goom->srcpad);
gst_goom_src_setcaps (goom, target);
- /* try to get a bufferpool now */
/* find a pool for the negotiated caps now */
query = gst_query_new_allocation (target, TRUE);
- if (gst_pad_peer_query (goom->srcpad, query)) {
+ if (!gst_pad_peer_query (goom->srcpad, query)) {
+ /* no problem, we use the query defaults */
+ GST_DEBUG_OBJECT (goom, "ALLOCATION query failed");
+ }
+
+ if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */
- gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
- &padding, &alignment, &pool);
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
} else {
+ pool = NULL;
size = goom->outsize;
min = max = 0;
- prefix = 0;
- padding = 0;
- alignment = 0;
}
if (pool == NULL) {
- GstStructure *config;
-
/* we did not get a pool, make one ourselves then */
pool = gst_buffer_pool_new ();
-
- config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set (config, target, size, min, max, prefix,
- padding, alignment);
- gst_buffer_pool_set_config (pool, config);
}
- if (goom->pool)
+ config = gst_buffer_pool_get_config (pool);
+ gst_buffer_pool_config_set (config, target, size, min, max, 0, 0, 0);
+ gst_buffer_pool_set_config (pool, config);
+
+ if (goom->pool) {
+ gst_buffer_pool_set_active (goom->pool, FALSE);
gst_object_unref (goom->pool);
+ }
goom->pool = pool;
/* and activate */
GstStructure *structure;
GstCaps *templ;
GstQuery *query;
- GstBufferPool *pool = NULL;
- guint size, min, max, prefix, alignment;
+ GstBufferPool *pool;
+ GstStructure *config;
+ guint size, min, max;
templ = gst_pad_get_pad_template_caps (monoscope->srcpad);
/* find a pool for the negotiated caps now */
query = gst_query_new_allocation (target, TRUE);
- if (gst_pad_peer_query (monoscope->srcpad, query)) {
+ if (!gst_pad_peer_query (monoscope->srcpad, query)) {
+ }
+
+ if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */
- gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
- &alignment, &pool);
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
} else {
+ pool = NULL;
size = monoscope->outsize;
min = max = 0;
- prefix = 0;
- alignment = 0;
}
if (pool == NULL) {
- GstStructure *config;
-
/* we did not get a pool, make one ourselves then */
pool = gst_buffer_pool_new ();
-
- config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set (config, target, size, min, max, prefix,
- alignment);
- gst_buffer_pool_set_config (pool, config);
}
- if (monoscope->pool)
+ config = gst_buffer_pool_get_config (pool);
+ gst_buffer_pool_config_set (config, target, size, min, max, 0, 0, 0);
+ gst_buffer_pool_set_config (pool, config);
+
+ if (monoscope->pool) {
+ gst_buffer_pool_set_active (monoscope->pool, TRUE);
gst_object_unref (monoscope->pool);
+ }
monoscope->pool = pool;
/* and activate */
{
GstQuery *query;
GstBufferPool *pool = NULL;
- guint size, min, max, prefix, padding, alignment;
+ guint size, min, max;
GstStructure *config;
/* find a pool for the negotiated caps now */
query = gst_query_new_allocation (caps, TRUE);
- if (gst_pad_peer_query (GST_RTP_BASE_DEPAYLOAD_SRCPAD (depay), query)) {
- GST_DEBUG_OBJECT (depay, "got downstream ALLOCATION hints");
+ if (!gst_pad_peer_query (GST_RTP_BASE_DEPAYLOAD_SRCPAD (depay), query)) {
+ /* not a problem, we use the defaults of query */
+ GST_DEBUG_OBJECT (depay, "could not get downstream ALLOCATION hints");
+ }
+
+ if (gst_query_get_n_allocation_pools (query) > 0) {
/* we got configuration from our peer, parse them */
- gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
- &padding, &alignment, &pool);
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
} else {
- GST_DEBUG_OBJECT (depay, "didn't get downstream ALLOCATION hints");
+ GST_DEBUG_OBJECT (depay, "didn't get downstream pool hints");
size = info->size;
min = max = 0;
- prefix = 0;
- padding = 0;
- alignment = 0;
}
if (pool == NULL) {
/* we did not get a pool, make one ourselves then */
- pool = gst_buffer_pool_new ();
+ pool = gst_video_buffer_pool_new ();
}
if (depay->pool)
depay->pool = pool;
config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_set (config, caps, size, min, max, prefix, padding,
- alignment);
- /* just set the metadata, if the pool can support it we will transparently use
- * it through the video info API. We could also see if the pool support this
- * metadata and only activate it then. */
- gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_META);
+ gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 0);
+ if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) {
+ /* just set the metadata, if the pool can support it we will transparently use
+ * it through the video info API. We could also see if the pool support this
+ * metadata and only activate it then. */
+ gst_buffer_pool_config_add_option (config,
+ GST_BUFFER_POOL_OPTION_VIDEO_META);
+ }
gst_buffer_pool_set_config (pool, config);
/* and activate */
}
}
/* we need at least 2 buffers to operate */
- gst_query_set_allocation_params (query, size, 2, 0, 0, 0, 0, pool);
+ gst_query_add_allocation_pool (query, pool, size, 2, 0);
/* we also support various metadata */
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE);
GstV4l2Src *src;
GstV4l2Object *obj;
GstBufferPool *pool;
- guint size, min, max, prefix, padding, alignment;
+ guint size, min, max;
+ gboolean update;
src = GST_V4L2SRC (bsrc);
obj = src->v4l2object;
- gst_query_parse_allocation_params (query, &size, &min, &max, &prefix,
- &padding, &alignment, &pool);
+ if (gst_query_get_n_allocation_pools (query) > 0) {
+ gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
+ update = TRUE;
+ } else {
+ pool = NULL;
+ min = max = 0;
+ size = 0;
+ update = FALSE;
+ }
- GST_DEBUG_OBJECT (src, "allocation: size:%u min:%u max:%u prefix:%u "
- "padding: %u align:%u pool:%" GST_PTR_FORMAT, size, min, max,
- prefix, padding, alignment, pool);
+ GST_DEBUG_OBJECT (src, "allocation: size:%u min:%u max:%u pool:%"
+ GST_PTR_FORMAT, size, min, max, pool);
if (min != 0) {
/* if there is a min-buffers suggestion, use it. We add 1 because we need 1
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_get (config, &caps, NULL, NULL, NULL, NULL, NULL,
NULL);
- gst_buffer_pool_config_set (config, caps, size, min, max, prefix, padding,
- alignment);
+ gst_buffer_pool_config_set (config, caps, size, min, max, 0, 0, 0);
/* if downstream supports video metadata, add this to the pool config */
if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE))
gst_buffer_pool_set_config (pool, config);
}
- gst_query_set_allocation_params (query, size, min, max, prefix, padding,
- alignment, pool);
+ if (update)
+ gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max);
+ else
+ gst_query_add_allocation_pool (query, pool, size, min, max);
return TRUE;
}