summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2012-03-15 20:37:56 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2012-03-15 20:37:56 +0100
commitf3a770a20c1ab8a91548cb3bd5c33c25ef75146e (patch)
tree45a50f0588eb0af7110814763ce67c11fc3502d4 /ext
parent6ed3bc109bce170367bde7a059831f62ddbe3b48 (diff)
downloadgstreamer-plugins-good-f3a770a20c1ab8a91548cb3bd5c33c25ef75146e.tar.gz
update for allocation query changes
Diffstat (limited to 'ext')
-rw-r--r--ext/aalib/gstaasink.c2
-rw-r--r--ext/dv/gstdvdec.c43
-rw-r--r--ext/gdk_pixbuf/gstgdkpixbuf.c35
-rw-r--r--ext/jpeg/gstjpegdec.c21
-rw-r--r--ext/libpng/gstpngdec.c42
5 files changed, 78 insertions, 65 deletions
diff --git a/ext/aalib/gstaasink.c b/ext/aalib/gstaasink.c
index 18946316a..a162d07f8 100644
--- a/ext/aalib/gstaasink.c
+++ b/ext/aalib/gstaasink.c
@@ -346,7 +346,7 @@ gst_aasink_propose_allocation (GstBaseSink * bsink, GstQuery * query)
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);
diff --git a/ext/dv/gstdvdec.c b/ext/dv/gstdvdec.c
index 3cadcd992..71fc8afa2 100644
--- a/ext/dv/gstdvdec.c
+++ b/ext/dv/gstdvdec.c
@@ -44,6 +44,7 @@
#include <string.h>
#include <math.h>
#include <gst/video/video.h>
+#include <gst/video/gstvideometa.h>
#include <gst/video/gstvideopool.h>
#include "gstdvdec.h"
@@ -252,46 +253,50 @@ static void
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);
diff --git a/ext/gdk_pixbuf/gstgdkpixbuf.c b/ext/gdk_pixbuf/gstgdkpixbuf.c
index 0076a3cab..3952888f7 100644
--- a/ext/gdk_pixbuf/gstgdkpixbuf.c
+++ b/ext/gdk_pixbuf/gstgdkpixbuf.c
@@ -224,8 +224,9 @@ gst_gdk_pixbuf_setup_pool (GstGdkPixbuf * filter, GstVideoInfo * info)
{
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);
@@ -233,32 +234,34 @@ gst_gdk_pixbuf_setup_pool (GstGdkPixbuf * filter, GstVideoInfo * info)
/* 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 */
diff --git a/ext/jpeg/gstjpegdec.c b/ext/jpeg/gstjpegdec.c
index 817881438..b5d6f44ce 100644
--- a/ext/jpeg/gstjpegdec.c
+++ b/ext/jpeg/gstjpegdec.c
@@ -1163,8 +1163,8 @@ static gboolean
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");
@@ -1172,18 +1172,18 @@ gst_jpeg_dec_buffer_pool (GstJpegDec * dec, GstCaps * caps)
/* 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);
@@ -1193,8 +1193,7 @@ gst_jpeg_dec_buffer_pool (GstJpegDec * dec, GstCaps * caps)
}
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);
diff --git a/ext/libpng/gstpngdec.c b/ext/libpng/gstpngdec.c
index 623237efd..7c569ed97 100644
--- a/ext/libpng/gstpngdec.c
+++ b/ext/libpng/gstpngdec.c
@@ -28,6 +28,8 @@
#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);
@@ -337,46 +339,50 @@ static GstFlowReturn
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);