diff options
author | Mark Purcell <msp@debian.org> | 2008-06-22 11:00:40 +1000 |
---|---|---|
committer | etobi <git@e-tobi.net> | 2013-09-03 09:48:42 +0200 |
commit | 891c51ff368ed700dec6025eeb47ce4d96f76418 (patch) | |
tree | 3729664829e4faa691d403274f38eb10890b533c /test/video.c | |
parent | 1c6e1f28f54ec2606c23936c1d8689f2be55a86c (diff) | |
parent | ab959d7b4194715870128e616b8e29d4a101e488 (diff) | |
download | linux-dvb-apps-debian/1.1.1+rev1207-1.tar.gz |
Imported Debian patch 1.1.1+rev1207-1debian/1.1.1+rev1207-1
Diffstat (limited to 'test/video.c')
-rw-r--r-- | test/video.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/test/video.c b/test/video.c index ea9e4a2..fae421e 100644 --- a/test/video.c +++ b/test/video.c @@ -1,13 +1,14 @@ - /** - * A tiny video watching application, just starts capturing /dev/video - * into /dev/fb0. - * Be shure to have >8Bit/pixel color resolution and r/w access for - * /dev/video0, /dev/fb0 and /dev/tty0 to let this work... - * - * compile with - * - * $ gcc -g -Wall -O2 -o video video.c -I../../ost/include - */ +#define USAGE \ +"\n" \ +"\n A tiny video watching application, just starts capturing /dev/video" \ +"\n into /dev/fb0." \ +"\n Be shure to have >8Bit/pixel color resolution and r/w access for " \ +"\n /dev/video0, /dev/fb0 and /dev/tty0 to let this work..." \ +"\n" \ +"\n compile with" \ +"\n" \ +"\n $ gcc -g -Wall -O2 -o video video.c -I../../ost/include" \ +"\n" #include <sys/mman.h> #include <sys/ioctl.h> @@ -55,7 +56,7 @@ int init_fb (void) } write( vt_fd, blankoff_str, strlen(blankoff_str) ); - + if (ioctl (fd, FBIOGET_VSCREENINFO, &fb_var) < 0) { perror("Could not get variable screen information (fb_var)\n"); return 1; @@ -77,14 +78,14 @@ int init_video (int stop) struct video_capability vcap; if ((fd = open (video_devname, O_RDWR)) < 0) { - fprintf (stderr, + fprintf (stderr, "%s: Could not open %s, please check permissions\n", __FUNCTION__, video_devname); return -1; } ioctl(fd, VIDIOCGCAP, &vcap); - + if (ioctl(fd, VIDIOCCAPTURE, &zero) < 0) { perror("Could not stop capturing (VIDIOCCAPTURE failed)\n"); return -2; @@ -92,7 +93,7 @@ int init_video (int stop) if (stop) return 0; - + { struct video_buffer b; b.base = (void*) fb_fix.smem_start; @@ -105,7 +106,7 @@ int init_video (int stop) return -3; } } - + { struct video_picture p; if (ioctl(fd, VIDIOCGPICT, &p) < 0) { @@ -131,7 +132,7 @@ int init_video (int stop) return -5; } } - + { struct video_window win; win.width = min((__u32) vcap.maxwidth, fb_var.xres); @@ -147,14 +148,14 @@ int init_video (int stop) return -6; } } - + if (ioctl(fd, VIDIOCCAPTURE, &one) < 0) { perror("Could not start capturing (VIDIOCCAPTURE failed)\n"); return -7; } - + close (fd); - + return 0; } @@ -173,10 +174,9 @@ int main (int argc, char **argv) video_devname = argv[1]; if (argc != 1 && argc != 2 && !(argc == 3 && stop)) { - fprintf (stderr, "usage: %s <devname> <stop>\n", argv[0]); + fprintf(stderr, "usage: %s <devname> <stop>\n" USAGE, argv[0]); exit (-1); } return init_video (stop); } - |