4
* Copyright (C) 1998 Rasca, Berlin
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
#include <sys/ioctl.h>
23
#include <sys/types.h>
25
#include <linux/types.h>
26
#include <linux/videodev.h>
32
* get image properties
38
struct video_picture vp;
42
rc = ioctl (v->fd, VIDIOCGPICT, &vp);
44
v->brightness = vp.brightness;
46
v->colour = vp.colour;
47
v->contrast = vp.contrast;
48
v->whiteness = vp.whiteness;
50
v->palette = vp.palette;
60
struct video_capability vc;
64
if (ioctl (v->fd, VIDIOCGCAP, &vc) == -1)
66
memcpy (v->name, vc.name, 32);
68
v->channels = vc.channels;
69
v->audios = vc.audios;
70
v->maxwidth = vc.maxwidth;
71
v->maxheight =vc.maxheight;
72
v->minwidth = vc.minwidth;
73
v->minheight =vc.minheight;
88
video_close (VIDEO *v)
102
video_open (const char *dev, int flags)
106
fd = open (dev, flags);
109
v = malloc (sizeof (VIDEO));
113
if (video_caps (v) != 0) {
117
if (video_prop (v) != 0) {
127
video_mmap (VIDEO *vid, int start)
132
vid->mmap = (char *) mmap (0, vid->size,
133
PROT_READ | PROT_WRITE, MAP_SHARED, vid->fd, 0);
134
if (vid->mmap == (char *)-1) {
139
/* free the mmap space */
141
munmap (vid->mmap, vid->fd);