2
Copyright (C) 2005 by Jasem Mutlaq <mutlaqja@ikarustech.com>
5
http://v4l2spec.bytesex.org/spec-single/v4l2.html#CAPTURE-EXAMPLE
7
This library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Lesser General Public
9
License as published by the Free Software Foundation; either
10
version 2.1 of the License, or (at your option) any later version.
12
This library is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
Lesser General Public License for more details.
17
You should have received a copy of the GNU Lesser General Public
18
License along with this library; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
28
#include "videodev2.h"
29
#include "eventloop.h"
30
#include "indidevapi.h"
32
#define VIDEO_COMPRESSION_LEVEL 4
40
typedef enum { IO_METHOD_READ, IO_METHOD_MMAP, IO_METHOD_USERPTR } io_method;
49
virtual int connectCam(const char * devpath, char *errmsg, int pixelFormat = -1 , int width = -1, int height = -1);
50
virtual void disconnectCam();
51
char * getDeviceName();
59
void setContrast(int val);
60
void setBrightness(int val);
61
void setColor(int val);
63
void setWhiteness(int val);
66
void callFrame(void *p);
67
void setPictureSettings();
68
void getPictureSettings();
73
virtual int setSize(int x, int y);
74
virtual void getMaxMinSize(int & x_max, int & y_max, int & x_min, int & y_min);
81
unsigned char * getY();
82
unsigned char * getU();
83
unsigned char * getV();
84
unsigned char * getColorBuffer();
86
void registerCallback(WPF *fp, void *ud);
88
int start_capturing(char *errmsg);
89
int stop_capturing(char *errmsg);
90
static void newFrame(int fd, void *p);
92
void enumerate_ctrl (void);
93
void enumerate_menu (void);
94
int queryINTControls(INumberVectorProperty *nvp);
95
int setINTControl(unsigned int ctrl_id, double new_value, char *errmsg);
97
int query_ctrl(unsigned int ctrl_id, double & ctrl_min, double & ctrl_max, double & ctrl_step, double & ctrl_value, char *errmsg);
101
int xioctl(int fd, int request, void *arg);
102
int read_frame(char *errsg);
103
int uninit_device(char *errmsg);
104
int open_device(const char *devpath, char *errmsg);
105
int init_device(char *errmsg, int pixelFormat , int width, int height);
106
int init_mmap(char *errmsg);
107
int errno_exit(const char *s, char *errmsg);
109
void close_device(void);
110
void init_userp(unsigned int buffer_size);
111
void init_read(unsigned int buffer_size);
115
struct v4l2_capability cap;
116
struct v4l2_cropcap cropcap;
117
struct v4l2_crop crop;
118
struct v4l2_format fmt;
120
struct v4l2_queryctrl queryctrl;
121
struct v4l2_querymenu querymenu;
128
struct buffer *buffers;
129
unsigned int n_buffers;
135
int xmax, xmin, ymax, ymin;
136
int selectCallBackID;
137
unsigned char * YBuf,*UBuf,*VBuf, *colorBuffer, *rgb24_buffer;