diff options
author | chase maupin <chase.maupin@ti.com> | 2014-06-05 11:44:30 -0500 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2014-06-13 13:38:10 +0200 |
commit | bbc32a09b2b6a16d72331026d044eb4bfe17a4c5 (patch) | |
tree | f9c5de5a0d6b0d1ee7770eae67d4dace9e4811d6 /meta-oe/recipes-multimedia/v4l2apps | |
parent | 75ca64e5917d0177c48f58f631497a05e2773731 (diff) | |
download | meta-openembedded-bbc32a09b2b6a16d72331026d044eb4bfe17a4c5.tar.gz |
yavta: Update to latest sources
* Update the yavta test utility to the latest sources in the
git repository.
* Updated the patch by Koen Kooi that allows stdout mode to be
used to work with the latest sources.
* Added a CFLAGS setting to use the include directory in the
sources which are more up-to-date and intended to be used
when building the application.
Signed-off-by: Chase Maupin <Chase.Maupin@ti.com>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-multimedia/v4l2apps')
-rw-r--r-- | meta-oe/recipes-multimedia/v4l2apps/yavta/0001-Add-stdout-mode-to-allow-streaming-over-the-network-.patch | 551 | ||||
-rw-r--r-- | meta-oe/recipes-multimedia/v4l2apps/yavta_git.bb | 7 |
2 files changed, 335 insertions, 223 deletions
diff --git a/meta-oe/recipes-multimedia/v4l2apps/yavta/0001-Add-stdout-mode-to-allow-streaming-over-the-network-.patch b/meta-oe/recipes-multimedia/v4l2apps/yavta/0001-Add-stdout-mode-to-allow-streaming-over-the-network-.patch index 430836fee..41a5dbf4f 100644 --- a/meta-oe/recipes-multimedia/v4l2apps/yavta/0001-Add-stdout-mode-to-allow-streaming-over-the-network-.patch +++ b/meta-oe/recipes-multimedia/v4l2apps/yavta/0001-Add-stdout-mode-to-allow-streaming-over-the-network-.patch | |||
@@ -1,18 +1,35 @@ | |||
1 | From 1146a0f01fc8730d5633b46b85d00154a721abbe Mon Sep 17 00:00:00 2001 | 1 | From 141d3b3593722eb3d588e7c4b1542f810bc25853 Mon Sep 17 00:00:00 2001 |
2 | From: Koen Kooi <koen@dominion.thruhere.net> | 2 | From: Koen Kooi <koen@dominion.thruhere.net> |
3 | Date: Fri, 22 Jun 2012 12:40:23 +0200 | 3 | Date: Thu, 5 Jun 2014 11:29:20 -0500 |
4 | Subject: [PATCH] Add stdout mode to allow streaming over the network with nc | 4 | Subject: [PATCH] Add stdout mode to allow streaming over the network with nc |
5 | 5 | ||
6 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | 6 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> |
7 | Signed-off-by: Chase Maupin <Chase.Maupin@ti.com> | ||
7 | --- | 8 | --- |
8 | yavta.c | 288 ++++++++++++++++++++++++++++++++++----------------------------- | 9 | yavta.c | 315 ++++++++++++++++++++++++++++++++++----------------------------- |
9 | 1 file changed, 157 insertions(+), 131 deletions(-) | 10 | 1 file changed, 169 insertions(+), 146 deletions(-) |
10 | 11 | ||
11 | diff --git a/yavta.c b/yavta.c | 12 | diff --git a/yavta.c b/yavta.c |
12 | index f3deae0..8020209 100644 | 13 | index 32adc26..b398da0 100644 |
13 | --- a/yavta.c | 14 | --- a/yavta.c |
14 | +++ b/yavta.c | 15 | +++ b/yavta.c |
15 | @@ -188,12 +188,12 @@ static int video_open(struct device *dev, const char *devname, int no_query) | 16 | @@ -309,7 +309,7 @@ static bool video_has_fd(struct device *dev) |
17 | static int video_set_fd(struct device *dev, int fd) | ||
18 | { | ||
19 | if (video_has_fd(dev)) { | ||
20 | - printf("Can't set fd (already open).\n"); | ||
21 | + fprintf(stderr, "Can't set fd (already open).\n"); | ||
22 | return -1; | ||
23 | } | ||
24 | |||
25 | @@ -321,18 +321,18 @@ static int video_set_fd(struct device *dev, int fd) | ||
26 | static int video_open(struct device *dev, const char *devname) | ||
27 | { | ||
28 | if (video_has_fd(dev)) { | ||
29 | - printf("Can't open device (already open).\n"); | ||
30 | + fprintf(stderr, "Can't open device (already open).\n"); | ||
31 | return -1; | ||
32 | } | ||
16 | 33 | ||
17 | dev->fd = open(devname, O_RDWR); | 34 | dev->fd = open(devname, O_RDWR); |
18 | if (dev->fd < 0) { | 35 | if (dev->fd < 0) { |
@@ -25,25 +42,27 @@ index f3deae0..8020209 100644 | |||
25 | - printf("Device %s opened.\n", devname); | 42 | - printf("Device %s opened.\n", devname); |
26 | + fprintf(stderr, "Device %s opened.\n", devname); | 43 | + fprintf(stderr, "Device %s opened.\n", devname); |
27 | 44 | ||
28 | if (no_query) { | 45 | dev->opened = 1; |
29 | /* Assume capture device. */ | 46 | |
30 | @@ -211,13 +211,13 @@ static int video_open(struct device *dev, const char *devname, int no_query) | 47 | @@ -352,7 +352,7 @@ static int video_querycap(struct device *dev, unsigned int *capabilities) |
31 | else if (cap.capabilities & V4L2_CAP_VIDEO_OUTPUT) | 48 | *capabilities = cap.capabilities & V4L2_CAP_DEVICE_CAPS |
32 | dev->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; | 49 | ? cap.device_caps : cap.capabilities; |
33 | else { | 50 | |
34 | - printf("Error opening device %s: neither video capture " | 51 | - printf("Device `%s' on `%s' is a video %s (%s mplanes) device.\n", |
35 | + fprintf(stderr, "Error opening device %s: neither video capture " | 52 | + fprintf(stderr, "Device `%s' on `%s' is a video %s (%s mplanes) device.\n", |
36 | "nor video output supported.\n", devname); | 53 | cap.card, cap.bus_info, |
37 | close(dev->fd); | 54 | video_is_capture(dev) ? "capture" : "output", |
55 | video_is_mplane(dev) ? "with" : "without"); | ||
56 | @@ -370,7 +370,7 @@ static int cap_get_buf_type(unsigned int capabilities) | ||
57 | } else if (capabilities & V4L2_CAP_VIDEO_OUTPUT) { | ||
58 | return V4L2_BUF_TYPE_VIDEO_OUTPUT; | ||
59 | } else { | ||
60 | - printf("Device supports neither capture nor output.\n"); | ||
61 | + fprintf(stderr, "Device supports neither capture nor output.\n"); | ||
38 | return -EINVAL; | 62 | return -EINVAL; |
39 | } | 63 | } |
40 | 64 | ||
41 | - printf("Device `%s' on `%s' is a video %s device.\n", | 65 | @@ -440,7 +440,7 @@ static int get_control(struct device *dev, unsigned int id, int type, |
42 | + fprintf(stderr, "Device `%s' on `%s' is a video %s device.\n", | ||
43 | cap.card, cap.bus_info, | ||
44 | dev->type == V4L2_BUF_TYPE_VIDEO_CAPTURE ? "capture" : "output"); | ||
45 | return 0; | ||
46 | @@ -280,7 +280,7 @@ static int get_control(struct device *dev, unsigned int id, int type, | ||
47 | } | 66 | } |
48 | } | 67 | } |
49 | 68 | ||
@@ -52,7 +71,7 @@ index f3deae0..8020209 100644 | |||
52 | id, strerror(errno), errno); | 71 | id, strerror(errno), errno); |
53 | return -1; | 72 | return -1; |
54 | } | 73 | } |
55 | @@ -322,12 +322,12 @@ static void set_control(struct device *dev, unsigned int id, int type, | 74 | @@ -484,12 +484,12 @@ static void set_control(struct device *dev, unsigned int id, int type, |
56 | val = old.value; | 75 | val = old.value; |
57 | } | 76 | } |
58 | if (ret == -1) { | 77 | if (ret == -1) { |
@@ -67,7 +86,7 @@ index f3deae0..8020209 100644 | |||
67 | id, old_val, val); | 86 | id, old_val, val); |
68 | } | 87 | } |
69 | 88 | ||
70 | @@ -341,7 +341,7 @@ static int video_get_format(struct device *dev) | 89 | @@ -504,7 +504,7 @@ static int video_get_format(struct device *dev) |
71 | 90 | ||
72 | ret = ioctl(dev->fd, VIDIOC_G_FMT, &fmt); | 91 | ret = ioctl(dev->fd, VIDIOC_G_FMT, &fmt); |
73 | if (ret < 0) { | 92 | if (ret < 0) { |
@@ -76,16 +95,34 @@ index f3deae0..8020209 100644 | |||
76 | errno); | 95 | errno); |
77 | return ret; | 96 | return ret; |
78 | } | 97 | } |
79 | @@ -351,7 +351,7 @@ static int video_get_format(struct device *dev) | 98 | @@ -514,7 +514,7 @@ static int video_get_format(struct device *dev) |
80 | dev->bytesperline = fmt.fmt.pix.bytesperline; | 99 | dev->height = fmt.fmt.pix_mp.height; |
81 | dev->imagesize = fmt.fmt.pix.bytesperline ? fmt.fmt.pix.sizeimage : 0; | 100 | dev->num_planes = fmt.fmt.pix_mp.num_planes; |
101 | |||
102 | - printf("Video format: %s (%08x) %ux%u field %s, %u planes: \n", | ||
103 | + fprintf(stderr, "Video format: %s (%08x) %ux%u field %s, %u planes: \n", | ||
104 | v4l2_format_name(fmt.fmt.pix_mp.pixelformat), fmt.fmt.pix_mp.pixelformat, | ||
105 | fmt.fmt.pix_mp.width, fmt.fmt.pix_mp.height, | ||
106 | v4l2_field_name(fmt.fmt.pix_mp.field), | ||
107 | @@ -527,7 +527,7 @@ static int video_get_format(struct device *dev) | ||
108 | fmt.fmt.pix_mp.plane_fmt[i].bytesperline ? | ||
109 | fmt.fmt.pix_mp.plane_fmt[i].sizeimage : 0; | ||
110 | |||
111 | - printf(" * Stride %u, buffer size %u\n", | ||
112 | + fprintf(stderr, " * Stride %u, buffer size %u\n", | ||
113 | fmt.fmt.pix_mp.plane_fmt[i].bytesperline, | ||
114 | fmt.fmt.pix_mp.plane_fmt[i].sizeimage); | ||
115 | } | ||
116 | @@ -539,7 +539,7 @@ static int video_get_format(struct device *dev) | ||
117 | dev->plane_fmt[0].bytesperline = fmt.fmt.pix.bytesperline; | ||
118 | dev->plane_fmt[0].sizeimage = fmt.fmt.pix.bytesperline ? fmt.fmt.pix.sizeimage : 0; | ||
82 | 119 | ||
83 | - printf("Video format: %s (%08x) %ux%u (stride %u) buffer size %u\n", | 120 | - printf("Video format: %s (%08x) %ux%u (stride %u) field %s buffer size %u\n", |
84 | + fprintf(stderr, "Video format: %s (%08x) %ux%u (stride %u) buffer size %u\n", | 121 | + fprintf(stderr, "Video format: %s (%08x) %ux%u (stride %u) field %s buffer size %u\n", |
85 | v4l2_format_name(fmt.fmt.pix.pixelformat), fmt.fmt.pix.pixelformat, | 122 | v4l2_format_name(fmt.fmt.pix.pixelformat), fmt.fmt.pix.pixelformat, |
86 | fmt.fmt.pix.width, fmt.fmt.pix.height, fmt.fmt.pix.bytesperline, | 123 | fmt.fmt.pix.width, fmt.fmt.pix.height, fmt.fmt.pix.bytesperline, |
87 | fmt.fmt.pix.sizeimage); | 124 | v4l2_field_name(fmt.fmt.pix_mp.field), |
88 | @@ -374,12 +374,12 @@ static int video_set_format(struct device *dev, unsigned int w, unsigned int h, | 125 | @@ -581,25 +581,25 @@ static int video_set_format(struct device *dev, unsigned int w, unsigned int h, |
89 | 126 | ||
90 | ret = ioctl(dev->fd, VIDIOC_S_FMT, &fmt); | 127 | ret = ioctl(dev->fd, VIDIOC_S_FMT, &fmt); |
91 | if (ret < 0) { | 128 | if (ret < 0) { |
@@ -95,12 +132,27 @@ index f3deae0..8020209 100644 | |||
95 | return ret; | 132 | return ret; |
96 | } | 133 | } |
97 | 134 | ||
98 | - printf("Video format set: %s (%08x) %ux%u (stride %u) buffer size %u\n", | 135 | if (video_is_mplane(dev)) { |
99 | + fprintf(stderr, "Video format set: %s (%08x) %ux%u (stride %u) buffer size %u\n", | 136 | - printf("Video format set: %s (%08x) %ux%u field %s, %u planes: \n", |
100 | v4l2_format_name(fmt.fmt.pix.pixelformat), fmt.fmt.pix.pixelformat, | 137 | + fprintf(stderr, "Video format set: %s (%08x) %ux%u field %s, %u planes: \n", |
101 | fmt.fmt.pix.width, fmt.fmt.pix.height, fmt.fmt.pix.bytesperline, | 138 | v4l2_format_name(fmt.fmt.pix_mp.pixelformat), fmt.fmt.pix_mp.pixelformat, |
102 | fmt.fmt.pix.sizeimage); | 139 | fmt.fmt.pix_mp.width, fmt.fmt.pix_mp.height, |
103 | @@ -396,16 +396,16 @@ static int video_set_framerate(struct device *dev, struct v4l2_fract *time_per_f | 140 | v4l2_field_name(fmt.fmt.pix_mp.field), |
141 | fmt.fmt.pix_mp.num_planes); | ||
142 | |||
143 | for (i = 0; i < fmt.fmt.pix_mp.num_planes; i++) { | ||
144 | - printf(" * Stride %u, buffer size %u\n", | ||
145 | + fprintf(stderr, " * Stride %u, buffer size %u\n", | ||
146 | fmt.fmt.pix_mp.plane_fmt[i].bytesperline, | ||
147 | fmt.fmt.pix_mp.plane_fmt[i].sizeimage); | ||
148 | } | ||
149 | } else { | ||
150 | - printf("Video format set: %s (%08x) %ux%u (stride %u) field %s buffer size %u\n", | ||
151 | + fprintf(stderr, "Video format set: %s (%08x) %ux%u (stride %u) field %s buffer size %u\n", | ||
152 | v4l2_format_name(fmt.fmt.pix.pixelformat), fmt.fmt.pix.pixelformat, | ||
153 | fmt.fmt.pix.width, fmt.fmt.pix.height, fmt.fmt.pix.bytesperline, | ||
154 | v4l2_field_name(fmt.fmt.pix.field), | ||
155 | @@ -619,16 +619,16 @@ static int video_set_framerate(struct device *dev, struct v4l2_fract *time_per_f | ||
104 | 156 | ||
105 | ret = ioctl(dev->fd, VIDIOC_G_PARM, &parm); | 157 | ret = ioctl(dev->fd, VIDIOC_G_PARM, &parm); |
106 | if (ret < 0) { | 158 | if (ret < 0) { |
@@ -120,7 +172,7 @@ index f3deae0..8020209 100644 | |||
120 | time_per_frame->numerator, | 172 | time_per_frame->numerator, |
121 | time_per_frame->denominator); | 173 | time_per_frame->denominator); |
122 | 174 | ||
123 | @@ -414,19 +414,19 @@ static int video_set_framerate(struct device *dev, struct v4l2_fract *time_per_f | 175 | @@ -637,19 +637,19 @@ static int video_set_framerate(struct device *dev, struct v4l2_fract *time_per_f |
124 | 176 | ||
125 | ret = ioctl(dev->fd, VIDIOC_S_PARM, &parm); | 177 | ret = ioctl(dev->fd, VIDIOC_S_PARM, &parm); |
126 | if (ret < 0) { | 178 | if (ret < 0) { |
@@ -143,7 +195,52 @@ index f3deae0..8020209 100644 | |||
143 | parm.parm.capture.timeperframe.numerator, | 195 | parm.parm.capture.timeperframe.numerator, |
144 | parm.parm.capture.timeperframe.denominator); | 196 | parm.parm.capture.timeperframe.denominator); |
145 | return 0; | 197 | return 0; |
146 | @@ -449,12 +449,12 @@ static int video_alloc_buffers(struct device *dev, int nbufs, | 198 | @@ -674,7 +674,7 @@ static int video_buffer_mmap(struct device *dev, struct buffer *buffer, |
199 | buffer->mem[i] = mmap(0, length, PROT_READ | PROT_WRITE, MAP_SHARED, | ||
200 | dev->fd, offset); | ||
201 | if (buffer->mem[i] == MAP_FAILED) { | ||
202 | - printf("Unable to map buffer %u/%u: %s (%d)\n", | ||
203 | + fprintf(stderr, "Unable to map buffer %u/%u: %s (%d)\n", | ||
204 | buffer->idx, i, strerror(errno), errno); | ||
205 | return -1; | ||
206 | } | ||
207 | @@ -682,7 +682,7 @@ static int video_buffer_mmap(struct device *dev, struct buffer *buffer, | ||
208 | buffer->size[i] = length; | ||
209 | buffer->padding[i] = 0; | ||
210 | |||
211 | - printf("Buffer %u/%u mapped at address %p.\n", | ||
212 | + fprintf(stderr, "Buffer %u/%u mapped at address %p.\n", | ||
213 | buffer->idx, i, buffer->mem[i]); | ||
214 | } | ||
215 | |||
216 | @@ -697,7 +697,7 @@ static int video_buffer_munmap(struct device *dev, struct buffer *buffer) | ||
217 | for (i = 0; i < dev->num_planes; i++) { | ||
218 | ret = munmap(buffer->mem[i], buffer->size[i]); | ||
219 | if (ret < 0) { | ||
220 | - printf("Unable to unmap buffer %u/%u: %s (%d)\n", | ||
221 | + fprintf(stderr, "Unable to unmap buffer %u/%u: %s (%d)\n", | ||
222 | buffer->idx, i, strerror(errno), errno); | ||
223 | } | ||
224 | |||
225 | @@ -725,7 +725,7 @@ static int video_buffer_alloc_userptr(struct device *dev, struct buffer *buffer, | ||
226 | ret = posix_memalign(&buffer->mem[i], page_size, | ||
227 | length + offset + padding); | ||
228 | if (ret < 0) { | ||
229 | - printf("Unable to allocate buffer %u/%u (%d)\n", | ||
230 | + fprintf(stderr, "Unable to allocate buffer %u/%u (%d)\n", | ||
231 | buffer->idx, i, ret); | ||
232 | return -ENOMEM; | ||
233 | } | ||
234 | @@ -734,7 +734,7 @@ static int video_buffer_alloc_userptr(struct device *dev, struct buffer *buffer, | ||
235 | buffer->size[i] = length; | ||
236 | buffer->padding[i] = padding; | ||
237 | |||
238 | - printf("Buffer %u/%u allocated at address %p.\n", | ||
239 | + fprintf(stderr, "Buffer %u/%u allocated at address %p.\n", | ||
240 | buffer->idx, i, buffer->mem[i]); | ||
241 | } | ||
242 | |||
243 | @@ -809,12 +809,12 @@ static int video_alloc_buffers(struct device *dev, int nbufs, | ||
147 | 244 | ||
148 | ret = ioctl(dev->fd, VIDIOC_REQBUFS, &rb); | 245 | ret = ioctl(dev->fd, VIDIOC_REQBUFS, &rb); |
149 | if (ret < 0) { | 246 | if (ret < 0) { |
@@ -158,8 +255,8 @@ index f3deae0..8020209 100644 | |||
158 | 255 | ||
159 | buffers = malloc(rb.count * sizeof buffers[0]); | 256 | buffers = malloc(rb.count * sizeof buffers[0]); |
160 | if (buffers == NULL) | 257 | if (buffers == NULL) |
161 | @@ -470,35 +470,35 @@ static int video_alloc_buffers(struct device *dev, int nbufs, | 258 | @@ -835,12 +835,12 @@ static int video_alloc_buffers(struct device *dev, int nbufs, |
162 | buf.memory = dev->memtype; | 259 | |
163 | ret = ioctl(dev->fd, VIDIOC_QUERYBUF, &buf); | 260 | ret = ioctl(dev->fd, VIDIOC_QUERYBUF, &buf); |
164 | if (ret < 0) { | 261 | if (ret < 0) { |
165 | - printf("Unable to query buffer %u: %s (%d).\n", i, | 262 | - printf("Unable to query buffer %u: %s (%d).\n", i, |
@@ -167,49 +264,13 @@ index f3deae0..8020209 100644 | |||
167 | strerror(errno), errno); | 264 | strerror(errno), errno); |
168 | return ret; | 265 | return ret; |
169 | } | 266 | } |
170 | - printf("length: %u offset: %u\n", buf.length, buf.m.offset); | 267 | get_ts_flags(buf.flags, &ts_type, &ts_source); |
171 | + fprintf(stderr, "length: %u offset: %u\n", buf.length, buf.m.offset); | 268 | - printf("length: %u offset: %u timestamp type/source: %s/%s\n", |
172 | 269 | + fprintf(stderr, "length: %u offset: %u timestamp type/source: %s/%s\n", | |
173 | switch (dev->memtype) { | 270 | buf.length, buf.m.offset, ts_type, ts_source); |
174 | case V4L2_MEMORY_MMAP: | ||
175 | buffers[i].mem = mmap(0, buf.length, PROT_READ | PROT_WRITE, MAP_SHARED, dev->fd, buf.m.offset); | ||
176 | if (buffers[i].mem == MAP_FAILED) { | ||
177 | - printf("Unable to map buffer %u: %s (%d)\n", i, | ||
178 | + fprintf(stderr, "Unable to map buffer %u: %s (%d)\n", i, | ||
179 | strerror(errno), errno); | ||
180 | return ret; | ||
181 | } | ||
182 | buffers[i].size = buf.length; | ||
183 | buffers[i].padding = 0; | ||
184 | - printf("Buffer %u mapped at address %p.\n", i, buffers[i].mem); | ||
185 | + fprintf(stderr, "Buffer %u mapped at address %p.\n", i, buffers[i].mem); | ||
186 | break; | ||
187 | |||
188 | case V4L2_MEMORY_USERPTR: | ||
189 | ret = posix_memalign(&buffers[i].mem, page_size, buf.length + offset + padding); | ||
190 | if (ret < 0) { | ||
191 | - printf("Unable to allocate buffer %u (%d)\n", i, ret); | ||
192 | + fprintf(stderr, "Unable to allocate buffer %u (%d)\n", i, ret); | ||
193 | return -ENOMEM; | ||
194 | } | ||
195 | buffers[i].mem += offset; | ||
196 | buffers[i].size = buf.length; | ||
197 | buffers[i].padding = padding; | ||
198 | - printf("Buffer %u allocated at address %p.\n", i, buffers[i].mem); | ||
199 | + fprintf(stderr, "Buffer %u allocated at address %p.\n", i, buffers[i].mem); | ||
200 | break; | ||
201 | 271 | ||
202 | default: | 272 | buffers[i].idx = i; |
203 | @@ -525,7 +525,7 @@ static int video_free_buffers(struct device *dev) | 273 | @@ -899,12 +899,12 @@ static int video_free_buffers(struct device *dev) |
204 | case V4L2_MEMORY_MMAP: | ||
205 | ret = munmap(dev->buffers[i].mem, dev->buffers[i].size); | ||
206 | if (ret < 0) { | ||
207 | - printf("Unable to unmap buffer %u: %s (%d)\n", i, | ||
208 | + fprintf(stderr, "Unable to unmap buffer %u: %s (%d)\n", i, | ||
209 | strerror(errno), errno); | ||
210 | return ret; | ||
211 | } | ||
212 | @@ -549,12 +549,12 @@ static int video_free_buffers(struct device *dev) | ||
213 | 274 | ||
214 | ret = ioctl(dev->fd, VIDIOC_REQBUFS, &rb); | 275 | ret = ioctl(dev->fd, VIDIOC_REQBUFS, &rb); |
215 | if (ret < 0) { | 276 | if (ret < 0) { |
@@ -224,7 +285,7 @@ index f3deae0..8020209 100644 | |||
224 | 285 | ||
225 | free(dev->buffers); | 286 | free(dev->buffers); |
226 | dev->nbufs = 0; | 287 | dev->nbufs = 0; |
227 | @@ -589,7 +589,7 @@ static int video_queue_buffer(struct device *dev, int index, enum buffer_fill_mo | 288 | @@ -974,7 +974,7 @@ static int video_queue_buffer(struct device *dev, int index, enum buffer_fill_mo |
228 | 289 | ||
229 | ret = ioctl(dev->fd, VIDIOC_QBUF, &buf); | 290 | ret = ioctl(dev->fd, VIDIOC_QBUF, &buf); |
230 | if (ret < 0) | 291 | if (ret < 0) |
@@ -233,7 +294,7 @@ index f3deae0..8020209 100644 | |||
233 | strerror(errno), errno); | 294 | strerror(errno), errno); |
234 | 295 | ||
235 | return ret; | 296 | return ret; |
236 | @@ -602,7 +602,7 @@ static int video_enable(struct device *dev, int enable) | 297 | @@ -987,7 +987,7 @@ static int video_enable(struct device *dev, int enable) |
237 | 298 | ||
238 | ret = ioctl(dev->fd, enable ? VIDIOC_STREAMON : VIDIOC_STREAMOFF, &type); | 299 | ret = ioctl(dev->fd, enable ? VIDIOC_STREAMON : VIDIOC_STREAMOFF, &type); |
239 | if (ret < 0) { | 300 | if (ret < 0) { |
@@ -242,19 +303,20 @@ index f3deae0..8020209 100644 | |||
242 | enable ? "start" : "stop", strerror(errno), errno); | 303 | enable ? "start" : "stop", strerror(errno), errno); |
243 | return ret; | 304 | return ret; |
244 | } | 305 | } |
245 | @@ -623,9 +623,9 @@ static void video_query_menu(struct device *dev, struct v4l2_queryctrl *query) | 306 | @@ -1009,10 +1009,10 @@ static void video_query_menu(struct device *dev, struct v4l2_queryctrl *query, |
246 | continue; | 307 | continue; |
247 | 308 | ||
248 | if (query->type == V4L2_CTRL_TYPE_MENU) | 309 | if (query->type == V4L2_CTRL_TYPE_MENU) |
249 | - printf(" %u: %.32s\n", menu.index, menu.name); | 310 | - printf(" %u: %.32s%s\n", menu.index, menu.name, |
250 | + fprintf(stderr, " %u: %.32s\n", menu.index, menu.name); | 311 | + fprintf(stderr, " %u: %.32s%s\n", menu.index, menu.name, |
312 | menu.index == value ? " (*)" : ""); | ||
251 | else | 313 | else |
252 | - printf(" %u: %lld\n", menu.index, menu.value); | 314 | - printf(" %u: %lld%s\n", menu.index, menu.value, |
253 | + fprintf(stderr, " %u: %lld\n", menu.index, menu.value); | 315 | + fprintf(stderr, " %u: %lld%s\n", menu.index, menu.value, |
316 | menu.index == value ? " (*)" : ""); | ||
254 | }; | 317 | }; |
255 | } | 318 | } |
256 | 319 | @@ -1043,7 +1043,7 @@ static void video_list_controls(struct device *dev) | |
257 | @@ -655,7 +655,7 @@ static void video_list_controls(struct device *dev) | ||
258 | continue; | 320 | continue; |
259 | 321 | ||
260 | if (query.type == V4L2_CTRL_TYPE_CTRL_CLASS) { | 322 | if (query.type == V4L2_CTRL_TYPE_CTRL_CLASS) { |
@@ -263,7 +325,7 @@ index f3deae0..8020209 100644 | |||
263 | continue; | 325 | continue; |
264 | } | 326 | } |
265 | 327 | ||
266 | @@ -665,7 +665,7 @@ static void video_list_controls(struct device *dev) | 328 | @@ -1053,7 +1053,7 @@ static void video_list_controls(struct device *dev) |
267 | else | 329 | else |
268 | sprintf(value, "%" PRId64, val64); | 330 | sprintf(value, "%" PRId64, val64); |
269 | 331 | ||
@@ -272,7 +334,7 @@ index f3deae0..8020209 100644 | |||
272 | query.id, query.name, query.minimum, query.maximum, | 334 | query.id, query.name, query.minimum, query.maximum, |
273 | query.step, query.default_value, value); | 335 | query.step, query.default_value, value); |
274 | 336 | ||
275 | @@ -677,9 +677,9 @@ static void video_list_controls(struct device *dev) | 337 | @@ -1065,9 +1065,9 @@ static void video_list_controls(struct device *dev) |
276 | } | 338 | } |
277 | 339 | ||
278 | if (nctrls) | 340 | if (nctrls) |
@@ -284,7 +346,7 @@ index f3deae0..8020209 100644 | |||
284 | } | 346 | } |
285 | 347 | ||
286 | static void video_enum_frame_intervals(struct device *dev, __u32 pixelformat, | 348 | static void video_enum_frame_intervals(struct device *dev, __u32 pixelformat, |
287 | @@ -700,30 +700,30 @@ static void video_enum_frame_intervals(struct device *dev, __u32 pixelformat, | 349 | @@ -1088,30 +1088,30 @@ static void video_enum_frame_intervals(struct device *dev, __u32 pixelformat, |
288 | break; | 350 | break; |
289 | 351 | ||
290 | if (i != ival.index) | 352 | if (i != ival.index) |
@@ -322,7 +384,7 @@ index f3deae0..8020209 100644 | |||
322 | ival.stepwise.min.numerator, | 384 | ival.stepwise.min.numerator, |
323 | ival.stepwise.min.denominator, | 385 | ival.stepwise.min.denominator, |
324 | ival.stepwise.max.numerator, | 386 | ival.stepwise.max.numerator, |
325 | @@ -731,7 +731,7 @@ static void video_enum_frame_intervals(struct device *dev, __u32 pixelformat, | 387 | @@ -1119,7 +1119,7 @@ static void video_enum_frame_intervals(struct device *dev, __u32 pixelformat, |
326 | return; | 388 | return; |
327 | 389 | ||
328 | case V4L2_FRMIVAL_TYPE_STEPWISE: | 390 | case V4L2_FRMIVAL_TYPE_STEPWISE: |
@@ -331,7 +393,7 @@ index f3deae0..8020209 100644 | |||
331 | ival.stepwise.min.numerator, | 393 | ival.stepwise.min.numerator, |
332 | ival.stepwise.min.denominator, | 394 | ival.stepwise.min.denominator, |
333 | ival.stepwise.max.numerator, | 395 | ival.stepwise.max.numerator, |
334 | @@ -761,23 +761,23 @@ static void video_enum_frame_sizes(struct device *dev, __u32 pixelformat) | 396 | @@ -1149,23 +1149,23 @@ static void video_enum_frame_sizes(struct device *dev, __u32 pixelformat) |
335 | break; | 397 | break; |
336 | 398 | ||
337 | if (i != frame.index) | 399 | if (i != frame.index) |
@@ -360,7 +422,7 @@ index f3deae0..8020209 100644 | |||
360 | frame.stepwise.min_width, | 422 | frame.stepwise.min_width, |
361 | frame.stepwise.min_height, | 423 | frame.stepwise.min_height, |
362 | frame.stepwise.max_width, | 424 | frame.stepwise.max_width, |
363 | @@ -785,11 +785,11 @@ static void video_enum_frame_sizes(struct device *dev, __u32 pixelformat) | 425 | @@ -1173,11 +1173,11 @@ static void video_enum_frame_sizes(struct device *dev, __u32 pixelformat) |
364 | video_enum_frame_intervals(dev, frame.pixel_format, | 426 | video_enum_frame_intervals(dev, frame.pixel_format, |
365 | frame.stepwise.max_width, | 427 | frame.stepwise.max_width, |
366 | frame.stepwise.max_height); | 428 | frame.stepwise.max_height); |
@@ -374,7 +436,7 @@ index f3deae0..8020209 100644 | |||
374 | frame.stepwise.min_width, | 436 | frame.stepwise.min_width, |
375 | frame.stepwise.min_height, | 437 | frame.stepwise.min_height, |
376 | frame.stepwise.max_width, | 438 | frame.stepwise.max_width, |
377 | @@ -799,7 +799,7 @@ static void video_enum_frame_sizes(struct device *dev, __u32 pixelformat) | 439 | @@ -1187,7 +1187,7 @@ static void video_enum_frame_sizes(struct device *dev, __u32 pixelformat) |
378 | video_enum_frame_intervals(dev, frame.pixel_format, | 440 | video_enum_frame_intervals(dev, frame.pixel_format, |
379 | frame.stepwise.max_width, | 441 | frame.stepwise.max_width, |
380 | frame.stepwise.max_height); | 442 | frame.stepwise.max_height); |
@@ -383,7 +445,7 @@ index f3deae0..8020209 100644 | |||
383 | break; | 445 | break; |
384 | 446 | ||
385 | default: | 447 | default: |
386 | @@ -823,19 +823,19 @@ static void video_enum_formats(struct device *dev, enum v4l2_buf_type type) | 448 | @@ -1211,19 +1211,19 @@ static void video_enum_formats(struct device *dev, enum v4l2_buf_type type) |
387 | break; | 449 | break; |
388 | 450 | ||
389 | if (i != fmt.index) | 451 | if (i != fmt.index) |
@@ -409,7 +471,7 @@ index f3deae0..8020209 100644 | |||
409 | } | 471 | } |
410 | } | 472 | } |
411 | 473 | ||
412 | @@ -853,13 +853,13 @@ static void video_enum_inputs(struct device *dev) | 474 | @@ -1241,13 +1241,13 @@ static void video_enum_inputs(struct device *dev) |
413 | break; | 475 | break; |
414 | 476 | ||
415 | if (i != input.index) | 477 | if (i != input.index) |
@@ -426,7 +488,7 @@ index f3deae0..8020209 100644 | |||
426 | } | 488 | } |
427 | 489 | ||
428 | static int video_get_input(struct device *dev) | 490 | static int video_get_input(struct device *dev) |
429 | @@ -869,7 +869,7 @@ static int video_get_input(struct device *dev) | 491 | @@ -1257,7 +1257,7 @@ static int video_get_input(struct device *dev) |
430 | 492 | ||
431 | ret = ioctl(dev->fd, VIDIOC_G_INPUT, &input); | 493 | ret = ioctl(dev->fd, VIDIOC_G_INPUT, &input); |
432 | if (ret < 0) { | 494 | if (ret < 0) { |
@@ -435,7 +497,7 @@ index f3deae0..8020209 100644 | |||
435 | strerror(errno), errno); | 497 | strerror(errno), errno); |
436 | return ret; | 498 | return ret; |
437 | } | 499 | } |
438 | @@ -884,7 +884,7 @@ static int video_set_input(struct device *dev, unsigned int input) | 500 | @@ -1272,7 +1272,7 @@ static int video_set_input(struct device *dev, unsigned int input) |
439 | 501 | ||
440 | ret = ioctl(dev->fd, VIDIOC_S_INPUT, &_input); | 502 | ret = ioctl(dev->fd, VIDIOC_S_INPUT, &_input); |
441 | if (ret < 0) | 503 | if (ret < 0) |
@@ -444,7 +506,7 @@ index f3deae0..8020209 100644 | |||
444 | strerror(errno), errno); | 506 | strerror(errno), errno); |
445 | 507 | ||
446 | return ret; | 508 | return ret; |
447 | @@ -903,14 +903,14 @@ static int video_set_quality(struct device *dev, unsigned int quality) | 509 | @@ -1291,14 +1291,14 @@ static int video_set_quality(struct device *dev, unsigned int quality) |
448 | 510 | ||
449 | ret = ioctl(dev->fd, VIDIOC_S_JPEGCOMP, &jpeg); | 511 | ret = ioctl(dev->fd, VIDIOC_S_JPEGCOMP, &jpeg); |
450 | if (ret < 0) { | 512 | if (ret < 0) { |
@@ -461,87 +523,99 @@ index f3deae0..8020209 100644 | |||
461 | 523 | ||
462 | return 0; | 524 | return 0; |
463 | } | 525 | } |
464 | @@ -930,7 +930,7 @@ static int video_load_test_pattern(struct device *dev, const char *filename) | 526 | @@ -1313,7 +1313,7 @@ static int video_load_test_pattern(struct device *dev, const char *filename) |
465 | 527 | if (filename != NULL) { | |
466 | if (filename == NULL) { | 528 | fd = open(filename, O_RDONLY); |
467 | if (dev->bytesperline == 0) { | 529 | if (fd == -1) { |
468 | - printf("Compressed format detect and no test pattern filename given.\n" | 530 | - printf("Unable to open test pattern file '%s': %s (%d).\n", |
469 | + fprintf(stderr, "Compressed format detect and no test pattern filename given.\n" | 531 | + fprintf(stderr, "Unable to open test pattern file '%s': %s (%d).\n", |
470 | "The test pattern can't be generated automatically.\n"); | 532 | filename, strerror(errno), errno); |
471 | return -EINVAL; | 533 | return -errno; |
472 | } | 534 | } |
473 | @@ -947,7 +947,7 @@ static int video_load_test_pattern(struct device *dev, const char *filename) | 535 | @@ -1331,7 +1331,7 @@ static int video_load_test_pattern(struct device *dev, const char *filename) |
536 | if (filename != NULL) { | ||
537 | ret = read(fd, dev->pattern[plane], size); | ||
538 | if (ret != (int)size && dev->plane_fmt[plane].bytesperline != 0) { | ||
539 | - printf("Test pattern file size %u doesn't match image size %u\n", | ||
540 | + fprintf(stderr, "Test pattern file size %u doesn't match image size %u\n", | ||
541 | ret, size); | ||
542 | ret = -EINVAL; | ||
543 | goto done; | ||
544 | @@ -1341,7 +1341,7 @@ static int video_load_test_pattern(struct device *dev, const char *filename) | ||
545 | unsigned int i; | ||
546 | |||
547 | if (dev->plane_fmt[plane].bytesperline == 0) { | ||
548 | - printf("Compressed format detected for plane %u and no test pattern filename given.\n" | ||
549 | + fprintf(stderr, "Compressed format detected for plane %u and no test pattern filename given.\n" | ||
550 | "The test pattern can't be generated automatically.\n", plane); | ||
551 | ret = -EINVAL; | ||
552 | goto done; | ||
553 | @@ -1410,7 +1410,7 @@ static void video_verify_buffer(struct device *dev, struct v4l2_buffer *buf) | ||
474 | 554 | ||
475 | fd = open(filename, O_RDONLY); | 555 | if (dev->plane_fmt[plane].sizeimage && |
476 | if (fd == -1) { | 556 | dev->plane_fmt[plane].sizeimage != length) |
477 | - printf("Unable to open test pattern file '%s': %s (%d).\n", | 557 | - printf("Warning: bytes used %u != image size %u for plane %u\n", |
478 | + fprintf(stderr, "Unable to open test pattern file '%s': %s (%d).\n", | 558 | + fprintf(stderr, "Warning: bytes used %u != image size %u for plane %u\n", |
479 | filename, strerror(errno), errno); | 559 | length, dev->plane_fmt[plane].sizeimage, plane); |
480 | return -errno; | ||
481 | } | ||
482 | @@ -956,7 +956,7 @@ static int video_load_test_pattern(struct device *dev, const char *filename) | ||
483 | close(fd); | ||
484 | 560 | ||
485 | if (ret != (int)size && dev->bytesperline != 0) { | 561 | if (buffer->padding[plane] == 0) |
486 | - printf("Test pattern file size %u doesn't match image size %u\n", | 562 | @@ -1424,16 +1424,16 @@ static void video_verify_buffer(struct device *dev, struct v4l2_buffer *buf) |
487 | + fprintf(stderr, "Test pattern file size %u doesn't match image size %u\n", | 563 | } |
488 | ret, size); | ||
489 | return -EINVAL; | ||
490 | } | ||
491 | @@ -1012,16 +1012,16 @@ static void video_verify_buffer(struct device *dev, int index) | ||
492 | } | ||
493 | 564 | ||
494 | if (errors) { | 565 | if (errors) { |
495 | - printf("Warning: %u bytes overwritten among %u first padding bytes\n", | 566 | - printf("Warning: %u bytes overwritten among %u first padding bytes for plane %u\n", |
496 | + fprintf(stderr, "Warning: %u bytes overwritten among %u first padding bytes\n", | 567 | + fprintf(stderr, "Warning: %u bytes overwritten among %u first padding bytes for plane %u\n", |
497 | errors, dirty); | 568 | errors, dirty, plane); |
498 | 569 | ||
499 | dirty = (dirty + 15) & ~15; | 570 | dirty = (dirty + 15) & ~15; |
500 | dirty = dirty > 32 ? 32 : dirty; | 571 | dirty = dirty > 32 ? 32 : dirty; |
501 | 572 | ||
502 | for (i = 0; i < dirty; ++i) { | 573 | for (i = 0; i < dirty; ++i) { |
503 | - printf("%02x ", data[i]); | 574 | - printf("%02x ", data[i]); |
504 | + fprintf(stderr, "%02x ", data[i]); | 575 | + fprintf(stderr, "%02x ", data[i]); |
505 | if (i % 16 == 15) | 576 | if (i % 16 == 15) |
506 | - printf("\n"); | 577 | - printf("\n"); |
507 | + fprintf(stderr, "\n"); | 578 | + fprintf(stderr, "\n"); |
579 | } | ||
508 | } | 580 | } |
509 | } | 581 | } |
510 | } | 582 | @@ -1481,18 +1481,32 @@ static void video_save_image(struct device *dev, struct v4l2_buffer *buf, |
511 | @@ -1061,15 +1061,29 @@ static void video_save_image(struct device *dev, struct v4l2_buffer *buf, | 583 | |
584 | ret = write(fd, dev->buffers[buf->index].mem[i], length); | ||
585 | if (ret < 0) { | ||
586 | - printf("write error: %s (%d)\n", strerror(errno), errno); | ||
587 | + fprintf(stderr, "write error: %s (%d)\n", strerror(errno), errno); | ||
588 | break; | ||
589 | } else if (ret != (int)length) | ||
590 | - printf("write error: only %d bytes written instead of %u\n", | ||
591 | + fprintf(stderr, "write error: only %d bytes written instead of %u\n", | ||
592 | ret, length); | ||
593 | } | ||
512 | close(fd); | 594 | close(fd); |
595 | } | ||
513 | 596 | ||
514 | if (ret < 0) | ||
515 | - printf("write error: %s (%d)\n", strerror(errno), errno); | ||
516 | + fprintf(stderr, "write error: %s (%d)\n", strerror(errno), errno); | ||
517 | else if (ret != (int)buf->bytesused) | ||
518 | - printf("write error: only %d bytes written instead of %u\n", | ||
519 | + fprintf(stderr, "write error: only %d bytes written instead of %u\n", | ||
520 | + ret, buf->bytesused); | ||
521 | +} | ||
522 | + | ||
523 | +static void video_stdout_image(struct device *dev, struct v4l2_buffer *buf) | 597 | +static void video_stdout_image(struct device *dev, struct v4l2_buffer *buf) |
524 | +{ | 598 | +{ |
525 | + int ret; | 599 | + int ret; |
526 | + | 600 | + |
527 | + fprintf(stderr, "stdout"); | 601 | + fprintf(stderr, "stdout"); |
528 | + ret = fwrite(dev->buffers[buf->index].mem, buf->bytesused, 1, stdout); | 602 | + ret = fwrite(dev->buffers[buf->index].mem, buf->bytesused, 1, stdout); |
603 | + | ||
604 | + if (ret < 0) | ||
605 | + fprintf(stderr, "write error: %s (%d)\n", strerror(errno), errno); | ||
606 | + else if (ret != (int)buf->bytesused) | ||
607 | + fprintf(stderr, "write error: only %d bytes written instead of %u\n", | ||
608 | + ret, buf->bytesused); | ||
609 | +} | ||
529 | + | 610 | + |
530 | + if (ret < 0) | ||
531 | + fprintf(stderr, "write error: %s (%d)\n", strerror(errno), errno); | ||
532 | + else if (ret != (int)buf->bytesused) | ||
533 | + fprintf(stderr, "write error: only %d bytes written instead of %u\n", | ||
534 | ret, buf->bytesused); | ||
535 | } | ||
536 | |||
537 | static int video_do_capture(struct device *dev, unsigned int nframes, | 611 | static int video_do_capture(struct device *dev, unsigned int nframes, |
538 | unsigned int skip, unsigned int delay, const char *pattern, | 612 | unsigned int skip, unsigned int delay, const char *pattern, |
539 | - int do_requeue_last, enum buffer_fill_mode fill) | 613 | - int do_requeue_last, enum buffer_fill_mode fill) |
540 | + int do_requeue_last, enum buffer_fill_mode fill, int do_stdout) | 614 | + int do_requeue_last, enum buffer_fill_mode fill, int do_stdout) |
541 | { | 615 | { |
542 | struct timespec start; | 616 | struct v4l2_plane planes[VIDEO_MAX_PLANES]; |
543 | struct timeval last; | 617 | struct v4l2_buffer buf; |
544 | @@ -1099,7 +1113,7 @@ static int video_do_capture(struct device *dev, unsigned int nframes, | 618 | @@ -1529,7 +1543,7 @@ static int video_do_capture(struct device *dev, unsigned int nframes, |
545 | ret = ioctl(dev->fd, VIDIOC_DQBUF, &buf); | 619 | ret = ioctl(dev->fd, VIDIOC_DQBUF, &buf); |
546 | if (ret < 0) { | 620 | if (ret < 0) { |
547 | if (errno != EIO) { | 621 | if (errno != EIO) { |
@@ -550,40 +624,26 @@ index f3deae0..8020209 100644 | |||
550 | strerror(errno), errno); | 624 | strerror(errno), errno); |
551 | goto done; | 625 | goto done; |
552 | } | 626 | } |
553 | @@ -1111,7 +1125,7 @@ static int video_do_capture(struct device *dev, unsigned int nframes, | 627 | @@ -1550,7 +1564,7 @@ static int video_do_capture(struct device *dev, unsigned int nframes, |
554 | |||
555 | if (dev->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && | ||
556 | dev->imagesize != 0 && buf.bytesused != dev->imagesize) | ||
557 | - printf("Warning: bytes used %u != image size %u\n", | ||
558 | + fprintf(stderr, "Warning: bytes used %u != image size %u\n", | ||
559 | buf.bytesused, dev->imagesize); | ||
560 | |||
561 | if (dev->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
562 | @@ -1124,7 +1138,7 @@ static int video_do_capture(struct device *dev, unsigned int nframes, | ||
563 | fps = fps ? 1000000.0 / fps : 0.0; | ||
564 | 628 | ||
565 | clock_gettime(CLOCK_MONOTONIC, &ts); | 629 | clock_gettime(CLOCK_MONOTONIC, &ts); |
566 | - printf("%u (%u) [%c] %u %u bytes %ld.%06ld %ld.%06ld %.3f fps\n", i, buf.index, | 630 | get_ts_flags(buf.flags, &ts_type, &ts_source); |
567 | + fprintf(stderr, "%u (%u) [%c] %u %u bytes %ld.%06ld %ld.%06ld %.3f fps\n", i, buf.index, | 631 | - printf("%u (%u) [%c] %s %u %u B %ld.%06ld %ld.%06ld %.3f fps ts %s/%s\n", i, buf.index, |
632 | + fprintf(stderr, "%u (%u) [%c] %s %u %u B %ld.%06ld %ld.%06ld %.3f fps ts %s/%s\n", i, buf.index, | ||
568 | (buf.flags & V4L2_BUF_FLAG_ERROR) ? 'E' : '-', | 633 | (buf.flags & V4L2_BUF_FLAG_ERROR) ? 'E' : '-', |
634 | v4l2_field_name(buf.field), | ||
569 | buf.sequence, buf.bytesused, buf.timestamp.tv_sec, | 635 | buf.sequence, buf.bytesused, buf.timestamp.tv_sec, |
570 | buf.timestamp.tv_usec, ts.tv_sec, ts.tv_nsec/1000, fps); | 636 | @@ -1563,6 +1577,9 @@ static int video_do_capture(struct device *dev, unsigned int nframes, |
571 | @@ -1132,8 +1146,13 @@ static int video_do_capture(struct device *dev, unsigned int nframes, | 637 | if (video_is_capture(dev) && pattern && !skip) |
572 | last = buf.timestamp; | ||
573 | |||
574 | /* Save the image. */ | ||
575 | - if (dev->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pattern && !skip) | ||
576 | + if (dev->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && pattern && !skip) { | ||
577 | video_save_image(dev, &buf, pattern, i); | 638 | video_save_image(dev, &buf, pattern, i); |
578 | + } | ||
579 | + | ||
580 | + if (dev->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && do_stdout && !skip) { | ||
581 | + video_stdout_image(dev, &buf); | ||
582 | + } | ||
583 | 639 | ||
640 | + if (video_is_capture(dev) && do_stdout && !skip) | ||
641 | + video_stdout_image(dev, &buf); | ||
642 | + | ||
584 | if (skip) | 643 | if (skip) |
585 | --skip; | 644 | --skip; |
586 | @@ -1149,7 +1168,7 @@ static int video_do_capture(struct device *dev, unsigned int nframes, | 645 | |
646 | @@ -1577,7 +1594,7 @@ static int video_do_capture(struct device *dev, unsigned int nframes, | ||
587 | 647 | ||
588 | ret = video_queue_buffer(dev, buf.index, fill); | 648 | ret = video_queue_buffer(dev, buf.index, fill); |
589 | if (ret < 0) { | 649 | if (ret < 0) { |
@@ -592,7 +652,7 @@ index f3deae0..8020209 100644 | |||
592 | strerror(errno), errno); | 652 | strerror(errno), errno); |
593 | goto done; | 653 | goto done; |
594 | } | 654 | } |
595 | @@ -1159,7 +1178,7 @@ static int video_do_capture(struct device *dev, unsigned int nframes, | 655 | @@ -1587,7 +1604,7 @@ static int video_do_capture(struct device *dev, unsigned int nframes, |
596 | video_enable(dev, 0); | 656 | video_enable(dev, 0); |
597 | 657 | ||
598 | if (nframes == 0) { | 658 | if (nframes == 0) { |
@@ -601,7 +661,7 @@ index f3deae0..8020209 100644 | |||
601 | goto done; | 661 | goto done; |
602 | } | 662 | } |
603 | 663 | ||
604 | @@ -1176,7 +1195,7 @@ static int video_do_capture(struct device *dev, unsigned int nframes, | 664 | @@ -1604,7 +1621,7 @@ static int video_do_capture(struct device *dev, unsigned int nframes, |
605 | bps = size/(ts.tv_nsec/1000.0+1000000.0*ts.tv_sec)*1000000.0; | 665 | bps = size/(ts.tv_nsec/1000.0+1000000.0*ts.tv_sec)*1000000.0; |
606 | fps = i/(ts.tv_nsec/1000.0+1000000.0*ts.tv_sec)*1000000.0; | 666 | fps = i/(ts.tv_nsec/1000.0+1000000.0*ts.tv_sec)*1000000.0; |
607 | 667 | ||
@@ -610,12 +670,14 @@ index f3deae0..8020209 100644 | |||
610 | i, ts.tv_sec, ts.tv_nsec/1000, fps, bps); | 670 | i, ts.tv_sec, ts.tv_nsec/1000, fps, bps); |
611 | 671 | ||
612 | done: | 672 | done: |
613 | @@ -1188,37 +1207,38 @@ done: | 673 | @@ -1616,42 +1633,42 @@ done: |
614 | 674 | ||
615 | static void usage(const char *argv0) | 675 | static void usage(const char *argv0) |
616 | { | 676 | { |
617 | - printf("Usage: %s [options] device\n", argv0); | 677 | - printf("Usage: %s [options] device\n", argv0); |
618 | - printf("Supported options:\n"); | 678 | - printf("Supported options:\n"); |
679 | - printf("-B, --buffer-type Buffer type (\"capture\", \"output\",\n"); | ||
680 | - printf(" \"capture-mplane\" or \"output-mplane\")\n"); | ||
619 | - printf("-c, --capture[=nframes] Capture frames\n"); | 681 | - printf("-c, --capture[=nframes] Capture frames\n"); |
620 | - printf("-C, --check-overrun Verify dequeued frames for buffer overrun\n"); | 682 | - printf("-C, --check-overrun Verify dequeued frames for buffer overrun\n"); |
621 | - printf("-d, --delay Delay (in ms) before requeuing buffers\n"); | 683 | - printf("-d, --delay Delay (in ms) before requeuing buffers\n"); |
@@ -639,14 +701,19 @@ index f3deae0..8020209 100644 | |||
639 | - printf("-w, --set-control 'ctrl value' Set control 'ctrl' to 'value'\n"); | 701 | - printf("-w, --set-control 'ctrl value' Set control 'ctrl' to 'value'\n"); |
640 | - printf(" --enum-formats Enumerate formats\n"); | 702 | - printf(" --enum-formats Enumerate formats\n"); |
641 | - printf(" --enum-inputs Enumerate inputs\n"); | 703 | - printf(" --enum-inputs Enumerate inputs\n"); |
704 | - printf(" --fd Use a numeric file descriptor insted of a device\n"); | ||
705 | - printf(" --field Interlaced format field order\n"); | ||
642 | - printf(" --no-query Don't query capabilities on open\n"); | 706 | - printf(" --no-query Don't query capabilities on open\n"); |
643 | - printf(" --offset User pointer buffer offset from page start\n"); | 707 | - printf(" --offset User pointer buffer offset from page start\n"); |
644 | - printf(" --requeue-last Requeue the last buffers before streamoff\n"); | 708 | - printf(" --requeue-last Requeue the last buffers before streamoff\n"); |
709 | - printf(" --timestamp-source Set timestamp source on output buffers [eof, soe]\n"); | ||
645 | - printf(" --skip n Skip the first n frames\n"); | 710 | - printf(" --skip n Skip the first n frames\n"); |
646 | - printf(" --sleep-forever Sleep forever after configuring the device\n"); | 711 | - printf(" --sleep-forever Sleep forever after configuring the device\n"); |
647 | - printf(" --stride value Line stride in bytes\n"); | 712 | - printf(" --stride value Line stride in bytes\n"); |
648 | + fprintf(stderr, "Usage: %s [options] device\n", argv0); | 713 | + fprintf(stderr, "Usage: %s [options] device\n", argv0); |
649 | + fprintf(stderr, "Supported options:\n"); | 714 | + fprintf(stderr, "Supported options:\n"); |
715 | + fprintf(stderr, "-B, --buffer-type Buffer type (\"capture\", \"output\",\n"); | ||
716 | + fprintf(stderr, " \"capture-mplane\" or \"output-mplane\")\n"); | ||
650 | + fprintf(stderr, "-c, --capture[=nframes] Capture frames\n"); | 717 | + fprintf(stderr, "-c, --capture[=nframes] Capture frames\n"); |
651 | + fprintf(stderr, "-C, --check-overrun Verify dequeued frames for buffer overrun\n"); | 718 | + fprintf(stderr, "-C, --check-overrun Verify dequeued frames for buffer overrun\n"); |
652 | + fprintf(stderr, "-d, --delay Delay (in ms) before requeuing buffers\n"); | 719 | + fprintf(stderr, "-d, --delay Delay (in ms) before requeuing buffers\n"); |
@@ -655,7 +722,6 @@ index f3deae0..8020209 100644 | |||
655 | + fprintf(stderr, "\tFor video capture devices, the first '#' character in the file name is\n"); | 722 | + fprintf(stderr, "\tFor video capture devices, the first '#' character in the file name is\n"); |
656 | + fprintf(stderr, "\texpanded to the frame sequence number. The default file name is\n"); | 723 | + fprintf(stderr, "\texpanded to the frame sequence number. The default file name is\n"); |
657 | + fprintf(stderr, "\t'frame-#.bin'.\n"); | 724 | + fprintf(stderr, "\t'frame-#.bin'.\n"); |
658 | + fprintf(stderr, " --stdout write frames to stdout\n"); | ||
659 | + fprintf(stderr, "-h, --help Show this help screen\n"); | 725 | + fprintf(stderr, "-h, --help Show this help screen\n"); |
660 | + fprintf(stderr, "-i, --input input Select the video input\n"); | 726 | + fprintf(stderr, "-i, --input input Select the video input\n"); |
661 | + fprintf(stderr, "-I, --fill-frames Fill frames with check pattern before queuing them\n"); | 727 | + fprintf(stderr, "-I, --fill-frames Fill frames with check pattern before queuing them\n"); |
@@ -671,32 +737,35 @@ index f3deae0..8020209 100644 | |||
671 | + fprintf(stderr, "-w, --set-control 'ctrl value' Set control 'ctrl' to 'value'\n"); | 737 | + fprintf(stderr, "-w, --set-control 'ctrl value' Set control 'ctrl' to 'value'\n"); |
672 | + fprintf(stderr, " --enum-formats Enumerate formats\n"); | 738 | + fprintf(stderr, " --enum-formats Enumerate formats\n"); |
673 | + fprintf(stderr, " --enum-inputs Enumerate inputs\n"); | 739 | + fprintf(stderr, " --enum-inputs Enumerate inputs\n"); |
740 | + fprintf(stderr, " --fd Use a numeric file descriptor insted of a device\n"); | ||
741 | + fprintf(stderr, " --field Interlaced format field order\n"); | ||
674 | + fprintf(stderr, " --no-query Don't query capabilities on open\n"); | 742 | + fprintf(stderr, " --no-query Don't query capabilities on open\n"); |
675 | + fprintf(stderr, " --offset User pointer buffer offset from page start\n"); | 743 | + fprintf(stderr, " --offset User pointer buffer offset from page start\n"); |
676 | + fprintf(stderr, " --requeue-last Requeue the last buffers before streamoff\n"); | 744 | + fprintf(stderr, " --requeue-last Requeue the last buffers before streamoff\n"); |
745 | + fprintf(stderr, " --timestamp-source Set timestamp source on output buffers [eof, soe]\n"); | ||
677 | + fprintf(stderr, " --skip n Skip the first n frames\n"); | 746 | + fprintf(stderr, " --skip n Skip the first n frames\n"); |
678 | + fprintf(stderr, " --sleep-forever Sleep forever after configuring the device\n"); | 747 | + fprintf(stderr, " --sleep-forever Sleep forever after configuring the device\n"); |
679 | + fprintf(stderr, " --stride value Line stride in bytes\n"); | 748 | + fprintf(stderr, " --stride value Line stride in bytes\n"); |
680 | } | 749 | } |
681 | 750 | ||
682 | #define OPT_ENUM_FORMATS 256 | 751 | #define OPT_ENUM_FORMATS 256 |
683 | @@ -1229,6 +1249,7 @@ static void usage(const char *argv0) | 752 | @@ -1665,6 +1682,7 @@ static void usage(const char *argv0) |
684 | #define OPT_USERPTR_OFFSET 261 | 753 | #define OPT_FD 264 |
685 | #define OPT_REQUEUE_LAST 262 | 754 | #define OPT_TSTAMP_SRC 265 |
686 | #define OPT_STRIDE 263 | 755 | #define OPT_FIELD 266 |
687 | +#define OPT_STDOUT 264 | 756 | +#define OPT_STDOUT 267 |
688 | 757 | ||
689 | static struct option opts[] = { | 758 | static struct option opts[] = { |
690 | {"capture", 2, 0, 'c'}, | 759 | {"buffer-type", 1, 0, 'B'}, |
691 | @@ -1238,6 +1259,7 @@ static struct option opts[] = { | 760 | @@ -1677,6 +1695,7 @@ static struct option opts[] = { |
692 | {"enum-inputs", 0, 0, OPT_ENUM_INPUTS}, | 761 | {"field", 1, 0, OPT_FIELD}, |
693 | {"file", 2, 0, 'F'}, | 762 | {"file", 2, 0, 'F'}, |
694 | {"fill-frames", 0, 0, 'I'}, | 763 | {"fill-frames", 0, 0, 'I'}, |
695 | + {"stdout", 0, 0, OPT_STDOUT}, | 764 | + {"stdout", 0, 0, OPT_STDOUT}, |
696 | {"format", 1, 0, 'f'}, | 765 | {"format", 1, 0, 'f'}, |
697 | {"help", 0, 0, 'h'}, | 766 | {"help", 0, 0, 'h'}, |
698 | {"input", 1, 0, 'i'}, | 767 | {"input", 1, 0, 'i'}, |
699 | @@ -1274,7 +1296,8 @@ int main(int argc, char *argv[]) | 768 | @@ -1717,7 +1736,8 @@ int main(int argc, char *argv[]) |
700 | int do_list_controls = 0, do_get_control = 0, do_set_control = 0; | 769 | int do_list_controls = 0, do_get_control = 0, do_set_control = 0; |
701 | int do_sleep_forever = 0, do_requeue_last = 0; | 770 | int do_sleep_forever = 0, do_requeue_last = 0; |
702 | int do_rt = 0; | 771 | int do_rt = 0; |
@@ -706,16 +775,25 @@ index f3deae0..8020209 100644 | |||
706 | char *endptr; | 775 | char *endptr; |
707 | int c; | 776 | int c; |
708 | 777 | ||
709 | @@ -1321,7 +1344,7 @@ int main(int argc, char *argv[]) | 778 | @@ -1755,7 +1775,7 @@ int main(int argc, char *argv[]) |
779 | case 'B': | ||
780 | ret = v4l2_buf_type_from_string(optarg); | ||
781 | if (ret == -1) { | ||
782 | - printf("Bad buffer type \"%s\"\n", optarg); | ||
783 | + fprintf(stderr, "Bad buffer type \"%s\"\n", optarg); | ||
784 | return 1; | ||
785 | } | ||
786 | video_set_buf_type(&dev, ret); | ||
787 | @@ -1775,7 +1795,7 @@ int main(int argc, char *argv[]) | ||
710 | do_set_format = 1; | 788 | do_set_format = 1; |
711 | pixelformat = v4l2_format_code(optarg); | 789 | info = v4l2_format_by_name(optarg); |
712 | if (pixelformat == 0) { | 790 | if (info == NULL) { |
713 | - printf("Unsupported video format '%s'\n", optarg); | 791 | - printf("Unsupported video format '%s'\n", optarg); |
714 | + fprintf(stderr, "Unsupported video format '%s'\n", optarg); | 792 | + fprintf(stderr, "Unsupported video format '%s'\n", optarg); |
715 | return 1; | 793 | return 1; |
716 | } | 794 | } |
717 | break; | 795 | pixelformat = info->fourcc; |
718 | @@ -1357,7 +1380,7 @@ int main(int argc, char *argv[]) | 796 | @@ -1812,7 +1832,7 @@ int main(int argc, char *argv[]) |
719 | case 'r': | 797 | case 'r': |
720 | ctrl_name = strtol(optarg, &endptr, 0); | 798 | ctrl_name = strtol(optarg, &endptr, 0); |
721 | if (*endptr != 0) { | 799 | if (*endptr != 0) { |
@@ -724,7 +802,7 @@ index f3deae0..8020209 100644 | |||
724 | return 1; | 802 | return 1; |
725 | } | 803 | } |
726 | do_get_control = 1; | 804 | do_get_control = 1; |
727 | @@ -1371,12 +1394,12 @@ int main(int argc, char *argv[]) | 805 | @@ -1826,12 +1846,12 @@ int main(int argc, char *argv[]) |
728 | do_set_format = 1; | 806 | do_set_format = 1; |
729 | width = strtol(optarg, &endptr, 10); | 807 | width = strtol(optarg, &endptr, 10); |
730 | if (*endptr != 'x' || endptr == optarg) { | 808 | if (*endptr != 'x' || endptr == optarg) { |
@@ -739,7 +817,7 @@ index f3deae0..8020209 100644 | |||
739 | return 1; | 817 | return 1; |
740 | } | 818 | } |
741 | break; | 819 | break; |
742 | @@ -1384,12 +1407,12 @@ int main(int argc, char *argv[]) | 820 | @@ -1839,12 +1859,12 @@ int main(int argc, char *argv[]) |
743 | do_set_time_per_frame = 1; | 821 | do_set_time_per_frame = 1; |
744 | time_per_frame.numerator = strtol(optarg, &endptr, 10); | 822 | time_per_frame.numerator = strtol(optarg, &endptr, 10); |
745 | if (*endptr != '/' || endptr == optarg) { | 823 | if (*endptr != '/' || endptr == optarg) { |
@@ -754,7 +832,7 @@ index f3deae0..8020209 100644 | |||
754 | return 1; | 832 | return 1; |
755 | } | 833 | } |
756 | break; | 834 | break; |
757 | @@ -1399,12 +1422,12 @@ int main(int argc, char *argv[]) | 835 | @@ -1854,12 +1874,12 @@ int main(int argc, char *argv[]) |
758 | case 'w': | 836 | case 'w': |
759 | ctrl_name = strtol(optarg, &endptr, 0); | 837 | ctrl_name = strtol(optarg, &endptr, 0); |
760 | if (*endptr != ' ' || endptr == optarg) { | 838 | if (*endptr != ' ' || endptr == optarg) { |
@@ -769,7 +847,35 @@ index f3deae0..8020209 100644 | |||
769 | return 1; | 847 | return 1; |
770 | } | 848 | } |
771 | do_set_control = 1; | 849 | do_set_control = 1; |
772 | @@ -1433,15 +1456,18 @@ int main(int argc, char *argv[]) | 850 | @@ -1873,16 +1893,16 @@ int main(int argc, char *argv[]) |
851 | case OPT_FD: | ||
852 | ret = atoi(optarg); | ||
853 | if (ret < 0) { | ||
854 | - printf("Bad file descriptor %d\n", ret); | ||
855 | + fprintf(stderr, "Bad file descriptor %d\n", ret); | ||
856 | return 1; | ||
857 | } | ||
858 | - printf("Using file descriptor %d\n", ret); | ||
859 | + fprintf(stderr, "Using file descriptor %d\n", ret); | ||
860 | video_set_fd(&dev, ret); | ||
861 | break; | ||
862 | case OPT_FIELD: | ||
863 | field = v4l2_field_from_string(optarg); | ||
864 | if (field == (enum v4l2_field)-1) { | ||
865 | - printf("Invalid field order '%s'\n", optarg); | ||
866 | + fprintf(stderr, "Invalid field order '%s'\n", optarg); | ||
867 | return 1; | ||
868 | } | ||
869 | break; | ||
870 | @@ -1907,22 +1927,25 @@ int main(int argc, char *argv[]) | ||
871 | } else if (!strcmp(optarg, "soe")) { | ||
872 | dev.buffer_output_flags |= V4L2_BUF_FLAG_TSTAMP_SRC_SOE; | ||
873 | } else { | ||
874 | - printf("Invalid timestamp source %s\n", optarg); | ||
875 | + fprintf(stderr, "Invalid timestamp source %s\n", optarg); | ||
876 | return 1; | ||
877 | } | ||
878 | break; | ||
773 | case OPT_USERPTR_OFFSET: | 879 | case OPT_USERPTR_OFFSET: |
774 | userptr_offset = atoi(optarg); | 880 | userptr_offset = atoi(optarg); |
775 | break; | 881 | break; |
@@ -791,7 +897,7 @@ index f3deae0..8020209 100644 | |||
791 | return 1; | 897 | return 1; |
792 | } | 898 | } |
793 | 899 | ||
794 | @@ -1470,7 +1496,7 @@ int main(int argc, char *argv[]) | 900 | @@ -1959,7 +1982,7 @@ int main(int argc, char *argv[]) |
795 | ret = get_control(&dev, ctrl_name, | 901 | ret = get_control(&dev, ctrl_name, |
796 | get_control_type(&dev, ctrl_name), &val); | 902 | get_control_type(&dev, ctrl_name), &val); |
797 | if (ret >= 0) | 903 | if (ret >= 0) |
@@ -800,15 +906,16 @@ index f3deae0..8020209 100644 | |||
800 | } | 906 | } |
801 | 907 | ||
802 | if (do_set_control) | 908 | if (do_set_control) |
803 | @@ -1481,21 +1507,21 @@ int main(int argc, char *argv[]) | 909 | @@ -1970,7 +1993,7 @@ int main(int argc, char *argv[]) |
804 | video_list_controls(&dev); | 910 | video_list_controls(&dev); |
805 | 911 | ||
806 | if (do_enum_formats) { | 912 | if (do_enum_formats) { |
807 | - printf("- Available formats:\n"); | 913 | - printf("- Available formats:\n"); |
808 | + fprintf(stderr, "- Available formats:\n"); | 914 | + fprintf(stderr, "- Available formats:\n"); |
809 | video_enum_formats(&dev, V4L2_BUF_TYPE_VIDEO_CAPTURE); | 915 | video_enum_formats(&dev, V4L2_BUF_TYPE_VIDEO_CAPTURE); |
916 | video_enum_formats(&dev, V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE); | ||
810 | video_enum_formats(&dev, V4L2_BUF_TYPE_VIDEO_OUTPUT); | 917 | video_enum_formats(&dev, V4L2_BUF_TYPE_VIDEO_OUTPUT); |
811 | video_enum_formats(&dev, V4L2_BUF_TYPE_VIDEO_OVERLAY); | 918 | @@ -1979,14 +2002,14 @@ int main(int argc, char *argv[]) |
812 | } | 919 | } |
813 | 920 | ||
814 | if (do_enum_inputs) { | 921 | if (do_enum_inputs) { |
@@ -825,7 +932,7 @@ index f3deae0..8020209 100644 | |||
825 | } | 932 | } |
826 | 933 | ||
827 | /* Set the video format. */ | 934 | /* Set the video format. */ |
828 | @@ -1537,7 +1563,7 @@ int main(int argc, char *argv[]) | 935 | @@ -2028,7 +2051,7 @@ int main(int argc, char *argv[]) |
829 | } | 936 | } |
830 | 937 | ||
831 | if (do_pause) { | 938 | if (do_pause) { |
@@ -834,7 +941,7 @@ index f3deae0..8020209 100644 | |||
834 | getchar(); | 941 | getchar(); |
835 | } | 942 | } |
836 | 943 | ||
837 | @@ -1546,12 +1572,12 @@ int main(int argc, char *argv[]) | 944 | @@ -2037,12 +2060,12 @@ int main(int argc, char *argv[]) |
838 | sched.sched_priority = rt_priority; | 945 | sched.sched_priority = rt_priority; |
839 | ret = sched_setscheduler(0, SCHED_RR, &sched); | 946 | ret = sched_setscheduler(0, SCHED_RR, &sched); |
840 | if (ret < 0) | 947 | if (ret < 0) |
@@ -850,5 +957,5 @@ index f3deae0..8020209 100644 | |||
850 | return 1; | 957 | return 1; |
851 | } | 958 | } |
852 | -- | 959 | -- |
853 | 1.7.10 | 960 | 1.7.9.5 |
854 | 961 | ||
diff --git a/meta-oe/recipes-multimedia/v4l2apps/yavta_git.bb b/meta-oe/recipes-multimedia/v4l2apps/yavta_git.bb index a20f5915c..d4e32dea4 100644 --- a/meta-oe/recipes-multimedia/v4l2apps/yavta_git.bb +++ b/meta-oe/recipes-multimedia/v4l2apps/yavta_git.bb | |||
@@ -4,12 +4,17 @@ LIC_FILES_CHKSUM = "file://COPYING.GPL;md5=751419260aa954499f7abaabaa882bbe" | |||
4 | 4 | ||
5 | SRC_URI = "git://git.ideasonboard.org/yavta.git \ | 5 | SRC_URI = "git://git.ideasonboard.org/yavta.git \ |
6 | file://0001-Add-stdout-mode-to-allow-streaming-over-the-network-.patch" | 6 | file://0001-Add-stdout-mode-to-allow-streaming-over-the-network-.patch" |
7 | SRCREV = "82ff2efdb9787737b9f21b6f4759f077c827b238" | 7 | SRCREV = "7e9f28bedc1ed3205fb5164f686aea96f27a0de2" |
8 | 8 | ||
9 | PV = "0.0" | 9 | PV = "0.0" |
10 | PR = "r2" | 10 | PR = "r2" |
11 | S = "${WORKDIR}/git" | 11 | S = "${WORKDIR}/git" |
12 | 12 | ||
13 | # The yavta sources include copies of the headers required to build in the | ||
14 | # include directory. The Makefile uses CFLAGS to include these, but since | ||
15 | # we override the CFLAGS then we need to add this include path back in. | ||
16 | CFLAGS += "-I${S}/include" | ||
17 | |||
13 | do_install() { | 18 | do_install() { |
14 | install -d ${D}${bindir} | 19 | install -d ${D}${bindir} |
15 | install -m 0755 yavta ${D}${bindir} | 20 | install -m 0755 yavta ${D}${bindir} |