summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2012-03-15 20:38:27 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2012-03-15 20:38:27 +0100
commit583f5d1dc792d1c23d7089bc23e351f618dfac5c (patch)
tree6c05f61ab2033c806fc4c59e3bd58abc9b4c6cfd
parent76460a0d7afae64c75d4301c79ee3381c9b438e3 (diff)
downloadgstreamer-plugins-bad-583f5d1dc792d1c23d7089bc23e351f618dfac5c.tar.gz
update for allocation query changes
-rw-r--r--gst-libs/gst/video/gstbasevideodecoder.c43
-rw-r--r--gst/audiovisualizers/gstbaseaudiovisualizer.c34
2 files changed, 41 insertions, 36 deletions
diff --git a/gst-libs/gst/video/gstbasevideodecoder.c b/gst-libs/gst/video/gstbasevideodecoder.c
index 2cc015543..29d45cc30 100644
--- a/gst-libs/gst/video/gstbasevideodecoder.c
+++ b/gst-libs/gst/video/gstbasevideodecoder.c
@@ -313,8 +313,8 @@ gst_base_video_decoder_setcaps (GstBaseVideoDecoder * base_video_decoder,
}
if (ret) {
- gst_buffer_replace (&GST_BASE_VIDEO_CODEC (base_video_decoder)->
- state.codec_data, NULL);
+ gst_buffer_replace (&GST_BASE_VIDEO_CODEC (base_video_decoder)->state.
+ codec_data, NULL);
gst_caps_replace (&GST_BASE_VIDEO_CODEC (base_video_decoder)->state.caps,
NULL);
GST_BASE_VIDEO_CODEC (base_video_decoder)->state = state;
@@ -1990,9 +1990,9 @@ gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder)
GstVideoState *state = &codec->state;
GstVideoInfo *info = &codec->info;
GstQuery *query;
- GstBufferPool *pool = NULL;
+ GstBufferPool *pool;
GstStructure *config;
- guint size, min, max, prefix, padding, alignment;
+ guint size, min, max;
gboolean ret;
/* minimum sense */
@@ -2041,39 +2041,42 @@ gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder)
/* Negotiate pool */
query = gst_query_new_allocation (caps, TRUE);
- if (gst_pad_peer_query (codec->srcpad, query)) {
- GST_DEBUG_OBJECT (codec, "got downstream ALLOCATION hints");
+ if (!gst_pad_peer_query (codec->srcpad, query)) {
+ GST_DEBUG_OBJECT (codec, "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 (codec, "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 (base_video_decoder->pool)
+ if (base_video_decoder->pool) {
+ gst_buffer_pool_set_active (base_video_decoder->pool, FALSE);
gst_object_unref (base_video_decoder->pool);
+ }
base_video_decoder->pool = pool;
config = gst_buffer_pool_get_config (pool);
- 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);
state->bytes_per_picture = size;
- /* 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);
+ 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);
+ }
/* check if downstream supports cropping */
base_video_decoder->use_cropping =
diff --git a/gst/audiovisualizers/gstbaseaudiovisualizer.c b/gst/audiovisualizers/gstbaseaudiovisualizer.c
index 96095c0f8..8cce39103 100644
--- a/gst/audiovisualizers/gstbaseaudiovisualizer.c
+++ b/gst/audiovisualizers/gstbaseaudiovisualizer.c
@@ -668,8 +668,9 @@ gst_base_audio_visualizer_src_negotiate (GstBaseAudioVisualizer * scope)
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 (scope->srcpad);
@@ -705,32 +706,33 @@ gst_base_audio_visualizer_src_negotiate (GstBaseAudioVisualizer * scope)
/* find a pool for the negotiated caps now */
query = gst_query_new_allocation (target, TRUE);
- if (gst_pad_peer_query (scope->srcpad, query)) {
+ if (!gst_pad_peer_query (scope->srcpad, query)) {
+ /* not a problem, we use the query defaults */
+ GST_DEBUG_OBJECT (scope, "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 = scope->bpf;
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 (scope->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 (scope->pool) {
+ gst_buffer_pool_set_active (scope->pool, FALSE);
gst_object_unref (scope->pool);
+ }
scope->pool = pool;
/* and activate */