v4l2.h
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2000 Brian Gerkey et al.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  */
21 //
22 // Desc: Video4Linux2 routines for camerav4l2 driver
23 // Author: Paul Osmialowski
24 //
26 
27 #ifndef _V4L2_H
28 #define _V4L2_H
29 
30 #include <sys/types.h>
31 #include <linux/videodev2.h>
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 #define v4l2_fmtbyname(name) v4l2_fourcc((name)[0], (name)[1], (name)[2], (name)[3])
38 
39 #define REQUEST_BUFFERS 4
40 
41 struct fg_struct
42 {
43  int dev_fd;
44  int grabbing;
45  int grab_number;
46  int depth;
47  int buffers_num;
48  unsigned int pixformat;
49  int r, g, b;
50  struct buff_struct
51  {
52  struct v4l2_buffer buffer;
53  unsigned char * video_map;
54  } buffers[REQUEST_BUFFERS];
55  int width;
56  int height;
57  int pixels;
58  int imgdepth;
59  unsigned char * bayerbuf;
60  int bayerbuf_size;
61  unsigned char * image;
62 };
63 
64 #define FG(ptr) ((struct fg_struct *)(ptr))
65 
66 extern void * open_fg(const char * dev, const char * pixformat, int width, int height, int imgdepth, int buffers);
67 extern void close_fg(void * fg);
68 extern int set_channel(void * fg, int channel, const char * mode);
69 extern int start_grab (void * fg);
70 extern void stop_grab (void * fg);
71 extern unsigned char * get_image(void * fg);
72 extern int fg_width(void * fg);
73 extern int fg_height(void * fg);
74 extern int fg_grabdepth(void * fg);
75 extern int fg_imgdepth(void * fg);
76 
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif
Definition: v4l2.h:51
Definition: v4l2.h:42
Definition: camera.h:150