diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index 306573525e..a48c2a8ea3 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -178,11 +178,17 @@ gst_v4l2_buffer_new (GstV4l2BufferPool * pool, guint index) /* add metadata to raw video buffers */ if (info->finfo) { + gsize offset[GST_VIDEO_MAX_PLANES]; + gint stride[GST_VIDEO_MAX_PLANES]; + + offset[0] = 0; + stride[0] = obj->bytesperline; + GST_DEBUG ("adding video meta"); gst_buffer_add_meta_video_full (ret, info->flags, GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info), GST_VIDEO_INFO_HEIGHT (info), GST_VIDEO_INFO_N_PLANES (info), - info->offset, info->stride); + offset, stride); } return ret; diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 2e991307a5..b124a6782b 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -2101,13 +2101,11 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps) format.fmt.pix.height, GST_FOURCC_ARGS (format.fmt.pix.pixelformat), format.fmt.pix.bytesperline); - v4l2object->custom_stride = format.fmt.pix.bytesperline != stride; - if (format.type != v4l2object->type || format.fmt.pix.width != width || format.fmt.pix.height != height || format.fmt.pix.pixelformat != pixelformat || - format.fmt.pix.field != field || v4l2object->custom_stride) { + format.fmt.pix.field != field || format.fmt.pix.bytesperline != stride) { /* something different, set the format */ GST_DEBUG_OBJECT (v4l2object->element, "Setting format to %dx%d, format " "%" GST_FOURCC_FORMAT " bytesperline %d", width, height, @@ -2135,12 +2133,7 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps) if (format.fmt.pix.pixelformat != pixelformat) goto invalid_pixelformat; - if (v4l2object->custom_stride) { - stride = format.fmt.pix.bytesperline; - GST_DEBUG_OBJECT (v4l2object->element, "We need custom stride %d", - stride); - GST_VIDEO_INFO_PLANE_STRIDE (&info, 0) = stride; - } + v4l2object->bytesperline = format.fmt.pix.bytesperline; } /* Is there a reason we require the caller to always specify a framerate? */ diff --git a/sys/v4l2/gstv4l2object.h b/sys/v4l2/gstv4l2object.h index 6d8710fe24..a1ced8ad7c 100644 --- a/sys/v4l2/gstv4l2object.h +++ b/sys/v4l2/gstv4l2object.h @@ -108,7 +108,7 @@ struct _GstV4l2Object { /* the current format */ struct v4l2_fmtdesc *fmtdesc; GstVideoInfo info; - gboolean custom_stride; + guint32 bytesperline; guint size; GstClockTime duration;