diff options
author | etobi <git@e-tobi.net> | 2013-09-03 09:48:41 +0200 |
---|---|---|
committer | etobi <git@e-tobi.net> | 2013-09-03 09:48:41 +0200 |
commit | ab959d7b4194715870128e616b8e29d4a101e488 (patch) | |
tree | 61a746231d30817be73416a7d67763fd677a1042 /test/video.c | |
parent | 6b350466c4902c5b137e0efaf1d189128a7f18f5 (diff) | |
download | linux-dvb-apps-ab959d7b4194715870128e616b8e29d4a101e488.tar.gz |
Imported Upstream version 1.1.1+rev1207upstream/1.1.1+rev1207
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); } - |