From ba32cf10f3e8898f3700979796f8886852dd0b7f Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Fri, 18 Apr 2014 13:09:00 -0400 Subject: [PATCH] v4l2bufferpool: Update config if meta is missing Rather then hard failure, we should update the config with the meta option we need and return false. --- sys/v4l2/gstv4l2bufferpool.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index 0f3071b5fb..95e30cd1af 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -497,12 +497,6 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config) gst_buffer_pool_config_has_option (config, GST_V4L2_BUFFER_POOL_OPTION_CROP_META); - if (!pool->add_videometa && obj->need_video_meta) - goto missing_video_api; - - if (!pool->add_cropmeta && obj->need_crop_meta) - goto missing_crop_api; - /* parse the config and keep around */ if (!gst_buffer_pool_config_get_params (config, &caps, &size, &min_buffers, &max_buffers)) @@ -567,6 +561,20 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config) } } + if (!pool->add_videometa && obj->need_video_meta) { + GST_INFO_OBJECT (pool, "adding needed video meta"); + updated = TRUE; + gst_buffer_pool_config_add_option (config, + GST_BUFFER_POOL_OPTION_VIDEO_META); + } + + if (!pool->add_cropmeta && obj->need_crop_meta) { + GST_INFO_OBJECT (pool, "adding needed crop meta"); + updated = TRUE; + gst_buffer_pool_config_add_option (config, + GST_V4L2_BUFFER_POOL_OPTION_CROP_META); + } + if (updated) gst_buffer_pool_config_set_params (config, caps, size, min_buffers, max_buffers); @@ -578,16 +586,6 @@ done: return !updated && ret; /* ERRORS */ -missing_video_api: - { - GST_ERROR_OBJECT (pool, "missing GstVideoMeta API in config"); - return FALSE; - } -missing_crop_api: - { - GST_ERROR_OBJECT (pool, "missing GstVideoCropMeta API"); - return FALSE; - } wrong_config: { GST_ERROR_OBJECT (pool, "invalid config %" GST_PTR_FORMAT, config);