mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
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.
This commit is contained in:
parent
f70bb08411
commit
403909d873
2 changed files with 13 additions and 26 deletions
|
@ -426,27 +426,8 @@ 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);
|
||||||
|
|
||||||
if (!pool->add_videometa &&
|
if (!pool->add_videometa && obj->need_video_meta)
|
||||||
GST_VIDEO_INFO_FORMAT (&obj->info) != GST_VIDEO_FORMAT_ENCODED) {
|
goto missing_video_api;
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 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,
|
||||||
|
@ -479,9 +460,7 @@ gst_v4l2_buffer_pool_set_config (GstBufferPool * bpool, GstStructure * config)
|
||||||
/* ERRORS */
|
/* ERRORS */
|
||||||
missing_video_api:
|
missing_video_api:
|
||||||
{
|
{
|
||||||
GST_ERROR_OBJECT (pool, "missing GstMetaVideo API in config, "
|
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]);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
wrong_config:
|
wrong_config:
|
||||||
|
|
|
@ -2257,8 +2257,16 @@ gst_v4l2_object_save_format (GstV4l2Object * v4l2object,
|
||||||
((align->padding_bottom + align->padding_right) != 0));
|
((align->padding_bottom + align->padding_right) != 0));
|
||||||
|
|
||||||
/* ... or also video meta if stride is non "standard" */
|
/* ... or also video meta if stride is non "standard" */
|
||||||
if (GST_VIDEO_INFO_PLANE_STRIDE (info, 0) != v4l2object->bytesperline[0])
|
for (i = 0; i < v4l2object->n_v4l2_planes; i++) {
|
||||||
v4l2object->need_video_meta = TRUE;
|
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 */
|
/* ... or also video meta if we use multiple, non-contiguous, planes */
|
||||||
if (v4l2object->n_v4l2_planes > 1)
|
if (v4l2object->n_v4l2_planes > 1)
|
||||||
|
|
Loading…
Reference in a new issue