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);
}