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 return value >= min && value <= max && ((value - min) % step == 0);
113 }
114
120 int clamp(int value) const {
121 if (value <= min)
122 return min;
123 if (value >= max)
124 return max;
125
126 // Round to nearest step
127 int steps = (value - min + step / 2) / step;
128 return min + steps * step;
129 }
130};
131
135struct Device {
136 std::wstring name;
137 std::wstring path;
138
140 Device() = default;
141
147 Device(std::wstring n, std::wstring p)
148 : name(std::move(n)), path(std::move(p)) {}
149
159
166 if (this != &other) {
167 name = other.name;
168 path = other.path;
169 }
170 return *this;
171 }
172
178
185
190 bool is_valid() const { return !name.empty() && !path.empty(); }
191
196 const std::wstring &get_id() const { return path.empty() ? name : path; }
197};
198
199} // 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:135
std::wstring path
Unique device path/identifier.
Definition types.h:137
Device(const Device &other)
Copy constructor - ensures deep copy of string data.
Definition types.h:157
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:196
std::wstring name
Human-readable device name.
Definition types.h:136
Device(std::wstring n, std::wstring p)
Construct device with name and path.
Definition types.h:147
bool is_valid() const
Check if device has valid identifying information.
Definition types.h:190
Device & operator=(const Device &other)
Copy assignment operator.
Definition types.h:165
Property range and default information.
Definition types.h:96
int clamp(int value) const
Clamp value to valid range.
Definition types.h:120
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