diff --git a/Manager/src/cmdparser.cpp b/Manager/src/cmdparser.cpp index 78618f5..c076a65 100644 --- a/Manager/src/cmdparser.cpp +++ b/Manager/src/cmdparser.cpp @@ -162,6 +162,10 @@ namespace AkVCam { AkVCam::CmdParser::CmdParser() { this->d = new CmdParserPrivate(); + auto logFile = this->d->m_ipcBridge.logPath("AkVCamManager"); + AkLogInfo() << "Sending debug output to " << logFile << std::endl; + AkVCam::Logger::setLogFile(logFile); + this->d->m_commands.push_back({}); this->setDefaultFuntion(AKVCAM_BIND_FUNC(CmdParserPrivate::defaultHandler)); this->addFlags("", diff --git a/VCamUtils/src/ipcbridge.h b/VCamUtils/src/ipcbridge.h index 4a73489..8f791c9 100644 --- a/VCamUtils/src/ipcbridge.h +++ b/VCamUtils/src/ipcbridge.h @@ -100,6 +100,7 @@ namespace AkVCam void setPicture(const std::string &picture); int logLevel() const; void setLogLevel(int logLevel); + std::string logPath(const std::string &logName={}) const; // Register the peer to the global server. bool registerPeer(); diff --git a/cmio/VCamIPC/src/ipcbridge.mm b/cmio/VCamIPC/src/ipcbridge.mm index 88d474c..fbf7c43 100644 --- a/cmio/VCamIPC/src/ipcbridge.mm +++ b/cmio/VCamIPC/src/ipcbridge.mm @@ -182,6 +182,15 @@ void AkVCam::IpcBridge::setLogLevel(int logLevel) Logger::setLogLevel(logLevel); } +std::string AkVCam::IpcBridge::logPath(const std::string &logName) const +{ + if (logName.empty()) + return {}; + + return AkVCam::Preferences::readString("logfile", + "/tmp/" + logName + ".log"); +} + bool AkVCam::IpcBridge::registerPeer() { AkLogFunction(); diff --git a/dshow/PlatformUtils/src/preferences.cpp b/dshow/PlatformUtils/src/preferences.cpp index ad7584a..4c53953 100644 --- a/dshow/PlatformUtils/src/preferences.cpp +++ b/dshow/PlatformUtils/src/preferences.cpp @@ -308,10 +308,8 @@ bool AkVCam::Preferences::removeCamera(const std::string &path) if (cameraIndex < 0) return false; - bool ok = true; - ok &= cameraSetFormats(size_t(cameraIndex), {}); - auto nCameras = camerasCount(); + bool ok = true; ok &= deleteKey("Cameras\\" + std::to_string(cameraIndex + 1) + '\\', true); for (auto i = size_t(cameraIndex + 1); i < nCameras; i++) @@ -319,6 +317,8 @@ bool AkVCam::Preferences::removeCamera(const std::string &path) "Cameras\\" + std::to_string(i), true); + ok &= deleteKey("Cameras\\" + std::to_string(nCameras) + '\\', true); + if (nCameras > 1) ok &= write("Cameras\\size", int(nCameras - 1), true); else diff --git a/dshow/PlatformUtils/src/utils.cpp b/dshow/PlatformUtils/src/utils.cpp index 96043f9..31c9cc9 100644 --- a/dshow/PlatformUtils/src/utils.cpp +++ b/dshow/PlatformUtils/src/utils.cpp @@ -975,7 +975,7 @@ LSTATUS AkVCam::copyTree(HKEY src, LPCSTR subkey, HKEY dst, REGSAM samFlags) DWORD nameLen = len; DWORD dataType = 0; BYTE *data = new BYTE[maxValueLen]; - DWORD dataSize = 0; + DWORD dataSize = maxValueLen; result = RegEnumValue(hkeyFrom, i, name, diff --git a/dshow/VCamIPC/src/ipcbridge.cpp b/dshow/VCamIPC/src/ipcbridge.cpp index 9812251..1f0a410 100644 --- a/dshow/VCamIPC/src/ipcbridge.cpp +++ b/dshow/VCamIPC/src/ipcbridge.cpp @@ -194,6 +194,16 @@ void AkVCam::IpcBridge::setLogLevel(int logLevel) Logger::setLogLevel(logLevel); } +std::string AkVCam::IpcBridge::logPath(const std::string &logName) const +{ + if (logName.empty()) + return {}; + + auto defaultLogFile = AkVCam::tempPath() + "\\" + logName + ".log"; + + return AkVCam::Preferences::readString("logfile", defaultLogFile); +} + bool AkVCam::IpcBridge::registerPeer() { AkLogFunction();