v4l2: Fix support for left and top padding
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Thu, 22 Jun 2023 14:10:43 +0000 (10:10 -0400)
committerTim-Philipp Müller <tim@centricular.com>
Tue, 1 Aug 2023 18:54:57 +0000 (19:54 +0100)
commit40311bf6651f5ff375580048b0f91cb8fab85be4
treeb992b1e25edd37c40f3c6d222c3f2c72131af4ea
parentbbca6cc8c8125f53b74f7b9a5b7a559595f9cf89
v4l2: Fix support for left and top padding

In the current implementation, we support for most pixel format left
and top padding by changing the offset in the video meta. Though, to
align driver bytesused to the offset, we recalculate the offset, which
removed the modification we did before.

Instead, save the plane size, and truncate the driver reported bytesused
to the expected size, which ensures that the offsets still match. This
should also fix issues were the buffer size ended up bigger then the
pool size due to driver introduced padding.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5132>
subprojects/gst-plugins-good/sys/v4l2/gstv4l2bufferpool.c
subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c
subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.h