DeviceManager
DeviceManager
#include <icy/av/devicemanager.h>class DeviceManagerDefined in src/av/include/icy/av/devicemanager.h:210
Enumerates and manages system audio and video devices.
List of all members
| Name | Kind | Owner |
|---|---|---|
DevicesChanged | variable | Declared here |
DeviceManager | function | Declared here |
~DeviceManager | function | Declared here |
getCameras | function | Declared here |
getMicrophones | function | Declared here |
getSpeakers | function | Declared here |
getDefaultCamera | function | Declared here |
getDefaultMicrophone | function | Declared here |
getDefaultSpeaker | function | Declared here |
findCamera | function | Declared here |
findMicrophone | function | Declared here |
findSpeaker | function | Declared here |
getDeviceList | function | Declared here |
getCapabilities | function | Declared here |
setWatcher | function | Declared here |
watcher | function | Declared here |
print | function | Declared here |
getHardwareCodecs | function | Declared here |
negotiateVideoCapture | function | Declared here |
negotiateAudioCapture | function | Declared here |
findVideoInputFormat | function | Declared here |
findAudioInputFormat | function | Declared here |
instance | function | Declared here |
shutdown | function | Declared here |
_watcher | variable | Declared here |
Public Attributes
| Return | Name | Description |
|---|---|---|
NullSignal | DevicesChanged | Signals when a system device is connected or removed. Emitted by the platform-specific [DeviceWatcher](icy-av-DeviceWatcher.html#devicewatcher). |
DevicesChanged
NullSignal DevicesChangedDefined in src/av/include/icy/av/devicemanager.h:297
Signals when a system device is connected or removed. Emitted by the platform-specific [DeviceWatcher](icy-av-DeviceWatcher.html#devicewatcher).
NOTE: This signal may be emitted from a background thread (e.g. inotify thread on Linux, COM callback on Windows, CoreAudio listener on macOS). Handlers must be thread-safe and should NOT call back into DeviceManager to enumerate. Instead, post to the main thread or set a flag.
Public Methods
| Return | Name | Description |
|---|---|---|
DeviceManager | ||
bool | getCameras const | Populate devices with all connected video input (camera) devices. |
bool | getMicrophones const | Populate devices with all connected audio input (microphone) devices. |
bool | getSpeakers const | Populate devices with all connected audio output (speaker) devices. |
bool | getDefaultCamera const | Return the default (or first available) camera. |
bool | getDefaultMicrophone const | Return the default (or first available) microphone. |
bool | getDefaultSpeaker const | Return the default (or first available) speaker. |
bool | findCamera const | Find a camera by display name or device id. |
bool | findMicrophone const | Find a microphone by display name or device id. |
bool | findSpeaker const | Find a speaker by display name or device id. |
bool | getDeviceList const | Populate devices from the platform-specific backend for the given type. |
int | getCapabilities const | |
void | setWatcher | Replace the active device watcher. Takes ownership. |
DeviceWatcher * | watcher const | |
void | print const | Print all devices to the output stream. |
std::vector< HardwareCodec > | getHardwareCodecs const | Detect available hardware-accelerated codecs via FFmpeg. |
std::optional< std::pair< Device, Device::VideoCapability > > | negotiateVideoCapture const | Resolve the best video capture parameters for a device. |
std::optional< std::pair< Device, Device::AudioCapability > > | negotiateAudioCapture const | Resolve the best audio capture parameters for a device. Returns std::nullopt if no microphone is available. |
const AVInputFormat * | findVideoInputFormat const | Find base FFmpeg formats. |
const AVInputFormat * | findAudioInputFormat const |
DeviceManager
DeviceManager()Defined in src/av/include/icy/av/devicemanager.h:213
getCameras
const
bool getCameras(std::vector< Device > & devices) constDefined in src/av/include/icy/av/devicemanager.h:219
Populate devices with all connected video input (camera) devices.
Parameters
devicesOutput vector to fill.
Returns
True if enumeration succeeded (even if the list is empty).
getMicrophones
const
bool getMicrophones(std::vector< Device > & devices) constDefined in src/av/include/icy/av/devicemanager.h:224
Populate devices with all connected audio input (microphone) devices.
Parameters
devicesOutput vector to fill.
Returns
True if enumeration succeeded.
getSpeakers
const
bool getSpeakers(std::vector< Device > & devices) constDefined in src/av/include/icy/av/devicemanager.h:229
Populate devices with all connected audio output (speaker) devices.
Parameters
devicesOutput vector to fill.
Returns
True if enumeration succeeded.
getDefaultCamera
const
bool getDefaultCamera(Device & device) constDefined in src/av/include/icy/av/devicemanager.h:234
Return the default (or first available) camera.
Parameters
deviceOutput Device to fill.
Returns
True if a camera was found.
getDefaultMicrophone
const
bool getDefaultMicrophone(Device & device) constDefined in src/av/include/icy/av/devicemanager.h:239
Return the default (or first available) microphone.
Parameters
deviceOutput Device to fill.
Returns
True if a microphone was found.
getDefaultSpeaker
const
bool getDefaultSpeaker(Device & device) constDefined in src/av/include/icy/av/devicemanager.h:244
Return the default (or first available) speaker.
Parameters
deviceOutput Device to fill.
Returns
True if a speaker was found.
findCamera
const
bool findCamera(std::string_view name, Device & device) constDefined in src/av/include/icy/av/devicemanager.h:250
Find a camera by display name or device id.
Parameters
nameThe name or id to search for.deviceOutput Device to fill if found.
Returns
True if a matching device was found.
findMicrophone
const
bool findMicrophone(std::string_view name, Device & device) constDefined in src/av/include/icy/av/devicemanager.h:256
Find a microphone by display name or device id.
Parameters
nameThe name or id to search for.deviceOutput Device to fill if found.
Returns
True if a matching device was found.
findSpeaker
const
bool findSpeaker(std::string_view name, Device & device) constDefined in src/av/include/icy/av/devicemanager.h:262
Find a speaker by display name or device id.
Parameters
nameThe name or id to search for.deviceOutput Device to fill if found.
Returns
True if a matching device was found.
getDeviceList
const
bool getDeviceList(Device::Type type, std::vector< av::Device > & devices) constDefined in src/av/include/icy/av/devicemanager.h:268
Populate devices from the platform-specific backend for the given type.
Parameters
typeThe device type to enumerate.devicesOutput vector to fill.
Returns
True if enumeration succeeded.
getCapabilities
const
int getCapabilities() constDefined in src/av/include/icy/av/devicemanager.h:271
Returns
A bitmask of MediaCapabilities flags indicating which capture/render types are available.
setWatcher
void setWatcher(DeviceWatcher * watcher)Defined in src/av/include/icy/av/devicemanager.h:275
Replace the active device watcher. Takes ownership.
Parameters
watcherThe new DeviceWatcher, or nullptr to disable watching.
watcher
const
DeviceWatcher * watcher() constDefined in src/av/include/icy/av/devicemanager.h:278
Returns
The currently active DeviceWatcher, or nullptr if none has been set.
const
void print(std::ostream & ost) constDefined in src/av/include/icy/av/devicemanager.h:281
Print all devices to the output stream.
getHardwareCodecs
const
std::vector< HardwareCodec > getHardwareCodecs() constDefined in src/av/include/icy/av/devicemanager.h:307
Detect available hardware-accelerated codecs via FFmpeg.
negotiateVideoCapture
const
std::optional< std::pair< Device, Device::VideoCapability > > negotiateVideoCapture(std::string_view deviceName, int width, int height, double fps) constDefined in src/av/include/icy/av/devicemanager.h:321
Resolve the best video capture parameters for a device.
Looks up the device by name/id (or default camera if empty), queries its capabilities, and returns the closest match. Returns std::nullopt if no camera is available.
Usage: if (auto result = devman.negotiateVideoCapture("", 1280, 720, 30)) { auto& [dev, cap] = *result; capture.openVideo(dev.id, cap.width, cap.height, cap.maxFps, cap.pixelFormat); }
negotiateAudioCapture
const
std::optional< std::pair< Device, Device::AudioCapability > > negotiateAudioCapture(std::string_view deviceName, int sampleRate, int channels) constDefined in src/av/include/icy/av/devicemanager.h:326
Resolve the best audio capture parameters for a device. Returns std::nullopt if no microphone is available.
findVideoInputFormat
const
const AVInputFormat * findVideoInputFormat() constDefined in src/av/include/icy/av/devicemanager.h:330
Find base FFmpeg formats.
findAudioInputFormat
const
const AVInputFormat * findAudioInputFormat() constDefined in src/av/include/icy/av/devicemanager.h:331
Public Static Methods
| Return | Name | Description |
|---|---|---|
DeviceManager & | instance static | Returns the default [DeviceManager](#devicemanager) singleton. |
void | shutdown static | Shuts down the MediaFactory and deletes the singleton instance. |
instance
static
static DeviceManager & instance()Defined in src/av/include/icy/av/devicemanager.h:284
Returns the default [DeviceManager](#devicemanager) singleton.
shutdown
static
static void shutdown()Defined in src/av/include/icy/av/devicemanager.h:287
Shuts down the MediaFactory and deletes the singleton instance.
Protected Attributes
| Return | Name | Description |
|---|---|---|
std::unique_ptr< DeviceWatcher > | _watcher |
_watcher
std::unique_ptr< DeviceWatcher > _watcher