From: Sebastian Dröge Date: Thu, 26 Apr 2012 16:12:39 +0000 (+0200) Subject: videofilter: Use a GstVideoBufferPool if none was provided X-Git-Tag: 1.19.3~511^2~6519 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=52dfa135222794574b885be3da4f40e3c9c1c20f;p=platform%2Fupstream%2Fgstreamer.git videofilter: Use a GstVideoBufferPool if none was provided --- diff --git a/gst-libs/gst/video/gstvideofilter.c b/gst-libs/gst/video/gstvideofilter.c index 1eab2b5..40364d2 100644 --- a/gst-libs/gst/video/gstvideofilter.c +++ b/gst-libs/gst/video/gstvideofilter.c @@ -116,22 +116,44 @@ config_failed: static gboolean gst_video_filter_decide_allocation (GstBaseTransform * trans, GstQuery * query) { + GstBufferPool *pool = NULL; + GstStructure *config; + guint min, max, size; + gboolean update_pool; if (gst_query_get_n_allocation_pools (query) > 0) { - GstBufferPool *pool = NULL; + gst_query_parse_nth_allocation_pool (query, 0, &pool, &size, &min, &max); - gst_query_parse_nth_allocation_pool (query, 0, &pool, NULL, NULL, NULL); + if (!pool) + pool = gst_video_buffer_pool_new (); - if (pool) { - GstStructure *config; - - 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); - gst_object_unref (pool); - } + update_pool = TRUE; + } else { + GstCaps *outcaps; + GstVideoInfo vinfo; + + gst_query_parse_allocation (query, &outcaps, NULL); + gst_video_info_init (&vinfo); + gst_video_info_from_caps (&vinfo, outcaps); + size = vinfo.size; + min = max = 0; + update_pool = FALSE; } + + if (!pool) + 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); + + if (update_pool) + gst_query_set_nth_allocation_pool (query, 0, pool, size, min, max); + else + gst_query_add_allocation_pool (query, pool, size, min, max); + + gst_object_unref (pool); + return GST_BASE_TRANSFORM_CLASS (parent_class)->decide_allocation (trans, query); }