duvc-ctl 2.0.0
USB Video Class Camera Control Library
Loading...
Searching...
No Matches
duvc::DeviceConnection Class Reference

RAII wrapper for DirectShow device connections. More...

#include <duvc-ctl/core.h>

Collaboration diagram for duvc::DeviceConnection:

Classes

class  com_apartment
 

Public Member Functions

 DeviceConnection (const Device &dev)
 
 ~DeviceConnection ()
 
bool get (CamProp prop, PropSetting &val)
 
bool set (CamProp prop, const PropSetting &val)
 
bool get (VidProp prop, PropSetting &val)
 
bool set (VidProp prop, const PropSetting &val)
 
bool get_range (CamProp prop, PropRange &range)
 
bool get_range (VidProp prop, PropRange &range)
 
bool is_valid () const
 
 DeviceConnection (const Device &dev)
 Create connection to specified device.
 
 ~DeviceConnection ()
 Destructor - releases all COM interfaces.
 
 DeviceConnection (const DeviceConnection &)=delete
 
DeviceConnectionoperator= (const DeviceConnection &)=delete
 
 DeviceConnection (DeviceConnection &&)=default
 
DeviceConnectionoperator= (DeviceConnection &&)=default
 
bool get (CamProp prop, PropSetting &val)
 Get current value of a camera control property.
 
bool set (CamProp prop, const PropSetting &val)
 Set value of a camera control property.
 
bool get (VidProp prop, PropSetting &val)
 Get current value of a video processing property.
 
bool set (VidProp prop, const PropSetting &val)
 Set value of a video processing property.
 
bool get_range (CamProp prop, PropRange &range)
 Get valid range for a camera control property.
 
bool get_range (VidProp prop, PropRange &range)
 Get valid range for a video processing property.
 
bool is_valid () const
 Check if connection is valid.
 

Detailed Description

RAII wrapper for DirectShow device connections.

Manages COM interfaces for a single device, providing efficient access to camera controls without repeated device enumeration and binding.

Definition at line 55 of file core.h.

Constructor & Destructor Documentation

◆ DeviceConnection() [1/4]

duvc::DeviceConnection::DeviceConnection ( const Device & dev)
explicit

Definition at line 358 of file core.cpp.

References duvc::get_cam_ctrl(), duvc::get_vproc(), and duvc::open_device_filter().

Here is the call graph for this function:

◆ ~DeviceConnection() [1/2]

duvc::DeviceConnection::~DeviceConnection ( )

Definition at line 379 of file core.cpp.

◆ DeviceConnection() [2/4]

duvc::DeviceConnection::DeviceConnection ( const Device & dev)
explicit

Create connection to specified device.

Parameters
devDevice to connect to
Exceptions
std::runtime_errorif device cannot be opened

◆ ~DeviceConnection() [2/2]

duvc::DeviceConnection::~DeviceConnection ( )

Destructor - releases all COM interfaces.

◆ DeviceConnection() [3/4]

duvc::DeviceConnection::DeviceConnection ( const DeviceConnection & )
delete

◆ DeviceConnection() [4/4]

duvc::DeviceConnection::DeviceConnection ( DeviceConnection && )
default

Member Function Documentation

◆ get() [1/4]

bool duvc::DeviceConnection::get ( CamProp prop,
PropSetting & val )

Definition at line 385 of file core.cpp.

References duvc::camprop_to_dshow(), duvc::from_flag(), and duvc::Result< T >::value().

Here is the call graph for this function:

◆ get() [2/4]

bool duvc::DeviceConnection::get ( CamProp prop,
PropSetting & val )

Get current value of a camera control property.

Parameters
propCamera property to query
valOutput current setting
Returns
true if value was retrieved successfully

◆ get() [3/4]

bool duvc::DeviceConnection::get ( VidProp prop,
PropSetting & val )

Definition at line 413 of file core.cpp.

References duvc::from_flag(), duvc::Result< T >::value(), and duvc::vidprop_to_dshow().

Here is the call graph for this function:

◆ get() [4/4]

bool duvc::DeviceConnection::get ( VidProp prop,
PropSetting & val )

Get current value of a video processing property.

Parameters
propVideo property to query
valOutput current setting
Returns
true if value was retrieved successfully

◆ get_range() [1/4]

bool duvc::DeviceConnection::get_range ( CamProp prop,
PropRange & range )

Definition at line 441 of file core.cpp.

References duvc::camprop_to_dshow(), duvc::PropRange::default_mode, duvc::PropRange::default_val, duvc::from_flag(), duvc::PropRange::max, duvc::PropRange::min, and duvc::PropRange::step.

Here is the call graph for this function:

◆ get_range() [2/4]

bool duvc::DeviceConnection::get_range ( CamProp prop,
PropRange & range )

Get valid range for a camera control property.

Parameters
propCamera property to query
rangeOutput range information
Returns
true if range was retrieved successfully

◆ get_range() [3/4]

bool duvc::DeviceConnection::get_range ( VidProp prop,
PropRange & range )

Definition at line 460 of file core.cpp.

References duvc::PropRange::default_mode, duvc::PropRange::default_val, duvc::from_flag(), duvc::PropRange::max, duvc::PropRange::min, duvc::PropRange::step, and duvc::vidprop_to_dshow().

Here is the call graph for this function:

◆ get_range() [4/4]

bool duvc::DeviceConnection::get_range ( VidProp prop,
PropRange & range )

Get valid range for a video processing property.

Parameters
propVideo property to query
rangeOutput range information
Returns
true if range was retrieved successfully

◆ is_valid() [1/2]

bool duvc::DeviceConnection::is_valid ( ) const
inline

Definition at line 67 of file core.h.

◆ is_valid() [2/2]

bool duvc::DeviceConnection::is_valid ( ) const
inline

Check if connection is valid.

Returns
true if device is connected and interfaces are available

Definition at line 93 of file connection_pool.h.

◆ operator=() [1/2]

DeviceConnection & duvc::DeviceConnection::operator= ( const DeviceConnection & )
delete

◆ operator=() [2/2]

DeviceConnection & duvc::DeviceConnection::operator= ( DeviceConnection && )
default

◆ set() [1/4]

bool duvc::DeviceConnection::set ( CamProp prop,
const PropSetting & val )

Definition at line 401 of file core.cpp.

References duvc::camprop_to_dshow(), duvc::to_flag(), and duvc::Result< T >::value().

Here is the call graph for this function:

◆ set() [2/4]

bool duvc::DeviceConnection::set ( CamProp prop,
const PropSetting & val )

Set value of a camera control property.

Parameters
propCamera property to set
valNew property setting
Returns
true if value was set successfully

◆ set() [3/4]

bool duvc::DeviceConnection::set ( VidProp prop,
const PropSetting & val )

Definition at line 429 of file core.cpp.

References duvc::to_flag(), duvc::Result< T >::value(), and duvc::vidprop_to_dshow().

Here is the call graph for this function:

◆ set() [4/4]

bool duvc::DeviceConnection::set ( VidProp prop,
const PropSetting & val )

Set value of a video processing property.

Parameters
propVideo property to set
valNew property setting
Returns
true if value was set successfully

The documentation for this class was generated from the following files: