videofilter: Use a GstVideoBufferPool if none was provided
This commit is contained in:
parent
cb04d8e003
commit
52dfa13522
@ -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;
|
||||
update_pool = TRUE;
|
||||
} else {
|
||||
GstCaps *outcaps;
|
||||
GstVideoInfo vinfo;
|
||||
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user