summaryrefslogtreecommitdiff
path: root/v4l2-apps
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-07-27 21:49:25 +0200
committerHans Verkuil <hverkuil@xs4all.nl>2008-07-27 21:49:25 +0200
commit502f8947100c39b36eb660adfa7ea1cc1d4fae64 (patch)
treef42283906eb7b9a0f10cbbe3f4b75ce8e7d600c6 /v4l2-apps
parent8dcba258bfae4be17ed5beb7a53d746075789e4f (diff)
downloadmediapointer-dvb-s2-502f8947100c39b36eb660adfa7ea1cc1d4fae64.tar.gz
mediapointer-dvb-s2-502f8947100c39b36eb660adfa7ea1cc1d4fae64.tar.bz2
v4l2-apps: some capture_example improvements
From: Hans Verkuil <hverkuil@xs4all.nl> - show progress even when sending captured data to stdout - use bytesused rather than length - use /dev/video0 instead of /dev/video (conform xawtv tools) Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'v4l2-apps')
-rw-r--r--v4l2-apps/test/capture_example.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/v4l2-apps/test/capture_example.c b/v4l2-apps/test/capture_example.c
index b2260b05f..7e967e891 100644
--- a/v4l2-apps/test/capture_example.c
+++ b/v4l2-apps/test/capture_example.c
@@ -68,11 +68,11 @@ static int xioctl(int fh, int request, void *arg)
static void process_image(const void *p, int size)
{
- if (!out_buf)
- fputc('.', stdout);
- else
+ if (out_buf)
fwrite(p, size, 1, stdout);
+ fflush(stderr);
+ fprintf(stderr, ".");
fflush(stdout);
}
@@ -125,7 +125,7 @@ static int read_frame(void)
assert(buf.index < n_buffers);
- process_image(buffers[buf.index].start, buffers[buf.index].length);
+ process_image(buffers[buf.index].start, buf.bytesused);
if (-1 == xioctl(fd, VIDIOC_QBUF, &buf))
errno_exit("VIDIOC_QBUF");
@@ -160,7 +160,7 @@ static int read_frame(void)
assert(i < n_buffers);
- process_image((void *) buf.m.userptr, buf.length);
+ process_image((void *) buf.m.userptr, buf.bytesused);
if (-1 == xioctl(fd, VIDIOC_QBUF, &buf))
errno_exit("VIDIOC_QBUF");
@@ -571,7 +571,7 @@ static void usage(FILE *fp, int argc, char **argv)
fprintf(fp,
"Usage: %s [options]\n\n"
"Options:\n"
- "-d | --device name Video device name [/dev/video]\n"
+ "-d | --device name Video device name [/dev/video0]\n"
"-h | --help Print this message\n"
"-m | --mmap Use memory mapped buffers\n"
"-r | --read Use read() calls\n"
@@ -596,7 +596,7 @@ long_options [] = {
int main(int argc, char **argv)
{
- dev_name = "/dev/video";
+ dev_name = "/dev/video0";
for (;;) {
int idx;
@@ -650,5 +650,6 @@ int main(int argc, char **argv)
stop_capturing();
uninit_device();
close_device();
+ fprintf(stderr, "\n");
return 0;
}