Commit 36dfdff8 authored by Nicolas Dufresne's avatar Nicolas Dufresne

v4l2object: Ensure video and crop meta are enabled if needed

In certain cases we cannot live without video meta and/or crop meta
being enabled in our internal buffer pool. Ensure this is always the case,
regardless of having support for allocation query.
parent e9eba56c
......@@ -1335,6 +1335,14 @@ gst_v4l2_buffer_pool_new (GstV4l2Object * obj, GstCaps * caps)
config = gst_buffer_pool_get_config (GST_BUFFER_POOL_CAST (pool));
gst_buffer_pool_config_set_params (config, caps, obj->sizeimage, 2, 0);
/* Ensure our internal pool has required features */
if (obj->need_video_meta)
gst_buffer_pool_config_add_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
if (obj->need_crop_meta)
gst_v4l2_buffer_pool_add_crop_meta (pool, obj->need_crop_meta);
res = gst_buffer_pool_set_config (GST_BUFFER_POOL_CAST (pool), config);
if (!res)
goto config_failed;
......
......@@ -2998,23 +2998,6 @@ gst_v4l2_object_decide_allocation (GstV4l2Object * obj, GstQuery * query)
gst_buffer_pool_set_config (pool, config);
}
/* Our pool may be incompatible, though we'll need the metadata in order to
* copy to a downstream compatible buffer */
if (pool != obj->pool && obj->need_video_meta) {
GstStructure *config;
config = gst_buffer_pool_get_config (obj->pool);
gst_buffer_pool_config_set_params (config, caps, obj->sizeimage, min, 0);
gst_buffer_pool_config_add_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
gst_buffer_pool_set_config (obj->pool, config);
}
if (obj->need_crop_meta)
gst_v4l2_buffer_pool_add_crop_meta (GST_V4L2_BUFFER_POOL (obj->pool),
obj->need_crop_meta);
/* Size field is mandatory and we have no size if now using our own pool and
* downstream didn't provide one. */
if (size == 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment