duvc-ctl 2.1.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
66
70enum class CamMode {
71 Auto,
72 Manual
73};
74
79 int value;
81
83 PropSetting() = default;
84
91};
92
96struct PropRange {
97 int min;
98 int max;
99 int step;
102
104 PropRange() = default;
105
111 bool is_valid(int value) const {
112 if (step <= 0) {
113 return false;
114 }
115
116 return value >= min && value <= max && ((value - min) % step == 0);
117 }
118
124 int clamp(int value) const {
125 if (step <= 0) {
126 if (value <= min)
127 return min;
128 if (value >= max)
129 return max;
130 return value;
131 }
132
133 if (value <= min)
134 return min;
135 if (value >= max)
136 return max;
137
138 // Round to nearest step
139 int steps = (value - min + step / 2) / step;
140 return min + steps * step;
141 }
142};
143
147struct Device {
148 std::wstring name;
149 std::wstring path;
150
152 Device() = default;
153
159 Device(std::wstring n, std::wstring p)
160 : name(std::move(n)), path(std::move(p)) {}
161
171
178 if (this != &other) {
179 name = other.name;
180 path = other.path;
181 }
182 return *this;
183 }
184
190
197
202 bool is_valid() const { return !name.empty() && !path.empty(); }
203
208 const std::wstring &get_id() const { return path.empty() ? name : path; }
209};
210
211} // 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
@ PowerLineFrequency
Power line frequency (anti-flicker setting)
@ DigitalMultiplier
Digital multiplier level.
@ Saturation
Color saturation level.
@ Gain
Sensor gain level.
@ WhiteBalanceComponent
White balance component adjustment.
@ WhiteBalance
White balance adjustment.
@ DigitalMultiplierLimit
Maximum digital multiplier level.
@ 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:70
@ 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:147
std::wstring path
Unique device path/identifier.
Definition types.h:149
Device(const Device &other)
Copy constructor - ensures deep copy of string data.
Definition types.h:169
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:208
std::wstring name
Human-readable device name.
Definition types.h:148
Device(std::wstring n, std::wstring p)
Construct device with name and path.
Definition types.h:159
bool is_valid() const
Check if device has valid identifying information.
Definition types.h:202
Device & operator=(const Device &other)
Copy assignment operator.
Definition types.h:177
Property range and default information.
Definition types.h:96
int clamp(int value) const
Clamp value to valid range.
Definition types.h:124
bool is_valid(int value) const
Check if a value is valid for this range.
Definition types.h:111
int default_val
Default value.
Definition types.h:100
int min
Minimum supported value.
Definition types.h:97
PropRange()=default
Default constructor.
int step
Step size between valid values.
Definition types.h:99
int max
Maximum supported value.
Definition types.h:98
CamMode default_mode
Default control mode.
Definition types.h:101
Property setting with value and control mode.
Definition types.h:78
PropSetting()=default
Default constructor.
int value
Property value.
Definition types.h:79
CamMode mode
Control mode (auto/manual)
Definition types.h:80
PropSetting(int v, CamMode m)
Construct property setting.
Definition types.h:90