aboutsummaryrefslogtreecommitdiffstats
path: root/test/video.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/video.c42
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);
}
-