mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
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.
This commit is contained in:
parent
92bdd596f2
commit
ba32cf10f3
1 changed files with 14 additions and 16 deletions
|
@ -497,12 +497,6 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config)
|
||||||
gst_buffer_pool_config_has_option (config,
|
gst_buffer_pool_config_has_option (config,
|
||||||
GST_V4L2_BUFFER_POOL_OPTION_CROP_META);
|
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 */
|
/* parse the config and keep around */
|
||||||
if (!gst_buffer_pool_config_get_params (config, &caps, &size, &min_buffers,
|
if (!gst_buffer_pool_config_get_params (config, &caps, &size, &min_buffers,
|
||||||
&max_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)
|
if (updated)
|
||||||
gst_buffer_pool_config_set_params (config, caps, size, min_buffers,
|
gst_buffer_pool_config_set_params (config, caps, size, min_buffers,
|
||||||
max_buffers);
|
max_buffers);
|
||||||
|
@ -578,16 +586,6 @@ done:
|
||||||
return !updated && ret;
|
return !updated && ret;
|
||||||
|
|
||||||
/* ERRORS */
|
/* 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:
|
wrong_config:
|
||||||
{
|
{
|
||||||
GST_ERROR_OBJECT (pool, "invalid config %" GST_PTR_FORMAT, config);
|
GST_ERROR_OBJECT (pool, "invalid config %" GST_PTR_FORMAT, config);
|
||||||
|
|
Loading…
Reference in a new issue