Skip to content

Commit f88d46a

Browse files
committed
Added information about the underlaying system API. Added frame capture tests for DirectShow and MediaFoundation in the builds.
1 parent cab42e9 commit f88d46a

10 files changed

Lines changed: 518 additions & 2 deletions

File tree

Manager/src/cmdparser.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ namespace AkVCam {
119119
int defaultHandler(const StringMap &flags,
120120
const StringVector &args);
121121
int showHelp(const StringMap &flags, const StringVector &args);
122+
int showSystemAPI(const StringMap &flags, const StringVector &args);
122123
int showDevices(const StringMap &flags, const StringVector &args);
123124
int addDevice(const StringMap &flags, const StringVector &args);
124125
int removeDevice(const StringMap &flags, const StringVector &args);
@@ -205,6 +206,10 @@ AkVCam::CmdParser::CmdParser()
205206
this->addFlags("",
206207
{"--build-info"},
207208
"Show build information.");
209+
this->addCommand("system-api",
210+
"",
211+
"Show the virtual camera API being used.",
212+
AKVCAM_BIND_FUNC(CmdParserPrivate::showSystemAPI));
208213
this->addCommand("devices",
209214
"",
210215
"List devices.",
@@ -891,6 +896,17 @@ int AkVCam::CmdParserPrivate::showHelp(const StringMap &flags,
891896
return 0;
892897
}
893898

899+
int AkVCam::CmdParserPrivate::showSystemAPI(const StringMap &flags,
900+
const StringVector &args)
901+
{
902+
UNUSED(flags);
903+
UNUSED(args);
904+
905+
auto api = this->m_ipcBridge.systemAPI();
906+
907+
AkPrintOut(api.c_str());
908+
}
909+
894910
int AkVCam::CmdParserPrivate::showDevices(const StringMap &flags,
895911
const StringVector &args)
896912
{

VCamUtils/src/ipcbridge.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ namespace AkVCam
8686

8787
/* Server & Client */
8888

89+
std::string systemAPI() const;
8990
std::string picture() const;
9091
void setPicture(const std::string &picture);
9192
int logLevel() const;

capi/src/capi.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,26 @@ CAPI_EXPORT void vcam_close(void *vcam)
149149
delete reinterpret_cast<VCamAPI *>(vcam);
150150
}
151151

152+
CAPI_EXPORT void vcam_system_api(void *vcam,
153+
char *api_name,
154+
size_t *api_name_len)
155+
{
156+
// Validate buffer_size
157+
if (!api_name_len)
158+
return -EINVAL;
159+
160+
// Cast vcam to VCamAPI
161+
auto vcamApi = reinterpret_cast<VCamAPI *>(vcam);
162+
163+
auto apiName = vcamApi->m_bridge.systemAPI();
164+
*api_name_len = apiName.size() + 1;
165+
166+
if (api_name)
167+
snprintf(api_name, *api_name_len, "%s", apiName.c_str());
168+
169+
return apiName.size();
170+
}
171+
152172
CAPI_EXPORT int vcam_devices(void *vcam, char *devs, size_t *buffer_size)
153173
{
154174
// Validate buffer_size

capi/src/capi.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ CAPI_EXPORT void *vcam_open();
4545
// Close the virtual camera
4646
CAPI_EXPORT void vcam_close(void *vcam);
4747

48+
// Show the virtual camera API being used
49+
CAPI_EXPORT void vcam_system_api(void *vcam,
50+
char *api_name,
51+
size_t *api_name_len);
52+
4853
// List devices.
4954
CAPI_EXPORT int vcam_devices(void *vcam, char *devs, size_t *buffer_size);
5055

cmio/PlatformUtils/src/utils.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <CoreGraphics/CGImage.h>
2626
#include <CoreGraphics/CGDataProvider.h>
2727
#include <libproc.h>
28+
#include <sys/sysctl.h>
2829

2930
#include "utils.h"
3031
#include "preferences.h"
@@ -132,6 +133,29 @@ std::string AkVCam::locatePluginPath()
132133
return fileExists(file)? file: std::string();
133134
}
134135

136+
bool AkVCam::supportsCmioExtensionVCam()
137+
{
138+
char version[16];
139+
size_t size = sizeof(version);
140+
141+
// Get the commercial version of macOS
142+
if (sysctlbyname("kern.osproductversion", version, &size, NULL, 0) != 0)
143+
return false;
144+
145+
// Get the major and minor number (major.minor)
146+
int major = 0, minor = 0;
147+
sscanf(version, "%d.%d", &major, &minor);
148+
149+
// CMIO Extensions requires macOS 12.3 or higher
150+
if (major > 12)
151+
return true;
152+
153+
if (major == 12 && minor >= 3)
154+
return true;
155+
156+
return false;
157+
}
158+
135159
std::string AkVCam::tempPath()
136160
{
137161
return {"/tmp"};

cmio/PlatformUtils/src/utils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ namespace AkVCam
3535
std::string locateManagerPath();
3636
std::string locateServicePath();
3737
std::string locatePluginPath();
38+
bool supportsCmioExtensionVCam();
3839
std::string tempPath();
3940
bool uuidEqual(const REFIID &uuid1, const CFUUIDRef uuid2);
4041
std::string enumToString(uint32_t value);

cmio/VCamIPC/src/ipcbridge.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,13 @@ AkVCam::IpcBridge::~IpcBridge()
209209
delete this->d;
210210
}
211211

212+
std::string AkVCam::IpcBridge::systemAPI() const
213+
{
214+
return supportsCmioExtensionVCam()?
215+
"CoreMediaIO Extension":
216+
"CoreMediaIO";
217+
}
218+
212219
std::string AkVCam::IpcBridge::picture() const
213220
{
214221
return this->d->m_picture;

0 commit comments

Comments
 (0)