Commit 403909d8 authored by Nicolas Dufresne's avatar Nicolas Dufresne

v4l2: Correctly check if video meta is needed

Correctly check if video meta is needed. In buffer pool, trust need_video_meta
flag in order to decide if configuration should succeed.
parent f70bb084
......@@ -426,27 +426,8 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config)
gst_buffer_pool_config_has_option (config,
GST_BUFFER_POOL_OPTION_VIDEO_META);
if (!pool->add_videometa &&
GST_VIDEO_INFO_FORMAT (&obj->info) != GST_VIDEO_FORMAT_ENCODED) {
gint stride = 0;
gint i = 0;
for (i = 0; i < obj->n_v4l2_planes; i++) {
/* we don't have video metadata, and we are dealing with raw video,
* see if the strides are compatible */
stride = GST_VIDEO_INFO_PLANE_STRIDE (&obj->info, i);
if (GST_VIDEO_FORMAT_INFO_IS_TILED (obj->info.finfo)) {
stride = GST_VIDEO_TILE_X_TILES (stride) <<
GST_VIDEO_FORMAT_INFO_TILE_WS ((obj->info.finfo));
}
GST_DEBUG_OBJECT (pool, "no videometadata, checking strides %d and %u",
stride, obj->bytesperline[i]);
if (stride != obj->bytesperline[i])
goto missing_video_api;
}
}
if (!pool->add_videometa && obj->need_video_meta)
goto missing_video_api;
/* parse the config and keep around */
if (!gst_buffer_pool_config_get_params (config, &caps, &size, &min_buffers,
......@@ -479,9 +460,7 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config)
/* ERRORS */
missing_video_api:
{
GST_ERROR_OBJECT (pool, "missing GstMetaVideo API in config, "
"default stride: %d, wanted stride %u",
GST_VIDEO_INFO_PLANE_STRIDE (&obj->info, 0), obj->bytesperline[0]);
GST_ERROR_OBJECT (pool, "missing GstMetaVideo API in config");
return FALSE;
}
wrong_config:
......
......@@ -2257,8 +2257,16 @@ gst_v4l2_object_save_format (GstV4l2Object * v4l2object,
((align->padding_bottom + align->padding_right) != 0));
/* ... or also video meta if stride is non "standard" */
if (GST_VIDEO_INFO_PLANE_STRIDE (info, 0) != v4l2object->bytesperline[0])
v4l2object->need_video_meta = TRUE;
for (i = 0; i < v4l2object->n_v4l2_planes; i++) {
gint stride = GST_VIDEO_INFO_PLANE_STRIDE (info, i);
if (GST_VIDEO_FORMAT_INFO_IS_TILED (info->finfo))
stride = GST_VIDEO_TILE_X_TILES (stride) <<
GST_VIDEO_FORMAT_INFO_TILE_WS (info->finfo);
if (stride != v4l2object->bytesperline[i])
v4l2object->need_video_meta = TRUE;
}
/* ... or also video meta if we use multiple, non-contiguous, planes */
if (v4l2object->n_v4l2_planes > 1)
......
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