提交 f90c3c0b 编写于 作者: S Simon Harrison 提交者: Mauro Carvalho Chehab

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: NSimon Harrison <si1356@yahoo.co.uk>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 3e478c06
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册