summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2016-11-29 12:13:35 +0100
committerSylwester Nawrocki <s.nawrocki@samsung.com>2016-11-29 12:22:19 +0100
commit891ea2e9951290f411878bcd2893c81a909c98ad (patch)
treebca0c7a1c04a26494f6f544fd46fcee2d8712213
parentf50ace41a0d05bea2f5f1a5c7d769b22b956bd94 (diff)
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 <m.szyprowski@samsung.com> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
-rw-r--r--v4l2-jpeg-codec-test/test-jpeg.c9
1 files changed, 5 insertions, 4 deletions
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");