1 #ifndef CVD_V4LCONTROL_H 2 #define CVD_V4LCONTROL_H 8 #include <linux/videodev2.h> 10 #include <cvd/exceptions.h> 23 using CVD::Exceptions::All::All;
78 V4LControl(
const std::string& name,
bool report =
true);
91 void autoexposure(
bool);
100 void brightness(
double);
101 double brightness(
void);
103 void contrast(
double);
104 double contrast(
void);
106 void saturation(
double);
107 double saturation(
void);
113 unsigned int getId(
const std::string& name)
const;
114 std::string getName(
unsigned int id)
const;
115 std::vector<unsigned int> supportedParameters(
void)
const;
116 std::vector<std::string> supportedParameterNames(
void)
const;
118 inline bool isSupported(
const std::string& name)
const 120 return (controlNames.find(name) != controlNames.end());
122 inline void set(
const std::string& name,
int value)
124 set(getId(name), value);
126 inline int get(
const std::string& name)
128 return get(getId(name));
130 inline int type(
const std::string& name)
132 return type(getId(name));
134 inline std::map<unsigned int, std::string> menuValues(
const std::string& name)
136 return menuValues(getId(name));
138 inline int defaultValue(
const std::string& name)
140 return defaultValue(getId(name));
142 inline int min(
const std::string& name)
144 return min(getId(name));
146 inline int max(
const std::string& name)
148 return max(getId(name));
150 inline int step(
const std::string& name)
152 return step(getId(name));
155 inline bool isSupported(
unsigned int id)
const 157 return (controlData.find(
id) != controlData.end());
159 void set(
unsigned int id,
int value);
160 int get(
unsigned int id);
161 int type(
unsigned int id);
162 std::map<unsigned int, std::string> menuValues(
unsigned int id)
const;
163 int defaultValue(
unsigned int id)
const;
164 int min(
unsigned int id)
const;
165 int max(
unsigned int id)
const;
166 int step(
unsigned int id)
const;
172 int getQueryStruct(v4l2_queryctrl& query)
const;
173 void getMenuStruct(
unsigned int id, std::vector<v4l2_querymenu>& menu)
const;
174 int setControlStruct(v4l2_control& value);
175 int getControlStruct(v4l2_control& value)
const;
179 inline int getFile(
void)
const {
return device; }
182 inline const std::string&
getDevice(
void)
const {
return deviceName; }
186 inline bool getReportErrors(
void)
const {
return reportErrors; }
190 std::string deviceName;
191 struct v4l2_control control;
194 void queryControls(
void);
196 std::map<std::string, unsigned int> controlNames;
197 std::map<unsigned int, v4l2_queryctrl> controlData;
198 std::map<unsigned int, std::vector<v4l2_querymenu>> menuData;
All classes and functions are within the CVD namespace.
Definition: argb.h:6
exposes the V4L2 API to set parameters on a capture device.
Definition: v4lcontrol.h:74
Definition: v4lcontrol.h:21
Error querying value.
Definition: v4lcontrol.h:42
Error querying device parameters.
Definition: v4lcontrol.h:56
Unsupported parameter.
Definition: v4lcontrol.h:34
Error setting value.
Definition: v4lcontrol.h:49
Base class for all CVD exceptions.
Definition: exceptions.h:15
Error opening the device.
Definition: v4lcontrol.h:27
void setReportErrors(bool report)
set error reporting
Definition: v4lcontrol.h:185
int getFile(void) const
return file descriptor for the opened device
Definition: v4lcontrol.h:179
const std::string & getDevice(void) const
return file name of the opened device
Definition: v4lcontrol.h:182