The patch number 8631 was added via Hans Verkuil <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

From: Hans Verkuil  <[EMAIL PROTECTED]>
v4l2-apps: some capture_example improvements


- 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 <[EMAIL PROTECTED]>


---

 v4l2-apps/test/capture_example.c |   15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff -r 5019762167d9 -r 9fe8543561fc v4l2-apps/test/capture_example.c
--- a/v4l2-apps/test/capture_example.c  Fri Jul 25 15:31:23 2008 +0200
+++ b/v4l2-apps/test/capture_example.c  Sun Jul 27 21:49:25 2008 +0200
@@ -68,11 +68,11 @@ static int xioctl(int fh, int request, v
 
 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, ch
        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;
 }


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/9fe8543561fc4fd89fea178299b35c3f4bf23f7a

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to