Added -f, --force flags to the manager, this bypass the virtual camera

usage check.
This commit is contained in:
Gonzalo Exequiel Pedone 2021-10-29 11:24:36 -03:00
parent f4a605ee6c
commit 67fdbde187
No known key found for this signature in database
GPG key ID: B8B09E63E9B85BAF
4 changed files with 15 additions and 3 deletions

View file

@ -1,3 +1,8 @@
akvirtualcamera 9.1.0:
- Added -f, --force flags to the manager, this bypass the virtual camera usage
check.
akvirtualcamera 9.0.0: akvirtualcamera 9.0.0:
- Code forked from Webcamoid. This virtual camera isn't compatible with - Code forked from Webcamoid. This virtual camera isn't compatible with

View file

@ -80,6 +80,7 @@ namespace AkVCam {
std::vector<CmdParserCommand> m_commands; std::vector<CmdParserCommand> m_commands;
IpcBridge m_ipcBridge; IpcBridge m_ipcBridge;
bool m_parseable {false}; bool m_parseable {false};
bool m_force {false};
static const std::map<ControlType, std::string> &typeStrMap(); static const std::map<ControlType, std::string> &typeStrMap();
std::string basename(const std::string &path); std::string basename(const std::string &path);
@ -184,6 +185,9 @@ AkVCam::CmdParser::CmdParser()
this->addFlags("", this->addFlags("",
{"-p", "--parseable"}, {"-p", "--parseable"},
"Show parseable output."); "Show parseable output.");
this->addFlags("",
{"-f", "--force"},
"Force command.");
this->addCommand("devices", this->addCommand("devices",
"", "",
"List devices.", "List devices.",
@ -430,7 +434,7 @@ int AkVCam::CmdParser::parse(int argc, char **argv)
} }
} }
if (this->d->m_ipcBridge.isBusyFor(command->command)) { if (!this->d->m_force && this->d->m_ipcBridge.isBusyFor(command->command)) {
std::cerr << "This operation is not permitted." << std::endl; std::cerr << "This operation is not permitted." << std::endl;
std::cerr << "The virtual camera is in use. Stop or close the virtual " std::cerr << "The virtual camera is in use. Stop or close the virtual "
<< "camera clients and try again." << std::endl; << "camera clients and try again." << std::endl;
@ -791,6 +795,9 @@ int AkVCam::CmdParserPrivate::defaultHandler(const StringMap &flags,
if (this->containsFlag(flags, "", "-p")) if (this->containsFlag(flags, "", "-p"))
this->m_parseable = true; this->m_parseable = true;
if (this->containsFlag(flags, "", "-f"))
this->m_force = true;
return 0; return 0;
} }

View file

@ -1,4 +1,4 @@
version: 9.0.0.{build}-{branch} version: 9.1.0.{build}-{branch}
os: MinGW os: MinGW
image: Visual Studio 2019 image: Visual Studio 2019

View file

@ -28,7 +28,7 @@ set(COMMONS_APPNAME AkVirtualCamera)
string(TOLOWER ${COMMONS_APPNAME} COMMONS_TARGET) string(TOLOWER ${COMMONS_APPNAME} COMMONS_TARGET)
set(VER_MAJ 9) set(VER_MAJ 9)
set(VER_MIN 0) set(VER_MIN 1)
set(VER_PAT 0) set(VER_PAT 0)
set(VERSION ${VER_MAJ}.${VER_MIN}.${VER_PAT}) set(VERSION ${VER_MAJ}.${VER_MIN}.${VER_PAT})
set(DAILY_BUILD OFF CACHE BOOL "Mark this as a daily build") set(DAILY_BUILD OFF CACHE BOOL "Mark this as a daily build")