V4L/DVB (10210): Fix a bug on v4lgrab.c

v4lgrab  breaks the fputc macro on some systems, because of #defined
FILE.

Also, I also added comments because it was not at all clear that to get gspca
cameras to work with this application you need v4l1compat.

Signed-off-by: Simon Harrison <si1356@yahoo.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Simon Harrison 2009-01-09 09:07:07 -03:00 committed by Mauro Carvalho Chehab
parent 3e478c06e8
commit f90c3c0bdd
1 changed files with 17 additions and 8 deletions

View File

@ -4,12 +4,21 @@
*
* Compile with:
* gcc -s -Wall -Wstrict-prototypes v4lgrab.c -o v4lgrab
* Use as:
* v4lgrab >image.ppm
* Use as:
* v4lgrab >image.ppm
*
* Copyright (C) 1998-05-03, Phil Blundell <philb@gnu.org>
* Copied from http://www.tazenda.demon.co.uk/phil/vgrabber.c
* with minor modifications (Dave Forrest, drf5n@virginia.edu).
* Copied from http://www.tazenda.demon.co.uk/phil/vgrabber.c
* with minor modifications (Dave Forrest, drf5n@virginia.edu).
*
*
* For some cameras you may need to pre-load libv4l to perform
* the necessary decompression, e.g.:
*
* export LD_PRELOAD=/usr/lib/libv4l/v4l1compat.so
* ./v4lgrab >image.ppm
*
* see http://hansdegoede.livejournal.com/3636.html for details.
*
*/
@ -24,7 +33,7 @@
#include <linux/types.h>
#include <linux/videodev.h>
#define FILE "/dev/video0"
#define VIDEO_DEV "/dev/video0"
/* Stole this from tvset.c */
@ -90,7 +99,7 @@ int get_brightness_adj(unsigned char *image, long size, int *brightness) {
int main(int argc, char ** argv)
{
int fd = open(FILE, O_RDONLY), f;
int fd = open(VIDEO_DEV, O_RDONLY), f;
struct video_capability cap;
struct video_window win;
struct video_picture vpic;
@ -100,13 +109,13 @@ int main(int argc, char ** argv)
unsigned int i, src_depth;
if (fd < 0) {
perror(FILE);
perror(VIDEO_DEV);
exit(1);
}
if (ioctl(fd, VIDIOCGCAP, &cap) < 0) {
perror("VIDIOGCAP");
fprintf(stderr, "(" FILE " not a video4linux device?)\n");
fprintf(stderr, "(" VIDEO_DEV " not a video4linux device?)\n");
close(fd);
exit(1);
}