summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2012-03-16 20:22:19 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2012-03-16 20:22:19 +0100
commite13a7c76a74aa8f2f9d9c69581ad7cd792802107 (patch)
tree5e11ba0cf8f77d41caccf77f22356eb5f9654e60
parent1e884df1dfe314c81db7f170173f93eb5eecdb50 (diff)
videotestsrc: fix decide_allocation
We want to propose a videopool even if downstream didn't provide one.
-rw-r--r--gst/videotestsrc/gstvideotestsrc.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c
index 2564497ce..a813c431d 100644
--- a/gst/videotestsrc/gstvideotestsrc.c
+++ b/gst/videotestsrc/gstvideotestsrc.c
@@ -610,31 +610,46 @@ static gboolean
gst_video_test_src_decide_allocation (GstBaseSrc * bsrc, GstQuery * query)
{
GstVideoTestSrc *videotestsrc;
+ GstBufferPool *pool;
+ gboolean update;
+ guint size, min, max;
+ GstStructure *config;
videotestsrc = GST_VIDEO_TEST_SRC (bsrc);
if (gst_query_get_n_allocation_pools (query) > 0) {
- GstBufferPool *pool;
- guint size, min, max;
-
gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max);
/* adjust size */
size = MAX (size, videotestsrc->info.size);
+ update = TRUE;
+ } else {
+ pool = NULL;
+ size = videotestsrc->info.size;
+ min = max = 0;
+ update = FALSE;
+ }
- if (pool) {
- GstStructure *config;
+ /* no downstream pool, make our own */
+ if (pool == NULL) {
+ pool = gst_video_buffer_pool_new ();
+ }
- config = gst_buffer_pool_get_config (pool);
- gst_buffer_pool_config_add_option (config,
- GST_BUFFER_POOL_OPTION_VIDEO_META);
- gst_buffer_pool_set_config (pool, config);
- }
+ config = gst_buffer_pool_get_config (pool);
+ if (gst_query_has_allocation_meta (query, GST_VIDEO_META_API_TYPE)) {
+ gst_buffer_pool_config_add_option (config,
+ GST_BUFFER_POOL_OPTION_VIDEO_META);
+ }
+ gst_buffer_pool_set_config (pool, config);
+
+ 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);
+
+ if (pool)
+ gst_object_unref (pool);
- if (pool)
- gst_object_unref (pool);
- }
return TRUE;
}