v4l2transform: use alignments from upstream when importing on sink
Try configuring the v4l2 output with the alignments from upstream when importing its buffers. This allows us to support importing with non-standard strides and/or heights if supported by the driver.
This commit is contained in:
parent
a92000ebb9
commit
a195d5a4a6
@ -894,6 +894,22 @@ gst_v4l2_transform_prepare_output_buffer (GstBaseTransform * trans,
|
|||||||
if (!gst_buffer_pool_is_active (pool)) {
|
if (!gst_buffer_pool_is_active (pool)) {
|
||||||
GstStructure *config = gst_buffer_pool_get_config (pool);
|
GstStructure *config = gst_buffer_pool_get_config (pool);
|
||||||
gint min = MAX (GST_V4L2_MIN_BUFFERS, self->v4l2output->min_buffers);
|
gint min = MAX (GST_V4L2_MIN_BUFFERS, self->v4l2output->min_buffers);
|
||||||
|
|
||||||
|
if (self->v4l2output->mode == GST_V4L2_IO_USERPTR ||
|
||||||
|
self->v4l2output->mode == GST_V4L2_IO_DMABUF_IMPORT) {
|
||||||
|
if (!gst_v4l2_object_try_import (self->v4l2output, inbuf)) {
|
||||||
|
GST_ERROR_OBJECT (self, "cannot import buffers from upstream");
|
||||||
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self->v4l2output->need_video_meta) {
|
||||||
|
/* We may need video meta if imported buffer is using non-standard
|
||||||
|
* stride/padding */
|
||||||
|
gst_buffer_pool_config_add_option (config,
|
||||||
|
GST_BUFFER_POOL_OPTION_VIDEO_META);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
gst_buffer_pool_config_set_params (config, self->incaps,
|
gst_buffer_pool_config_set_params (config, self->incaps,
|
||||||
self->v4l2output->info.size, min, min);
|
self->v4l2output->info.size, min, min);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user