duvc-ctl 2.0.0
USB Video Class Camera Control Library
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1#pragma once
2
8#include <string>
9
10namespace duvc {
11
43
62
66enum class CamMode {
67 Auto,
68 Manual
69};
70
75 int value;
77
79 PropSetting() = default;
80
87};
88
92struct PropRange {
93 int min;
94 int max;
95 int step;
98
100 PropRange() = default;
101
107 bool is_valid(int value) const {
108 return value >= min && value <= max && ((value - min) % step == 0);
109 }
110
116 int clamp(int value) const {
117 if (value <= min)
118 return min;
119 if (value >= max)
120 return max;
121
122 // Round to nearest step
123 int steps = (value - min + step / 2) / step;
124 return min + steps * step;
125 }
126};
127
131struct Device {
132 std::wstring name;
133 std::wstring path;
134
136 Device() = default;
137
143 Device(std::wstring n, std::wstring p)
144 : name(std::move(n)), path(std::move(p)) {}
145
155
162 if (this != &other) {
163 name = other.name;
164 path = other.path;
165 }
166 return *this;
167 }
168
174
181
186 bool is_valid() const { return !name.empty() && !path.empty(); }
187
192 const std::wstring &get_id() const { return path.empty() ? name : path; }
193};
194
195} // namespace duvc
Result type that can contain either a value or an error.
Definition result.h:75
Definition core.h:13
VidProp
Video processing properties (IAMVideoProcAmp interface)
Definition types.h:50
@ Saturation
Color saturation level.
@ Gain
Sensor gain level.
@ WhiteBalance
White balance adjustment.
@ Brightness
Image brightness level.
@ ColorEnable
Color vs. monochrome mode.
@ Sharpness
Image sharpness level.
@ Contrast
Image contrast level.
@ Gamma
Gamma correction value.
@ Hue
Color hue adjustment.
CamMode
Property control mode.
Definition types.h:66
@ Auto
Automatic control by camera.
@ Manual
Manual control by application.
CamProp
Camera control properties (IAMCameraControl interface)
Definition types.h:18
@ ExposureRelative
Relative exposure adjustment.
@ Roll
Camera roll rotation.
@ FocusSimple
Simple focus control.
@ PanRelative
Relative pan movement.
@ RollRelative
Relative roll movement.
@ Zoom
Optical zoom level.
@ Lamp
Camera lamp/flash control.
@ PanTiltRelative
Relative pan/tilt movement.
@ Tilt
Vertical camera rotation.
@ TiltRelative
Relative tilt movement.
@ ScanMode
Scan mode (progressive/interlaced)
@ ZoomRelative
Relative zoom movement.
@ Privacy
Privacy mode on/off.
@ IrisRelative
Relative iris adjustment.
@ Iris
Aperture/iris setting.
@ Exposure
Exposure time.
@ Focus
Focus position.
@ FocusRelative
Relative focus adjustment.
@ PanTilt
Combined pan/tilt control.
@ DigitalZoomRelative
Relative digital zoom.
@ Pan
Horizontal camera rotation.
@ BacklightCompensation
Backlight compensation.
@ DigitalZoom
Digital zoom level.
Represents a camera device.
Definition types.h:131
std::wstring path
Unique device path/identifier.
Definition types.h:133
Device(const Device &other)
Copy constructor - ensures deep copy of string data.
Definition types.h:153
Device()=default
Default constructor.
Device(Device &&) noexcept=default
Move constructor - transfers ownership of string data.
const std::wstring & get_id() const
Get stable identifier for this device.
Definition types.h:192
std::wstring name
Human-readable device name.
Definition types.h:132
Device(std::wstring n, std::wstring p)
Construct device with name and path.
Definition types.h:143
bool is_valid() const
Check if device has valid identifying information.
Definition types.h:186
Device & operator=(const Device &other)
Copy assignment operator.
Definition types.h:161
Property range and default information.
Definition types.h:92
int clamp(int value) const
Clamp value to valid range.
Definition types.h:116
bool is_valid(int value) const
Check if a value is valid for this range.
Definition types.h:107
int default_val
Default value.
Definition types.h:96
int min
Minimum supported value.
Definition types.h:93
PropRange()=default
Default constructor.
int step
Step size between valid values.
Definition types.h:95
int max
Maximum supported value.
Definition types.h:94
CamMode default_mode
Default control mode.
Definition types.h:97
Property setting with value and control mode.
Definition types.h:74
PropSetting()=default
Default constructor.
int value
Property value.
Definition types.h:75
CamMode mode
Control mode (auto/manual)
Definition types.h:76
PropSetting(int v, CamMode m)
Construct property setting.
Definition types.h:86