v4l2: don't store stride in the videoinfo
We want to keep the default strides in the videoinfo. Keep the stride of the video frames separate so that we can use both to copy a video frame and do correct stride conversion.
This commit is contained in:
parent
3aed125163
commit
398001f20d
@ -178,11 +178,17 @@ gst_v4l2_buffer_new (GstV4l2BufferPool * pool, guint index)
|
|||||||
|
|
||||||
/* add metadata to raw video buffers */
|
/* add metadata to raw video buffers */
|
||||||
if (info->finfo) {
|
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_DEBUG ("adding video meta");
|
||||||
gst_buffer_add_meta_video_full (ret, info->flags,
|
gst_buffer_add_meta_video_full (ret, info->flags,
|
||||||
GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info),
|
GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info),
|
||||||
GST_VIDEO_INFO_HEIGHT (info), GST_VIDEO_INFO_N_PLANES (info),
|
GST_VIDEO_INFO_HEIGHT (info), GST_VIDEO_INFO_N_PLANES (info),
|
||||||
info->offset, info->stride);
|
offset, stride);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -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.height, GST_FOURCC_ARGS (format.fmt.pix.pixelformat),
|
||||||
format.fmt.pix.bytesperline);
|
format.fmt.pix.bytesperline);
|
||||||
|
|
||||||
v4l2object->custom_stride = format.fmt.pix.bytesperline != stride;
|
|
||||||
|
|
||||||
if (format.type != v4l2object->type ||
|
if (format.type != v4l2object->type ||
|
||||||
format.fmt.pix.width != width ||
|
format.fmt.pix.width != width ||
|
||||||
format.fmt.pix.height != height ||
|
format.fmt.pix.height != height ||
|
||||||
format.fmt.pix.pixelformat != pixelformat ||
|
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 */
|
/* something different, set the format */
|
||||||
GST_DEBUG_OBJECT (v4l2object->element, "Setting format to %dx%d, format "
|
GST_DEBUG_OBJECT (v4l2object->element, "Setting format to %dx%d, format "
|
||||||
"%" GST_FOURCC_FORMAT " bytesperline %d", width, height,
|
"%" 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)
|
if (format.fmt.pix.pixelformat != pixelformat)
|
||||||
goto invalid_pixelformat;
|
goto invalid_pixelformat;
|
||||||
|
|
||||||
if (v4l2object->custom_stride) {
|
v4l2object->bytesperline = format.fmt.pix.bytesperline;
|
||||||
stride = format.fmt.pix.bytesperline;
|
|
||||||
GST_DEBUG_OBJECT (v4l2object->element, "We need custom stride %d",
|
|
||||||
stride);
|
|
||||||
GST_VIDEO_INFO_PLANE_STRIDE (&info, 0) = stride;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Is there a reason we require the caller to always specify a framerate? */
|
/* Is there a reason we require the caller to always specify a framerate? */
|
||||||
|
@ -108,7 +108,7 @@ struct _GstV4l2Object {
|
|||||||
/* the current format */
|
/* the current format */
|
||||||
struct v4l2_fmtdesc *fmtdesc;
|
struct v4l2_fmtdesc *fmtdesc;
|
||||||
GstVideoInfo info;
|
GstVideoInfo info;
|
||||||
gboolean custom_stride;
|
guint32 bytesperline;
|
||||||
|
|
||||||
guint size;
|
guint size;
|
||||||
GstClockTime duration;
|
GstClockTime duration;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user