Home
AV module

Device

Represents a system audio, video or render device.

Device

#include <icy/av/devicemanager.h>
struct Device

Defined in src/av/include/icy/av/devicemanager.h:44

Represents a system audio, video or render device.

List of all members

NameKindOwner
typevariableDeclared here
idvariableDeclared here
namevariableDeclared here
isDefaultvariableDeclared here
isConnectedvariableDeclared here
isInUsevariableDeclared here
videoCapabilitiesvariableDeclared here
audioCapabilitiesvariableDeclared here
DevicefunctionDeclared here
DevicefunctionDeclared here
printfunctionDeclared here
operator==functionDeclared here
bestVideoCapabilityfunctionDeclared here
bestAudioCapabilityfunctionDeclared here
TypeenumDeclared here

Public Attributes

ReturnNameDescription
Typetype
std::stringid
std::stringname
boolisDefault
boolisConnected
boolisInUse
std::vector< VideoCapability >videoCapabilities
std::vector< AudioCapability >audioCapabilities

type

Type type {}

Defined in src/av/include/icy/av/devicemanager.h:73


id

std::string id

Defined in src/av/include/icy/av/devicemanager.h:74


name

std::string name

Defined in src/av/include/icy/av/devicemanager.h:75


isDefault

bool isDefault {false}

Defined in src/av/include/icy/av/devicemanager.h:76


isConnected

bool isConnected {true}

Defined in src/av/include/icy/av/devicemanager.h:77


isInUse

bool isInUse {false}

Defined in src/av/include/icy/av/devicemanager.h:78


videoCapabilities

std::vector< VideoCapability > videoCapabilities

Defined in src/av/include/icy/av/devicemanager.h:80


audioCapabilities

std::vector< AudioCapability > audioCapabilities

Defined in src/av/include/icy/av/devicemanager.h:81

Public Methods

ReturnNameDescription
DeviceConstruct a device with Unknown type and empty fields.
DeviceConstruct a device with explicit fields.
voidprint constPrint device details (type, id, name, capabilities) to the given stream.
booloperator== const inlineEquality based on type, id, and name.
VideoCapabilitybestVideoCapability const inlineFind the video capability closest to the requested parameters.
AudioCapabilitybestAudioCapability const inlineFind the audio capability closest to the requested parameters.

Device

Device()

Defined in src/av/include/icy/av/devicemanager.h:84

Construct a device with Unknown type and empty fields.


Device

Device(Type type, const std::string & id, const std::string & name, bool isDefault = false)

Defined in src/av/include/icy/av/devicemanager.h:91

Construct a device with explicit fields.

Parameters

  • type The device type (VideoInput, AudioInput, etc.).

  • id The platform-specific device identifier.

  • name The human-readable device name.

  • isDefault True if this is the system default device of its type.


print

const

void print(std::ostream & os) const

Defined in src/av/include/icy/av/devicemanager.h:95

Print device details (type, id, name, capabilities) to the given stream.

Parameters

  • os The output stream to write to.

operator==

const inline

inline bool operator==(const Device & that) const

Defined in src/av/include/icy/av/devicemanager.h:98

Equality based on type, id, and name.


bestVideoCapability

const inline

inline VideoCapability bestVideoCapability(int width, int height, double fps) const

Defined in src/av/include/icy/av/devicemanager.h:112

Find the video capability closest to the requested parameters.

Scoring: resolution match weighted 70%, fps match weighted 30%. Both dimensions are normalised to [0,1] so the weights are meaningful. Prefers capabilities that are >= the requested resolution (upscaling is worse than slight downscaling).

Returns a default capability with the requested values if none are available (allows callers to skip the empty check).


bestAudioCapability

const inline

inline AudioCapability bestAudioCapability(int sampleRate, int channels) const

Defined in src/av/include/icy/av/devicemanager.h:151

Find the audio capability closest to the requested parameters.

Scoring: sample rate match weighted 70%, channel count weighted 30%. Both dimensions are normalised to [0,1].

Returns a default capability with the requested values if none are available.

Public Types

NameDescription
Type

Type

enum Type

Defined in src/av/include/icy/av/devicemanager.h:46

ValueDescription
Unknown
VideoInput
VideoOutput
AudioInput
AudioOutput