This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/v4l-utils.git tree:
Subject: v4l2-ctl: zero bytesperline. Author: Hans Verkuil <[email protected]> Date: Thu Nov 22 12:53:47 2012 +0100 Some drivers allow applications to set bytesperline to a value larger than the minimum necessary. This makes it possible to specify additional padding. However, v4l2-ctl does a G_FMT before setting a new format, and currently it doesn't reset bytesperline. So if the old format was 1920x1080, and you switch to 1280x720, then bytesperline will still be at the old 1920 value. This patch ensures that bytesperline is reset to 0 before calling S_FMT, thus overwriting any old bytesperline values. Signed-off-by: Hans Verkuil <[email protected]> utils/v4l2-ctl/v4l2-ctl-vidcap.cpp | 9 +++++++++ utils/v4l2-ctl/v4l2-ctl-vidout.cpp | 10 ++++++++++ 2 files changed, 19 insertions(+), 0 deletions(-) --- http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=ebee59ff2749e39eb48d75492cbb34d9c16145a5 diff --git a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp index d48bdc4..1ba5131 100644 --- a/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-vidcap.cpp @@ -262,6 +262,10 @@ void vidcap_set(int fd) false); } } + /* G_FMT might return a bytesperline value > width, + * reset this to 0 to force the driver to update it + * to the closest value for the new width. */ + in_vfmt.fmt.pix.bytesperline = 0; if (options[OptSetVideoFormat]) ret = doioctl(fd, VIDIOC_S_FMT, &in_vfmt); else @@ -288,6 +292,11 @@ void vidcap_set(int fd) true); } } + /* G_FMT might return bytesperline values > width, + * reset them to 0 to force the driver to update them + * to the closest value for the new width. */ + for (unsigned i = 0; i < in_vfmt.fmt.pix_mp.num_planes; i++) + in_vfmt.fmt.pix_mp.plane_fmt[i].bytesperline = 0; if (options[OptSetVideoMplaneFormat]) ret = doioctl(fd, VIDIOC_S_FMT, &in_vfmt); else diff --git a/utils/v4l2-ctl/v4l2-ctl-vidout.cpp b/utils/v4l2-ctl/v4l2-ctl-vidout.cpp index a0ba56b..85510e5 100644 --- a/utils/v4l2-ctl/v4l2-ctl-vidout.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-vidout.cpp @@ -102,6 +102,10 @@ void vidout_set(int fd) false); } } + /* G_FMT might return a bytesperline value > width, + * reset this to 0 to force the driver to update it + * to the closest value for the new width. */ + in_vfmt.fmt.pix.bytesperline = 0; if (options[OptSetVideoOutFormat]) ret = doioctl(fd, VIDIOC_S_FMT, &in_vfmt); @@ -129,6 +133,12 @@ void vidout_set(int fd) true); } } + /* G_FMT might return bytesperline values > width, + * reset them to 0 to force the driver to update them + * to the closest value for the new width. */ + for (unsigned i = 0; i < in_vfmt.fmt.pix_mp.num_planes; i++) + in_vfmt.fmt.pix_mp.plane_fmt[i].bytesperline = 0; + if (options[OptSetVideoOutMplaneFormat]) ret = doioctl(fd, VIDIOC_S_FMT, &in_vfmt); else _______________________________________________ linuxtv-commits mailing list [email protected] http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
