From 891ea2e9951290f411878bcd2893c81a909c98ad Mon Sep 17 00:00:00 2001 From: Sylwester Nawrocki Date: Tue, 29 Nov 2016 12:13:35 +0100 Subject: v4l2-jpeg-codec-test: Ensure V4L2 data structures are properly initialized This patch adds clearing some data structures before they are passed to ioctls to avoid problems with more recent kernels and also butesused field on the V4L2_BUF_TYPE_VIDEO_OUTPUT queue is initialized as required. Signed-off-by: Marek Szyprowski Signed-off-by: Sylwester Nawrocki --- v4l2-jpeg-codec-test/test-jpeg.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'v4l2-jpeg-codec-test') diff --git a/v4l2-jpeg-codec-test/test-jpeg.c b/v4l2-jpeg-codec-test/test-jpeg.c index f723bf4..ed3c650 100644 --- a/v4l2-jpeg-codec-test/test-jpeg.c +++ b/v4l2-jpeg-codec-test/test-jpeg.c @@ -389,14 +389,14 @@ int main(int argc, char *argv[]) { int i, r, input_fd; int ret = 0; - struct v4l2_buffer buf; - struct v4l2_requestbuffers reqbuf; + struct v4l2_buffer buf = {0}; + struct v4l2_requestbuffers reqbuf = {0}; enum v4l2_buf_type type; fd_set read_fds; char *def_outfile = "out.file"; - struct v4l2_capability cap; - struct v4l2_format fmt; + struct v4l2_capability cap = {0}; + struct v4l2_format fmt = {0}; char video_node_name[20]; ret = parse_args(argc, argv); @@ -482,6 +482,7 @@ int main(int argc, char *argv[]) buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; buf.memory = V4L2_MEMORY_MMAP; buf.index = 0; + buf.bytesused = input_file_sz; ret = ioctl(vid_fd, VIDIOC_QBUF, &buf); perror_exit(ret != 0, "ioctl"); -- cgit v1.2.3