I have a macOS app, which detects if a camera is being used via the kCMIOHardwarePropertyDevices :
typedef void (^DeviceIterator)(CMIOObjectID cameraObject, BOOL *stop);
static void iterateThroughAllInputDevices(DeviceIterator deviceIterator)
{
// Check the number of devices.
CMIOObjectPropertyAddress address = makeGlobalPropertyAddress(kCMIOHardwarePropertyDevices);
UInt32 devicesDataSize;
auto status = CMIOObjectGetPropertyDataSize(kCMIOObjectSystemObject, &address, 0, nil, &devicesDataSize);
if (isError(status))
{
return;
}
// Get the devices.
UInt32 devicesDataUsed;
int count = devicesDataSize / sizeof(CMIOObjectID);
if (!count)
{
LOG_INFO("video device list is empty");
return;
}
I am using virtual machines for my automated end-to-end tests (which tests are written in Python). These Virtual Machines don't have a Camera device available, so I quickly wrote a macOS Camera Extension (based on the "Create camera extensions with Core Media IO" WWDC session ) in hope that it could act like a real camera. Unfortunately this Virtual Camera is not being detected by the code above. I am getting the video device list is empty message.
How could I create a virtual (software) camera that would be listed by the API above?