Added VIDIOCGCHAN and VIDIOCSCHAN ioctls
[v4l1_capture.git] / v4l1_capture.h
blob0ef0f4f067180d40ad9585315d6ce82af52a7a8a
1 /*
2 Copyright (C) 2008 Brian Johnson
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #ifndef _V4L1_CAPTURE_H
20 #define _V4L1_CAPTURE_H
22 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
23 #define PAGE_ALIGN(len) ((((len) / 4096) + 1) * 4096)
25 #define MIN(a, b) ((a) < (b) ? (a) : (b))
27 #define V4L1_BUFFER_SIZE PAGE_ALIGN(640 * 480 * 4)
29 #define NUM_BUFFERS 5
31 #define info(format, arg...) syslog(LOG_INFO, "" format "", ## arg)
34 struct v4l1_buffers {
35 int offsets[NUM_BUFFERS];
36 char* mem;
37 size_t size;
40 struct v4l2_buffers {
41 struct v4l2_buffer buf;
42 void *start;
45 struct v4l1_device {
46 int v4l1_fd;
47 int v4l2_fd;
49 struct v4l1_buffers v4l1buffers;
50 struct v4l2_buffers v4l2buffers[NUM_BUFFERS];
51 struct v4l2_buffers *read_buffer;
54 int v4l1_open(struct fusd_file_info *);
55 int v4l1_close(struct fusd_file_info *);
56 int v4l1_ioctl(struct fusd_file_info *, int, void *);
57 int v4l1_read(struct fusd_file_info *, char *, size_t, loff_t *);
58 int v4l1_mmap(struct fusd_file_info *, int, size_t, int, void **, size_t *);
60 int v4l2_request_buffers(struct v4l1_device *, int);
61 int v4l2_free_buffers(struct v4l1_device *);
63 #endif