Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 130742
b: refs/heads/master
c: f90c3c0
h: refs/heads/master
v: v3
  • Loading branch information
Simon Harrison authored and Mauro Carvalho Chehab committed Jan 29, 2009
1 parent 6c13064 commit a5eb3de
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3e478c06e83efc365e8351bff7b4c569f22e642d
refs/heads/master: f90c3c0bdd7a3f16eecf1b077f5e031c44ddb605
25 changes: 17 additions & 8 deletions trunk/Documentation/video4linux/v4lgrab.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
*/

Expand All @@ -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 */

Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down

0 comments on commit a5eb3de

Please sign in to comment.