Commit 7b8bb718 authored by Nicolas Dufresne's avatar Nicolas Dufresne

v4l2bufferpool: Turn cropmeta into a custom option

Turn crop meta into a custom option and make sure it's there is needed.
parent db3d2f35
...@@ -224,9 +224,16 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config) ...@@ -224,9 +224,16 @@ 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_BUFFER_POOL_OPTION_VIDEO_META); GST_BUFFER_POOL_OPTION_VIDEO_META);
pool->add_cropmeta =
gst_buffer_pool_config_has_option (config,
GST_V4L2_BUFFER_POOL_OPTION_CROP_META);
if (!pool->add_videometa && obj->need_video_meta) if (!pool->add_videometa && obj->need_video_meta)
goto missing_video_api; 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))
...@@ -299,7 +306,12 @@ done: ...@@ -299,7 +306,12 @@ done:
/* ERRORS */ /* ERRORS */
missing_video_api: missing_video_api:
{ {
GST_ERROR_OBJECT (pool, "missing GstMetaVideo API in config"); GST_ERROR_OBJECT (pool, "missing GstVideoMeta API in config");
return FALSE;
}
missing_crop_api:
{
GST_ERROR_OBJECT (pool, "missing GstVideoCropMeta API");
return FALSE; return FALSE;
} }
wrong_config: wrong_config:
......
...@@ -44,6 +44,8 @@ G_BEGIN_DECLS ...@@ -44,6 +44,8 @@ G_BEGIN_DECLS
#define GST_V4L2_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4L2_BUFFER_POOL, GstV4l2BufferPool)) #define GST_V4L2_BUFFER_POOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_V4L2_BUFFER_POOL, GstV4l2BufferPool))
#define GST_V4L2_BUFFER_POOL_CAST(obj) ((GstV4l2BufferPool*)(obj)) #define GST_V4L2_BUFFER_POOL_CAST(obj) ((GstV4l2BufferPool*)(obj))
#define GST_V4L2_BUFFER_POOL_OPTION_CROP_META "GstV4l2BufferPoolOptionCropMeta"
struct _GstV4l2BufferPool struct _GstV4l2BufferPool
{ {
GstBufferPool parent; GstBufferPool parent;
......
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