Improved log system.
This commit is contained in:
parent
a1d4747900
commit
fd0c716c50
59 changed files with 1620 additions and 1447 deletions
|
@ -28,7 +28,6 @@ exists(commons.pri) {
|
||||||
|
|
||||||
win32: include(../dshow/dshow.pri)
|
win32: include(../dshow/dshow.pri)
|
||||||
macx: include(../cmio/cmio.pri)
|
macx: include(../cmio/cmio.pri)
|
||||||
include(../VCamUtils/VCamUtils.pri)
|
|
||||||
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
CONFIG += console link_prl
|
CONFIG += console link_prl
|
||||||
|
|
|
@ -26,8 +26,6 @@ exists(commons.pri) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include(VCamUtils.pri)
|
|
||||||
|
|
||||||
CONFIG += \
|
CONFIG += \
|
||||||
staticlib \
|
staticlib \
|
||||||
create_prl \
|
create_prl \
|
||||||
|
|
|
@ -20,32 +20,45 @@
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <map>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
#include "logger.h"
|
#include "logger.h"
|
||||||
#include "../utils.h"
|
#include "../utils.h"
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class LoggerPrivate: public std::streambuf
|
class LoggerPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::ostream *outs;
|
std::string logFile;
|
||||||
std::string fileName;
|
std::string fileName;
|
||||||
std::fstream logFile;
|
int logLevel {AKVCAM_LOGLEVEL_DEFAULT};
|
||||||
Logger::LogCallback logCallback;
|
std::fstream stream;
|
||||||
|
|
||||||
LoggerPrivate();
|
static std::string logLevelString(int logLevel)
|
||||||
~LoggerPrivate() override;
|
{
|
||||||
|
static std::map<int, std::string> llsMap {
|
||||||
|
{AKVCAM_LOGLEVEL_DEFAULT , "default" },
|
||||||
|
{AKVCAM_LOGLEVEL_EMERGENCY, "emergency"},
|
||||||
|
{AKVCAM_LOGLEVEL_FATAL , "fatal" },
|
||||||
|
{AKVCAM_LOGLEVEL_CRITICAL , "critical" },
|
||||||
|
{AKVCAM_LOGLEVEL_ERROR , "error" },
|
||||||
|
{AKVCAM_LOGLEVEL_WARNING , "warning" },
|
||||||
|
{AKVCAM_LOGLEVEL_NOTICE , "notice" },
|
||||||
|
{AKVCAM_LOGLEVEL_INFO , "info" },
|
||||||
|
{AKVCAM_LOGLEVEL_DEBUG , "debug" },
|
||||||
|
};
|
||||||
|
|
||||||
protected:
|
if (llsMap.count(logLevel) < 1)
|
||||||
std::streamsize xsputn(const char *s, std::streamsize n) override;
|
return {};
|
||||||
|
|
||||||
|
return llsMap[logLevel];
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline LoggerPrivate *loggerPrivate()
|
LoggerPrivate *loggerPrivate()
|
||||||
{
|
{
|
||||||
static LoggerPrivate logger;
|
static LoggerPrivate logger;
|
||||||
|
|
||||||
|
@ -53,91 +66,76 @@ namespace AkVCam
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::Logger::start(const std::string &fileName,
|
std::string AkVCam::Logger::logFile()
|
||||||
const std::string &extension)
|
|
||||||
{
|
{
|
||||||
stop();
|
return loggerPrivate()->logFile;
|
||||||
loggerPrivate()->fileName =
|
|
||||||
fileName + "-" + timeStamp() + "." + extension;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::Logger::start(LogCallback callback)
|
void AkVCam::Logger::setLogFile(const std::string &fileName)
|
||||||
{
|
{
|
||||||
stop();
|
loggerPrivate()->logFile = fileName;
|
||||||
loggerPrivate()->logCallback = callback;
|
auto index = fileName.rfind('.');
|
||||||
|
|
||||||
|
if (index == fileName.npos) {
|
||||||
|
loggerPrivate()->fileName = fileName + "-" + timeStamp();
|
||||||
|
} else {
|
||||||
|
std::string fname = fileName.substr(0, index);
|
||||||
|
std::string extension = fileName.substr(index + 1);
|
||||||
|
loggerPrivate()->fileName = fname + "-" + timeStamp() + "." + extension;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string AkVCam::Logger::header()
|
int AkVCam::Logger::logLevel()
|
||||||
|
{
|
||||||
|
return loggerPrivate()->logLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkVCam::Logger::setLogLevel(int logLevel)
|
||||||
|
{
|
||||||
|
loggerPrivate()->logLevel = logLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AkVCam::Logger::header(int logLevel, const std::string file, int line)
|
||||||
{
|
{
|
||||||
auto now = std::chrono::system_clock::now();
|
auto now = std::chrono::system_clock::now();
|
||||||
auto nowMSecs = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch());
|
auto nowMSecs =
|
||||||
|
std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch());
|
||||||
char timeStamp[256];
|
char timeStamp[256];
|
||||||
auto time = std::chrono::system_clock::to_time_t(now);
|
auto time = std::chrono::system_clock::to_time_t(now);
|
||||||
strftime(timeStamp, 256, "%Y-%m-%d %H:%M:%S", std::localtime(&time));
|
strftime(timeStamp, 256, "%Y-%m-%d %H:%M:%S", std::localtime(&time));
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "["
|
ss << "["
|
||||||
<< timeStamp
|
<< timeStamp
|
||||||
<< "." << nowMSecs.count() % 1000 << ", " << std::this_thread::get_id() << "] ";
|
<< "."
|
||||||
|
<< nowMSecs.count() % 1000
|
||||||
|
<< ", "
|
||||||
|
<< std::this_thread::get_id()
|
||||||
|
<< ", "
|
||||||
|
<< file
|
||||||
|
<< " ("
|
||||||
|
<< line
|
||||||
|
<< ")] "
|
||||||
|
<< LoggerPrivate::logLevelString(logLevel) << ": ";
|
||||||
|
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream &AkVCam::Logger::out()
|
std::ostream &AkVCam::Logger::log(int logLevel)
|
||||||
{
|
{
|
||||||
if (loggerPrivate()->logCallback.second)
|
static std::ostream dummy(nullptr);
|
||||||
return *loggerPrivate()->outs;
|
|
||||||
|
if (logLevel > loggerPrivate()->logLevel)
|
||||||
|
return dummy;
|
||||||
|
|
||||||
if (loggerPrivate()->fileName.empty())
|
if (loggerPrivate()->fileName.empty())
|
||||||
return std::cout;
|
return std::cout;
|
||||||
|
|
||||||
if (!loggerPrivate()->logFile.is_open())
|
if (!loggerPrivate()->stream.is_open())
|
||||||
loggerPrivate()->logFile.open(loggerPrivate()->fileName,
|
loggerPrivate()->stream.open(loggerPrivate()->fileName,
|
||||||
std::ios_base::out
|
std::ios_base::out | std::ios_base::app);
|
||||||
| std::ios_base::app);
|
|
||||||
|
|
||||||
if (!loggerPrivate()->logFile.is_open())
|
if (!loggerPrivate()->stream.is_open())
|
||||||
return std::cout;
|
return std::cout;
|
||||||
|
|
||||||
return loggerPrivate()->logFile;
|
return loggerPrivate()->stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::Logger::log()
|
|
||||||
{
|
|
||||||
tlog(header());
|
|
||||||
}
|
|
||||||
|
|
||||||
void AkVCam::Logger::tlog()
|
|
||||||
{
|
|
||||||
out() << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AkVCam::Logger::stop()
|
|
||||||
{
|
|
||||||
loggerPrivate()->fileName = {};
|
|
||||||
|
|
||||||
if (loggerPrivate()->logFile.is_open())
|
|
||||||
loggerPrivate()->logFile.close();
|
|
||||||
|
|
||||||
loggerPrivate()->logCallback = {nullptr, nullptr};
|
|
||||||
}
|
|
||||||
|
|
||||||
AkVCam::LoggerPrivate::LoggerPrivate():
|
|
||||||
outs(new std::ostream(this)),
|
|
||||||
logCallback({nullptr, nullptr})
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
AkVCam::LoggerPrivate::~LoggerPrivate()
|
|
||||||
{
|
|
||||||
delete this->outs;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::streamsize AkVCam::LoggerPrivate::xsputn(const char *s, std::streamsize n)
|
|
||||||
{
|
|
||||||
if (this->logCallback.second)
|
|
||||||
this->logCallback.second(this->logCallback.first, s, size_t(n));
|
|
||||||
|
|
||||||
return std::streambuf::xsputn(s, n);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
|
@ -24,44 +24,45 @@
|
||||||
|
|
||||||
#include "../utils.h"
|
#include "../utils.h"
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
#define AKVCAM_LOGLEVEL_DEFAULT -1
|
||||||
#define AkLoggerStart(...) AkVCam::Logger::start(__VA_ARGS__)
|
#define AKVCAM_LOGLEVEL_EMERGENCY 0
|
||||||
#define AkLoggerLog(...) AkVCam::Logger::log(__VA_ARGS__)
|
#define AKVCAM_LOGLEVEL_FATAL 1
|
||||||
#define AkLoggerStop() AkVCam::Logger::stop()
|
#define AKVCAM_LOGLEVEL_CRITICAL 2
|
||||||
|
#define AKVCAM_LOGLEVEL_ERROR 3
|
||||||
|
#define AKVCAM_LOGLEVEL_WARNING 4
|
||||||
|
#define AKVCAM_LOGLEVEL_NOTICE 5
|
||||||
|
#define AKVCAM_LOGLEVEL_INFO 6
|
||||||
|
#define AKVCAM_LOGLEVEL_DEBUG 7
|
||||||
|
|
||||||
namespace AkVCam
|
#define AkLog(level) AkVCam::Logger::log(level) << AkVCam::Logger::header(level, __FILE__, __LINE__)
|
||||||
{
|
#define AkLogEmergency() AkLog(AKVCAM_LOGLEVEL_EMERGENCY)
|
||||||
namespace Logger
|
#define AkLogFatal() AkLog(AKVCAM_LOGLEVEL_FATAL)
|
||||||
{
|
#define AkLogCritical() AkLog(AKVCAM_LOGLEVEL_CRITICAL)
|
||||||
AKVCAM_CALLBACK(Log, const char *data, size_t size)
|
#define AkLogError() AkLog(AKVCAM_LOGLEVEL_ERROR)
|
||||||
|
#define AkLogWarning() AkLog(AKVCAM_LOGLEVEL_WARNING)
|
||||||
|
#define AkLogNotice() AkLog(AKVCAM_LOGLEVEL_NOTICE)
|
||||||
|
#define AkLogInfo() AkLog(AKVCAM_LOGLEVEL_INFO)
|
||||||
|
#define AkLogDebug() AkLog(AKVCAM_LOGLEVEL_DEBUG)
|
||||||
|
|
||||||
void start(const std::string &fileName=std::string(),
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
const std::string &extension=std::string());
|
# define AkLogFunction() AkLogDebug() << __PRETTY_FUNCTION__ << std::endl
|
||||||
void start(LogCallback callback);
|
#elif defined(_MSC_VER)
|
||||||
std::string header();
|
# define AkLogFunction() AkLogDebug() << __FUNCSIG__ << std::endl
|
||||||
std::ostream &out();
|
|
||||||
void log();
|
|
||||||
void tlog();
|
|
||||||
void stop();
|
|
||||||
|
|
||||||
template<typename First, typename... Next>
|
|
||||||
void tlog(const First &first, const Next &... next)
|
|
||||||
{
|
|
||||||
out() << first;
|
|
||||||
tlog(next...);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename... Param>
|
|
||||||
void log(const Param &... param)
|
|
||||||
{
|
|
||||||
tlog(header(), " ", param...);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
#define AkLoggerStart(...)
|
# define AkLogFunction() AkLogDebug() << __FUNCTION__ << "()" << std::endl
|
||||||
#define AkLoggerLog(...)
|
|
||||||
#define AkLoggerStop()
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace AkVCam
|
||||||
|
{
|
||||||
|
namespace Logger
|
||||||
|
{
|
||||||
|
std::string logFile();
|
||||||
|
void setLogFile(const std::string &fileName);
|
||||||
|
int logLevel();
|
||||||
|
void setLogLevel(int logLevel);
|
||||||
|
std::string header(int logLevel, const std::string file, int line);
|
||||||
|
std::ostream &log(int logLevel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif // AKVCAMUTILS_LOGGER_H
|
#endif // AKVCAMUTILS_LOGGER_H
|
||||||
|
|
|
@ -16,9 +16,6 @@
|
||||||
#
|
#
|
||||||
# Web-Site: http://webcamoid.github.io/
|
# Web-Site: http://webcamoid.github.io/
|
||||||
|
|
||||||
win32: include(dshow/dshow.pri)
|
|
||||||
macx: include(cmio/cmio.pri)
|
|
||||||
|
|
||||||
TEMPLATE = subdirs
|
TEMPLATE = subdirs
|
||||||
CONFIG += ordered
|
CONFIG += ordered
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,6 @@ exists(commons.pri) {
|
||||||
}
|
}
|
||||||
|
|
||||||
include(../cmio.pri)
|
include(../cmio.pri)
|
||||||
include(../../VCamUtils/VCamUtils.pri)
|
|
||||||
|
|
||||||
CONFIG += console link_prl
|
CONFIG += console link_prl
|
||||||
CONFIG -= app_bundle
|
CONFIG -= app_bundle
|
||||||
|
@ -42,6 +41,7 @@ SOURCES += \
|
||||||
src/assistant.cpp
|
src/assistant.cpp
|
||||||
|
|
||||||
LIBS += \
|
LIBS += \
|
||||||
|
-L$${OUT_PWD}/../PlatformUtils/$${BIN_DIR} -lPlatformUtils \
|
||||||
-L$${OUT_PWD}/../../VCamUtils/$${BIN_DIR} -lVCamUtils \
|
-L$${OUT_PWD}/../../VCamUtils/$${BIN_DIR} -lVCamUtils \
|
||||||
-framework CoreFoundation
|
-framework CoreFoundation
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ HEADERS += \
|
||||||
src/assistant.h
|
src/assistant.h
|
||||||
|
|
||||||
INCLUDEPATH += \
|
INCLUDEPATH += \
|
||||||
|
.. \
|
||||||
../..
|
../..
|
||||||
|
|
||||||
INSTALLPATH = $${CMIO_PLUGIN_NAME}.plugin/Contents/Resources
|
INSTALLPATH = $${CMIO_PLUGIN_NAME}.plugin/Contents/Resources
|
||||||
|
|
|
@ -25,20 +25,16 @@
|
||||||
|
|
||||||
#include "assistant.h"
|
#include "assistant.h"
|
||||||
#include "assistantglobals.h"
|
#include "assistantglobals.h"
|
||||||
|
#include "PlatformUtils/src/preferences.h"
|
||||||
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/image/videoformat.h"
|
#include "VCamUtils/src/image/videoformat.h"
|
||||||
#include "VCamUtils/src/image/videoframe.h"
|
#include "VCamUtils/src/image/videoframe.h"
|
||||||
#include "VCamUtils/src/logger/logger.h"
|
#include "VCamUtils/src/logger/logger.h"
|
||||||
|
|
||||||
#define AkAssistantLogMethod() \
|
|
||||||
AkLoggerLog("Assistant::", __FUNCTION__, "()")
|
|
||||||
|
|
||||||
#define AkAssistantPrivateLogMethod() \
|
|
||||||
AkLoggerLog("ServicePrivate::", __FUNCTION__, "()")
|
|
||||||
|
|
||||||
#define AKVCAM_BIND_FUNC(member) \
|
#define AKVCAM_BIND_FUNC(member) \
|
||||||
std::bind(&member, this, std::placeholders::_1, std::placeholders::_2)
|
std::bind(&member, this, std::placeholders::_1, std::placeholders::_2)
|
||||||
|
|
||||||
#define PREFERENCES_ID CFSTR(AKVCAM_ASSISTANT_NAME)
|
#define PREFERENCES_ID CFSTR(CMIO_ASSISTANT_NAME)
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
|
@ -74,48 +70,6 @@ namespace AkVCam
|
||||||
bool startTimer();
|
bool startTimer();
|
||||||
void stopTimer();
|
void stopTimer();
|
||||||
static void timerTimeout(CFRunLoopTimerRef timer, void *info);
|
static void timerTimeout(CFRunLoopTimerRef timer, void *info);
|
||||||
std::shared_ptr<CFTypeRef> cfTypeFromStd(const std::string &str) const;
|
|
||||||
std::shared_ptr<CFTypeRef> cfTypeFromStd(const std::wstring &str) const;
|
|
||||||
std::shared_ptr<CFTypeRef> cfTypeFromStd(int num) const;
|
|
||||||
std::shared_ptr<CFTypeRef> cfTypeFromStd(double num) const;
|
|
||||||
std::string stringFromCFType(CFTypeRef cfType) const;
|
|
||||||
std::wstring wstringFromCFType(CFTypeRef cfType) const;
|
|
||||||
std::vector<std::string> preferencesKeys() const;
|
|
||||||
void preferencesWrite(const std::string &key,
|
|
||||||
const std::shared_ptr<CFTypeRef> &value) const;
|
|
||||||
void preferencesWrite(const std::string &key,
|
|
||||||
const std::string &value) const;
|
|
||||||
void preferencesWrite(const std::string &key,
|
|
||||||
const std::wstring &value) const;
|
|
||||||
void preferencesWrite(const std::string &key, int value) const;
|
|
||||||
void preferencesWrite(const std::string &key, double value) const;
|
|
||||||
std::shared_ptr<CFTypeRef> preferencesRead(const std::string &key) const;
|
|
||||||
std::string preferencesReadString(const std::string &key) const;
|
|
||||||
std::wstring preferencesReadWString(const std::string &key) const;
|
|
||||||
int preferencesReadInt(const std::string &key) const;
|
|
||||||
double preferencesReadDouble(const std::string &key) const;
|
|
||||||
void preferencesDelete(const std::string &key) const;
|
|
||||||
void preferencesDeleteAll(const std::string &key) const;
|
|
||||||
void preferencesMove(const std::string &keyFrom,
|
|
||||||
const std::string &keyTo) const;
|
|
||||||
void preferencesMoveAll(const std::string &keyFrom,
|
|
||||||
const std::string &keyTo) const;
|
|
||||||
void preferencesSync() const;
|
|
||||||
std::string preferencesAddCamera(const std::wstring &description,
|
|
||||||
const std::vector<VideoFormat> &formats);
|
|
||||||
std::string preferencesAddCamera(const std::string &path,
|
|
||||||
const std::wstring &description,
|
|
||||||
const std::vector<VideoFormat> &formats);
|
|
||||||
void preferencesRemoveCamera(const std::string &path);
|
|
||||||
size_t camerasCount() const;
|
|
||||||
std::string createDevicePath() const;
|
|
||||||
int cameraFromPath(const std::string &path) const;
|
|
||||||
bool cameraExists(const std::string &path) const;
|
|
||||||
std::wstring cameraDescription(size_t cameraIndex) const;
|
|
||||||
std::string cameraPath(size_t cameraIndex) const;
|
|
||||||
size_t formatsCount(size_t cameraIndex) const;
|
|
||||||
VideoFormat cameraFormat(size_t cameraIndex, size_t formatIndex) const;
|
|
||||||
std::vector<VideoFormat> cameraFormats(size_t cameraIndex) const;
|
|
||||||
void loadCameras();
|
void loadCameras();
|
||||||
void releaseDevicesFromPeer(const std::string &portName);
|
void releaseDevicesFromPeer(const std::string &portName);
|
||||||
void peerDied();
|
void peerDied();
|
||||||
|
@ -165,7 +119,7 @@ void AkVCam::Assistant::setTimeout(double timeout)
|
||||||
void AkVCam::Assistant::messageReceived(xpc_connection_t client,
|
void AkVCam::Assistant::messageReceived(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantLogMethod();
|
AkLogFunction();
|
||||||
auto type = xpc_get_type(event);
|
auto type = xpc_get_type(event);
|
||||||
|
|
||||||
if (type == XPC_TYPE_ERROR) {
|
if (type == XPC_TYPE_ERROR) {
|
||||||
|
@ -173,7 +127,7 @@ void AkVCam::Assistant::messageReceived(xpc_connection_t client,
|
||||||
this->d->peerDied();
|
this->d->peerDied();
|
||||||
} else {
|
} else {
|
||||||
auto description = xpc_copy_description(event);
|
auto description = xpc_copy_description(event);
|
||||||
AkLoggerLog("ERROR: ", description);
|
AkLogError() << description << std::endl;
|
||||||
free(description);
|
free(description);
|
||||||
}
|
}
|
||||||
} else if (type == XPC_TYPE_DICTIONARY) {
|
} else if (type == XPC_TYPE_DICTIONARY) {
|
||||||
|
@ -245,7 +199,7 @@ uint64_t AkVCam::AssistantPrivate::id()
|
||||||
|
|
||||||
bool AkVCam::AssistantPrivate::startTimer()
|
bool AkVCam::AssistantPrivate::startTimer()
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->m_timer || this->m_timeout <= 0.0)
|
if (this->m_timer || this->m_timeout <= 0.0)
|
||||||
return false;
|
return false;
|
||||||
|
@ -273,7 +227,7 @@ bool AkVCam::AssistantPrivate::startTimer()
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::stopTimer()
|
void AkVCam::AssistantPrivate::stopTimer()
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->m_timer)
|
if (!this->m_timer)
|
||||||
return;
|
return;
|
||||||
|
@ -290,533 +244,27 @@ void AkVCam::AssistantPrivate::timerTimeout(CFRunLoopTimerRef timer, void *info)
|
||||||
{
|
{
|
||||||
UNUSED(timer)
|
UNUSED(timer)
|
||||||
UNUSED(info)
|
UNUSED(info)
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
CFRunLoopStop(CFRunLoopGetMain());
|
CFRunLoopStop(CFRunLoopGetMain());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<CFTypeRef> AkVCam::AssistantPrivate::cfTypeFromStd(const std::string &str) const
|
|
||||||
{
|
|
||||||
auto ref =
|
|
||||||
new CFTypeRef(CFStringCreateWithCString(kCFAllocatorDefault,
|
|
||||||
str.c_str(),
|
|
||||||
kCFStringEncodingUTF8));
|
|
||||||
|
|
||||||
return std::shared_ptr<CFTypeRef>(ref, [] (CFTypeRef *ptr) {
|
|
||||||
CFRelease(*ptr);
|
|
||||||
delete ptr;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<CFTypeRef> AkVCam::AssistantPrivate::cfTypeFromStd(const std::wstring &str) const
|
|
||||||
{
|
|
||||||
auto ref =
|
|
||||||
new CFTypeRef(CFStringCreateWithBytes(kCFAllocatorDefault,
|
|
||||||
reinterpret_cast<const UInt8 *>(str.c_str()),
|
|
||||||
CFIndex(str.size() * sizeof(wchar_t)),
|
|
||||||
kCFStringEncodingUTF32LE,
|
|
||||||
false));
|
|
||||||
|
|
||||||
return std::shared_ptr<CFTypeRef>(ref, [] (CFTypeRef *ptr) {
|
|
||||||
CFRelease(*ptr);
|
|
||||||
delete ptr;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<CFTypeRef> AkVCam::AssistantPrivate::cfTypeFromStd(int num) const
|
|
||||||
{
|
|
||||||
auto ref =
|
|
||||||
new CFTypeRef(CFNumberCreate(kCFAllocatorDefault,
|
|
||||||
kCFNumberIntType,
|
|
||||||
&num));
|
|
||||||
|
|
||||||
return std::shared_ptr<CFTypeRef>(ref, [] (CFTypeRef *ptr) {
|
|
||||||
CFRelease(*ptr);
|
|
||||||
delete ptr;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<CFTypeRef> AkVCam::AssistantPrivate::cfTypeFromStd(double num) const
|
|
||||||
{
|
|
||||||
auto ref =
|
|
||||||
new CFTypeRef(CFNumberCreate(kCFAllocatorDefault,
|
|
||||||
kCFNumberDoubleType,
|
|
||||||
&num));
|
|
||||||
|
|
||||||
return std::shared_ptr<CFTypeRef>(ref, [] (CFTypeRef *ptr) {
|
|
||||||
CFRelease(*ptr);
|
|
||||||
delete ptr;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string AkVCam::AssistantPrivate::stringFromCFType(CFTypeRef cfType) const
|
|
||||||
{
|
|
||||||
auto len = size_t(CFStringGetLength(CFStringRef(cfType)));
|
|
||||||
auto data = CFStringGetCStringPtr(CFStringRef(cfType), kCFStringEncodingUTF8);
|
|
||||||
|
|
||||||
if (data)
|
|
||||||
return std::string(data, len);
|
|
||||||
|
|
||||||
auto cstr = new char[len];
|
|
||||||
CFStringGetCString(CFStringRef(cfType), cstr, CFIndex(len), kCFStringEncodingUTF8);
|
|
||||||
std::string str(cstr, len);
|
|
||||||
delete [] cstr;
|
|
||||||
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::wstring AkVCam::AssistantPrivate::wstringFromCFType(CFTypeRef cfType) const
|
|
||||||
{
|
|
||||||
auto len = CFStringGetLength(CFStringRef(cfType));
|
|
||||||
auto range = CFRangeMake(0, len);
|
|
||||||
CFIndex bufferLen = 0;
|
|
||||||
auto converted = CFStringGetBytes(CFStringRef(cfType),
|
|
||||||
range,
|
|
||||||
kCFStringEncodingUTF32LE,
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
nullptr,
|
|
||||||
0,
|
|
||||||
&bufferLen);
|
|
||||||
|
|
||||||
if (converted < 1 || bufferLen < 1)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
wchar_t cstr[bufferLen];
|
|
||||||
|
|
||||||
converted = CFStringGetBytes(CFStringRef(cfType),
|
|
||||||
range,
|
|
||||||
kCFStringEncodingUTF32LE,
|
|
||||||
0,
|
|
||||||
false,
|
|
||||||
reinterpret_cast<UInt8 *>(cstr),
|
|
||||||
bufferLen,
|
|
||||||
nullptr);
|
|
||||||
|
|
||||||
if (converted < 1)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
return std::wstring(cstr, size_t(len));
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> AkVCam::AssistantPrivate::preferencesKeys() const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
std::vector<std::string> keys;
|
|
||||||
|
|
||||||
auto cfKeys = CFPreferencesCopyKeyList(PREFERENCES_ID,
|
|
||||||
kCFPreferencesCurrentUser,
|
|
||||||
kCFPreferencesAnyHost);
|
|
||||||
|
|
||||||
if (cfKeys) {
|
|
||||||
auto size = CFArrayGetCount(cfKeys);
|
|
||||||
|
|
||||||
for (CFIndex i = 0; i < size; i++) {
|
|
||||||
auto key = CFStringRef(CFArrayGetValueAtIndex(cfKeys, i));
|
|
||||||
keys.push_back(this->stringFromCFType(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
CFRelease(cfKeys);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
|
||||||
AkLoggerLog("Keys: ", keys.size());
|
|
||||||
std::sort(keys.begin(), keys.end());
|
|
||||||
|
|
||||||
for (auto &key: keys)
|
|
||||||
AkLoggerLog(" ", key);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return keys;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::preferencesWrite(const std::string &key,
|
|
||||||
const std::shared_ptr<CFTypeRef> &value) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
AkLoggerLog("Writing: ", key, " = ", *value);
|
|
||||||
auto cfKey = cfTypeFromStd(key);
|
|
||||||
CFPreferencesSetAppValue(CFStringRef(*cfKey), *value, PREFERENCES_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::preferencesWrite(const std::string &key,
|
|
||||||
const std::string &value) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
AkLoggerLog("Writing: ", key, " = ", value);
|
|
||||||
auto cfKey = cfTypeFromStd(key);
|
|
||||||
auto cfValue = cfTypeFromStd(value);
|
|
||||||
CFPreferencesSetAppValue(CFStringRef(*cfKey), *cfValue, PREFERENCES_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::preferencesWrite(const std::string &key,
|
|
||||||
const std::wstring &value) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
AkLoggerLog("Writing: ", key, " = ", std::string(value.begin(),
|
|
||||||
value.end()));
|
|
||||||
auto cfKey = cfTypeFromStd(key);
|
|
||||||
auto cfValue = cfTypeFromStd(value);
|
|
||||||
CFPreferencesSetAppValue(CFStringRef(*cfKey), *cfValue, PREFERENCES_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::preferencesWrite(const std::string &key,
|
|
||||||
int value) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
AkLoggerLog("Writing: ", key, " = ", value);
|
|
||||||
auto cfKey = cfTypeFromStd(key);
|
|
||||||
auto cfValue = cfTypeFromStd(value);
|
|
||||||
CFPreferencesSetAppValue(CFStringRef(*cfKey), *cfValue, PREFERENCES_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::preferencesWrite(const std::string &key,
|
|
||||||
double value) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
AkLoggerLog("Writing: ", key, " = ", value);
|
|
||||||
auto cfKey = cfTypeFromStd(key);
|
|
||||||
auto cfValue = cfTypeFromStd(value);
|
|
||||||
CFPreferencesSetAppValue(CFStringRef(*cfKey), *cfValue, PREFERENCES_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<CFTypeRef> AkVCam::AssistantPrivate::preferencesRead(const std::string &key) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
auto cfKey = cfTypeFromStd(key);
|
|
||||||
auto cfValue = CFTypeRef(CFPreferencesCopyAppValue(CFStringRef(*cfKey),
|
|
||||||
PREFERENCES_ID));
|
|
||||||
|
|
||||||
if (!cfValue)
|
|
||||||
return {};
|
|
||||||
|
|
||||||
return std::shared_ptr<CFTypeRef>(new CFTypeRef(cfValue),
|
|
||||||
[] (CFTypeRef *ptr) {
|
|
||||||
CFRelease(*ptr);
|
|
||||||
delete ptr;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string AkVCam::AssistantPrivate::preferencesReadString(const std::string &key) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
auto cfKey = cfTypeFromStd(key);
|
|
||||||
auto cfValue =
|
|
||||||
CFStringRef(CFPreferencesCopyAppValue(CFStringRef(*cfKey),
|
|
||||||
PREFERENCES_ID));
|
|
||||||
std::string value;
|
|
||||||
|
|
||||||
if (cfValue) {
|
|
||||||
value = this->stringFromCFType(cfValue);
|
|
||||||
CFRelease(cfValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::wstring AkVCam::AssistantPrivate::preferencesReadWString(const std::string &key) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
auto cfKey = cfTypeFromStd(key);
|
|
||||||
auto cfValue =
|
|
||||||
CFStringRef(CFPreferencesCopyAppValue(CFStringRef(*cfKey),
|
|
||||||
PREFERENCES_ID));
|
|
||||||
std::wstring value;
|
|
||||||
|
|
||||||
if (cfValue) {
|
|
||||||
value = this->wstringFromCFType(cfValue);
|
|
||||||
CFRelease(cfValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AkVCam::AssistantPrivate::preferencesReadInt(const std::string &key) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
auto cfKey = cfTypeFromStd(key);
|
|
||||||
auto cfValue =
|
|
||||||
CFNumberRef(CFPreferencesCopyAppValue(CFStringRef(*cfKey),
|
|
||||||
PREFERENCES_ID));
|
|
||||||
int value = 0;
|
|
||||||
|
|
||||||
if (cfValue) {
|
|
||||||
CFNumberGetValue(cfValue, kCFNumberIntType, &value);
|
|
||||||
CFRelease(cfValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
double AkVCam::AssistantPrivate::preferencesReadDouble(const std::string &key) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
auto cfKey = cfTypeFromStd(key);
|
|
||||||
auto cfValue =
|
|
||||||
CFNumberRef(CFPreferencesCopyAppValue(CFStringRef(*cfKey),
|
|
||||||
PREFERENCES_ID));
|
|
||||||
double value = 0;
|
|
||||||
|
|
||||||
if (cfValue) {
|
|
||||||
CFNumberGetValue(cfValue, kCFNumberDoubleType, &value);
|
|
||||||
CFRelease(cfValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::preferencesDelete(const std::string &key) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
AkLoggerLog("Deleting ", key);
|
|
||||||
auto cfKey = cfTypeFromStd(key);
|
|
||||||
CFPreferencesSetAppValue(CFStringRef(*cfKey), nullptr, PREFERENCES_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::preferencesDeleteAll(const std::string &key) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
AkLoggerLog("Key: ", key);
|
|
||||||
|
|
||||||
for (auto &key_: this->preferencesKeys())
|
|
||||||
if (key_.size() >= key.size() && key_.substr(0, key.size()) == key)
|
|
||||||
this->preferencesDelete(key_);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::preferencesMove(const std::string &keyFrom,
|
|
||||||
const std::string &keyTo) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
AkLoggerLog("From: ", keyFrom);
|
|
||||||
AkLoggerLog("To: ", keyTo);
|
|
||||||
auto value = this->preferencesRead(keyFrom);
|
|
||||||
|
|
||||||
if (!value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
this->preferencesWrite(keyTo, value);
|
|
||||||
this->preferencesDelete(keyFrom);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::preferencesMoveAll(const std::string &keyFrom,
|
|
||||||
const std::string &keyTo) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
AkLoggerLog("From: ", keyFrom);
|
|
||||||
AkLoggerLog("to: ", keyTo);
|
|
||||||
|
|
||||||
for (auto &key: this->preferencesKeys())
|
|
||||||
if (key.size() >= keyFrom.size()
|
|
||||||
&& key.substr(0, keyFrom.size()) == keyFrom) {
|
|
||||||
if (key.size() == keyFrom.size())
|
|
||||||
this->preferencesMove(key, keyTo);
|
|
||||||
else
|
|
||||||
this->preferencesMove(key, keyTo + key.substr(keyFrom.size()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::preferencesSync() const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
CFPreferencesAppSynchronize(PREFERENCES_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string AkVCam::AssistantPrivate::preferencesAddCamera(const std::wstring &description,
|
|
||||||
const std::vector<VideoFormat> &formats)
|
|
||||||
{
|
|
||||||
return this->preferencesAddCamera("", description, formats);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string AkVCam::AssistantPrivate::preferencesAddCamera(const std::string &path,
|
|
||||||
const std::wstring &description,
|
|
||||||
const std::vector<VideoFormat> &formats)
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
|
|
||||||
if (!path.empty() && this->cameraExists(path))
|
|
||||||
return {};
|
|
||||||
|
|
||||||
auto path_ = path.empty()? this->createDevicePath(): path;
|
|
||||||
int cameraIndex = this->preferencesReadInt("cameras");
|
|
||||||
this->preferencesWrite("cameras", cameraIndex + 1);
|
|
||||||
|
|
||||||
this->preferencesWrite("cameras."
|
|
||||||
+ std::to_string(cameraIndex)
|
|
||||||
+ ".description",
|
|
||||||
description);
|
|
||||||
this->preferencesWrite("cameras."
|
|
||||||
+ std::to_string(cameraIndex)
|
|
||||||
+ ".path",
|
|
||||||
path_);
|
|
||||||
this->preferencesWrite("cameras."
|
|
||||||
+ std::to_string(cameraIndex)
|
|
||||||
+ ".formats",
|
|
||||||
int(formats.size()));
|
|
||||||
|
|
||||||
for (size_t i = 0; i < formats.size(); i++) {
|
|
||||||
auto &format = formats[i];
|
|
||||||
auto prefix = "cameras."
|
|
||||||
+ std::to_string(cameraIndex)
|
|
||||||
+ ".formats."
|
|
||||||
+ std::to_string(i);
|
|
||||||
auto formatStr = VideoFormat::stringFromFourcc(format.fourcc());
|
|
||||||
this->preferencesWrite(prefix + ".format", formatStr);
|
|
||||||
this->preferencesWrite(prefix + ".width", format.width());
|
|
||||||
this->preferencesWrite(prefix + ".height", format.height());
|
|
||||||
this->preferencesWrite(prefix + ".fps", format.minimumFrameRate().toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
this->preferencesSync();
|
|
||||||
|
|
||||||
return path_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::preferencesRemoveCamera(const std::string &path)
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
AkLoggerLog("Device: ", path);
|
|
||||||
int cameraIndex = this->cameraFromPath(path);
|
|
||||||
|
|
||||||
if (cameraIndex < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto nCameras = this->camerasCount();
|
|
||||||
this->preferencesDeleteAll("cameras." + std::to_string(cameraIndex));
|
|
||||||
|
|
||||||
for (auto i = size_t(cameraIndex + 1); i < nCameras; i++)
|
|
||||||
this->preferencesMoveAll("cameras." + std::to_string(i),
|
|
||||||
"cameras." + std::to_string(i - 1));
|
|
||||||
|
|
||||||
if (nCameras > 1)
|
|
||||||
this->preferencesWrite("cameras", int(nCameras - 1));
|
|
||||||
else
|
|
||||||
this->preferencesDelete("cameras");
|
|
||||||
|
|
||||||
this->preferencesSync();
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t AkVCam::AssistantPrivate::camerasCount() const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
int nCameras = this->preferencesReadInt("cameras");
|
|
||||||
AkLoggerLog("Cameras: ", nCameras);
|
|
||||||
|
|
||||||
return size_t(nCameras);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string AkVCam::AssistantPrivate::createDevicePath() const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
|
|
||||||
// List device paths in use.
|
|
||||||
std::vector<std::string> cameraPaths;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < this->camerasCount(); i++)
|
|
||||||
cameraPaths.push_back(this->cameraPath(i));
|
|
||||||
|
|
||||||
const int maxId = 64;
|
|
||||||
|
|
||||||
for (int i = 0; i < maxId; i++) {
|
|
||||||
/* There are no rules for device paths in Windows. Just append an
|
|
||||||
* incremental index to a common prefix.
|
|
||||||
*/
|
|
||||||
auto path = CMIO_PLUGIN_DEVICE_PREFIX + std::to_string(i);
|
|
||||||
|
|
||||||
// Check if the path is being used, if not return it.
|
|
||||||
if (std::find(cameraPaths.begin(),
|
|
||||||
cameraPaths.end(),
|
|
||||||
path) == cameraPaths.end())
|
|
||||||
return path;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
int AkVCam::AssistantPrivate::cameraFromPath(const std::string &path) const
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < this->camerasCount(); i++)
|
|
||||||
if (this->cameraPath(i) == path && !this->cameraFormats(i).empty())
|
|
||||||
return int(i);
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AkVCam::AssistantPrivate::cameraExists(const std::string &path) const
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < this->camerasCount(); i++)
|
|
||||||
if (this->cameraPath(i) == path)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::wstring AkVCam::AssistantPrivate::cameraDescription(size_t cameraIndex) const
|
|
||||||
{
|
|
||||||
return this->preferencesReadWString("cameras."
|
|
||||||
+ std::to_string(cameraIndex)
|
|
||||||
+ ".description");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string AkVCam::AssistantPrivate::cameraPath(size_t cameraIndex) const
|
|
||||||
{
|
|
||||||
return this->preferencesReadString("cameras."
|
|
||||||
+ std::to_string(cameraIndex)
|
|
||||||
+ ".path");
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t AkVCam::AssistantPrivate::formatsCount(size_t cameraIndex) const
|
|
||||||
{
|
|
||||||
return size_t(this->preferencesReadInt("cameras."
|
|
||||||
+ std::to_string(cameraIndex)
|
|
||||||
+ ".formats"));
|
|
||||||
}
|
|
||||||
|
|
||||||
AkVCam::VideoFormat AkVCam::AssistantPrivate::cameraFormat(size_t cameraIndex,
|
|
||||||
size_t formatIndex) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
auto prefix = "cameras."
|
|
||||||
+ std::to_string(cameraIndex)
|
|
||||||
+ ".formats."
|
|
||||||
+ std::to_string(formatIndex);
|
|
||||||
auto format = this->preferencesReadString(prefix + ".format");
|
|
||||||
auto fourcc = VideoFormat::fourccFromString(format);
|
|
||||||
int width = this->preferencesReadInt(prefix + ".width");
|
|
||||||
int height = this->preferencesReadInt(prefix + ".height");
|
|
||||||
auto fps = Fraction(this->preferencesReadString(prefix + ".fps"));
|
|
||||||
|
|
||||||
return VideoFormat(fourcc, width, height, {fps});
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<AkVCam::VideoFormat> AkVCam::AssistantPrivate::cameraFormats(size_t cameraIndex) const
|
|
||||||
{
|
|
||||||
AkAssistantPrivateLogMethod();
|
|
||||||
std::vector<AkVCam::VideoFormat> formats;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < this->formatsCount(cameraIndex); i++) {
|
|
||||||
auto videoFormat = this->cameraFormat(cameraIndex, i);
|
|
||||||
|
|
||||||
if (videoFormat)
|
|
||||||
formats.push_back(videoFormat);
|
|
||||||
}
|
|
||||||
|
|
||||||
return formats;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::loadCameras()
|
void AkVCam::AssistantPrivate::loadCameras()
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
for (size_t i = 0; i < this->camerasCount(); i++) {
|
for (size_t i = 0; i < Preferences::camerasCount(); i++) {
|
||||||
this->m_deviceConfigs[this->cameraPath(i)] = {};
|
this->m_deviceConfigs[Preferences::cameraPath(i)] = {};
|
||||||
this->m_deviceConfigs[this->cameraPath(i)].description = this->cameraDescription(i);
|
this->m_deviceConfigs[Preferences::cameraPath(i)].description =
|
||||||
this->m_deviceConfigs[this->cameraPath(i)].formats = this->cameraFormats(i);
|
Preferences::cameraDescription(i);
|
||||||
|
this->m_deviceConfigs[Preferences::cameraPath(i)].formats =
|
||||||
|
Preferences::cameraFormats(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::releaseDevicesFromPeer(const std::string &portName)
|
void AkVCam::AssistantPrivate::releaseDevicesFromPeer(const std::string &portName)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
for (auto &config: this->m_deviceConfigs)
|
for (auto &config: this->m_deviceConfigs)
|
||||||
if (config.second.broadcaster == portName) {
|
if (config.second.broadcaster == portName) {
|
||||||
|
@ -847,7 +295,7 @@ void AkVCam::AssistantPrivate::releaseDevicesFromPeer(const std::string &portNam
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::peerDied()
|
void AkVCam::AssistantPrivate::peerDied()
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
std::vector<AssistantPeers *> allPeers {
|
std::vector<AssistantPeers *> allPeers {
|
||||||
&this->m_clients,
|
&this->m_clients,
|
||||||
|
@ -878,7 +326,7 @@ void AkVCam::AssistantPrivate::peerDied()
|
||||||
void AkVCam::AssistantPrivate::requestPort(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::requestPort(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
bool asClient = xpc_dictionary_get_bool(event, "client");
|
bool asClient = xpc_dictionary_get_bool(event, "client");
|
||||||
std::string portName = asClient?
|
std::string portName = asClient?
|
||||||
|
@ -886,7 +334,7 @@ void AkVCam::AssistantPrivate::requestPort(xpc_connection_t client,
|
||||||
AKVCAM_ASSISTANT_SERVER_NAME;
|
AKVCAM_ASSISTANT_SERVER_NAME;
|
||||||
portName += std::to_string(this->id());
|
portName += std::to_string(this->id());
|
||||||
|
|
||||||
AkLoggerLog("Returning Port: ", portName);
|
AkLogInfo() << "Returning Port: " << portName << std::endl;
|
||||||
|
|
||||||
auto reply = xpc_dictionary_create_reply(event);
|
auto reply = xpc_dictionary_create_reply(event);
|
||||||
xpc_dictionary_set_string(reply, "port", portName.c_str());
|
xpc_dictionary_set_string(reply, "port", portName.c_str());
|
||||||
|
@ -897,7 +345,7 @@ void AkVCam::AssistantPrivate::requestPort(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::addPort(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::addPort(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
std::string portName = xpc_dictionary_get_string(event, "port");
|
std::string portName = xpc_dictionary_get_string(event, "port");
|
||||||
auto endpoint = xpc_dictionary_get_value(event, "connection");
|
auto endpoint = xpc_dictionary_get_value(event, "connection");
|
||||||
|
@ -920,7 +368,7 @@ void AkVCam::AssistantPrivate::addPort(xpc_connection_t client,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
AkLoggerLog("Adding Peer: ", portName);
|
AkLogInfo() << "Adding Peer: " << portName << std::endl;
|
||||||
(*peers)[portName] = connection;
|
(*peers)[portName] = connection;
|
||||||
this->stopTimer();
|
this->stopTimer();
|
||||||
}
|
}
|
||||||
|
@ -933,8 +381,8 @@ void AkVCam::AssistantPrivate::addPort(xpc_connection_t client,
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::removePortByName(const std::string &portName)
|
void AkVCam::AssistantPrivate::removePortByName(const std::string &portName)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("Port: ", portName);
|
AkLogInfo() << "Port: " << portName << std::endl;
|
||||||
|
|
||||||
std::vector<AssistantPeers *> allPeers {
|
std::vector<AssistantPeers *> allPeers {
|
||||||
&this->m_clients,
|
&this->m_clients,
|
||||||
|
@ -969,7 +417,7 @@ void AkVCam::AssistantPrivate::removePort(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
UNUSED(client)
|
UNUSED(client)
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->removePortByName(xpc_dictionary_get_string(event, "port"));
|
this->removePortByName(xpc_dictionary_get_string(event, "port"));
|
||||||
}
|
}
|
||||||
|
@ -977,9 +425,9 @@ void AkVCam::AssistantPrivate::removePort(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::deviceCreate(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::deviceCreate(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string portName = xpc_dictionary_get_string(event, "port");
|
std::string portName = xpc_dictionary_get_string(event, "port");
|
||||||
AkLoggerLog("Port Name: ", portName);
|
AkLogInfo() << "Port Name: " << portName << std::endl;
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
auto data = reinterpret_cast<const wchar_t *>(xpc_dictionary_get_data(event,
|
auto data = reinterpret_cast<const wchar_t *>(xpc_dictionary_get_data(event,
|
||||||
"description",
|
"description",
|
||||||
|
@ -997,7 +445,7 @@ void AkVCam::AssistantPrivate::deviceCreate(xpc_connection_t client,
|
||||||
formats.push_back(VideoFormat {fourcc, width, height, {frameRate}});
|
formats.push_back(VideoFormat {fourcc, width, height, {frameRate}});
|
||||||
}
|
}
|
||||||
|
|
||||||
auto deviceId = this->preferencesAddCamera(description, formats);
|
auto deviceId = Preferences::addCamera(description, formats);
|
||||||
this->m_deviceConfigs[deviceId] = {};
|
this->m_deviceConfigs[deviceId] = {};
|
||||||
this->m_deviceConfigs[deviceId].description = description;
|
this->m_deviceConfigs[deviceId].description = description;
|
||||||
this->m_deviceConfigs[deviceId].formats = formats;
|
this->m_deviceConfigs[deviceId].formats = formats;
|
||||||
|
@ -1009,7 +457,7 @@ void AkVCam::AssistantPrivate::deviceCreate(xpc_connection_t client,
|
||||||
xpc_connection_send_message(client.second, notification);
|
xpc_connection_send_message(client.second, notification);
|
||||||
|
|
||||||
xpc_release(notification);
|
xpc_release(notification);
|
||||||
AkLoggerLog("Device created: ", deviceId);
|
AkLogInfo() << "Device created: " << deviceId << std::endl;
|
||||||
|
|
||||||
auto reply = xpc_dictionary_create_reply(event);
|
auto reply = xpc_dictionary_create_reply(event);
|
||||||
xpc_dictionary_set_string(reply, "device", deviceId.c_str());
|
xpc_dictionary_set_string(reply, "device", deviceId.c_str());
|
||||||
|
@ -1019,7 +467,7 @@ void AkVCam::AssistantPrivate::deviceCreate(xpc_connection_t client,
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::deviceDestroyById(const std::string &deviceId)
|
void AkVCam::AssistantPrivate::deviceDestroyById(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
auto it = this->m_deviceConfigs.find(deviceId);
|
auto it = this->m_deviceConfigs.find(deviceId);
|
||||||
|
|
||||||
if (it != this->m_deviceConfigs.end()) {
|
if (it != this->m_deviceConfigs.end()) {
|
||||||
|
@ -1040,25 +488,25 @@ void AkVCam::AssistantPrivate::deviceDestroy(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
UNUSED(client)
|
UNUSED(client)
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
this->deviceDestroyById(deviceId);
|
this->deviceDestroyById(deviceId);
|
||||||
this->preferencesRemoveCamera(deviceId);
|
Preferences::removeCamera(deviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::setBroadcasting(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::setBroadcasting(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
std::string broadcaster = xpc_dictionary_get_string(event, "broadcaster");
|
std::string broadcaster = xpc_dictionary_get_string(event, "broadcaster");
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
||||||
if (this->m_deviceConfigs.count(deviceId) > 0)
|
if (this->m_deviceConfigs.count(deviceId) > 0)
|
||||||
if (this->m_deviceConfigs[deviceId].broadcaster != broadcaster) {
|
if (this->m_deviceConfigs[deviceId].broadcaster != broadcaster) {
|
||||||
AkLoggerLog("Device: ", deviceId);
|
AkLogInfo() << "Device: " << deviceId << std::endl;
|
||||||
AkLoggerLog("Broadcaster: ", broadcaster);
|
AkLogInfo() << "Broadcaster: " << broadcaster << std::endl;
|
||||||
this->m_deviceConfigs[deviceId].broadcaster = broadcaster;
|
this->m_deviceConfigs[deviceId].broadcaster = broadcaster;
|
||||||
auto notification = xpc_copy(event);
|
auto notification = xpc_copy(event);
|
||||||
|
|
||||||
|
@ -1078,7 +526,7 @@ void AkVCam::AssistantPrivate::setBroadcasting(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::setMirroring(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::setMirroring(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
bool horizontalMirror = xpc_dictionary_get_bool(event, "hmirror");
|
bool horizontalMirror = xpc_dictionary_get_bool(event, "hmirror");
|
||||||
bool verticalMirror = xpc_dictionary_get_bool(event, "vmirror");
|
bool verticalMirror = xpc_dictionary_get_bool(event, "vmirror");
|
||||||
|
@ -1107,7 +555,7 @@ void AkVCam::AssistantPrivate::setMirroring(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::setScaling(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::setScaling(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
auto scaling = Scaling(xpc_dictionary_get_int64(event, "scaling"));
|
auto scaling = Scaling(xpc_dictionary_get_int64(event, "scaling"));
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
@ -1133,7 +581,7 @@ void AkVCam::AssistantPrivate::setScaling(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::setAspectRatio(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::setAspectRatio(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
auto aspectRatio = AspectRatio(xpc_dictionary_get_int64(event, "aspect"));
|
auto aspectRatio = AspectRatio(xpc_dictionary_get_int64(event, "aspect"));
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
@ -1159,7 +607,7 @@ void AkVCam::AssistantPrivate::setAspectRatio(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::setSwapRgb(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::setSwapRgb(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
auto swapRgb = xpc_dictionary_get_bool(event, "swap");
|
auto swapRgb = xpc_dictionary_get_bool(event, "swap");
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
@ -1186,7 +634,7 @@ void AkVCam::AssistantPrivate::frameReady(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
UNUSED(client)
|
UNUSED(client)
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
auto reply = xpc_dictionary_create_reply(event);
|
auto reply = xpc_dictionary_create_reply(event);
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
|
||||||
|
@ -1211,7 +659,7 @@ void AkVCam::AssistantPrivate::frameReady(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::listeners(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::listeners(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
auto listeners = xpc_array_create(nullptr, 0);
|
auto listeners = xpc_array_create(nullptr, 0);
|
||||||
|
|
||||||
|
@ -1221,8 +669,8 @@ void AkVCam::AssistantPrivate::listeners(xpc_connection_t client,
|
||||||
xpc_array_append_value(listeners, listenerObj);
|
xpc_array_append_value(listeners, listenerObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
AkLoggerLog("Device: ", deviceId);
|
AkLogInfo() << "Device: " << deviceId << std::endl;
|
||||||
AkLoggerLog("Listeners: ", xpc_array_get_count(listeners));
|
AkLogInfo() << "Listeners: " << xpc_array_get_count(listeners) << std::endl;
|
||||||
auto reply = xpc_dictionary_create_reply(event);
|
auto reply = xpc_dictionary_create_reply(event);
|
||||||
xpc_dictionary_set_value(reply, "listeners", listeners);
|
xpc_dictionary_set_value(reply, "listeners", listeners);
|
||||||
xpc_connection_send_message(client, reply);
|
xpc_connection_send_message(client, reply);
|
||||||
|
@ -1232,7 +680,7 @@ void AkVCam::AssistantPrivate::listeners(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::listener(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::listener(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
auto index = xpc_dictionary_get_uint64(event, "index");
|
auto index = xpc_dictionary_get_uint64(event, "index");
|
||||||
std::string listener;
|
std::string listener;
|
||||||
|
@ -1244,8 +692,8 @@ void AkVCam::AssistantPrivate::listener(xpc_connection_t client,
|
||||||
ok = true;
|
ok = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AkLoggerLog("Device: ", deviceId);
|
AkLogInfo() << "Device: " << deviceId << std::endl;
|
||||||
AkLoggerLog("Listener: ", listener);
|
AkLogInfo() << "Listener: " << listener << std::endl;
|
||||||
auto reply = xpc_dictionary_create_reply(event);
|
auto reply = xpc_dictionary_create_reply(event);
|
||||||
xpc_dictionary_set_string(reply, "listener", listener.c_str());
|
xpc_dictionary_set_string(reply, "listener", listener.c_str());
|
||||||
xpc_dictionary_set_bool(reply, "status", ok);
|
xpc_dictionary_set_bool(reply, "status", ok);
|
||||||
|
@ -1256,7 +704,7 @@ void AkVCam::AssistantPrivate::listener(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::devices(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::devices(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
auto devices = xpc_array_create(nullptr, 0);
|
auto devices = xpc_array_create(nullptr, 0);
|
||||||
|
|
||||||
for (auto &device: this->m_deviceConfigs) {
|
for (auto &device: this->m_deviceConfigs) {
|
||||||
|
@ -1273,15 +721,18 @@ void AkVCam::AssistantPrivate::devices(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::description(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::description(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
std::wstring description;
|
std::wstring description;
|
||||||
|
|
||||||
if (this->m_deviceConfigs.count(deviceId) > 0)
|
if (this->m_deviceConfigs.count(deviceId) > 0)
|
||||||
description = this->m_deviceConfigs[deviceId].description;
|
description = this->m_deviceConfigs[deviceId].description;
|
||||||
|
|
||||||
AkLoggerLog("Description for device ", deviceId, ": ",
|
AkLogInfo() << "Description for device "
|
||||||
std::string(description.begin(), description.end()));
|
<< deviceId
|
||||||
|
<< ": "
|
||||||
|
<< std::string(description.begin(), description.end())
|
||||||
|
<< std::endl;
|
||||||
auto reply = xpc_dictionary_create_reply(event);
|
auto reply = xpc_dictionary_create_reply(event);
|
||||||
xpc_dictionary_set_data(reply,
|
xpc_dictionary_set_data(reply,
|
||||||
"description",
|
"description",
|
||||||
|
@ -1294,7 +745,7 @@ void AkVCam::AssistantPrivate::description(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::formats(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::formats(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
auto formats = xpc_array_create(nullptr, 0);
|
auto formats = xpc_array_create(nullptr, 0);
|
||||||
|
|
||||||
|
@ -1317,15 +768,15 @@ void AkVCam::AssistantPrivate::formats(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::broadcasting(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::broadcasting(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
std::string broadcaster;
|
std::string broadcaster;
|
||||||
|
|
||||||
if (this->m_deviceConfigs.count(deviceId) > 0)
|
if (this->m_deviceConfigs.count(deviceId) > 0)
|
||||||
broadcaster = this->m_deviceConfigs[deviceId].broadcaster;
|
broadcaster = this->m_deviceConfigs[deviceId].broadcaster;
|
||||||
|
|
||||||
AkLoggerLog("Device: ", deviceId);
|
AkLogInfo() << "Device: " << deviceId << std::endl;
|
||||||
AkLoggerLog("Broadcaster: ", broadcaster);
|
AkLogInfo() << "Broadcaster: " << broadcaster << std::endl;
|
||||||
auto reply = xpc_dictionary_create_reply(event);
|
auto reply = xpc_dictionary_create_reply(event);
|
||||||
xpc_dictionary_set_string(reply, "broadcaster", broadcaster.c_str());
|
xpc_dictionary_set_string(reply, "broadcaster", broadcaster.c_str());
|
||||||
xpc_connection_send_message(client, reply);
|
xpc_connection_send_message(client, reply);
|
||||||
|
@ -1335,7 +786,7 @@ void AkVCam::AssistantPrivate::broadcasting(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::mirroring(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::mirroring(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
bool horizontalMirror = false;
|
bool horizontalMirror = false;
|
||||||
bool verticalMirror = false;
|
bool verticalMirror = false;
|
||||||
|
@ -1345,9 +796,9 @@ void AkVCam::AssistantPrivate::mirroring(xpc_connection_t client,
|
||||||
verticalMirror = this->m_deviceConfigs[deviceId].verticalMirror;
|
verticalMirror = this->m_deviceConfigs[deviceId].verticalMirror;
|
||||||
}
|
}
|
||||||
|
|
||||||
AkLoggerLog("Device: ", deviceId);
|
AkLogInfo() << "Device: " << deviceId << std::endl;
|
||||||
AkLoggerLog("Horizontal mirror: ", horizontalMirror);
|
AkLogInfo() << "Horizontal mirror: " << horizontalMirror << std::endl;
|
||||||
AkLoggerLog("Vertical mirror: ", verticalMirror);
|
AkLogInfo() << "Vertical mirror: " << verticalMirror << std::endl;
|
||||||
auto reply = xpc_dictionary_create_reply(event);
|
auto reply = xpc_dictionary_create_reply(event);
|
||||||
xpc_dictionary_set_bool(reply, "hmirror", horizontalMirror);
|
xpc_dictionary_set_bool(reply, "hmirror", horizontalMirror);
|
||||||
xpc_dictionary_set_bool(reply, "vmirror", verticalMirror);
|
xpc_dictionary_set_bool(reply, "vmirror", verticalMirror);
|
||||||
|
@ -1357,15 +808,15 @@ void AkVCam::AssistantPrivate::mirroring(xpc_connection_t client,
|
||||||
|
|
||||||
void AkVCam::AssistantPrivate::scaling(xpc_connection_t client, xpc_object_t event)
|
void AkVCam::AssistantPrivate::scaling(xpc_connection_t client, xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
Scaling scaling = ScalingFast;
|
Scaling scaling = ScalingFast;
|
||||||
|
|
||||||
if (this->m_deviceConfigs.count(deviceId) > 0)
|
if (this->m_deviceConfigs.count(deviceId) > 0)
|
||||||
scaling = this->m_deviceConfigs[deviceId].scaling;
|
scaling = this->m_deviceConfigs[deviceId].scaling;
|
||||||
|
|
||||||
AkLoggerLog("Device: ", deviceId);
|
AkLogInfo() << "Device: " << deviceId << std::endl;
|
||||||
AkLoggerLog("Scaling: ", scaling);
|
AkLogInfo() << "Scaling: " << scaling << std::endl;
|
||||||
auto reply = xpc_dictionary_create_reply(event);
|
auto reply = xpc_dictionary_create_reply(event);
|
||||||
xpc_dictionary_set_int64(reply, "scaling", scaling);
|
xpc_dictionary_set_int64(reply, "scaling", scaling);
|
||||||
xpc_connection_send_message(client, reply);
|
xpc_connection_send_message(client, reply);
|
||||||
|
@ -1375,15 +826,15 @@ void AkVCam::AssistantPrivate::scaling(xpc_connection_t client, xpc_object_t eve
|
||||||
void AkVCam::AssistantPrivate::aspectRatio(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::aspectRatio(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
AspectRatio aspectRatio = AspectRatioIgnore;
|
AspectRatio aspectRatio = AspectRatioIgnore;
|
||||||
|
|
||||||
if (this->m_deviceConfigs.count(deviceId) > 0)
|
if (this->m_deviceConfigs.count(deviceId) > 0)
|
||||||
aspectRatio = this->m_deviceConfigs[deviceId].aspectRatio;
|
aspectRatio = this->m_deviceConfigs[deviceId].aspectRatio;
|
||||||
|
|
||||||
AkLoggerLog("Device: ", deviceId);
|
AkLogInfo() << "Device: " << deviceId << std::endl;
|
||||||
AkLoggerLog("Aspect ratio: ", aspectRatio);
|
AkLogInfo() << "Aspect ratio: " << aspectRatio << std::endl;
|
||||||
auto reply = xpc_dictionary_create_reply(event);
|
auto reply = xpc_dictionary_create_reply(event);
|
||||||
xpc_dictionary_set_int64(reply, "aspect", aspectRatio);
|
xpc_dictionary_set_int64(reply, "aspect", aspectRatio);
|
||||||
xpc_connection_send_message(client, reply);
|
xpc_connection_send_message(client, reply);
|
||||||
|
@ -1393,15 +844,15 @@ void AkVCam::AssistantPrivate::aspectRatio(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::swapRgb(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::swapRgb(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
bool swapRgb = false;
|
bool swapRgb = false;
|
||||||
|
|
||||||
if (this->m_deviceConfigs.count(deviceId) > 0)
|
if (this->m_deviceConfigs.count(deviceId) > 0)
|
||||||
swapRgb = this->m_deviceConfigs[deviceId].swapRgb;
|
swapRgb = this->m_deviceConfigs[deviceId].swapRgb;
|
||||||
|
|
||||||
AkLoggerLog("Device: ", deviceId);
|
AkLogInfo() << "Device: " << deviceId << std::endl;
|
||||||
AkLoggerLog("Swap RGB: ", swapRgb);
|
AkLogInfo() << "Swap RGB: " << swapRgb << std::endl;
|
||||||
auto reply = xpc_dictionary_create_reply(event);
|
auto reply = xpc_dictionary_create_reply(event);
|
||||||
xpc_dictionary_set_bool(reply, "swap", swapRgb);
|
xpc_dictionary_set_bool(reply, "swap", swapRgb);
|
||||||
xpc_connection_send_message(client, reply);
|
xpc_connection_send_message(client, reply);
|
||||||
|
@ -1411,7 +862,7 @@ void AkVCam::AssistantPrivate::swapRgb(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::listenerAdd(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::listenerAdd(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
std::string listener = xpc_dictionary_get_string(event, "listener");
|
std::string listener = xpc_dictionary_get_string(event, "listener");
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
@ -1441,7 +892,7 @@ void AkVCam::AssistantPrivate::listenerAdd(xpc_connection_t client,
|
||||||
void AkVCam::AssistantPrivate::listenerRemove(xpc_connection_t client,
|
void AkVCam::AssistantPrivate::listenerRemove(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkAssistantPrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
std::string listener = xpc_dictionary_get_string(event, "listener");
|
std::string listener = xpc_dictionary_get_string(event, "listener");
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <xpc/xpc.h>
|
#include <xpc/xpc.h>
|
||||||
|
|
||||||
#define AKVCAM_ASSISTANT_NAME "org.webcamoid.cmio.AkVCam.Assistant"
|
|
||||||
#define AKVCAM_ASSISTANT_CLIENT_NAME "org.webcamoid.cmio.AkVCam.Client"
|
#define AKVCAM_ASSISTANT_CLIENT_NAME "org.webcamoid.cmio.AkVCam.Client"
|
||||||
#define AKVCAM_ASSISTANT_SERVER_NAME "org.webcamoid.cmio.AkVCam.Server"
|
#define AKVCAM_ASSISTANT_SERVER_NAME "org.webcamoid.cmio.AkVCam.Server"
|
||||||
|
|
||||||
|
|
|
@ -23,14 +23,18 @@
|
||||||
|
|
||||||
#include "assistant.h"
|
#include "assistant.h"
|
||||||
#include "assistantglobals.h"
|
#include "assistantglobals.h"
|
||||||
|
#include "PlatformUtils/src/preferences.h"
|
||||||
#include "VCamUtils/src/logger/logger.h"
|
#include "VCamUtils/src/logger/logger.h"
|
||||||
|
|
||||||
GLOBAL_STATIC(AkVCam::Assistant, assistant)
|
GLOBAL_STATIC(AkVCam::Assistant, assistant)
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
auto loglevel =
|
||||||
|
AkVCam::Preferences::readInt("loglevel", AKVCAM_LOGLEVEL_DEFAULT);
|
||||||
|
AkVCam::Logger::setLogLevel(loglevel);
|
||||||
auto server =
|
auto server =
|
||||||
xpc_connection_create_mach_service(AKVCAM_ASSISTANT_NAME,
|
xpc_connection_create_mach_service(CMIO_ASSISTANT_NAME,
|
||||||
NULL,
|
NULL,
|
||||||
XPC_CONNECTION_MACH_SERVICE_LISTENER);
|
XPC_CONNECTION_MACH_SERVICE_LISTENER);
|
||||||
|
|
||||||
|
@ -40,7 +44,7 @@ int main(int argc, char **argv)
|
||||||
for (int i = 0; i < argc; i++)
|
for (int i = 0; i < argc; i++)
|
||||||
if (strcmp(argv[i], "--timeout") == 0 && i + 1 < argc) {
|
if (strcmp(argv[i], "--timeout") == 0 && i + 1 < argc) {
|
||||||
auto timeout = strtod(argv[i + 1], nullptr);
|
auto timeout = strtod(argv[i + 1], nullptr);
|
||||||
AkLoggerLog("Set timeout: ", timeout);
|
AkLogInfo() << "Set timeout: " << timeout << std::endl;
|
||||||
assistant()->setTimeout(timeout);
|
assistant()->setTimeout(timeout);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -51,7 +55,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
if (type == XPC_TYPE_ERROR) {
|
if (type == XPC_TYPE_ERROR) {
|
||||||
auto description = xpc_copy_description(event);
|
auto description = xpc_copy_description(event);
|
||||||
AkLoggerLog("ERROR: ", description);
|
AkLogError() << description << std::endl;
|
||||||
free(description);
|
free(description);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -16,9 +16,40 @@
|
||||||
#
|
#
|
||||||
# Web-Site: http://webcamoid.github.io/
|
# Web-Site: http://webcamoid.github.io/
|
||||||
|
|
||||||
DEFINES += \
|
exists(commons.pri) {
|
||||||
QT_NAMESPACE=AkVCam
|
include(commons.pri)
|
||||||
|
} else {
|
||||||
CONFIG(debug, debug|release) {
|
exists(../../commons.pri) {
|
||||||
DEFINES += QT_DEBUG
|
include(../../commons.pri)
|
||||||
|
} else {
|
||||||
|
error("commons.pri file not found.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
include(../cmio.pri)
|
||||||
|
|
||||||
|
CONFIG += \
|
||||||
|
staticlib \
|
||||||
|
create_prl \
|
||||||
|
no_install_prl
|
||||||
|
CONFIG -= qt
|
||||||
|
|
||||||
|
DESTDIR = $${OUT_PWD}/$${BIN_DIR}
|
||||||
|
|
||||||
|
TARGET = PlatformUtils
|
||||||
|
|
||||||
|
TEMPLATE = lib
|
||||||
|
|
||||||
|
LIBS = \
|
||||||
|
-L$${OUT_PWD}/../../VCamUtils/$${BIN_DIR} -lVCamUtils \
|
||||||
|
-framework CoreFoundation
|
||||||
|
|
||||||
|
SOURCES = \
|
||||||
|
src/preferences.cpp \
|
||||||
|
src/utils.cpp
|
||||||
|
|
||||||
|
HEADERS = \
|
||||||
|
src/preferences.h \
|
||||||
|
src/utils.h
|
||||||
|
|
||||||
|
INCLUDEPATH += ../..
|
430
cmio/PlatformUtils/src/preferences.cpp
Normal file
430
cmio/PlatformUtils/src/preferences.cpp
Normal file
|
@ -0,0 +1,430 @@
|
||||||
|
/* akvirtualcamera, virtual camera for Mac and Windows.
|
||||||
|
* Copyright (C) 2020 Gonzalo Exequiel Pedone
|
||||||
|
*
|
||||||
|
* akvirtualcamera is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* akvirtualcamera is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with akvirtualcamera. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Web-Site: http://webcamoid.github.io/
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "preferences.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "VCamUtils/src/image/videoformat.h"
|
||||||
|
#include "VCamUtils/src/logger/logger.h"
|
||||||
|
|
||||||
|
#define PREFERENCES_ID CFSTR(CMIO_ASSISTANT_NAME)
|
||||||
|
|
||||||
|
std::vector<std::string> AkVCam::Preferences::keys()
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
std::vector<std::string> keys;
|
||||||
|
|
||||||
|
auto cfKeys = CFPreferencesCopyKeyList(PREFERENCES_ID,
|
||||||
|
kCFPreferencesCurrentUser,
|
||||||
|
kCFPreferencesAnyHost);
|
||||||
|
|
||||||
|
if (cfKeys) {
|
||||||
|
auto size = CFArrayGetCount(cfKeys);
|
||||||
|
|
||||||
|
for (CFIndex i = 0; i < size; i++) {
|
||||||
|
auto key = CFStringRef(CFArrayGetValueAtIndex(cfKeys, i));
|
||||||
|
keys.push_back(stringFromCFType(key));
|
||||||
|
}
|
||||||
|
|
||||||
|
CFRelease(cfKeys);
|
||||||
|
}
|
||||||
|
|
||||||
|
AkLogInfo() << "Keys: " << keys.size() << std::endl;
|
||||||
|
std::sort(keys.begin(), keys.end());
|
||||||
|
|
||||||
|
for (auto &key: keys)
|
||||||
|
AkLogInfo() << " " << key << std::endl;
|
||||||
|
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkVCam::Preferences::write(const std::string &key,
|
||||||
|
const std::shared_ptr<CFTypeRef> &value)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "Writing: " << key << " = " << *value << std::endl;
|
||||||
|
auto cfKey = cfTypeFromStd(key);
|
||||||
|
CFPreferencesSetAppValue(CFStringRef(*cfKey), *value, PREFERENCES_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkVCam::Preferences::write(const std::string &key,
|
||||||
|
const std::string &value)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "Writing: " << key << " = " << value << std::endl;
|
||||||
|
auto cfKey = cfTypeFromStd(key);
|
||||||
|
auto cfValue = cfTypeFromStd(value);
|
||||||
|
CFPreferencesSetAppValue(CFStringRef(*cfKey), *cfValue, PREFERENCES_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkVCam::Preferences::write(const std::string &key,
|
||||||
|
const std::wstring &value)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "Writing: "
|
||||||
|
<< key
|
||||||
|
<< " = "
|
||||||
|
<< std::string(value.begin(), value.end()) << std::endl;
|
||||||
|
auto cfKey = cfTypeFromStd(key);
|
||||||
|
auto cfValue = cfTypeFromStd(value);
|
||||||
|
CFPreferencesSetAppValue(CFStringRef(*cfKey), *cfValue, PREFERENCES_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkVCam::Preferences::write(const std::string &key, int value)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "Writing: " << key << " = " << value << std::endl;
|
||||||
|
auto cfKey = cfTypeFromStd(key);
|
||||||
|
auto cfValue = cfTypeFromStd(value);
|
||||||
|
CFPreferencesSetAppValue(CFStringRef(*cfKey), *cfValue, PREFERENCES_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkVCam::Preferences::write(const std::string &key, double value)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "Writing: " << key << " = " << value << std::endl;
|
||||||
|
auto cfKey = cfTypeFromStd(key);
|
||||||
|
auto cfValue = cfTypeFromStd(value);
|
||||||
|
CFPreferencesSetAppValue(CFStringRef(*cfKey), *cfValue, PREFERENCES_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<CFTypeRef> AkVCam::Preferences::read(const std::string &key)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
auto cfKey = cfTypeFromStd(key);
|
||||||
|
auto cfValue = CFTypeRef(CFPreferencesCopyAppValue(CFStringRef(*cfKey),
|
||||||
|
PREFERENCES_ID));
|
||||||
|
|
||||||
|
if (!cfValue)
|
||||||
|
return {};
|
||||||
|
|
||||||
|
return std::shared_ptr<CFTypeRef>(new CFTypeRef(cfValue),
|
||||||
|
[] (CFTypeRef *ptr) {
|
||||||
|
CFRelease(*ptr);
|
||||||
|
delete ptr;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AkVCam::Preferences::readString(const std::string &key,
|
||||||
|
const std::string &defaultValue)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
auto cfKey = cfTypeFromStd(key);
|
||||||
|
auto cfValue =
|
||||||
|
CFStringRef(CFPreferencesCopyAppValue(CFStringRef(*cfKey),
|
||||||
|
PREFERENCES_ID));
|
||||||
|
auto value = defaultValue;
|
||||||
|
|
||||||
|
if (cfValue) {
|
||||||
|
value = stringFromCFType(cfValue);
|
||||||
|
CFRelease(cfValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring AkVCam::Preferences::readWString(const std::string &key,
|
||||||
|
const std::wstring &defaultValue)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
auto cfKey = cfTypeFromStd(key);
|
||||||
|
auto cfValue =
|
||||||
|
CFStringRef(CFPreferencesCopyAppValue(CFStringRef(*cfKey),
|
||||||
|
PREFERENCES_ID));
|
||||||
|
auto value = defaultValue;
|
||||||
|
|
||||||
|
if (cfValue) {
|
||||||
|
value = wstringFromCFType(cfValue);
|
||||||
|
CFRelease(cfValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
int AkVCam::Preferences::readInt(const std::string &key, int defaultValue)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
auto cfKey = cfTypeFromStd(key);
|
||||||
|
auto cfValue =
|
||||||
|
CFNumberRef(CFPreferencesCopyAppValue(CFStringRef(*cfKey),
|
||||||
|
PREFERENCES_ID));
|
||||||
|
auto value = defaultValue;
|
||||||
|
|
||||||
|
if (cfValue) {
|
||||||
|
CFNumberGetValue(cfValue, kCFNumberIntType, &value);
|
||||||
|
CFRelease(cfValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
double AkVCam::Preferences::readDouble(const std::string &key,
|
||||||
|
double defaultValue)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
auto cfKey = cfTypeFromStd(key);
|
||||||
|
auto cfValue =
|
||||||
|
CFNumberRef(CFPreferencesCopyAppValue(CFStringRef(*cfKey),
|
||||||
|
PREFERENCES_ID));
|
||||||
|
auto value = defaultValue;
|
||||||
|
|
||||||
|
if (cfValue) {
|
||||||
|
CFNumberGetValue(cfValue, kCFNumberDoubleType, &value);
|
||||||
|
CFRelease(cfValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkVCam::Preferences::deleteKey(const std::string &key)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "Deleting " << key << std::endl;
|
||||||
|
auto cfKey = cfTypeFromStd(key);
|
||||||
|
CFPreferencesSetAppValue(CFStringRef(*cfKey), nullptr, PREFERENCES_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkVCam::Preferences::deleteAllKeys(const std::string &key)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "Key: " << key << std::endl;
|
||||||
|
|
||||||
|
for (auto &key_: keys())
|
||||||
|
if (key_.size() >= key.size() && key_.substr(0, key.size()) == key)
|
||||||
|
deleteKey(key_);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkVCam::Preferences::move(const std::string &keyFrom,
|
||||||
|
const std::string &keyTo)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "From: " << keyFrom << std::endl;
|
||||||
|
AkLogInfo() << "To: " << keyTo << std::endl;
|
||||||
|
auto value = read(keyFrom);
|
||||||
|
|
||||||
|
if (!value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
write(keyTo, value);
|
||||||
|
deleteKey(keyFrom);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkVCam::Preferences::moveAll(const std::string &keyFrom,
|
||||||
|
const std::string &keyTo)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "From: " << keyFrom << std::endl;
|
||||||
|
AkLogInfo() << "To: " << keyTo << std::endl;
|
||||||
|
|
||||||
|
for (auto &key: keys())
|
||||||
|
if (key.size() >= keyFrom.size()
|
||||||
|
&& key.substr(0, keyFrom.size()) == keyFrom) {
|
||||||
|
if (key.size() == keyFrom.size())
|
||||||
|
move(key, keyTo);
|
||||||
|
else
|
||||||
|
move(key, keyTo + key.substr(keyFrom.size()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkVCam::Preferences::sync()
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
CFPreferencesAppSynchronize(PREFERENCES_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AkVCam::Preferences::addCamera(const std::wstring &description,
|
||||||
|
const std::vector<VideoFormat> &formats)
|
||||||
|
{
|
||||||
|
return addCamera("", description, formats);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AkVCam::Preferences::addCamera(const std::string &path,
|
||||||
|
const std::wstring &description,
|
||||||
|
const std::vector<VideoFormat> &formats)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
|
||||||
|
if (!path.empty() && cameraExists(path))
|
||||||
|
return {};
|
||||||
|
|
||||||
|
auto path_ = path.empty()? createDevicePath(): path;
|
||||||
|
int cameraIndex = readInt("cameras");
|
||||||
|
write("cameras", cameraIndex + 1);
|
||||||
|
|
||||||
|
write("cameras."
|
||||||
|
+ std::to_string(cameraIndex)
|
||||||
|
+ ".description",
|
||||||
|
description);
|
||||||
|
write("cameras."
|
||||||
|
+ std::to_string(cameraIndex)
|
||||||
|
+ ".path",
|
||||||
|
path_);
|
||||||
|
write("cameras."
|
||||||
|
+ std::to_string(cameraIndex)
|
||||||
|
+ ".formats",
|
||||||
|
int(formats.size()));
|
||||||
|
|
||||||
|
for (size_t i = 0; i < formats.size(); i++) {
|
||||||
|
auto &format = formats[i];
|
||||||
|
auto prefix = "cameras."
|
||||||
|
+ std::to_string(cameraIndex)
|
||||||
|
+ ".formats."
|
||||||
|
+ std::to_string(i);
|
||||||
|
auto formatStr = VideoFormat::stringFromFourcc(format.fourcc());
|
||||||
|
write(prefix + ".format", formatStr);
|
||||||
|
write(prefix + ".width", format.width());
|
||||||
|
write(prefix + ".height", format.height());
|
||||||
|
write(prefix + ".fps", format.minimumFrameRate().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
sync();
|
||||||
|
|
||||||
|
return path_;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AkVCam::Preferences::removeCamera(const std::string &path)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "Device: " << path << std::endl;
|
||||||
|
int cameraIndex = cameraFromPath(path);
|
||||||
|
|
||||||
|
if (cameraIndex < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
auto nCameras = camerasCount();
|
||||||
|
deleteAllKeys("cameras." + std::to_string(cameraIndex));
|
||||||
|
|
||||||
|
for (auto i = size_t(cameraIndex + 1); i < nCameras; i++)
|
||||||
|
moveAll("cameras." + std::to_string(i),
|
||||||
|
"cameras." + std::to_string(i - 1));
|
||||||
|
|
||||||
|
if (nCameras > 1)
|
||||||
|
write("cameras", int(nCameras - 1));
|
||||||
|
else
|
||||||
|
deleteKey("cameras");
|
||||||
|
|
||||||
|
sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t AkVCam::Preferences::camerasCount()
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
int nCameras = readInt("cameras");
|
||||||
|
AkLogInfo() << "Cameras: " << nCameras << std::endl;
|
||||||
|
|
||||||
|
return size_t(nCameras);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AkVCam::Preferences::createDevicePath()
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
|
||||||
|
// List device paths in use.
|
||||||
|
std::vector<std::string> cameraPaths;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < camerasCount(); i++)
|
||||||
|
cameraPaths.push_back(cameraPath(i));
|
||||||
|
|
||||||
|
const int maxId = 64;
|
||||||
|
|
||||||
|
for (int i = 0; i < maxId; i++) {
|
||||||
|
/* There are no rules for device paths in Windows. Just append an
|
||||||
|
* incremental index to a common prefix.
|
||||||
|
*/
|
||||||
|
auto path = CMIO_PLUGIN_DEVICE_PREFIX + std::to_string(i);
|
||||||
|
|
||||||
|
// Check if the path is being used, if not return it.
|
||||||
|
if (std::find(cameraPaths.begin(),
|
||||||
|
cameraPaths.end(),
|
||||||
|
path) == cameraPaths.end())
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
int AkVCam::Preferences::cameraFromPath(const std::string &path)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < camerasCount(); i++)
|
||||||
|
if (cameraPath(i) == path && !cameraFormats(i).empty())
|
||||||
|
return int(i);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AkVCam::Preferences::cameraExists(const std::string &path)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < camerasCount(); i++)
|
||||||
|
if (cameraPath(i) == path)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring AkVCam::Preferences::cameraDescription(size_t cameraIndex)
|
||||||
|
{
|
||||||
|
return readWString("cameras."
|
||||||
|
+ std::to_string(cameraIndex)
|
||||||
|
+ ".description");
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AkVCam::Preferences::cameraPath(size_t cameraIndex)
|
||||||
|
{
|
||||||
|
return readString("cameras."
|
||||||
|
+ std::to_string(cameraIndex)
|
||||||
|
+ ".path");
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t AkVCam::Preferences::formatsCount(size_t cameraIndex)
|
||||||
|
{
|
||||||
|
return size_t(readInt("cameras."
|
||||||
|
+ std::to_string(cameraIndex)
|
||||||
|
+ ".formats"));
|
||||||
|
}
|
||||||
|
|
||||||
|
AkVCam::VideoFormat AkVCam::Preferences::cameraFormat(size_t cameraIndex,
|
||||||
|
size_t formatIndex)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
auto prefix = "cameras."
|
||||||
|
+ std::to_string(cameraIndex)
|
||||||
|
+ ".formats."
|
||||||
|
+ std::to_string(formatIndex);
|
||||||
|
auto format = readString(prefix + ".format");
|
||||||
|
auto fourcc = VideoFormat::fourccFromString(format);
|
||||||
|
int width = readInt(prefix + ".width");
|
||||||
|
int height = readInt(prefix + ".height");
|
||||||
|
auto fps = Fraction(readString(prefix + ".fps"));
|
||||||
|
|
||||||
|
return VideoFormat(fourcc, width, height, {fps});
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<AkVCam::VideoFormat> AkVCam::Preferences::cameraFormats(size_t cameraIndex)
|
||||||
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
std::vector<AkVCam::VideoFormat> formats;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < formatsCount(cameraIndex); i++) {
|
||||||
|
auto videoFormat = cameraFormat(cameraIndex, i);
|
||||||
|
|
||||||
|
if (videoFormat)
|
||||||
|
formats.push_back(videoFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
return formats;
|
||||||
|
}
|
70
cmio/PlatformUtils/src/preferences.h
Normal file
70
cmio/PlatformUtils/src/preferences.h
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
/* akvirtualcamera, virtual camera for Mac and Windows.
|
||||||
|
* Copyright (C) 2020 Gonzalo Exequiel Pedone
|
||||||
|
*
|
||||||
|
* akvirtualcamera is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* akvirtualcamera is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with akvirtualcamera. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Web-Site: http://webcamoid.github.io/
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PREFERENCES_H
|
||||||
|
#define PREFERENCES_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
|
||||||
|
namespace AkVCam
|
||||||
|
{
|
||||||
|
class VideoFormat;
|
||||||
|
|
||||||
|
namespace Preferences
|
||||||
|
{
|
||||||
|
std::vector<std::string> keys();
|
||||||
|
void write(const std::string &key,
|
||||||
|
const std::shared_ptr<CFTypeRef> &value);
|
||||||
|
void write(const std::string &key, const std::string &value);
|
||||||
|
void write(const std::string &key, const std::wstring &value);
|
||||||
|
void write(const std::string &key, int value);
|
||||||
|
void write(const std::string &key, double value);
|
||||||
|
std::shared_ptr<CFTypeRef> read(const std::string &key);
|
||||||
|
std::string readString(const std::string &key,
|
||||||
|
const std::string &defaultValue={});
|
||||||
|
std::wstring readWString(const std::string &key,
|
||||||
|
const std::wstring &defaultValue={});
|
||||||
|
int readInt(const std::string &key, int defaultValue=0);
|
||||||
|
double readDouble(const std::string &key, double defaultValue=0.0);
|
||||||
|
void deleteKey(const std::string &key);
|
||||||
|
void deleteAllKeys(const std::string &key);
|
||||||
|
void move(const std::string &keyFrom, const std::string &keyTo);
|
||||||
|
void moveAll(const std::string &keyFrom, const std::string &keyTo);
|
||||||
|
void sync();
|
||||||
|
std::string addCamera(const std::wstring &description,
|
||||||
|
const std::vector<VideoFormat> &formats);
|
||||||
|
std::string addCamera(const std::string &path,
|
||||||
|
const std::wstring &description,
|
||||||
|
const std::vector<VideoFormat> &formats);
|
||||||
|
void removeCamera(const std::string &path);
|
||||||
|
size_t camerasCount();
|
||||||
|
std::string createDevicePath();
|
||||||
|
int cameraFromPath(const std::string &path);
|
||||||
|
bool cameraExists(const std::string &path);
|
||||||
|
std::wstring cameraDescription(size_t cameraIndex);
|
||||||
|
std::string cameraPath(size_t cameraIndex);
|
||||||
|
size_t formatsCount(size_t cameraIndex);
|
||||||
|
VideoFormat cameraFormat(size_t cameraIndex, size_t formatIndex);
|
||||||
|
std::vector<VideoFormat> cameraFormats(size_t cameraIndex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // PREFERENCES_H
|
128
cmio/PlatformUtils/src/utils.cpp
Normal file
128
cmio/PlatformUtils/src/utils.cpp
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
/* akvirtualcamera, virtual camera for Mac and Windows.
|
||||||
|
* Copyright (C) 2020 Gonzalo Exequiel Pedone
|
||||||
|
*
|
||||||
|
* akvirtualcamera is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* akvirtualcamera is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with akvirtualcamera. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Web-Site: http://webcamoid.github.io/
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "utils.h"
|
||||||
|
|
||||||
|
std::shared_ptr<CFTypeRef> AkVCam::cfTypeFromStd(const std::string &str)
|
||||||
|
{
|
||||||
|
auto ref =
|
||||||
|
new CFTypeRef(CFStringCreateWithCString(kCFAllocatorDefault,
|
||||||
|
str.c_str(),
|
||||||
|
kCFStringEncodingUTF8));
|
||||||
|
|
||||||
|
return std::shared_ptr<CFTypeRef>(ref, [] (CFTypeRef *ptr) {
|
||||||
|
CFRelease(*ptr);
|
||||||
|
delete ptr;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<CFTypeRef> AkVCam::cfTypeFromStd(const std::wstring &str)
|
||||||
|
{
|
||||||
|
auto ref =
|
||||||
|
new CFTypeRef(CFStringCreateWithBytes(kCFAllocatorDefault,
|
||||||
|
reinterpret_cast<const UInt8 *>(str.c_str()),
|
||||||
|
CFIndex(str.size() * sizeof(wchar_t)),
|
||||||
|
kCFStringEncodingUTF32LE,
|
||||||
|
false));
|
||||||
|
|
||||||
|
return std::shared_ptr<CFTypeRef>(ref, [] (CFTypeRef *ptr) {
|
||||||
|
CFRelease(*ptr);
|
||||||
|
delete ptr;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<CFTypeRef> AkVCam::cfTypeFromStd(int num)
|
||||||
|
{
|
||||||
|
auto ref =
|
||||||
|
new CFTypeRef(CFNumberCreate(kCFAllocatorDefault,
|
||||||
|
kCFNumberIntType,
|
||||||
|
&num));
|
||||||
|
|
||||||
|
return std::shared_ptr<CFTypeRef>(ref, [] (CFTypeRef *ptr) {
|
||||||
|
CFRelease(*ptr);
|
||||||
|
delete ptr;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<CFTypeRef> AkVCam::cfTypeFromStd(double num)
|
||||||
|
{
|
||||||
|
auto ref =
|
||||||
|
new CFTypeRef(CFNumberCreate(kCFAllocatorDefault,
|
||||||
|
kCFNumberDoubleType,
|
||||||
|
&num));
|
||||||
|
|
||||||
|
return std::shared_ptr<CFTypeRef>(ref, [] (CFTypeRef *ptr) {
|
||||||
|
CFRelease(*ptr);
|
||||||
|
delete ptr;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string AkVCam::stringFromCFType(CFTypeRef cfType)
|
||||||
|
{
|
||||||
|
auto len = size_t(CFStringGetLength(CFStringRef(cfType)));
|
||||||
|
auto data = CFStringGetCStringPtr(CFStringRef(cfType),
|
||||||
|
kCFStringEncodingUTF8);
|
||||||
|
|
||||||
|
if (data)
|
||||||
|
return std::string(data, len);
|
||||||
|
|
||||||
|
auto cstr = new char[len];
|
||||||
|
CFStringGetCString(CFStringRef(cfType),
|
||||||
|
cstr,
|
||||||
|
CFIndex(len),
|
||||||
|
kCFStringEncodingUTF8);
|
||||||
|
std::string str(cstr, len);
|
||||||
|
delete [] cstr;
|
||||||
|
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring AkVCam::wstringFromCFType(CFTypeRef cfType)
|
||||||
|
{
|
||||||
|
auto len = CFStringGetLength(CFStringRef(cfType));
|
||||||
|
auto range = CFRangeMake(0, len);
|
||||||
|
CFIndex bufferLen = 0;
|
||||||
|
auto converted = CFStringGetBytes(CFStringRef(cfType),
|
||||||
|
range,
|
||||||
|
kCFStringEncodingUTF32LE,
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
nullptr,
|
||||||
|
0,
|
||||||
|
&bufferLen);
|
||||||
|
|
||||||
|
if (converted < 1 || bufferLen < 1)
|
||||||
|
return {};
|
||||||
|
|
||||||
|
wchar_t cstr[bufferLen];
|
||||||
|
|
||||||
|
converted = CFStringGetBytes(CFStringRef(cfType),
|
||||||
|
range,
|
||||||
|
kCFStringEncodingUTF32LE,
|
||||||
|
0,
|
||||||
|
false,
|
||||||
|
reinterpret_cast<UInt8 *>(cstr),
|
||||||
|
bufferLen,
|
||||||
|
nullptr);
|
||||||
|
|
||||||
|
if (converted < 1)
|
||||||
|
return {};
|
||||||
|
|
||||||
|
return std::wstring(cstr, size_t(len));
|
||||||
|
}
|
38
cmio/PlatformUtils/src/utils.h
Normal file
38
cmio/PlatformUtils/src/utils.h
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
/* akvirtualcamera, virtual camera for Mac and Windows.
|
||||||
|
* Copyright (C) 2020 Gonzalo Exequiel Pedone
|
||||||
|
*
|
||||||
|
* akvirtualcamera is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* akvirtualcamera is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with akvirtualcamera. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Web-Site: http://webcamoid.github.io/
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef PLATFORM_UTILS_H
|
||||||
|
#define PLATFORM_UTILS_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <CoreFoundation/CoreFoundation.h>
|
||||||
|
|
||||||
|
namespace AkVCam
|
||||||
|
{
|
||||||
|
class VideoFormat;
|
||||||
|
|
||||||
|
std::shared_ptr<CFTypeRef> cfTypeFromStd(const std::string &str);
|
||||||
|
std::shared_ptr<CFTypeRef> cfTypeFromStd(const std::wstring &str);
|
||||||
|
std::shared_ptr<CFTypeRef> cfTypeFromStd(int num);
|
||||||
|
std::shared_ptr<CFTypeRef> cfTypeFromStd(double num);
|
||||||
|
std::string stringFromCFType(CFTypeRef cfType);
|
||||||
|
std::wstring wstringFromCFType(CFTypeRef cfType);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // PLATFORM_UTILS_H
|
|
@ -36,12 +36,6 @@
|
||||||
#include "VCamUtils/src/logger/logger.h"
|
#include "VCamUtils/src/logger/logger.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AkIpcBridgeLogMethod() \
|
|
||||||
AkLoggerLog("IpcBridge::", __FUNCTION__, "()")
|
|
||||||
|
|
||||||
#define AkIpcBridgePrivateLogMethod() \
|
|
||||||
AkLoggerLog("IpcBridgePrivate::", __FUNCTION__, "()")
|
|
||||||
|
|
||||||
#define AKVCAM_BIND_FUNC(member) \
|
#define AKVCAM_BIND_FUNC(member) \
|
||||||
std::bind(&member, this, std::placeholders::_1, std::placeholders::_2)
|
std::bind(&member, this, std::placeholders::_1, std::placeholders::_2)
|
||||||
|
|
||||||
|
@ -116,7 +110,7 @@ namespace AkVCam
|
||||||
|
|
||||||
AkVCam::IpcBridge::IpcBridge()
|
AkVCam::IpcBridge::IpcBridge()
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
this->d = new IpcBridgePrivate(this);
|
this->d = new IpcBridgePrivate(this);
|
||||||
ipcBridgePrivate().add(this);
|
ipcBridgePrivate().add(this);
|
||||||
}
|
}
|
||||||
|
@ -136,7 +130,7 @@ std::wstring AkVCam::IpcBridge::errorMessage() const
|
||||||
void AkVCam::IpcBridge::setOption(const std::string &key,
|
void AkVCam::IpcBridge::setOption(const std::string &key,
|
||||||
const std::string &value)
|
const std::string &value)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (value.empty())
|
if (value.empty())
|
||||||
this->d->m_options.erase(key);
|
this->d->m_options.erase(key);
|
||||||
|
@ -146,14 +140,14 @@ void AkVCam::IpcBridge::setOption(const std::string &key,
|
||||||
|
|
||||||
std::vector<std::wstring> AkVCam::IpcBridge::driverPaths() const
|
std::vector<std::wstring> AkVCam::IpcBridge::driverPaths() const
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return *this->d->driverPaths();
|
return *this->d->driverPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::IpcBridge::setDriverPaths(const std::vector<std::wstring> &driverPaths)
|
void AkVCam::IpcBridge::setDriverPaths(const std::vector<std::wstring> &driverPaths)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
*this->d->driverPaths() = driverPaths;
|
*this->d->driverPaths() = driverPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,25 +183,25 @@ bool AkVCam::IpcBridge::setRootMethod(const std::string &rootMethod)
|
||||||
|
|
||||||
void AkVCam::IpcBridge::connectService(bool asClient)
|
void AkVCam::IpcBridge::connectService(bool asClient)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_asClient = asClient;
|
this->d->m_asClient = asClient;
|
||||||
this->registerPeer(asClient);
|
this->registerPeer(asClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::IpcBridge::disconnectService()
|
void AkVCam::IpcBridge::disconnectService()
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
this->unregisterPeer();
|
this->unregisterPeer();
|
||||||
this->d->m_asClient = false;
|
this->d->m_asClient = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::registerPeer(bool asClient)
|
bool AkVCam::IpcBridge::registerPeer(bool asClient)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!asClient) {
|
if (!asClient) {
|
||||||
std::string plistFile =
|
std::string plistFile =
|
||||||
CMIO_DAEMONS_PATH "/" AKVCAM_ASSISTANT_NAME ".plist";
|
CMIO_DAEMONS_PATH "/" CMIO_ASSISTANT_NAME ".plist";
|
||||||
|
|
||||||
auto daemon = replace(plistFile, "~", this->d->homePath());
|
auto daemon = replace(plistFile, "~", this->d->homePath());
|
||||||
|
|
||||||
|
@ -226,7 +220,7 @@ bool AkVCam::IpcBridge::registerPeer(bool asClient)
|
||||||
bool status = false;
|
bool status = false;
|
||||||
|
|
||||||
auto serverMessagePort =
|
auto serverMessagePort =
|
||||||
xpc_connection_create_mach_service(AKVCAM_ASSISTANT_NAME,
|
xpc_connection_create_mach_service(CMIO_ASSISTANT_NAME,
|
||||||
nullptr,
|
nullptr,
|
||||||
0);
|
0);
|
||||||
|
|
||||||
|
@ -299,7 +293,7 @@ bool AkVCam::IpcBridge::registerPeer(bool asClient)
|
||||||
this->d->m_messagePort = messagePort;
|
this->d->m_messagePort = messagePort;
|
||||||
this->d->m_serverMessagePort = serverMessagePort;
|
this->d->m_serverMessagePort = serverMessagePort;
|
||||||
|
|
||||||
AkLoggerLog("SUCCESSFUL");
|
AkLogInfo() << "SUCCESSFUL" << std::endl;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -310,14 +304,14 @@ registerEndPoint_failed:
|
||||||
if (serverMessagePort)
|
if (serverMessagePort)
|
||||||
xpc_release(serverMessagePort);
|
xpc_release(serverMessagePort);
|
||||||
|
|
||||||
AkLoggerLog("FAILED");
|
AkLogError() << "FAILED" << std::endl;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::IpcBridge::unregisterPeer()
|
void AkVCam::IpcBridge::unregisterPeer()
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_messagePort) {
|
if (this->d->m_messagePort) {
|
||||||
xpc_release(this->d->m_messagePort);
|
xpc_release(this->d->m_messagePort);
|
||||||
|
@ -343,7 +337,7 @@ void AkVCam::IpcBridge::unregisterPeer()
|
||||||
|
|
||||||
std::vector<std::string> AkVCam::IpcBridge::listDevices() const
|
std::vector<std::string> AkVCam::IpcBridge::listDevices() const
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return {};
|
return {};
|
||||||
|
@ -369,19 +363,17 @@ std::vector<std::string> AkVCam::IpcBridge::listDevices() const
|
||||||
|
|
||||||
xpc_release(reply);
|
xpc_release(reply);
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
AkLogInfo() << "Devices:" << std::endl;
|
||||||
AkLoggerLog("Devices:");
|
|
||||||
|
|
||||||
for (auto &device: devices)
|
for (auto &device: devices)
|
||||||
AkLoggerLog(" ", device);
|
AkLogInfo() << " " << device << std::endl;
|
||||||
#endif
|
|
||||||
|
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring AkVCam::IpcBridge::description(const std::string &deviceId) const
|
std::wstring AkVCam::IpcBridge::description(const std::string &deviceId) const
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return {};
|
return {};
|
||||||
|
@ -427,7 +419,7 @@ AkVCam::PixelFormat AkVCam::IpcBridge::defaultOutputPixelFormat() const
|
||||||
|
|
||||||
std::vector<AkVCam::VideoFormat> AkVCam::IpcBridge::formats(const std::string &deviceId) const
|
std::vector<AkVCam::VideoFormat> AkVCam::IpcBridge::formats(const std::string &deviceId) const
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return {};
|
return {};
|
||||||
|
@ -466,7 +458,7 @@ std::vector<AkVCam::VideoFormat> AkVCam::IpcBridge::formats(const std::string &d
|
||||||
|
|
||||||
std::string AkVCam::IpcBridge::broadcaster(const std::string &deviceId) const
|
std::string AkVCam::IpcBridge::broadcaster(const std::string &deviceId) const
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return {};
|
return {};
|
||||||
|
@ -488,15 +480,15 @@ std::string AkVCam::IpcBridge::broadcaster(const std::string &deviceId) const
|
||||||
std::string broadcaster = xpc_dictionary_get_string(reply, "broadcaster");
|
std::string broadcaster = xpc_dictionary_get_string(reply, "broadcaster");
|
||||||
xpc_release(reply);
|
xpc_release(reply);
|
||||||
|
|
||||||
AkLoggerLog("Device: ", deviceId);
|
AkLogInfo() << "Device: " << deviceId << std::endl;
|
||||||
AkLoggerLog("Broadcaster: ", broadcaster);
|
AkLogInfo() << "Broadcaster: " << broadcaster << std::endl;
|
||||||
|
|
||||||
return broadcaster;
|
return broadcaster;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::isHorizontalMirrored(const std::string &deviceId)
|
bool AkVCam::IpcBridge::isHorizontalMirrored(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return false;
|
return false;
|
||||||
|
@ -523,7 +515,7 @@ bool AkVCam::IpcBridge::isHorizontalMirrored(const std::string &deviceId)
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::isVerticalMirrored(const std::string &deviceId)
|
bool AkVCam::IpcBridge::isVerticalMirrored(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return false;
|
return false;
|
||||||
|
@ -550,7 +542,7 @@ bool AkVCam::IpcBridge::isVerticalMirrored(const std::string &deviceId)
|
||||||
|
|
||||||
AkVCam::Scaling AkVCam::IpcBridge::scalingMode(const std::string &deviceId)
|
AkVCam::Scaling AkVCam::IpcBridge::scalingMode(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return ScalingFast;
|
return ScalingFast;
|
||||||
|
@ -577,7 +569,7 @@ AkVCam::Scaling AkVCam::IpcBridge::scalingMode(const std::string &deviceId)
|
||||||
|
|
||||||
AkVCam::AspectRatio AkVCam::IpcBridge::aspectRatioMode(const std::string &deviceId)
|
AkVCam::AspectRatio AkVCam::IpcBridge::aspectRatioMode(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return AspectRatioIgnore;
|
return AspectRatioIgnore;
|
||||||
|
@ -604,7 +596,7 @@ AkVCam::AspectRatio AkVCam::IpcBridge::aspectRatioMode(const std::string &device
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::swapRgb(const std::string &deviceId)
|
bool AkVCam::IpcBridge::swapRgb(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return false;
|
return false;
|
||||||
|
@ -631,7 +623,7 @@ bool AkVCam::IpcBridge::swapRgb(const std::string &deviceId)
|
||||||
|
|
||||||
std::vector<std::string> AkVCam::IpcBridge::listeners(const std::string &deviceId)
|
std::vector<std::string> AkVCam::IpcBridge::listeners(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return {};
|
return {};
|
||||||
|
@ -658,8 +650,8 @@ std::vector<std::string> AkVCam::IpcBridge::listeners(const std::string &deviceI
|
||||||
|
|
||||||
xpc_release(reply);
|
xpc_release(reply);
|
||||||
|
|
||||||
AkLoggerLog("Device: ", deviceId);
|
AkLogInfo() << "Device: " << deviceId << std::endl;
|
||||||
AkLoggerLog("Listeners: ", listeners.size());
|
AkLogInfo() << "Listeners: " << listeners.size() << std::endl;
|
||||||
|
|
||||||
return listeners;
|
return listeners;
|
||||||
}
|
}
|
||||||
|
@ -728,7 +720,7 @@ bool AkVCam::IpcBridge::canApply(AkVCam::IpcBridge::Operation operation) const
|
||||||
std::string AkVCam::IpcBridge::deviceCreate(const std::wstring &description,
|
std::string AkVCam::IpcBridge::deviceCreate(const std::wstring &description,
|
||||||
const std::vector<VideoFormat> &formats)
|
const std::vector<VideoFormat> &formats)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->canApply(OperationCreate)) {
|
if (!this->canApply(OperationCreate)) {
|
||||||
this->d->m_error = L"The driver is in use";
|
this->d->m_error = L"The driver is in use";
|
||||||
|
@ -789,7 +781,7 @@ bool AkVCam::IpcBridge::deviceEdit(const std::string &deviceId,
|
||||||
const std::wstring &description,
|
const std::wstring &description,
|
||||||
const std::vector<VideoFormat> &formats)
|
const std::vector<VideoFormat> &formats)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->canApply(OperationEdit)) {
|
if (!this->canApply(OperationEdit)) {
|
||||||
this->d->m_error = L"The driver is in use";
|
this->d->m_error = L"The driver is in use";
|
||||||
|
@ -813,7 +805,7 @@ bool AkVCam::IpcBridge::deviceEdit(const std::string &deviceId,
|
||||||
bool AkVCam::IpcBridge::changeDescription(const std::string &deviceId,
|
bool AkVCam::IpcBridge::changeDescription(const std::string &deviceId,
|
||||||
const std::wstring &description)
|
const std::wstring &description)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->canApply(OperationEdit)) {
|
if (!this->canApply(OperationEdit)) {
|
||||||
this->d->m_error = L"The driver is in use";
|
this->d->m_error = L"The driver is in use";
|
||||||
|
@ -841,7 +833,7 @@ bool AkVCam::IpcBridge::changeDescription(const std::string &deviceId,
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::deviceDestroy(const std::string &deviceId)
|
bool AkVCam::IpcBridge::deviceDestroy(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->canApply(OperationDestroy)) {
|
if (!this->canApply(OperationDestroy)) {
|
||||||
this->d->m_error = L"The driver is in use";
|
this->d->m_error = L"The driver is in use";
|
||||||
|
@ -868,7 +860,7 @@ bool AkVCam::IpcBridge::deviceDestroy(const std::string &deviceId)
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::destroyAllDevices()
|
bool AkVCam::IpcBridge::destroyAllDevices()
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->canApply(OperationDestroyAll)) {
|
if (!this->canApply(OperationDestroyAll)) {
|
||||||
this->d->m_error = L"The driver is in use";
|
this->d->m_error = L"The driver is in use";
|
||||||
|
@ -886,7 +878,7 @@ bool AkVCam::IpcBridge::deviceStart(const std::string &deviceId,
|
||||||
const VideoFormat &format)
|
const VideoFormat &format)
|
||||||
{
|
{
|
||||||
UNUSED(format)
|
UNUSED(format)
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return false;
|
return false;
|
||||||
|
@ -922,7 +914,7 @@ bool AkVCam::IpcBridge::deviceStart(const std::string &deviceId,
|
||||||
|
|
||||||
void AkVCam::IpcBridge::deviceStop(const std::string &deviceId)
|
void AkVCam::IpcBridge::deviceStop(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return;
|
return;
|
||||||
|
@ -948,7 +940,7 @@ void AkVCam::IpcBridge::deviceStop(const std::string &deviceId)
|
||||||
bool AkVCam::IpcBridge::write(const std::string &deviceId,
|
bool AkVCam::IpcBridge::write(const std::string &deviceId,
|
||||||
const VideoFrame &frame)
|
const VideoFrame &frame)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1021,7 +1013,7 @@ void AkVCam::IpcBridge::setMirroring(const std::string &deviceId,
|
||||||
bool horizontalMirrored,
|
bool horizontalMirrored,
|
||||||
bool verticalMirrored)
|
bool verticalMirrored)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return;
|
return;
|
||||||
|
@ -1040,7 +1032,7 @@ void AkVCam::IpcBridge::setMirroring(const std::string &deviceId,
|
||||||
void AkVCam::IpcBridge::setScaling(const std::string &deviceId,
|
void AkVCam::IpcBridge::setScaling(const std::string &deviceId,
|
||||||
Scaling scaling)
|
Scaling scaling)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return;
|
return;
|
||||||
|
@ -1058,7 +1050,7 @@ void AkVCam::IpcBridge::setScaling(const std::string &deviceId,
|
||||||
void AkVCam::IpcBridge::setAspectRatio(const std::string &deviceId,
|
void AkVCam::IpcBridge::setAspectRatio(const std::string &deviceId,
|
||||||
AspectRatio aspectRatio)
|
AspectRatio aspectRatio)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return;
|
return;
|
||||||
|
@ -1075,7 +1067,7 @@ void AkVCam::IpcBridge::setAspectRatio(const std::string &deviceId,
|
||||||
|
|
||||||
void AkVCam::IpcBridge::setSwapRgb(const std::string &deviceId, bool swap)
|
void AkVCam::IpcBridge::setSwapRgb(const std::string &deviceId, bool swap)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return;
|
return;
|
||||||
|
@ -1092,7 +1084,7 @@ void AkVCam::IpcBridge::setSwapRgb(const std::string &deviceId, bool swap)
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::addListener(const std::string &deviceId)
|
bool AkVCam::IpcBridge::addListener(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1120,7 +1112,7 @@ bool AkVCam::IpcBridge::addListener(const std::string &deviceId)
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::removeListener(const std::string &deviceId)
|
bool AkVCam::IpcBridge::removeListener(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_serverMessagePort)
|
if (!this->d->m_serverMessagePort)
|
||||||
return true;
|
return true;
|
||||||
|
@ -1203,7 +1195,7 @@ std::vector<AkVCam::IpcBridge *> &AkVCam::IpcBridgePrivate::bridges()
|
||||||
void AkVCam::IpcBridgePrivate::isAlive(xpc_connection_t client,
|
void AkVCam::IpcBridgePrivate::isAlive(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
auto reply = xpc_dictionary_create_reply(event);
|
auto reply = xpc_dictionary_create_reply(event);
|
||||||
xpc_dictionary_set_bool(reply, "alive", true);
|
xpc_dictionary_set_bool(reply, "alive", true);
|
||||||
|
@ -1215,7 +1207,7 @@ void AkVCam::IpcBridgePrivate::deviceCreate(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
UNUSED(client)
|
UNUSED(client)
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string device = xpc_dictionary_get_string(event, "device");
|
std::string device = xpc_dictionary_get_string(event, "device");
|
||||||
|
|
||||||
for (auto bridge: this->m_bridges)
|
for (auto bridge: this->m_bridges)
|
||||||
|
@ -1226,7 +1218,7 @@ void AkVCam::IpcBridgePrivate::deviceDestroy(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
UNUSED(client)
|
UNUSED(client)
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
std::string device = xpc_dictionary_get_string(event, "device");
|
std::string device = xpc_dictionary_get_string(event, "device");
|
||||||
|
|
||||||
|
@ -1238,7 +1230,7 @@ void AkVCam::IpcBridgePrivate::frameReady(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
UNUSED(client)
|
UNUSED(client)
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
std::string deviceId =
|
std::string deviceId =
|
||||||
xpc_dictionary_get_string(event, "device");
|
xpc_dictionary_get_string(event, "device");
|
||||||
|
@ -1273,7 +1265,7 @@ void AkVCam::IpcBridgePrivate::setBroadcasting(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
UNUSED(client)
|
UNUSED(client)
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
std::string deviceId =
|
std::string deviceId =
|
||||||
xpc_dictionary_get_string(event, "device");
|
xpc_dictionary_get_string(event, "device");
|
||||||
|
@ -1288,7 +1280,7 @@ void AkVCam::IpcBridgePrivate::setMirror(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
UNUSED(client)
|
UNUSED(client)
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
std::string deviceId =
|
std::string deviceId =
|
||||||
xpc_dictionary_get_string(event, "device");
|
xpc_dictionary_get_string(event, "device");
|
||||||
|
@ -1309,7 +1301,7 @@ void AkVCam::IpcBridgePrivate::setScaling(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
UNUSED(client)
|
UNUSED(client)
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
std::string deviceId =
|
std::string deviceId =
|
||||||
xpc_dictionary_get_string(event, "device");
|
xpc_dictionary_get_string(event, "device");
|
||||||
|
@ -1324,7 +1316,7 @@ void AkVCam::IpcBridgePrivate::setAspectRatio(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
UNUSED(client)
|
UNUSED(client)
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
std::string deviceId =
|
std::string deviceId =
|
||||||
xpc_dictionary_get_string(event, "device");
|
xpc_dictionary_get_string(event, "device");
|
||||||
|
@ -1339,7 +1331,7 @@ void AkVCam::IpcBridgePrivate::setSwapRgb(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
UNUSED(client)
|
UNUSED(client)
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
std::string deviceId =
|
std::string deviceId =
|
||||||
xpc_dictionary_get_string(event, "device");
|
xpc_dictionary_get_string(event, "device");
|
||||||
|
@ -1353,7 +1345,7 @@ void AkVCam::IpcBridgePrivate::listenerAdd(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
UNUSED(client)
|
UNUSED(client)
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
std::string listener = xpc_dictionary_get_string(event, "listener");
|
std::string listener = xpc_dictionary_get_string(event, "listener");
|
||||||
|
@ -1366,7 +1358,7 @@ void AkVCam::IpcBridgePrivate::listenerRemove(xpc_connection_t client,
|
||||||
xpc_object_t event)
|
xpc_object_t event)
|
||||||
{
|
{
|
||||||
UNUSED(client)
|
UNUSED(client)
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
std::string deviceId = xpc_dictionary_get_string(event, "device");
|
||||||
std::string listener = xpc_dictionary_get_string(event, "listener");
|
std::string listener = xpc_dictionary_get_string(event, "listener");
|
||||||
|
@ -1382,7 +1374,7 @@ void AkVCam::IpcBridgePrivate::messageReceived(xpc_connection_t client,
|
||||||
|
|
||||||
if (type == XPC_TYPE_ERROR) {
|
if (type == XPC_TYPE_ERROR) {
|
||||||
auto description = xpc_copy_description(event);
|
auto description = xpc_copy_description(event);
|
||||||
AkLoggerLog("ERROR: ", description);
|
AkLogError() << description << std::endl;
|
||||||
free(description);
|
free(description);
|
||||||
} else if (type == XPC_TYPE_DICTIONARY) {
|
} else if (type == XPC_TYPE_DICTIONARY) {
|
||||||
auto message = xpc_dictionary_get_int64(event, "message");
|
auto message = xpc_dictionary_get_int64(event, "message");
|
||||||
|
@ -1494,7 +1486,7 @@ bool AkVCam::IpcBridgePrivate::rm(const std::string &path) const
|
||||||
|
|
||||||
bool AkVCam::IpcBridgePrivate::createDaemonPlist(const std::string &fileName) const
|
bool AkVCam::IpcBridgePrivate::createDaemonPlist(const std::string &fileName) const
|
||||||
{
|
{
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
std::fstream plistFile;
|
std::fstream plistFile;
|
||||||
plistFile.open(fileName, std::ios_base::out);
|
plistFile.open(fileName, std::ios_base::out);
|
||||||
|
|
||||||
|
@ -1508,7 +1500,7 @@ bool AkVCam::IpcBridgePrivate::createDaemonPlist(const std::string &fileName) co
|
||||||
<< "<plist version=\"1.0\">" << std::endl
|
<< "<plist version=\"1.0\">" << std::endl
|
||||||
<< " <dict>" << std::endl
|
<< " <dict>" << std::endl
|
||||||
<< " <key>Label</key>" << std::endl
|
<< " <key>Label</key>" << std::endl
|
||||||
<< " <string>" << AKVCAM_ASSISTANT_NAME
|
<< " <string>" << CMIO_ASSISTANT_NAME
|
||||||
<< "</string>" << std::endl
|
<< "</string>" << std::endl
|
||||||
<< " <key>ProgramArguments</key>" << std::endl
|
<< " <key>ProgramArguments</key>" << std::endl
|
||||||
<< " <array>" << std::endl
|
<< " <array>" << std::endl
|
||||||
|
@ -1523,21 +1515,11 @@ bool AkVCam::IpcBridgePrivate::createDaemonPlist(const std::string &fileName) co
|
||||||
<< " </array>" << std::endl
|
<< " </array>" << std::endl
|
||||||
<< " <key>MachServices</key>" << std::endl
|
<< " <key>MachServices</key>" << std::endl
|
||||||
<< " <dict>" << std::endl
|
<< " <dict>" << std::endl
|
||||||
<< " <key>" << AKVCAM_ASSISTANT_NAME
|
<< " <key>" << CMIO_ASSISTANT_NAME
|
||||||
<< "</key>" << std::endl
|
<< "</key>" << std::endl
|
||||||
<< " <true/>" << std::endl
|
<< " <true/>" << std::endl
|
||||||
<< " </dict>" << std::endl;
|
<< " </dict>" << std::endl
|
||||||
|
<< " </dict>" << std::endl
|
||||||
#ifdef QT_DEBUG
|
|
||||||
std::string daemonLog = "/tmp/" AKVCAM_ASSISTANT_NAME ".log";
|
|
||||||
|
|
||||||
plistFile << " <key>StandardOutPath</key>" << std::endl
|
|
||||||
<< " <string>" << daemonLog << "</string>" << std::endl
|
|
||||||
<< " <key>StandardErrorPath</key>" << std::endl
|
|
||||||
<< " <string>" << daemonLog << "</string>" << std::endl;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
plistFile << " </dict>" << std::endl
|
|
||||||
<< "</plist>" << std::endl;
|
<< "</plist>" << std::endl;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1545,14 +1527,14 @@ bool AkVCam::IpcBridgePrivate::createDaemonPlist(const std::string &fileName) co
|
||||||
|
|
||||||
bool AkVCam::IpcBridgePrivate::loadDaemon()
|
bool AkVCam::IpcBridgePrivate::loadDaemon()
|
||||||
{
|
{
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto launchctl = popen("launchctl list " AKVCAM_ASSISTANT_NAME, "r");
|
auto launchctl = popen("launchctl list " CMIO_ASSISTANT_NAME, "r");
|
||||||
|
|
||||||
if (launchctl && !pclose(launchctl))
|
if (launchctl && !pclose(launchctl))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto daemonsPath = replace(CMIO_DAEMONS_PATH, "~", this->homePath());
|
auto daemonsPath = replace(CMIO_DAEMONS_PATH, "~", this->homePath());
|
||||||
auto dstDaemonsPath = daemonsPath + "/" AKVCAM_ASSISTANT_NAME ".plist";
|
auto dstDaemonsPath = daemonsPath + "/" CMIO_ASSISTANT_NAME ".plist";
|
||||||
|
|
||||||
if (!this->fileExists(dstDaemonsPath)) {
|
if (!this->fileExists(dstDaemonsPath)) {
|
||||||
this->m_error = L"Daemon plist does not exists";
|
this->m_error = L"Daemon plist does not exists";
|
||||||
|
@ -1573,8 +1555,8 @@ bool AkVCam::IpcBridgePrivate::loadDaemon()
|
||||||
|
|
||||||
void AkVCam::IpcBridgePrivate::unloadDaemon() const
|
void AkVCam::IpcBridgePrivate::unloadDaemon() const
|
||||||
{
|
{
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
std::string daemonPlist = AKVCAM_ASSISTANT_NAME ".plist";
|
std::string daemonPlist = CMIO_ASSISTANT_NAME ".plist";
|
||||||
auto daemonsPath = replace(CMIO_DAEMONS_PATH, "~", this->homePath());
|
auto daemonsPath = replace(CMIO_DAEMONS_PATH, "~", this->homePath());
|
||||||
auto dstDaemonsPath = daemonsPath + "/" + daemonPlist;
|
auto dstDaemonsPath = daemonsPath + "/" + daemonPlist;
|
||||||
|
|
||||||
|
@ -1589,7 +1571,7 @@ void AkVCam::IpcBridgePrivate::unloadDaemon() const
|
||||||
|
|
||||||
bool AkVCam::IpcBridgePrivate::checkDaemon()
|
bool AkVCam::IpcBridgePrivate::checkDaemon()
|
||||||
{
|
{
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto driverPath = this->locateDriverPath();
|
auto driverPath = this->locateDriverPath();
|
||||||
|
|
||||||
if (driverPath.empty()) {
|
if (driverPath.empty()) {
|
||||||
|
@ -1637,7 +1619,7 @@ bool AkVCam::IpcBridgePrivate::checkDaemon()
|
||||||
}
|
}
|
||||||
|
|
||||||
auto daemonsPath = replace(CMIO_DAEMONS_PATH, "~", this->homePath());
|
auto daemonsPath = replace(CMIO_DAEMONS_PATH, "~", this->homePath());
|
||||||
auto dstDaemonsPath = daemonsPath + "/" + AKVCAM_ASSISTANT_NAME + ".plist";
|
auto dstDaemonsPath = daemonsPath + "/" + CMIO_ASSISTANT_NAME + ".plist";
|
||||||
|
|
||||||
if (!this->fileExists(dstDaemonsPath)) {
|
if (!this->fileExists(dstDaemonsPath)) {
|
||||||
if (!this->mkpath(daemonsPath)) {
|
if (!this->mkpath(daemonsPath)) {
|
||||||
|
@ -1658,7 +1640,7 @@ bool AkVCam::IpcBridgePrivate::checkDaemon()
|
||||||
|
|
||||||
void AkVCam::IpcBridgePrivate::uninstallPlugin()
|
void AkVCam::IpcBridgePrivate::uninstallPlugin()
|
||||||
{
|
{
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
// Stop the daemon
|
// Stop the daemon
|
||||||
this->unloadDaemon();
|
this->unloadDaemon();
|
||||||
|
@ -1666,7 +1648,7 @@ void AkVCam::IpcBridgePrivate::uninstallPlugin()
|
||||||
// Remove the agent plist
|
// Remove the agent plist
|
||||||
auto daemonsPath =
|
auto daemonsPath =
|
||||||
replace(CMIO_DAEMONS_PATH, "~", this->homePath());
|
replace(CMIO_DAEMONS_PATH, "~", this->homePath());
|
||||||
this->rm(daemonsPath + "/" AKVCAM_ASSISTANT_NAME ".plist");
|
this->rm(daemonsPath + "/" CMIO_ASSISTANT_NAME ".plist");
|
||||||
|
|
||||||
// Remove the plugin
|
// Remove the plugin
|
||||||
auto driverPath = this->locateDriverPath();
|
auto driverPath = this->locateDriverPath();
|
||||||
|
@ -1684,7 +1666,7 @@ void AkVCam::IpcBridgePrivate::uninstallPlugin()
|
||||||
|
|
||||||
std::wstring AkVCam::IpcBridgePrivate::locateDriverPath() const
|
std::wstring AkVCam::IpcBridgePrivate::locateDriverPath() const
|
||||||
{
|
{
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
std::wstring driverPath;
|
std::wstring driverPath;
|
||||||
|
|
||||||
for (auto it = this->driverPaths()->rbegin();
|
for (auto it = this->driverPaths()->rbegin();
|
||||||
|
@ -1714,7 +1696,7 @@ std::wstring AkVCam::IpcBridgePrivate::locateDriverPath() const
|
||||||
|
|
||||||
int AkVCam::IpcBridgePrivate::sudo(const std::vector<std::string> ¶meters)
|
int AkVCam::IpcBridgePrivate::sudo(const std::vector<std::string> ¶meters)
|
||||||
{
|
{
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "osascript -e \"do shell script \\\"";
|
ss << "osascript -e \"do shell script \\\"";
|
||||||
|
|
||||||
|
@ -1742,7 +1724,7 @@ int AkVCam::IpcBridgePrivate::sudo(const std::vector<std::string> ¶meters)
|
||||||
auto result = pclose(sudo);
|
auto result = pclose(sudo);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
AkLoggerLog(output);
|
AkLogInfo() << output << std::endl;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ exists(commons.pri) {
|
||||||
}
|
}
|
||||||
|
|
||||||
include(../cmio.pri)
|
include(../cmio.pri)
|
||||||
include(../../VCamUtils/VCamUtils.pri)
|
|
||||||
|
|
||||||
CONFIG -= qt link_prl
|
CONFIG -= qt link_prl
|
||||||
CONFIG += \
|
CONFIG += \
|
||||||
|
@ -41,6 +40,7 @@ INCLUDEPATH += \
|
||||||
../..
|
../..
|
||||||
|
|
||||||
LIBS = \
|
LIBS = \
|
||||||
|
-L$${OUT_PWD}/../PlatformUtils/$${BIN_DIR} -lPlatformUtils \
|
||||||
-L$${OUT_PWD}/../../VCamUtils/$${BIN_DIR} -lVCamUtils \
|
-L$${OUT_PWD}/../../VCamUtils/$${BIN_DIR} -lVCamUtils \
|
||||||
-L$${OUT_PWD}/../VCamIPC/$${BIN_DIR} -lVCamIPC \
|
-L$${OUT_PWD}/../VCamIPC/$${BIN_DIR} -lVCamIPC \
|
||||||
-framework CoreFoundation \
|
-framework CoreFoundation \
|
||||||
|
|
|
@ -42,7 +42,7 @@ AkVCam::Device::~Device()
|
||||||
|
|
||||||
OSStatus AkVCam::Device::createObject()
|
OSStatus AkVCam::Device::createObject()
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->m_pluginInterface
|
if (!this->m_pluginInterface
|
||||||
|| !*this->m_pluginInterface)
|
|| !*this->m_pluginInterface)
|
||||||
|
@ -59,7 +59,7 @@ OSStatus AkVCam::Device::createObject()
|
||||||
if (status == kCMIOHardwareNoError) {
|
if (status == kCMIOHardwareNoError) {
|
||||||
this->m_isCreated = true;
|
this->m_isCreated = true;
|
||||||
this->m_objectID = deviceID;
|
this->m_objectID = deviceID;
|
||||||
AkLoggerLog("Created device: ", this->m_objectID);
|
AkLogInfo() << "Created device: " << this->m_objectID << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
@ -67,7 +67,7 @@ OSStatus AkVCam::Device::createObject()
|
||||||
|
|
||||||
OSStatus AkVCam::Device::registerObject(bool regist)
|
OSStatus AkVCam::Device::registerObject(bool regist)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!this->m_isCreated
|
if (!this->m_isCreated
|
||||||
|
@ -96,7 +96,7 @@ OSStatus AkVCam::Device::registerObject(bool regist)
|
||||||
|
|
||||||
AkVCam::StreamPtr AkVCam::Device::addStream()
|
AkVCam::StreamPtr AkVCam::Device::addStream()
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
auto stream = StreamPtr(new Stream(false, this));
|
auto stream = StreamPtr(new Stream(false, this));
|
||||||
|
|
||||||
if (stream->createObject() == kCMIOHardwareNoError) {
|
if (stream->createObject() == kCMIOHardwareNoError) {
|
||||||
|
@ -111,7 +111,7 @@ AkVCam::StreamPtr AkVCam::Device::addStream()
|
||||||
|
|
||||||
std::list<AkVCam::StreamPtr> AkVCam::Device::addStreams(int n)
|
std::list<AkVCam::StreamPtr> AkVCam::Device::addStreams(int n)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
std::list<StreamPtr> streams;
|
std::list<StreamPtr> streams;
|
||||||
|
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
|
@ -133,7 +133,7 @@ std::list<AkVCam::StreamPtr> AkVCam::Device::addStreams(int n)
|
||||||
|
|
||||||
OSStatus AkVCam::Device::registerStreams(bool regist)
|
OSStatus AkVCam::Device::registerStreams(bool regist)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!this->m_isCreated
|
if (!this->m_isCreated
|
||||||
|
@ -226,25 +226,23 @@ void AkVCam::Device::setSwapRgb(bool swap)
|
||||||
|
|
||||||
OSStatus AkVCam::Device::suspend()
|
OSStatus AkVCam::Device::suspend()
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
AkLogDebug() << "STUB" << std::endl;
|
||||||
AkLoggerLog("STUB");
|
|
||||||
|
|
||||||
return kCMIOHardwareUnspecifiedError;
|
return kCMIOHardwareUnspecifiedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSStatus AkVCam::Device::resume()
|
OSStatus AkVCam::Device::resume()
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
AkLogDebug() << "STUB" << std::endl;
|
||||||
AkLoggerLog("STUB");
|
|
||||||
|
|
||||||
return kCMIOHardwareUnspecifiedError;
|
return kCMIOHardwareUnspecifiedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSStatus AkVCam::Device::startStream(CMIOStreamID stream)
|
OSStatus AkVCam::Device::startStream(CMIOStreamID stream)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
UInt32 isRunning = 0;
|
UInt32 isRunning = 0;
|
||||||
this->m_properties.getProperty(kCMIODevicePropertyDeviceIsRunning,
|
this->m_properties.getProperty(kCMIODevicePropertyDeviceIsRunning,
|
||||||
|
@ -278,7 +276,7 @@ OSStatus AkVCam::Device::startStream(CMIOStreamID stream)
|
||||||
|
|
||||||
OSStatus AkVCam::Device::stopStream(CMIOStreamID stream)
|
OSStatus AkVCam::Device::stopStream(CMIOStreamID stream)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
UInt32 isRunning = 0;
|
UInt32 isRunning = 0;
|
||||||
this->m_properties.getProperty(kCMIODevicePropertyDeviceIsRunning,
|
this->m_properties.getProperty(kCMIODevicePropertyDeviceIsRunning,
|
||||||
|
@ -310,20 +308,18 @@ OSStatus AkVCam::Device::stopStream(CMIOStreamID stream)
|
||||||
|
|
||||||
OSStatus AkVCam::Device::processAVCCommand(CMIODeviceAVCCommand *ioAVCCommand)
|
OSStatus AkVCam::Device::processAVCCommand(CMIODeviceAVCCommand *ioAVCCommand)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
|
||||||
UNUSED(ioAVCCommand)
|
UNUSED(ioAVCCommand)
|
||||||
|
AkLogFunction();
|
||||||
AkLoggerLog("STUB");
|
AkLogDebug() << "STUB" << std::endl;
|
||||||
|
|
||||||
return kCMIOHardwareUnspecifiedError;
|
return kCMIOHardwareUnspecifiedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSStatus AkVCam::Device::processRS422Command(CMIODeviceRS422Command *ioRS422Command)
|
OSStatus AkVCam::Device::processRS422Command(CMIODeviceRS422Command *ioRS422Command)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
|
||||||
UNUSED(ioRS422Command)
|
UNUSED(ioRS422Command)
|
||||||
|
AkLogFunction();
|
||||||
AkLoggerLog("STUB");
|
AkLogDebug() << "STUB" << std::endl;
|
||||||
|
|
||||||
return kCMIOHardwareUnspecifiedError;
|
return kCMIOHardwareUnspecifiedError;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,22 +62,25 @@ CMIOObjectPropertyAddress AkVCam::ObjectInterface::address(CMIOObjectPropertySel
|
||||||
|
|
||||||
void AkVCam::ObjectInterface::show()
|
void AkVCam::ObjectInterface::show()
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
AkLogDebug() << "STUB" << std::endl;
|
||||||
AkLoggerLog("STUB");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean AkVCam::ObjectInterface::hasProperty(const CMIOObjectPropertyAddress *address)
|
Boolean AkVCam::ObjectInterface::hasProperty(const CMIOObjectPropertyAddress *address)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->m_properties.getProperty(address->mSelector)) {
|
if (!this->m_properties.getProperty(address->mSelector)) {
|
||||||
AkLoggerLog("Unknown property ", enumToString(address->mSelector));
|
AkLogWarning() << "Unknown property "
|
||||||
|
<< enumToString(address->mSelector)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AkLoggerLog("Found property ", enumToString(address->mSelector));
|
AkLogInfo() << "Found property "
|
||||||
|
<< enumToString(address->mSelector)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -85,10 +88,12 @@ Boolean AkVCam::ObjectInterface::hasProperty(const CMIOObjectPropertyAddress *ad
|
||||||
OSStatus AkVCam::ObjectInterface::isPropertySettable(const CMIOObjectPropertyAddress *address,
|
OSStatus AkVCam::ObjectInterface::isPropertySettable(const CMIOObjectPropertyAddress *address,
|
||||||
Boolean *isSettable)
|
Boolean *isSettable)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->m_properties.getProperty(address->mSelector)) {
|
if (!this->m_properties.getProperty(address->mSelector)) {
|
||||||
AkLoggerLog("Unknown property ", enumToString(address->mSelector));
|
AkLogWarning() << "Unknown property "
|
||||||
|
<< enumToString(address->mSelector)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
return kCMIOHardwareUnknownPropertyError;
|
return kCMIOHardwareUnknownPropertyError;
|
||||||
}
|
}
|
||||||
|
@ -98,10 +103,11 @@ OSStatus AkVCam::ObjectInterface::isPropertySettable(const CMIOObjectPropertyAdd
|
||||||
if (isSettable)
|
if (isSettable)
|
||||||
*isSettable = settable;
|
*isSettable = settable;
|
||||||
|
|
||||||
AkLoggerLog("Is property ",
|
AkLogInfo() << "Is property "
|
||||||
enumToString(address->mSelector),
|
<< enumToString(address->mSelector)
|
||||||
" settable? ",
|
<< " settable? "
|
||||||
(settable? "YES": "NO"));
|
<< (settable? "YES": "NO")
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
return kCMIOHardwareNoError;
|
return kCMIOHardwareNoError;
|
||||||
}
|
}
|
||||||
|
@ -111,15 +117,19 @@ OSStatus AkVCam::ObjectInterface::getPropertyDataSize(const CMIOObjectPropertyAd
|
||||||
const void *qualifierData,
|
const void *qualifierData,
|
||||||
UInt32 *dataSize)
|
UInt32 *dataSize)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("Getting property size ", enumToString(address->mSelector));
|
AkLogInfo() << "Getting property size "
|
||||||
|
<< enumToString(address->mSelector)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
if (!this->m_properties.getProperty(address->mSelector,
|
if (!this->m_properties.getProperty(address->mSelector,
|
||||||
qualifierDataSize,
|
qualifierDataSize,
|
||||||
qualifierData,
|
qualifierData,
|
||||||
0,
|
0,
|
||||||
dataSize)) {
|
dataSize)) {
|
||||||
AkLoggerLog("Unknown property ", enumToString(address->mSelector));
|
AkLogWarning() << "Unknown property "
|
||||||
|
<< enumToString(address->mSelector)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
return kCMIOHardwareUnknownPropertyError;
|
return kCMIOHardwareUnknownPropertyError;
|
||||||
}
|
}
|
||||||
|
@ -134,8 +144,10 @@ OSStatus AkVCam::ObjectInterface::getPropertyData(const CMIOObjectPropertyAddres
|
||||||
UInt32 *dataUsed,
|
UInt32 *dataUsed,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("Getting property ", enumToString(address->mSelector));
|
AkLogInfo() << "Getting property"
|
||||||
|
<< enumToString(address->mSelector)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
if (!this->m_properties.getProperty(address->mSelector,
|
if (!this->m_properties.getProperty(address->mSelector,
|
||||||
qualifierDataSize,
|
qualifierDataSize,
|
||||||
|
@ -143,7 +155,9 @@ OSStatus AkVCam::ObjectInterface::getPropertyData(const CMIOObjectPropertyAddres
|
||||||
dataSize,
|
dataSize,
|
||||||
dataUsed,
|
dataUsed,
|
||||||
data)) {
|
data)) {
|
||||||
AkLoggerLog("Unknown property ", enumToString(address->mSelector));
|
AkLogWarning() << "Unknown property "
|
||||||
|
<< enumToString(address->mSelector)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
return kCMIOHardwareUnknownPropertyError;
|
return kCMIOHardwareUnknownPropertyError;
|
||||||
}
|
}
|
||||||
|
@ -157,15 +171,19 @@ OSStatus AkVCam::ObjectInterface::setPropertyData(const CMIOObjectPropertyAddres
|
||||||
UInt32 dataSize,
|
UInt32 dataSize,
|
||||||
const void *data)
|
const void *data)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("Setting property ", enumToString(address->mSelector));
|
AkLogInfo() << "Setting property "
|
||||||
|
<< enumToString(address->mSelector)
|
||||||
|
<< std::endl;
|
||||||
UNUSED(qualifierDataSize)
|
UNUSED(qualifierDataSize)
|
||||||
UNUSED(qualifierData)
|
UNUSED(qualifierData)
|
||||||
|
|
||||||
if (!this->m_properties.setProperty(address->mSelector,
|
if (!this->m_properties.setProperty(address->mSelector,
|
||||||
dataSize,
|
dataSize,
|
||||||
data)) {
|
data)) {
|
||||||
AkLoggerLog("Unknown property ", enumToString(address->mSelector));
|
AkLogWarning() << "Unknown property "
|
||||||
|
<< enumToString(address->mSelector)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
return kCMIOHardwareUnknownPropertyError;
|
return kCMIOHardwareUnknownPropertyError;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,14 +26,6 @@
|
||||||
#include "objectproperties.h"
|
#include "objectproperties.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AkObjectLogMethod() \
|
|
||||||
AkLoggerLog(this->m_className, \
|
|
||||||
"(", \
|
|
||||||
this->m_objectID, \
|
|
||||||
")::", \
|
|
||||||
__FUNCTION__, \
|
|
||||||
"()")
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class ObjectInterface
|
class ObjectInterface
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include "plugin.h"
|
#include "plugin.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
#include "PlatformUtils/src/preferences.h"
|
||||||
#include "VCamUtils/src/ipcbridge.h"
|
#include "VCamUtils/src/ipcbridge.h"
|
||||||
#include "VCamUtils/src/logger/logger.h"
|
#include "VCamUtils/src/logger/logger.h"
|
||||||
|
|
||||||
|
@ -26,14 +27,20 @@ extern "C" void *akPluginMain(CFAllocatorRef allocator,
|
||||||
CFUUIDRef requestedTypeUUID)
|
CFUUIDRef requestedTypeUUID)
|
||||||
{
|
{
|
||||||
UNUSED(allocator)
|
UNUSED(allocator)
|
||||||
|
auto logLevel =
|
||||||
|
AkVCam::Preferences::readInt("loglevel", AKVCAM_LOGLEVEL_DEFAULT);
|
||||||
|
AkVCam::Logger::setLogLevel(logLevel);
|
||||||
|
|
||||||
#if defined(QT_DEBUG) && 0
|
if (AkVCam::Logger::logLevel() > AKVCAM_LOGLEVEL_DEFAULT) {
|
||||||
// Turn on lights
|
// Turn on lights
|
||||||
freopen("/dev/tty", "a", stdout);
|
freopen("/dev/tty", "a", stdout);
|
||||||
freopen("/dev/tty", "a", stderr);
|
freopen("/dev/tty", "a", stderr);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
AkLoggerStart("/tmp/" CMIO_PLUGIN_NAME, "log");
|
auto logFile =
|
||||||
|
AkVCam::Preferences::readString("logfile",
|
||||||
|
"/tmp/" CMIO_PLUGIN_NAME ".log");
|
||||||
|
AkVCam::Logger::setLogFile(logFile);
|
||||||
|
|
||||||
if (!CFEqual(requestedTypeUUID, kCMIOHardwarePlugInTypeID))
|
if (!CFEqual(requestedTypeUUID, kCMIOHardwarePlugInTypeID))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -29,12 +29,6 @@
|
||||||
#include "VCamUtils/src/ipcbridge.h"
|
#include "VCamUtils/src/ipcbridge.h"
|
||||||
#include "VCamUtils/src/logger/logger.h"
|
#include "VCamUtils/src/logger/logger.h"
|
||||||
|
|
||||||
#define AkPluginPrivateIntefaceLog() \
|
|
||||||
AkLoggerLog("PluginInterfacePrivate::", __FUNCTION__, "()")
|
|
||||||
|
|
||||||
#define AkPluginPrivateIntefaceLogID(x) \
|
|
||||||
AkLoggerLog("PluginInterfacePrivate::", __FUNCTION__, "(id = ", x, ")")
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
struct PluginInterfacePrivate
|
struct PluginInterfacePrivate
|
||||||
|
@ -165,7 +159,7 @@ AkVCam::PluginInterface::PluginInterface():
|
||||||
auto homePath = std::string("/Users/") + getenv("USER");
|
auto homePath = std::string("/Users/") + getenv("USER");
|
||||||
|
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << CMIO_DAEMONS_PATH << "/" << AKVCAM_ASSISTANT_NAME << ".plist";
|
ss << CMIO_DAEMONS_PATH << "/" << CMIO_ASSISTANT_NAME << ".plist";
|
||||||
auto daemon = ss.str();
|
auto daemon = ss.str();
|
||||||
|
|
||||||
if (daemon[0] == '~')
|
if (daemon[0] == '~')
|
||||||
|
@ -201,7 +195,7 @@ CMIOObjectID AkVCam::PluginInterface::objectID() const
|
||||||
|
|
||||||
CMIOHardwarePlugInRef AkVCam::PluginInterface::create()
|
CMIOHardwarePlugInRef AkVCam::PluginInterface::create()
|
||||||
{
|
{
|
||||||
AkLoggerLog("Creating plugin interface.");
|
AkLogFunction();
|
||||||
|
|
||||||
auto pluginInterface = new PluginInterface();
|
auto pluginInterface = new PluginInterface();
|
||||||
pluginInterface->d->AddRef(pluginInterface->d);
|
pluginInterface->d->AddRef(pluginInterface->d);
|
||||||
|
@ -220,14 +214,14 @@ AkVCam::Object *AkVCam::PluginInterface::findObject(CMIOObjectID objectID)
|
||||||
|
|
||||||
HRESULT AkVCam::PluginInterface::QueryInterface(REFIID uuid, LPVOID *interface)
|
HRESULT AkVCam::PluginInterface::QueryInterface(REFIID uuid, LPVOID *interface)
|
||||||
{
|
{
|
||||||
|
AkLogFunction();
|
||||||
|
|
||||||
if (!interface)
|
if (!interface)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
AkLoggerLog("AkVCam::PluginInterface::QueryInterface");
|
|
||||||
|
|
||||||
if (uuidEqual(uuid, kCMIOHardwarePlugInInterfaceID)
|
if (uuidEqual(uuid, kCMIOHardwarePlugInInterfaceID)
|
||||||
|| uuidEqual(uuid, IUnknownUUID)) {
|
|| uuidEqual(uuid, IUnknownUUID)) {
|
||||||
AkLoggerLog("Found plugin interface.");
|
AkLogInfo() << "Found plugin interface." << std::endl;
|
||||||
this->d->AddRef(this->d);
|
this->d->AddRef(this->d);
|
||||||
*interface = this->d;
|
*interface = this->d;
|
||||||
|
|
||||||
|
@ -239,27 +233,18 @@ HRESULT AkVCam::PluginInterface::QueryInterface(REFIID uuid, LPVOID *interface)
|
||||||
|
|
||||||
OSStatus AkVCam::PluginInterface::Initialize()
|
OSStatus AkVCam::PluginInterface::Initialize()
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::Initialize");
|
AkLogFunction();
|
||||||
|
|
||||||
return this->InitializeWithObjectID(kCMIOObjectUnknown);
|
return this->InitializeWithObjectID(kCMIOObjectUnknown);
|
||||||
}
|
}
|
||||||
|
|
||||||
OSStatus AkVCam::PluginInterface::InitializeWithObjectID(CMIOObjectID objectID)
|
OSStatus AkVCam::PluginInterface::InitializeWithObjectID(CMIOObjectID objectID)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::InitializeWithObjectID: ", objectID);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << objectID << std::endl;
|
||||||
|
|
||||||
this->m_objectID = objectID;
|
this->m_objectID = objectID;
|
||||||
|
|
||||||
#if defined(QT_DEBUG) && 0
|
|
||||||
std::vector<VideoFormat> formats {
|
|
||||||
{PixelFormatRGB32, 640, 480, {30.0}}
|
|
||||||
};
|
|
||||||
|
|
||||||
this->createDevice("org.webcamoid.cmio.AkVCam.Driver.Debug",
|
|
||||||
"Virtual Debug Camera (driver side)",
|
|
||||||
formats);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (auto deviceId: this->d->m_ipcBridge.listDevices())
|
for (auto deviceId: this->d->m_ipcBridge.listDevices())
|
||||||
this->deviceAdded(this, deviceId);
|
this->deviceAdded(this, deviceId);
|
||||||
|
|
||||||
|
@ -268,7 +253,7 @@ OSStatus AkVCam::PluginInterface::InitializeWithObjectID(CMIOObjectID objectID)
|
||||||
|
|
||||||
OSStatus AkVCam::PluginInterface::Teardown()
|
OSStatus AkVCam::PluginInterface::Teardown()
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::Teardown");
|
AkLogFunction();
|
||||||
|
|
||||||
return kCMIOHardwareNoError;
|
return kCMIOHardwareNoError;
|
||||||
}
|
}
|
||||||
|
@ -276,7 +261,7 @@ OSStatus AkVCam::PluginInterface::Teardown()
|
||||||
void AkVCam::PluginInterface::serverStateChanged(void *userData,
|
void AkVCam::PluginInterface::serverStateChanged(void *userData,
|
||||||
IpcBridge::ServerState state)
|
IpcBridge::ServerState state)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::frameReady");
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<PluginInterface *>(userData);
|
auto self = reinterpret_cast<PluginInterface *>(userData);
|
||||||
|
|
||||||
for (auto device: self->m_devices)
|
for (auto device: self->m_devices)
|
||||||
|
@ -289,8 +274,8 @@ void AkVCam::PluginInterface::serverStateChanged(void *userData,
|
||||||
void AkVCam::PluginInterface::deviceAdded(void *userData,
|
void AkVCam::PluginInterface::deviceAdded(void *userData,
|
||||||
const std::string &deviceId)
|
const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::deviceAdded");
|
AkLogFunction();
|
||||||
AkLoggerLog("Device Added: ", deviceId);
|
AkLogInfo() << "Device Added: " << deviceId << std::endl;
|
||||||
|
|
||||||
auto self = reinterpret_cast<PluginInterface *>(userData);
|
auto self = reinterpret_cast<PluginInterface *>(userData);
|
||||||
auto description = self->d->m_ipcBridge.description(deviceId);
|
auto description = self->d->m_ipcBridge.description(deviceId);
|
||||||
|
@ -302,8 +287,8 @@ void AkVCam::PluginInterface::deviceAdded(void *userData,
|
||||||
void AkVCam::PluginInterface::deviceRemoved(void *userData,
|
void AkVCam::PluginInterface::deviceRemoved(void *userData,
|
||||||
const std::string &deviceId)
|
const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::deviceRemoved");
|
AkLogFunction();
|
||||||
AkLoggerLog("Device Removed: ", deviceId);
|
AkLogInfo() << "Device Removed: " << deviceId << std::endl;
|
||||||
|
|
||||||
auto self = reinterpret_cast<PluginInterface *>(userData);
|
auto self = reinterpret_cast<PluginInterface *>(userData);
|
||||||
self->destroyDevice(deviceId);
|
self->destroyDevice(deviceId);
|
||||||
|
@ -313,7 +298,7 @@ void AkVCam::PluginInterface::frameReady(void *userData,
|
||||||
const std::string &deviceId,
|
const std::string &deviceId,
|
||||||
const VideoFrame &frame)
|
const VideoFrame &frame)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::frameReady");
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<PluginInterface *>(userData);
|
auto self = reinterpret_cast<PluginInterface *>(userData);
|
||||||
|
|
||||||
for (auto device: self->m_devices)
|
for (auto device: self->m_devices)
|
||||||
|
@ -325,9 +310,9 @@ void AkVCam::PluginInterface::setBroadcasting(void *userData,
|
||||||
const std::string &deviceId,
|
const std::string &deviceId,
|
||||||
const std::string &broadcaster)
|
const std::string &broadcaster)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::setBroadcasting");
|
AkLogFunction();
|
||||||
AkLoggerLog("Device: ", deviceId);
|
AkLogInfo() << "Device: " << deviceId << std::endl;
|
||||||
AkLoggerLog("Broadcaster: ", broadcaster);
|
AkLogInfo() << "Broadcaster: " << broadcaster << std::endl;
|
||||||
auto self = reinterpret_cast<PluginInterface *>(userData);
|
auto self = reinterpret_cast<PluginInterface *>(userData);
|
||||||
|
|
||||||
for (auto device: self->m_devices)
|
for (auto device: self->m_devices)
|
||||||
|
@ -340,7 +325,7 @@ void AkVCam::PluginInterface::setMirror(void *userData,
|
||||||
bool horizontalMirror,
|
bool horizontalMirror,
|
||||||
bool verticalMirror)
|
bool verticalMirror)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::setMirror");
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<PluginInterface *>(userData);
|
auto self = reinterpret_cast<PluginInterface *>(userData);
|
||||||
|
|
||||||
for (auto device: self->m_devices)
|
for (auto device: self->m_devices)
|
||||||
|
@ -352,7 +337,7 @@ void AkVCam::PluginInterface::setScaling(void *userData,
|
||||||
const std::string &deviceId,
|
const std::string &deviceId,
|
||||||
Scaling scaling)
|
Scaling scaling)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::setScaling");
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<PluginInterface *>(userData);
|
auto self = reinterpret_cast<PluginInterface *>(userData);
|
||||||
|
|
||||||
for (auto device: self->m_devices)
|
for (auto device: self->m_devices)
|
||||||
|
@ -364,7 +349,7 @@ void AkVCam::PluginInterface::setAspectRatio(void *userData,
|
||||||
const std::string &deviceId,
|
const std::string &deviceId,
|
||||||
AspectRatio aspectRatio)
|
AspectRatio aspectRatio)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::setAspectRatio");
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<PluginInterface *>(userData);
|
auto self = reinterpret_cast<PluginInterface *>(userData);
|
||||||
|
|
||||||
for (auto device: self->m_devices)
|
for (auto device: self->m_devices)
|
||||||
|
@ -376,7 +361,7 @@ void AkVCam::PluginInterface::setSwapRgb(void *userData,
|
||||||
const std::string &deviceId,
|
const std::string &deviceId,
|
||||||
bool swap)
|
bool swap)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::setSwapRgb");
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<PluginInterface *>(userData);
|
auto self = reinterpret_cast<PluginInterface *>(userData);
|
||||||
|
|
||||||
for (auto device: self->m_devices)
|
for (auto device: self->m_devices)
|
||||||
|
@ -387,7 +372,7 @@ void AkVCam::PluginInterface::setSwapRgb(void *userData,
|
||||||
void AkVCam::PluginInterface::addListener(void *userData,
|
void AkVCam::PluginInterface::addListener(void *userData,
|
||||||
const std::string &deviceId)
|
const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::addListener");
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<PluginInterface *>(userData);
|
auto self = reinterpret_cast<PluginInterface *>(userData);
|
||||||
self->d->m_ipcBridge.addListener(deviceId);
|
self->d->m_ipcBridge.addListener(deviceId);
|
||||||
}
|
}
|
||||||
|
@ -395,7 +380,7 @@ void AkVCam::PluginInterface::addListener(void *userData,
|
||||||
void AkVCam::PluginInterface::removeListener(void *userData,
|
void AkVCam::PluginInterface::removeListener(void *userData,
|
||||||
const std::string &deviceId)
|
const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::removeListener");
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<PluginInterface *>(userData);
|
auto self = reinterpret_cast<PluginInterface *>(userData);
|
||||||
self->d->m_ipcBridge.removeListener(deviceId);
|
self->d->m_ipcBridge.removeListener(deviceId);
|
||||||
}
|
}
|
||||||
|
@ -404,8 +389,7 @@ bool AkVCam::PluginInterface::createDevice(const std::string &deviceId,
|
||||||
const std::wstring &description,
|
const std::wstring &description,
|
||||||
const std::vector<VideoFormat> &formats)
|
const std::vector<VideoFormat> &formats)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::createDevice");
|
AkLogFunction();
|
||||||
|
|
||||||
StreamPtr stream;
|
StreamPtr stream;
|
||||||
|
|
||||||
// Create one device.
|
// Create one device.
|
||||||
|
@ -488,7 +472,7 @@ createDevice_failed:
|
||||||
|
|
||||||
void AkVCam::PluginInterface::destroyDevice(const std::string &deviceId)
|
void AkVCam::PluginInterface::destroyDevice(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::PluginInterface::destroyDevice");
|
AkLogFunction();
|
||||||
|
|
||||||
for (auto it = this->m_devices.begin(); it != this->m_devices.end(); it++) {
|
for (auto it = this->m_devices.begin(); it != this->m_devices.end(); it++) {
|
||||||
auto device = *it;
|
auto device = *it;
|
||||||
|
@ -524,7 +508,7 @@ HRESULT AkVCam::PluginInterfacePrivate::QueryInterface(void *self,
|
||||||
REFIID uuid,
|
REFIID uuid,
|
||||||
LPVOID *interface)
|
LPVOID *interface)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLog();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
@ -536,7 +520,7 @@ HRESULT AkVCam::PluginInterfacePrivate::QueryInterface(void *self,
|
||||||
|
|
||||||
ULONG AkVCam::PluginInterfacePrivate::AddRef(void *self)
|
ULONG AkVCam::PluginInterfacePrivate::AddRef(void *self)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLog();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -549,7 +533,7 @@ ULONG AkVCam::PluginInterfacePrivate::AddRef(void *self)
|
||||||
|
|
||||||
ULONG AkVCam::PluginInterfacePrivate::Release(void *self)
|
ULONG AkVCam::PluginInterfacePrivate::Release(void *self)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLog();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -571,7 +555,7 @@ ULONG AkVCam::PluginInterfacePrivate::Release(void *self)
|
||||||
|
|
||||||
OSStatus AkVCam::PluginInterfacePrivate::Initialize(CMIOHardwarePlugInRef self)
|
OSStatus AkVCam::PluginInterfacePrivate::Initialize(CMIOHardwarePlugInRef self)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLog();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
return kCMIOHardwareUnspecifiedError;
|
return kCMIOHardwareUnspecifiedError;
|
||||||
|
@ -584,7 +568,7 @@ OSStatus AkVCam::PluginInterfacePrivate::Initialize(CMIOHardwarePlugInRef self)
|
||||||
OSStatus AkVCam::PluginInterfacePrivate::InitializeWithObjectID(CMIOHardwarePlugInRef self,
|
OSStatus AkVCam::PluginInterfacePrivate::InitializeWithObjectID(CMIOHardwarePlugInRef self,
|
||||||
CMIOObjectID objectID)
|
CMIOObjectID objectID)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLog();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
return kCMIOHardwareUnspecifiedError;
|
return kCMIOHardwareUnspecifiedError;
|
||||||
|
@ -596,7 +580,7 @@ OSStatus AkVCam::PluginInterfacePrivate::InitializeWithObjectID(CMIOHardwarePlug
|
||||||
|
|
||||||
OSStatus AkVCam::PluginInterfacePrivate::Teardown(CMIOHardwarePlugInRef self)
|
OSStatus AkVCam::PluginInterfacePrivate::Teardown(CMIOHardwarePlugInRef self)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLog();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
return kCMIOHardwareUnspecifiedError;
|
return kCMIOHardwareUnspecifiedError;
|
||||||
|
@ -609,7 +593,8 @@ OSStatus AkVCam::PluginInterfacePrivate::Teardown(CMIOHardwarePlugInRef self)
|
||||||
void AkVCam::PluginInterfacePrivate::ObjectShow(CMIOHardwarePlugInRef self,
|
void AkVCam::PluginInterfacePrivate::ObjectShow(CMIOHardwarePlugInRef self,
|
||||||
CMIOObjectID objectID)
|
CMIOObjectID objectID)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(objectID);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "ObjectID " << objectID << std::endl;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
return;
|
return;
|
||||||
|
@ -626,7 +611,8 @@ Boolean AkVCam::PluginInterfacePrivate::ObjectHasProperty(CMIOHardwarePlugInRef
|
||||||
CMIOObjectID objectID,
|
CMIOObjectID objectID,
|
||||||
const CMIOObjectPropertyAddress *address)
|
const CMIOObjectPropertyAddress *address)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(objectID);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "ObjectID " << objectID << std::endl;
|
||||||
Boolean result = false;
|
Boolean result = false;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
@ -647,7 +633,8 @@ OSStatus AkVCam::PluginInterfacePrivate::ObjectIsPropertySettable(CMIOHardwarePl
|
||||||
const CMIOObjectPropertyAddress *address,
|
const CMIOObjectPropertyAddress *address,
|
||||||
Boolean *isSettable)
|
Boolean *isSettable)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(objectID);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "ObjectID " << objectID << std::endl;
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
@ -672,7 +659,8 @@ OSStatus AkVCam::PluginInterfacePrivate::ObjectGetPropertyDataSize(CMIOHardwareP
|
||||||
const void *qualifierData,
|
const void *qualifierData,
|
||||||
UInt32 *dataSize)
|
UInt32 *dataSize)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(objectID);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "ObjectID " << objectID << std::endl;
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
@ -703,7 +691,8 @@ OSStatus AkVCam::PluginInterfacePrivate::ObjectGetPropertyData(CMIOHardwarePlugI
|
||||||
UInt32 *dataUsed,
|
UInt32 *dataUsed,
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(objectID);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "ObjectID " << objectID << std::endl;
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
@ -737,7 +726,8 @@ OSStatus AkVCam::PluginInterfacePrivate::ObjectSetPropertyData(CMIOHardwarePlugI
|
||||||
UInt32 dataSize,
|
UInt32 dataSize,
|
||||||
const void *data)
|
const void *data)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(objectID);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "ObjectID " << objectID << std::endl;
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
@ -764,7 +754,8 @@ OSStatus AkVCam::PluginInterfacePrivate::ObjectSetPropertyData(CMIOHardwarePlugI
|
||||||
OSStatus AkVCam::PluginInterfacePrivate::DeviceSuspend(CMIOHardwarePlugInRef self,
|
OSStatus AkVCam::PluginInterfacePrivate::DeviceSuspend(CMIOHardwarePlugInRef self,
|
||||||
CMIODeviceID device)
|
CMIODeviceID device)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(device);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "DeviceID " << device << std::endl;
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
@ -782,7 +773,8 @@ OSStatus AkVCam::PluginInterfacePrivate::DeviceSuspend(CMIOHardwarePlugInRef sel
|
||||||
OSStatus AkVCam::PluginInterfacePrivate::DeviceResume(CMIOHardwarePlugInRef self,
|
OSStatus AkVCam::PluginInterfacePrivate::DeviceResume(CMIOHardwarePlugInRef self,
|
||||||
CMIODeviceID device)
|
CMIODeviceID device)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(device);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "DeviceID " << device << std::endl;
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
@ -801,7 +793,8 @@ OSStatus AkVCam::PluginInterfacePrivate::DeviceStartStream(CMIOHardwarePlugInRef
|
||||||
CMIODeviceID device,
|
CMIODeviceID device,
|
||||||
CMIOStreamID stream)
|
CMIOStreamID stream)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(device);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "DeviceID " << device << std::endl;
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
@ -820,7 +813,8 @@ OSStatus AkVCam::PluginInterfacePrivate::DeviceStopStream(CMIOHardwarePlugInRef
|
||||||
CMIODeviceID device,
|
CMIODeviceID device,
|
||||||
CMIOStreamID stream)
|
CMIOStreamID stream)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(device);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "DeviceID " << device << std::endl;
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
@ -839,7 +833,8 @@ OSStatus AkVCam::PluginInterfacePrivate::DeviceProcessAVCCommand(CMIOHardwarePlu
|
||||||
CMIODeviceID device,
|
CMIODeviceID device,
|
||||||
CMIODeviceAVCCommand *ioAVCCommand)
|
CMIODeviceAVCCommand *ioAVCCommand)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(device);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "DeviceID " << device << std::endl;
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
@ -858,7 +853,8 @@ OSStatus AkVCam::PluginInterfacePrivate::DeviceProcessRS422Command(CMIOHardwareP
|
||||||
CMIODeviceID device,
|
CMIODeviceID device,
|
||||||
CMIODeviceRS422Command *ioRS422Command)
|
CMIODeviceRS422Command *ioRS422Command)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(device);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "DeviceID " << device << std::endl;
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
@ -879,7 +875,8 @@ OSStatus AkVCam::PluginInterfacePrivate::StreamCopyBufferQueue(CMIOHardwarePlugI
|
||||||
void *queueAlteredRefCon,
|
void *queueAlteredRefCon,
|
||||||
CMSimpleQueueRef *queue)
|
CMSimpleQueueRef *queue)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(stream);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "StreamID " << stream << std::endl;
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
@ -899,7 +896,8 @@ OSStatus AkVCam::PluginInterfacePrivate::StreamCopyBufferQueue(CMIOHardwarePlugI
|
||||||
OSStatus AkVCam::PluginInterfacePrivate::StreamDeckPlay(CMIOHardwarePlugInRef self,
|
OSStatus AkVCam::PluginInterfacePrivate::StreamDeckPlay(CMIOHardwarePlugInRef self,
|
||||||
CMIOStreamID stream)
|
CMIOStreamID stream)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(stream);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "StreamID " << stream << std::endl;
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
@ -917,7 +915,8 @@ OSStatus AkVCam::PluginInterfacePrivate::StreamDeckPlay(CMIOHardwarePlugInRef se
|
||||||
OSStatus AkVCam::PluginInterfacePrivate::StreamDeckStop(CMIOHardwarePlugInRef self,
|
OSStatus AkVCam::PluginInterfacePrivate::StreamDeckStop(CMIOHardwarePlugInRef self,
|
||||||
CMIOStreamID stream)
|
CMIOStreamID stream)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(stream);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "StreamID " << stream << std::endl;
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
@ -936,7 +935,8 @@ OSStatus AkVCam::PluginInterfacePrivate::StreamDeckJog(CMIOHardwarePlugInRef sel
|
||||||
CMIOStreamID stream,
|
CMIOStreamID stream,
|
||||||
SInt32 speed)
|
SInt32 speed)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(stream);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "StreamID " << stream << std::endl;
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
@ -956,7 +956,8 @@ OSStatus AkVCam::PluginInterfacePrivate::StreamDeckCueTo(CMIOHardwarePlugInRef s
|
||||||
Float64 frameNumber,
|
Float64 frameNumber,
|
||||||
Boolean playOnCue)
|
Boolean playOnCue)
|
||||||
{
|
{
|
||||||
AkPluginPrivateIntefaceLogID(stream);
|
AkLogFunction();
|
||||||
|
AkLogInfo() << "StreamID " << stream << std::endl;
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!self)
|
if (!self)
|
||||||
|
|
|
@ -99,7 +99,7 @@ AkVCam::Stream::~Stream()
|
||||||
|
|
||||||
OSStatus AkVCam::Stream::createObject()
|
OSStatus AkVCam::Stream::createObject()
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->m_pluginInterface
|
if (!this->m_pluginInterface
|
||||||
|| !*this->m_pluginInterface
|
|| !*this->m_pluginInterface
|
||||||
|
@ -117,7 +117,7 @@ OSStatus AkVCam::Stream::createObject()
|
||||||
if (status == kCMIOHardwareNoError) {
|
if (status == kCMIOHardwareNoError) {
|
||||||
this->m_isCreated = true;
|
this->m_isCreated = true;
|
||||||
this->m_objectID = streamID;
|
this->m_objectID = streamID;
|
||||||
AkLoggerLog("Created stream: ", this->m_objectID);
|
AkLogInfo() << "Created stream: " << this->m_objectID << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
|
@ -125,7 +125,7 @@ OSStatus AkVCam::Stream::createObject()
|
||||||
|
|
||||||
OSStatus AkVCam::Stream::registerObject(bool regist)
|
OSStatus AkVCam::Stream::registerObject(bool regist)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
OSStatus status = kCMIOHardwareUnspecifiedError;
|
OSStatus status = kCMIOHardwareUnspecifiedError;
|
||||||
|
|
||||||
if (!this->m_isCreated
|
if (!this->m_isCreated
|
||||||
|
@ -155,7 +155,7 @@ OSStatus AkVCam::Stream::registerObject(bool regist)
|
||||||
|
|
||||||
void AkVCam::Stream::setFormats(const std::vector<VideoFormat> &formats)
|
void AkVCam::Stream::setFormats(const std::vector<VideoFormat> &formats)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (formats.empty())
|
if (formats.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -174,15 +174,14 @@ void AkVCam::Stream::setFormats(const std::vector<VideoFormat> &formats)
|
||||||
formatsAdjusted.push_back(format);
|
formatsAdjusted.push_back(format);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
|
||||||
for (auto &format: formatsAdjusted)
|
for (auto &format: formatsAdjusted)
|
||||||
AkLoggerLog("Format: ",
|
AkLogInfo() << "Format: "
|
||||||
enumToString(format.fourcc()),
|
<< enumToString(format.fourcc())
|
||||||
" ",
|
<< " "
|
||||||
format.width(),
|
<< format.width()
|
||||||
"x",
|
<< "x"
|
||||||
format.height());
|
<< format.height()
|
||||||
#endif
|
<< std::endl;
|
||||||
|
|
||||||
this->m_properties.setProperty(kCMIOStreamPropertyFormatDescriptions,
|
this->m_properties.setProperty(kCMIOStreamPropertyFormatDescriptions,
|
||||||
formatsAdjusted);
|
formatsAdjusted);
|
||||||
|
@ -191,7 +190,7 @@ void AkVCam::Stream::setFormats(const std::vector<VideoFormat> &formats)
|
||||||
|
|
||||||
void AkVCam::Stream::setFormat(const VideoFormat &format)
|
void AkVCam::Stream::setFormat(const VideoFormat &format)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
this->m_properties.setProperty(kCMIOStreamPropertyFormatDescription,
|
this->m_properties.setProperty(kCMIOStreamPropertyFormatDescription,
|
||||||
format);
|
format);
|
||||||
this->m_properties.setProperty(kCMIOStreamPropertyFrameRates,
|
this->m_properties.setProperty(kCMIOStreamPropertyFrameRates,
|
||||||
|
@ -213,7 +212,7 @@ void AkVCam::Stream::setFrameRate(const Fraction &frameRate)
|
||||||
|
|
||||||
bool AkVCam::Stream::start()
|
bool AkVCam::Stream::start()
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_running)
|
if (this->d->m_running)
|
||||||
return false;
|
return false;
|
||||||
|
@ -223,14 +222,14 @@ bool AkVCam::Stream::start()
|
||||||
this->d->m_sequence = 0;
|
this->d->m_sequence = 0;
|
||||||
memset(&this->d->m_pts, 0, sizeof(CMTime));
|
memset(&this->d->m_pts, 0, sizeof(CMTime));
|
||||||
this->d->m_running = this->d->startTimer();
|
this->d->m_running = this->d->startTimer();
|
||||||
AkLoggerLog("Running: ", this->d->m_running);
|
AkLogInfo() << "Running: " << this->d->m_running << std::endl;
|
||||||
|
|
||||||
return this->d->m_running;
|
return this->d->m_running;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::Stream::stop()
|
void AkVCam::Stream::stop()
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_running)
|
if (!this->d->m_running)
|
||||||
return;
|
return;
|
||||||
|
@ -248,7 +247,7 @@ bool AkVCam::Stream::running()
|
||||||
|
|
||||||
void AkVCam::Stream::serverStateChanged(IpcBridge::ServerState state)
|
void AkVCam::Stream::serverStateChanged(IpcBridge::ServerState state)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (state == IpcBridge::ServerStateGone) {
|
if (state == IpcBridge::ServerStateGone) {
|
||||||
this->d->m_broadcaster.clear();
|
this->d->m_broadcaster.clear();
|
||||||
|
@ -267,9 +266,9 @@ void AkVCam::Stream::serverStateChanged(IpcBridge::ServerState state)
|
||||||
|
|
||||||
void AkVCam::Stream::frameReady(const AkVCam::VideoFrame &frame)
|
void AkVCam::Stream::frameReady(const AkVCam::VideoFrame &frame)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("Running: ", this->d->m_running);
|
AkLogInfo() << "Running: " << this->d->m_running << std::endl;
|
||||||
AkLoggerLog("Broadcaster: ", this->d->m_broadcaster);
|
AkLogInfo() << "Broadcaster: " << this->d->m_broadcaster << std::endl;
|
||||||
|
|
||||||
if (!this->d->m_running)
|
if (!this->d->m_running)
|
||||||
return;
|
return;
|
||||||
|
@ -284,7 +283,7 @@ void AkVCam::Stream::frameReady(const AkVCam::VideoFrame &frame)
|
||||||
|
|
||||||
void AkVCam::Stream::setBroadcasting(const std::string &broadcaster)
|
void AkVCam::Stream::setBroadcasting(const std::string &broadcaster)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_broadcaster == broadcaster)
|
if (this->d->m_broadcaster == broadcaster)
|
||||||
return;
|
return;
|
||||||
|
@ -300,7 +299,7 @@ void AkVCam::Stream::setBroadcasting(const std::string &broadcaster)
|
||||||
|
|
||||||
void AkVCam::Stream::setMirror(bool horizontalMirror, bool verticalMirror)
|
void AkVCam::Stream::setMirror(bool horizontalMirror, bool verticalMirror)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_horizontalMirror == horizontalMirror
|
if (this->d->m_horizontalMirror == horizontalMirror
|
||||||
&& this->d->m_verticalMirror == verticalMirror)
|
&& this->d->m_verticalMirror == verticalMirror)
|
||||||
|
@ -313,7 +312,7 @@ void AkVCam::Stream::setMirror(bool horizontalMirror, bool verticalMirror)
|
||||||
|
|
||||||
void AkVCam::Stream::setScaling(Scaling scaling)
|
void AkVCam::Stream::setScaling(Scaling scaling)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_scaling == scaling)
|
if (this->d->m_scaling == scaling)
|
||||||
return;
|
return;
|
||||||
|
@ -324,7 +323,7 @@ void AkVCam::Stream::setScaling(Scaling scaling)
|
||||||
|
|
||||||
void AkVCam::Stream::setAspectRatio(AspectRatio aspectRatio)
|
void AkVCam::Stream::setAspectRatio(AspectRatio aspectRatio)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_aspectRatio == aspectRatio)
|
if (this->d->m_aspectRatio == aspectRatio)
|
||||||
return;
|
return;
|
||||||
|
@ -335,7 +334,7 @@ void AkVCam::Stream::setAspectRatio(AspectRatio aspectRatio)
|
||||||
|
|
||||||
void AkVCam::Stream::setSwapRgb(bool swap)
|
void AkVCam::Stream::setSwapRgb(bool swap)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_swapRgb == swap)
|
if (this->d->m_swapRgb == swap)
|
||||||
return;
|
return;
|
||||||
|
@ -348,7 +347,7 @@ OSStatus AkVCam::Stream::copyBufferQueue(CMIODeviceStreamQueueAlteredProc queueA
|
||||||
void *queueAlteredRefCon,
|
void *queueAlteredRefCon,
|
||||||
CMSimpleQueueRef *queue)
|
CMSimpleQueueRef *queue)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->d->m_queueAltered = queueAlteredProc;
|
this->d->m_queueAltered = queueAlteredProc;
|
||||||
this->d->m_queueAlteredRefCon = queueAlteredRefCon;
|
this->d->m_queueAlteredRefCon = queueAlteredRefCon;
|
||||||
|
@ -362,39 +361,35 @@ OSStatus AkVCam::Stream::copyBufferQueue(CMIODeviceStreamQueueAlteredProc queueA
|
||||||
|
|
||||||
OSStatus AkVCam::Stream::deckPlay()
|
OSStatus AkVCam::Stream::deckPlay()
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
AkLogDebug() << "STUB" << std::endl;
|
||||||
AkLoggerLog("STUB");
|
|
||||||
|
|
||||||
return kCMIOHardwareUnspecifiedError;
|
return kCMIOHardwareUnspecifiedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSStatus AkVCam::Stream::deckStop()
|
OSStatus AkVCam::Stream::deckStop()
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
AkLogFunction();
|
||||||
|
AkLogDebug() << "STUB" << std::endl;
|
||||||
AkLoggerLog("STUB");
|
|
||||||
|
|
||||||
return kCMIOHardwareUnspecifiedError;
|
return kCMIOHardwareUnspecifiedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSStatus AkVCam::Stream::deckJog(SInt32 speed)
|
OSStatus AkVCam::Stream::deckJog(SInt32 speed)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
|
||||||
UNUSED(speed)
|
UNUSED(speed)
|
||||||
|
AkLogFunction();
|
||||||
AkLoggerLog("STUB");
|
AkLogDebug() << "STUB" << std::endl;
|
||||||
|
|
||||||
return kCMIOHardwareUnspecifiedError;
|
return kCMIOHardwareUnspecifiedError;
|
||||||
}
|
}
|
||||||
|
|
||||||
OSStatus AkVCam::Stream::deckCueTo(Float64 frameNumber, Boolean playOnCue)
|
OSStatus AkVCam::Stream::deckCueTo(Float64 frameNumber, Boolean playOnCue)
|
||||||
{
|
{
|
||||||
AkObjectLogMethod();
|
|
||||||
UNUSED(frameNumber)
|
UNUSED(frameNumber)
|
||||||
UNUSED(playOnCue)
|
UNUSED(playOnCue)
|
||||||
|
AkLogFunction();
|
||||||
AkLoggerLog("STUB");
|
AkLogDebug() << "STUB" << std::endl;
|
||||||
|
|
||||||
return kCMIOHardwareUnspecifiedError;
|
return kCMIOHardwareUnspecifiedError;
|
||||||
}
|
}
|
||||||
|
@ -406,7 +401,7 @@ AkVCam::StreamPrivate::StreamPrivate(AkVCam::Stream *self):
|
||||||
|
|
||||||
bool AkVCam::StreamPrivate::startTimer()
|
bool AkVCam::StreamPrivate::startTimer()
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::StreamPrivate::startTimer()");
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->m_timer)
|
if (this->m_timer)
|
||||||
return false;
|
return false;
|
||||||
|
@ -437,7 +432,7 @@ bool AkVCam::StreamPrivate::startTimer()
|
||||||
|
|
||||||
void AkVCam::StreamPrivate::stopTimer()
|
void AkVCam::StreamPrivate::stopTimer()
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::StreamPrivate::stopTimer()");
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->m_timer)
|
if (!this->m_timer)
|
||||||
return;
|
return;
|
||||||
|
@ -452,11 +447,11 @@ void AkVCam::StreamPrivate::stopTimer()
|
||||||
|
|
||||||
void AkVCam::StreamPrivate::streamLoop(CFRunLoopTimerRef timer, void *info)
|
void AkVCam::StreamPrivate::streamLoop(CFRunLoopTimerRef timer, void *info)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::StreamPrivate::streamLoop()");
|
|
||||||
UNUSED(timer)
|
UNUSED(timer)
|
||||||
|
AkLogFunction();
|
||||||
|
|
||||||
auto self = reinterpret_cast<StreamPrivate *>(info);
|
auto self = reinterpret_cast<StreamPrivate *>(info);
|
||||||
AkLoggerLog("Running: ", self->m_running);
|
AkLogInfo() << "Running: " << self->m_running << std::endl;
|
||||||
|
|
||||||
if (!self->m_running)
|
if (!self->m_running)
|
||||||
return;
|
return;
|
||||||
|
@ -473,7 +468,7 @@ void AkVCam::StreamPrivate::streamLoop(CFRunLoopTimerRef timer, void *info)
|
||||||
|
|
||||||
void AkVCam::StreamPrivate::sendFrame(const VideoFrame &frame)
|
void AkVCam::StreamPrivate::sendFrame(const VideoFrame &frame)
|
||||||
{
|
{
|
||||||
AkLoggerLog("AkVCam::StreamPrivate::sendFrame()");
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->m_queue->fullness() >= 1.0f)
|
if (this->m_queue->fullness() >= 1.0f)
|
||||||
return;
|
return;
|
||||||
|
@ -482,12 +477,13 @@ void AkVCam::StreamPrivate::sendFrame(const VideoFrame &frame)
|
||||||
int width = frame.format().width();
|
int width = frame.format().width();
|
||||||
int height = frame.format().height();
|
int height = frame.format().height();
|
||||||
|
|
||||||
AkLoggerLog("Sending Frame: ",
|
AkLogInfo() << "Sending Frame: "
|
||||||
enumToString(fourcc),
|
<< enumToString(fourcc)
|
||||||
" ",
|
<< " "
|
||||||
width,
|
<< width
|
||||||
"x",
|
<< "x"
|
||||||
height);
|
<< height
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
bool resync = false;
|
bool resync = false;
|
||||||
auto hostTime = CFAbsoluteTimeGetCurrent();
|
auto hostTime = CFAbsoluteTimeGetCurrent();
|
||||||
|
|
|
@ -30,6 +30,8 @@ isEmpty(CMIO_PLUGIN_VENDOR):
|
||||||
CMIO_PLUGIN_VENDOR = "Webcamoid Project"
|
CMIO_PLUGIN_VENDOR = "Webcamoid Project"
|
||||||
isEmpty(CMIO_PLUGIN_PRODUCT):
|
isEmpty(CMIO_PLUGIN_PRODUCT):
|
||||||
CMIO_PLUGIN_PRODUCT = $$CMIO_PLUGIN_NAME
|
CMIO_PLUGIN_PRODUCT = $$CMIO_PLUGIN_NAME
|
||||||
|
isEmpty(CMIO_ASSISTANT_NAME):
|
||||||
|
CMIO_ASSISTANT_NAME = "org.webcamoid.cmio.AkVCam.Assistant"
|
||||||
|
|
||||||
DEFINES += \
|
DEFINES += \
|
||||||
CMIO_PLUGINS_DAL_PATH=\"\\\"$$CMIO_PLUGINS_DAL_PATH\\\"\" \
|
CMIO_PLUGINS_DAL_PATH=\"\\\"$$CMIO_PLUGINS_DAL_PATH\\\"\" \
|
||||||
|
@ -41,4 +43,5 @@ DEFINES += \
|
||||||
CMIO_PLUGIN_ASSISTANT_NAME_L=\"L\\\"$$CMIO_PLUGIN_ASSISTANT_NAME\\\"\" \
|
CMIO_PLUGIN_ASSISTANT_NAME_L=\"L\\\"$$CMIO_PLUGIN_ASSISTANT_NAME\\\"\" \
|
||||||
CMIO_PLUGIN_DEVICE_PREFIX=\"\\\"$$CMIO_PLUGIN_DEVICE_PREFIX\\\"\" \
|
CMIO_PLUGIN_DEVICE_PREFIX=\"\\\"$$CMIO_PLUGIN_DEVICE_PREFIX\\\"\" \
|
||||||
CMIO_PLUGIN_VENDOR=\"\\\"$$CMIO_PLUGIN_VENDOR\\\"\" \
|
CMIO_PLUGIN_VENDOR=\"\\\"$$CMIO_PLUGIN_VENDOR\\\"\" \
|
||||||
CMIO_PLUGIN_PRODUCT=\"\\\"$$CMIO_PLUGIN_PRODUCT\\\"\"
|
CMIO_PLUGIN_PRODUCT=\"\\\"$$CMIO_PLUGIN_PRODUCT\\\"\" \
|
||||||
|
CMIO_ASSISTANT_NAME=\"\\\"$$CMIO_ASSISTANT_NAME\\\"\"
|
||||||
|
|
|
@ -20,6 +20,7 @@ TEMPLATE = subdirs
|
||||||
CONFIG += ordered
|
CONFIG += ordered
|
||||||
|
|
||||||
SUBDIRS = \
|
SUBDIRS = \
|
||||||
|
PlatformUtils \
|
||||||
VCamIPC \
|
VCamIPC \
|
||||||
Assistant \
|
Assistant \
|
||||||
VirtualCamera
|
VirtualCamera
|
||||||
|
|
|
@ -65,7 +65,6 @@ COMPILER = $$join(COMPILER, _)
|
||||||
|
|
||||||
CONFIG(debug, debug|release) {
|
CONFIG(debug, debug|release) {
|
||||||
COMMONS_BUILD_PATH = debug/$${COMPILER}/$${TARGET_ARCH}
|
COMMONS_BUILD_PATH = debug/$${COMPILER}/$${TARGET_ARCH}
|
||||||
DEFINES += QT_DEBUG
|
|
||||||
} else {
|
} else {
|
||||||
COMMONS_BUILD_PATH = release/$$COMPILER/$${TARGET_ARCH}
|
COMMONS_BUILD_PATH = release/$$COMPILER/$${TARGET_ARCH}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ exists(commons.pri) {
|
||||||
}
|
}
|
||||||
|
|
||||||
include(../dshow.pri)
|
include(../dshow.pri)
|
||||||
include(../../VCamUtils/VCamUtils.pri)
|
|
||||||
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
CONFIG += console link_prl
|
CONFIG += console link_prl
|
||||||
|
|
|
@ -26,9 +26,14 @@
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
auto loglevel = AkVCam::regReadInt("loglevel", AKVCAM_LOGLEVEL_DEFAULT);
|
||||||
|
AkVCam::Logger::setLogLevel(loglevel);
|
||||||
auto temp = AkVCam::tempPath();
|
auto temp = AkVCam::tempPath();
|
||||||
AkLoggerStart(std::string(temp.begin(), temp.end())
|
auto logFile =
|
||||||
+ "\\" DSHOW_PLUGIN_ASSISTANT_NAME, "log");
|
AkVCam::regReadString("logfile",
|
||||||
|
std::string(temp.begin(), temp.end())
|
||||||
|
+ "\\" DSHOW_PLUGIN_ASSISTANT_NAME ".log");
|
||||||
|
AkVCam::Logger::setLogFile(logFile);
|
||||||
AkVCam::Service service;
|
AkVCam::Service service;
|
||||||
|
|
||||||
if (argc > 1) {
|
if (argc > 1) {
|
||||||
|
@ -49,7 +54,7 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AkLoggerLog("Setting service dispatcher");
|
AkLogInfo() << "Setting service dispatcher" << std::endl;
|
||||||
|
|
||||||
WCHAR serviceName[] = TEXT(DSHOW_PLUGIN_ASSISTANT_NAME);
|
WCHAR serviceName[] = TEXT(DSHOW_PLUGIN_ASSISTANT_NAME);
|
||||||
SERVICE_TABLE_ENTRY serviceTable[] = {
|
SERVICE_TABLE_ENTRY serviceTable[] = {
|
||||||
|
@ -58,7 +63,7 @@ int main(int argc, char **argv)
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!StartServiceCtrlDispatcher(serviceTable)) {
|
if (!StartServiceCtrlDispatcher(serviceTable)) {
|
||||||
AkLoggerLog("Service dispatcher failed");
|
AkLogError() << "Service dispatcher failed" << std::endl;
|
||||||
|
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,12 +36,6 @@
|
||||||
#include "VCamUtils/src/timer.h"
|
#include "VCamUtils/src/timer.h"
|
||||||
#include "VCamUtils/src/logger/logger.h"
|
#include "VCamUtils/src/logger/logger.h"
|
||||||
|
|
||||||
#define AkServiceLogMethod() \
|
|
||||||
AkLoggerLog("Service::", __FUNCTION__, "()")
|
|
||||||
|
|
||||||
#define AkServicePrivateLogMethod() \
|
|
||||||
AkLoggerLog("ServicePrivate::", __FUNCTION__, "()")
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
struct AssistantDevice
|
struct AssistantDevice
|
||||||
|
@ -126,11 +120,11 @@ AkVCam::Service::~Service()
|
||||||
|
|
||||||
BOOL AkVCam::Service::install()
|
BOOL AkVCam::Service::install()
|
||||||
{
|
{
|
||||||
AkServiceLogMethod();
|
AkLogFunction();
|
||||||
WCHAR fileName[MAX_PATH];
|
WCHAR fileName[MAX_PATH];
|
||||||
|
|
||||||
if (!GetModuleFileName(nullptr, fileName, MAX_PATH)) {
|
if (!GetModuleFileName(nullptr, fileName, MAX_PATH)) {
|
||||||
AkLoggerLog("Can't read module file name");
|
AkLogError() << "Can't read module file name" << std::endl;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -138,7 +132,7 @@ BOOL AkVCam::Service::install()
|
||||||
auto scManager = OpenSCManager(nullptr, nullptr, SC_MANAGER_ALL_ACCESS);
|
auto scManager = OpenSCManager(nullptr, nullptr, SC_MANAGER_ALL_ACCESS);
|
||||||
|
|
||||||
if (!scManager) {
|
if (!scManager) {
|
||||||
AkLoggerLog("Can't open SCManager");
|
AkLogError() << "Can't open SCManager" << std::endl;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -159,7 +153,7 @@ BOOL AkVCam::Service::install()
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
||||||
if (!service) {
|
if (!service) {
|
||||||
AkLoggerLog("Can't create service");
|
AkLogError() << "Can't create service" << std::endl;
|
||||||
CloseServiceHandle(scManager);
|
CloseServiceHandle(scManager);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -204,11 +198,11 @@ BOOL AkVCam::Service::install()
|
||||||
|
|
||||||
void AkVCam::Service::uninstall()
|
void AkVCam::Service::uninstall()
|
||||||
{
|
{
|
||||||
AkServiceLogMethod();
|
AkLogFunction();
|
||||||
auto scManager = OpenSCManager(nullptr, nullptr, SC_MANAGER_ALL_ACCESS);
|
auto scManager = OpenSCManager(nullptr, nullptr, SC_MANAGER_ALL_ACCESS);
|
||||||
|
|
||||||
if (!scManager) {
|
if (!scManager) {
|
||||||
AkLoggerLog("Can't open SCManager");
|
AkLogError() << "Can't open SCManager" << std::endl;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -221,7 +215,7 @@ void AkVCam::Service::uninstall()
|
||||||
if (ControlService(sevice,
|
if (ControlService(sevice,
|
||||||
SERVICE_CONTROL_STOP,
|
SERVICE_CONTROL_STOP,
|
||||||
&servicePrivate()->m_status)) {
|
&servicePrivate()->m_status)) {
|
||||||
AkLoggerLog("Stopping service");
|
AkLogInfo() << "Stopping service" << std::endl;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
Sleep(1000);
|
Sleep(1000);
|
||||||
|
@ -230,12 +224,12 @@ void AkVCam::Service::uninstall()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DeleteService(sevice)) {
|
if (!DeleteService(sevice)) {
|
||||||
AkLoggerLog("Delete service failed");
|
AkLogError() << "Delete service failed" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseServiceHandle(sevice);
|
CloseServiceHandle(sevice);
|
||||||
} else {
|
} else {
|
||||||
AkLoggerLog("Can't open service");
|
AkLogError() << "Can't open service" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
CloseServiceHandle(scManager);
|
CloseServiceHandle(scManager);
|
||||||
|
@ -243,14 +237,14 @@ void AkVCam::Service::uninstall()
|
||||||
|
|
||||||
void AkVCam::Service::debug()
|
void AkVCam::Service::debug()
|
||||||
{
|
{
|
||||||
AkServiceLogMethod();
|
AkLogFunction();
|
||||||
SetConsoleCtrlHandler(controlDebugHandler, TRUE);
|
SetConsoleCtrlHandler(controlDebugHandler, TRUE);
|
||||||
servicePrivate()->m_messageServer.start(true);
|
servicePrivate()->m_messageServer.start(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::Service::showHelp(int argc, char **argv)
|
void AkVCam::Service::showHelp(int argc, char **argv)
|
||||||
{
|
{
|
||||||
AkServiceLogMethod();
|
AkLogFunction();
|
||||||
UNUSED(argc)
|
UNUSED(argc)
|
||||||
|
|
||||||
auto programName = strrchr(argv[0], '\\');
|
auto programName = strrchr(argv[0], '\\');
|
||||||
|
@ -277,7 +271,7 @@ void AkVCam::Service::showHelp(int argc, char **argv)
|
||||||
|
|
||||||
AkVCam::ServicePrivate::ServicePrivate()
|
AkVCam::ServicePrivate::ServicePrivate()
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->m_status = {
|
this->m_status = {
|
||||||
SERVICE_WIN32_OWN_PROCESS,
|
SERVICE_WIN32_OWN_PROCESS,
|
||||||
|
@ -364,7 +358,7 @@ void AkVCam::ServicePrivate::checkPeers(void *userData)
|
||||||
self->m_peerMutex.unlock();
|
self->m_peerMutex.unlock();
|
||||||
|
|
||||||
for (auto &port: removePorts) {
|
for (auto &port: removePorts) {
|
||||||
AkLoggerLog(port, " died, removing...");
|
AkLogWarning() << port << " died, removing..." << std::endl;
|
||||||
self->removePortByName(port);
|
self->removePortByName(port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -373,7 +367,7 @@ void AkVCam::ServicePrivate::sendStatus(DWORD currentState,
|
||||||
DWORD exitCode,
|
DWORD exitCode,
|
||||||
DWORD wait)
|
DWORD wait)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->m_status.dwControlsAccepted =
|
this->m_status.dwControlsAccepted =
|
||||||
currentState == SERVICE_START_PENDING? 0: SERVICE_ACCEPT_STOP;
|
currentState == SERVICE_START_PENDING? 0: SERVICE_ACCEPT_STOP;
|
||||||
|
@ -398,8 +392,8 @@ uint64_t AkVCam::ServicePrivate::id()
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::removePortByName(const std::string &portName)
|
void AkVCam::ServicePrivate::removePortByName(const std::string &portName)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("Port: ", portName);
|
AkLogInfo() << "Port: " << portName << std::endl;
|
||||||
|
|
||||||
this->m_peerMutex.lock();
|
this->m_peerMutex.lock();
|
||||||
|
|
||||||
|
@ -463,7 +457,7 @@ void AkVCam::ServicePrivate::releaseDevicesFromPeer(const std::string &portName)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::requestPort(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::requestPort(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
auto data = messageData<MsgRequestPort>(message);
|
auto data = messageData<MsgRequestPort>(message);
|
||||||
std::string portName = data->client?
|
std::string portName = data->client?
|
||||||
|
@ -471,7 +465,7 @@ void AkVCam::ServicePrivate::requestPort(AkVCam::Message *message)
|
||||||
AKVCAM_ASSISTANT_SERVER_NAME;
|
AKVCAM_ASSISTANT_SERVER_NAME;
|
||||||
portName += std::to_string(this->id());
|
portName += std::to_string(this->id());
|
||||||
|
|
||||||
AkLoggerLog("Returning Port: ", portName);
|
AkLogInfo() << "Returning Port: " << portName << std::endl;
|
||||||
memcpy(data->port,
|
memcpy(data->port,
|
||||||
portName.c_str(),
|
portName.c_str(),
|
||||||
(std::min<size_t>)(portName.size(), MAX_STRING));
|
(std::min<size_t>)(portName.size(), MAX_STRING));
|
||||||
|
@ -479,7 +473,7 @@ void AkVCam::ServicePrivate::requestPort(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::addPort(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::addPort(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
auto data = messageData<MsgAddPort>(message);
|
auto data = messageData<MsgAddPort>(message);
|
||||||
std::string portName(data->port);
|
std::string portName(data->port);
|
||||||
|
@ -502,7 +496,7 @@ void AkVCam::ServicePrivate::addPort(AkVCam::Message *message)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
AkLoggerLog("Adding Peer: ", portName);
|
AkLogInfo() << "Adding Peer: " << portName << std::endl;
|
||||||
(*peers)[portName] = pipeName;
|
(*peers)[portName] = pipeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,7 +512,7 @@ void AkVCam::ServicePrivate::addPort(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::removePort(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::removePort(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
auto data = messageData<MsgRemovePort>(message);
|
auto data = messageData<MsgRemovePort>(message);
|
||||||
this->removePortByName(data->port);
|
this->removePortByName(data->port);
|
||||||
|
@ -526,7 +520,7 @@ void AkVCam::ServicePrivate::removePort(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::setBroadCasting(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::setBroadCasting(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto data = messageData<MsgBroadcasting>(message);
|
auto data = messageData<MsgBroadcasting>(message);
|
||||||
std::string deviceId(data->device);
|
std::string deviceId(data->device);
|
||||||
std::string broadcaster(data->broadcaster);
|
std::string broadcaster(data->broadcaster);
|
||||||
|
@ -538,8 +532,8 @@ void AkVCam::ServicePrivate::setBroadCasting(AkVCam::Message *message)
|
||||||
if (this->m_deviceConfigs[deviceId].broadcaster == broadcaster)
|
if (this->m_deviceConfigs[deviceId].broadcaster == broadcaster)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AkLoggerLog("Device: ", deviceId);
|
AkLogInfo() << "Device: " << deviceId << std::endl;
|
||||||
AkLoggerLog("Broadcaster: ", broadcaster);
|
AkLogInfo() << "Broadcaster: " << broadcaster << std::endl;
|
||||||
this->m_deviceConfigs[deviceId].broadcaster = broadcaster;
|
this->m_deviceConfigs[deviceId].broadcaster = broadcaster;
|
||||||
data->status = true;
|
data->status = true;
|
||||||
|
|
||||||
|
@ -555,7 +549,7 @@ void AkVCam::ServicePrivate::setBroadCasting(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::setMirroring(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::setMirroring(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto data = messageData<MsgMirroring>(message);
|
auto data = messageData<MsgMirroring>(message);
|
||||||
std::string deviceId(data->device);
|
std::string deviceId(data->device);
|
||||||
data->status = false;
|
data->status = false;
|
||||||
|
@ -583,7 +577,7 @@ void AkVCam::ServicePrivate::setMirroring(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::setScaling(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::setScaling(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto data = messageData<MsgScaling>(message);
|
auto data = messageData<MsgScaling>(message);
|
||||||
std::string deviceId(data->device);
|
std::string deviceId(data->device);
|
||||||
data->status = false;
|
data->status = false;
|
||||||
|
@ -609,7 +603,7 @@ void AkVCam::ServicePrivate::setScaling(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::setAspectRatio(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::setAspectRatio(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto data = messageData<MsgAspectRatio>(message);
|
auto data = messageData<MsgAspectRatio>(message);
|
||||||
std::string deviceId(data->device);
|
std::string deviceId(data->device);
|
||||||
data->status = false;
|
data->status = false;
|
||||||
|
@ -635,7 +629,7 @@ void AkVCam::ServicePrivate::setAspectRatio(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::setSwapRgb(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::setSwapRgb(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto data = messageData<MsgSwapRgb>(message);
|
auto data = messageData<MsgSwapRgb>(message);
|
||||||
std::string deviceId(data->device);
|
std::string deviceId(data->device);
|
||||||
data->status = false;
|
data->status = false;
|
||||||
|
@ -661,7 +655,7 @@ void AkVCam::ServicePrivate::setSwapRgb(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::frameReady(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::frameReady(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
this->m_peerMutex.lock();
|
this->m_peerMutex.lock();
|
||||||
|
|
||||||
for (auto &client: this->m_clients)
|
for (auto &client: this->m_clients)
|
||||||
|
@ -672,7 +666,7 @@ void AkVCam::ServicePrivate::frameReady(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::listeners(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::listeners(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto data = messageData<MsgListeners>(message);
|
auto data = messageData<MsgListeners>(message);
|
||||||
std::string deviceId(data->device);
|
std::string deviceId(data->device);
|
||||||
|
|
||||||
|
@ -693,7 +687,7 @@ void AkVCam::ServicePrivate::listeners(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::listener(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::listener(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto data = messageData<MsgListeners>(message);
|
auto data = messageData<MsgListeners>(message);
|
||||||
std::string deviceId(data->device);
|
std::string deviceId(data->device);
|
||||||
|
|
||||||
|
@ -718,7 +712,7 @@ void AkVCam::ServicePrivate::listener(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::broadcasting(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::broadcasting(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto data = messageData<MsgBroadcasting>(message);
|
auto data = messageData<MsgBroadcasting>(message);
|
||||||
std::string deviceId(data->device);
|
std::string deviceId(data->device);
|
||||||
|
|
||||||
|
@ -734,7 +728,7 @@ void AkVCam::ServicePrivate::broadcasting(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::mirroring(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::mirroring(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto data = messageData<MsgMirroring>(message);
|
auto data = messageData<MsgMirroring>(message);
|
||||||
std::string deviceId(data->device);
|
std::string deviceId(data->device);
|
||||||
|
|
||||||
|
@ -748,7 +742,7 @@ void AkVCam::ServicePrivate::mirroring(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::scaling(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::scaling(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto data = messageData<MsgScaling>(message);
|
auto data = messageData<MsgScaling>(message);
|
||||||
std::string deviceId(data->device);
|
std::string deviceId(data->device);
|
||||||
|
|
||||||
|
@ -761,7 +755,7 @@ void AkVCam::ServicePrivate::scaling(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::aspectRatio(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::aspectRatio(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto data = messageData<MsgAspectRatio>(message);
|
auto data = messageData<MsgAspectRatio>(message);
|
||||||
std::string deviceId(data->device);
|
std::string deviceId(data->device);
|
||||||
|
|
||||||
|
@ -774,7 +768,7 @@ void AkVCam::ServicePrivate::aspectRatio(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::swapRgb(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::swapRgb(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto data = messageData<MsgSwapRgb>(message);
|
auto data = messageData<MsgSwapRgb>(message);
|
||||||
std::string deviceId(data->device);
|
std::string deviceId(data->device);
|
||||||
|
|
||||||
|
@ -787,7 +781,7 @@ void AkVCam::ServicePrivate::swapRgb(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::listenerAdd(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::listenerAdd(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto data = messageData<MsgListeners>(message);
|
auto data = messageData<MsgListeners>(message);
|
||||||
std::string deviceId(data->device);
|
std::string deviceId(data->device);
|
||||||
|
|
||||||
|
@ -819,7 +813,7 @@ void AkVCam::ServicePrivate::listenerAdd(AkVCam::Message *message)
|
||||||
|
|
||||||
void AkVCam::ServicePrivate::listenerRemove(AkVCam::Message *message)
|
void AkVCam::ServicePrivate::listenerRemove(AkVCam::Message *message)
|
||||||
{
|
{
|
||||||
AkServicePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto data = messageData<MsgListeners>(message);
|
auto data = messageData<MsgListeners>(message);
|
||||||
std::string deviceId(data->device);
|
std::string deviceId(data->device);
|
||||||
|
|
||||||
|
@ -857,7 +851,7 @@ DWORD WINAPI controlHandler(DWORD control,
|
||||||
UNUSED(eventType)
|
UNUSED(eventType)
|
||||||
UNUSED(eventData)
|
UNUSED(eventData)
|
||||||
UNUSED(context)
|
UNUSED(context)
|
||||||
AkLoggerLog("controlHandler()");
|
AkLogFunction();
|
||||||
|
|
||||||
DWORD result = ERROR_CALL_NOT_IMPLEMENTED;
|
DWORD result = ERROR_CALL_NOT_IMPLEMENTED;
|
||||||
|
|
||||||
|
@ -889,7 +883,7 @@ DWORD WINAPI controlHandler(DWORD control,
|
||||||
|
|
||||||
BOOL WINAPI controlDebugHandler(DWORD control)
|
BOOL WINAPI controlDebugHandler(DWORD control)
|
||||||
{
|
{
|
||||||
AkLoggerLog("controlDebugHandler()");
|
AkLogFunction();
|
||||||
|
|
||||||
if (control == CTRL_BREAK_EVENT || control == CTRL_C_EVENT) {
|
if (control == CTRL_BREAK_EVENT || control == CTRL_C_EVENT) {
|
||||||
AkVCam::servicePrivate()->m_messageServer.stop();
|
AkVCam::servicePrivate()->m_messageServer.stop();
|
||||||
|
@ -904,8 +898,8 @@ void WINAPI serviceMain(DWORD dwArgc, LPTSTR *lpszArgv)
|
||||||
{
|
{
|
||||||
UNUSED(dwArgc)
|
UNUSED(dwArgc)
|
||||||
UNUSED(lpszArgv)
|
UNUSED(lpszArgv)
|
||||||
AkLoggerLog("serviceMain()");
|
AkLogFunction();
|
||||||
AkLoggerLog("Setting service control handler");
|
AkLogInfo() << "Setting service control handler" << std::endl;
|
||||||
|
|
||||||
AkVCam::servicePrivate()->m_statusHandler =
|
AkVCam::servicePrivate()->m_statusHandler =
|
||||||
RegisterServiceCtrlHandlerEx(TEXT(DSHOW_PLUGIN_ASSISTANT_NAME),
|
RegisterServiceCtrlHandlerEx(TEXT(DSHOW_PLUGIN_ASSISTANT_NAME),
|
||||||
|
@ -917,7 +911,7 @@ void WINAPI serviceMain(DWORD dwArgc, LPTSTR *lpszArgv)
|
||||||
|
|
||||||
AkVCam::servicePrivate()->sendStatus(SERVICE_START_PENDING, NO_ERROR, 3000);
|
AkVCam::servicePrivate()->sendStatus(SERVICE_START_PENDING, NO_ERROR, 3000);
|
||||||
|
|
||||||
AkLoggerLog("Setting up service");
|
AkLogInfo() << "Setting up service" << std::endl;
|
||||||
AkVCam::servicePrivate()->m_messageServer
|
AkVCam::servicePrivate()->m_messageServer
|
||||||
.connectStateChanged(AkVCam::servicePrivate(),
|
.connectStateChanged(AkVCam::servicePrivate(),
|
||||||
&AkVCam::ServicePrivate::stateChanged);
|
&AkVCam::ServicePrivate::stateChanged);
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "VCamUtils/src/logger/logger.h"
|
#include "VCamUtils/src/logger/logger.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "MessageServer"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class MessageServerPrivate
|
class MessageServerPrivate
|
||||||
|
@ -124,16 +122,16 @@ void AkVCam::MessageServer::setHandlers(const std::map<uint32_t, MessageHandler>
|
||||||
|
|
||||||
bool AkVCam::MessageServer::start(bool wait)
|
bool AkVCam::MessageServer::start(bool wait)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
switch (this->d->m_mode) {
|
switch (this->d->m_mode) {
|
||||||
case ServerModeReceive:
|
case ServerModeReceive:
|
||||||
AkLoggerLog("Starting mode receive");
|
AkLogInfo() << "Starting mode receive" << std::endl;
|
||||||
|
|
||||||
return this->d->startReceive(wait);
|
return this->d->startReceive(wait);
|
||||||
|
|
||||||
case ServerModeSend:
|
case ServerModeSend:
|
||||||
AkLoggerLog("Starting mode send");
|
AkLogInfo() << "Starting mode send" << std::endl;
|
||||||
|
|
||||||
return this->d->startSend();
|
return this->d->startSend();
|
||||||
}
|
}
|
||||||
|
@ -143,7 +141,7 @@ bool AkVCam::MessageServer::start(bool wait)
|
||||||
|
|
||||||
void AkVCam::MessageServer::stop(bool wait)
|
void AkVCam::MessageServer::stop(bool wait)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_mode == ServerModeReceive)
|
if (this->d->m_mode == ServerModeReceive)
|
||||||
this->d->stopReceive(wait);
|
this->d->stopReceive(wait);
|
||||||
|
@ -279,9 +277,10 @@ bool AkVCam::MessageServerPrivate::startReceive(bool wait)
|
||||||
startReceive_failed:
|
startReceive_failed:
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
AkLoggerLog("Error starting server: ",
|
AkLogError() << "Error starting server: "
|
||||||
errorToString(GetLastError()),
|
<< errorToString(GetLastError())
|
||||||
" (", GetLastError(), ")");
|
<< " (" << GetLastError() << ")"
|
||||||
|
<< std::endl;
|
||||||
AKVCAM_EMIT(this->self, StateChanged, MessageServer::StateStopped)
|
AKVCAM_EMIT(this->self, StateChanged, MessageServer::StateStopped)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,17 +370,19 @@ void AkVCam::MessageServerPrivate::checkLoop()
|
||||||
|
|
||||||
if (result
|
if (result
|
||||||
&& this->m_pipeState != AkVCam::MessageServer::PipeStateAvailable) {
|
&& this->m_pipeState != AkVCam::MessageServer::PipeStateAvailable) {
|
||||||
AkLoggerLog("Pipe Available: ",
|
AkLogInfo() << "Pipe Available: "
|
||||||
std::string(this->m_pipeName.begin(),
|
<< std::string(this->m_pipeName.begin(),
|
||||||
this->m_pipeName.end()));
|
this->m_pipeName.end())
|
||||||
|
<< std::endl;
|
||||||
this->m_pipeState = AkVCam::MessageServer::PipeStateAvailable;
|
this->m_pipeState = AkVCam::MessageServer::PipeStateAvailable;
|
||||||
AKVCAM_EMIT(this->self, PipeStateChanged, this->m_pipeState);
|
AKVCAM_EMIT(this->self, PipeStateChanged, this->m_pipeState);
|
||||||
} else if (!result
|
} else if (!result
|
||||||
&& this->m_pipeState != AkVCam::MessageServer::PipeStateGone
|
&& this->m_pipeState != AkVCam::MessageServer::PipeStateGone
|
||||||
&& GetLastError() != ERROR_SEM_TIMEOUT) {
|
&& GetLastError() != ERROR_SEM_TIMEOUT) {
|
||||||
AkLoggerLog("Pipe Gone: ",
|
AkLogInfo() << "Pipe Gone: "
|
||||||
std::string(this->m_pipeName.begin(),
|
<< std::string(this->m_pipeName.begin(),
|
||||||
this->m_pipeName.end()));
|
this->m_pipeName.end())
|
||||||
|
<< std::endl;
|
||||||
this->m_pipeState = AkVCam::MessageServer::PipeStateGone;
|
this->m_pipeState = AkVCam::MessageServer::PipeStateGone;
|
||||||
AKVCAM_EMIT(this->self, PipeStateChanged, this->m_pipeState);
|
AKVCAM_EMIT(this->self, PipeStateChanged, this->m_pipeState);
|
||||||
}
|
}
|
||||||
|
@ -414,9 +415,10 @@ HRESULT AkVCam::MessageServerPrivate::waitResult(DWORD *bytesTransferred)
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
AkLoggerLog("Wait result failed: ",
|
AkLogWarning() << "Wait result failed: "
|
||||||
errorToString(lastError),
|
<< errorToString(lastError)
|
||||||
" (", lastError, ")");
|
<< " (" << lastError << ")"
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,12 +127,13 @@ bool AkVCam::SharedMemory::open(size_t pageSize, OpenMode mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this->d->m_sharedHandle) {
|
if (!this->d->m_sharedHandle) {
|
||||||
AkLoggerLog("Error opening shared memory (",
|
AkLogError() << "Error opening shared memory ("
|
||||||
std::string(this->d->m_name.begin(),
|
<< std::string(this->d->m_name.begin(),
|
||||||
this->d->m_name.end()),
|
this->d->m_name.end())
|
||||||
"): ",
|
<< "): "
|
||||||
errorToString(GetLastError()),
|
<< errorToString(GetLastError())
|
||||||
" (", GetLastError(), ")");
|
<< " (" << GetLastError() << ")"
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -814,6 +814,53 @@ LONG AkVCam::regGetValue(HKEY hkey,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string AkVCam::regReadString(const std::string &key, const std::string &defaultValue)
|
||||||
|
{
|
||||||
|
auto wkey = std::wstring(key.begin(), key.end());
|
||||||
|
WCHAR value[MAX_PATH];
|
||||||
|
memset(value, 0, MAX_PATH * sizeof(WCHAR));
|
||||||
|
DWORD valueSize = MAX_PATH;
|
||||||
|
if (FAILED(regGetValue(HKEY_LOCAL_MACHINE,
|
||||||
|
L"SOFTWARE\\Webcamoid\\VirtualCamera",
|
||||||
|
wkey.c_str(),
|
||||||
|
RRF_RT_REG_SZ,
|
||||||
|
nullptr,
|
||||||
|
&value,
|
||||||
|
&valueSize)))
|
||||||
|
return defaultValue;
|
||||||
|
|
||||||
|
char str[MAX_PATH];
|
||||||
|
char defaultChar = '?';
|
||||||
|
WideCharToMultiByte(CP_ACP,
|
||||||
|
0,
|
||||||
|
value,
|
||||||
|
-1,
|
||||||
|
str,
|
||||||
|
MAX_PATH,
|
||||||
|
&defaultChar,
|
||||||
|
nullptr);
|
||||||
|
|
||||||
|
return std::string(str);
|
||||||
|
}
|
||||||
|
|
||||||
|
int AkVCam::regReadInt(const std::string &key, int defaultValue)
|
||||||
|
{
|
||||||
|
auto wkey = std::wstring(key.begin(), key.end());
|
||||||
|
DWORD value = 0;
|
||||||
|
DWORD valueSize = sizeof(DWORD);
|
||||||
|
|
||||||
|
if (FAILED(regGetValue(HKEY_LOCAL_MACHINE,
|
||||||
|
L"SOFTWARE\\Webcamoid\\VirtualCamera",
|
||||||
|
wkey.c_str(),
|
||||||
|
RRF_RT_REG_DWORD,
|
||||||
|
nullptr,
|
||||||
|
&value,
|
||||||
|
&valueSize)))
|
||||||
|
return defaultValue;
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<CLSID> AkVCam::listRegisteredCameras(HINSTANCE hinstDLL)
|
std::vector<CLSID> AkVCam::listRegisteredCameras(HINSTANCE hinstDLL)
|
||||||
{
|
{
|
||||||
WCHAR *strIID = nullptr;
|
WCHAR *strIID = nullptr;
|
||||||
|
|
|
@ -27,10 +27,7 @@
|
||||||
#include "VCamUtils/src/logger/logger.h"
|
#include "VCamUtils/src/logger/logger.h"
|
||||||
|
|
||||||
#define AkLogInterface(interface, instance) \
|
#define AkLogInterface(interface, instance) \
|
||||||
AkLoggerLog("Returning ", #interface, "(", instance, ")")
|
AkLogInfo() << "Returning " << #interface << "(" << instance << ")" << std::endl
|
||||||
|
|
||||||
#define AkLogMethod() \
|
|
||||||
AkLoggerLog(AK_CUR_INTERFACE, "(", this, ")::", __FUNCTION__, "()")
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
|
@ -79,6 +76,9 @@ namespace AkVCam
|
||||||
LPDWORD pdwType,
|
LPDWORD pdwType,
|
||||||
PVOID pvData,
|
PVOID pvData,
|
||||||
LPDWORD pcbData);
|
LPDWORD pcbData);
|
||||||
|
std::string regReadString(const std::string &key,
|
||||||
|
const std::string &defaultValue={});
|
||||||
|
int regReadInt(const std::string &key, int defaultValue=0);
|
||||||
std::vector<CLSID> listRegisteredCameras(HINSTANCE hinstDLL);
|
std::vector<CLSID> listRegisteredCameras(HINSTANCE hinstDLL);
|
||||||
DWORD camerasCount();
|
DWORD camerasCount();
|
||||||
std::wstring createDevicePath();
|
std::wstring createDevicePath();
|
||||||
|
|
|
@ -36,12 +36,6 @@
|
||||||
#include "VCamUtils/src/ipcbridge.h"
|
#include "VCamUtils/src/ipcbridge.h"
|
||||||
#include "VCamUtils/src/logger/logger.h"
|
#include "VCamUtils/src/logger/logger.h"
|
||||||
|
|
||||||
#define AkIpcBridgeLogMethod() \
|
|
||||||
AkLoggerLog("IpcBridge::", __FUNCTION__, "()")
|
|
||||||
|
|
||||||
#define AkIpcBridgePrivateLogMethod() \
|
|
||||||
AkLoggerLog("IpcBridgePrivate::", __FUNCTION__, "()")
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
typedef std::shared_ptr<IMoniker> MonikerPtr;
|
typedef std::shared_ptr<IMoniker> MonikerPtr;
|
||||||
|
@ -141,7 +135,7 @@ namespace AkVCam
|
||||||
|
|
||||||
AkVCam::IpcBridge::IpcBridge()
|
AkVCam::IpcBridge::IpcBridge()
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
this->d = new IpcBridgePrivate(this);
|
this->d = new IpcBridgePrivate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,7 +151,7 @@ std::wstring AkVCam::IpcBridge::errorMessage() const
|
||||||
|
|
||||||
void AkVCam::IpcBridge::setOption(const std::string &key, const std::string &value)
|
void AkVCam::IpcBridge::setOption(const std::string &key, const std::string &value)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (value.empty())
|
if (value.empty())
|
||||||
this->d->m_options.erase(key);
|
this->d->m_options.erase(key);
|
||||||
|
@ -167,14 +161,14 @@ void AkVCam::IpcBridge::setOption(const std::string &key, const std::string &val
|
||||||
|
|
||||||
std::vector<std::wstring> AkVCam::IpcBridge::driverPaths() const
|
std::vector<std::wstring> AkVCam::IpcBridge::driverPaths() const
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return *this->d->driverPaths();
|
return *this->d->driverPaths();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::IpcBridge::setDriverPaths(const std::vector<std::wstring> &driverPaths)
|
void AkVCam::IpcBridge::setDriverPaths(const std::vector<std::wstring> &driverPaths)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
*this->d->driverPaths() = driverPaths;
|
*this->d->driverPaths() = driverPaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,21 +204,21 @@ bool AkVCam::IpcBridge::setRootMethod(const std::string &rootMethod)
|
||||||
|
|
||||||
void AkVCam::IpcBridge::connectService(bool asClient)
|
void AkVCam::IpcBridge::connectService(bool asClient)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_asClient = asClient;
|
this->d->m_asClient = asClient;
|
||||||
this->d->m_mainServer.start();
|
this->d->m_mainServer.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::IpcBridge::disconnectService()
|
void AkVCam::IpcBridge::disconnectService()
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_mainServer.stop(true);
|
this->d->m_mainServer.stop(true);
|
||||||
this->d->m_asClient = false;
|
this->d->m_asClient = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::registerPeer(bool asClient)
|
bool AkVCam::IpcBridge::registerPeer(bool asClient)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
Message message;
|
Message message;
|
||||||
message.messageId = AKVCAM_ASSISTANT_MSG_REQUEST_PORT;
|
message.messageId = AKVCAM_ASSISTANT_MSG_REQUEST_PORT;
|
||||||
|
@ -241,10 +235,10 @@ bool AkVCam::IpcBridge::registerPeer(bool asClient)
|
||||||
this->d->m_messageServer.setPipeName(std::wstring(pipeName.begin(),
|
this->d->m_messageServer.setPipeName(std::wstring(pipeName.begin(),
|
||||||
pipeName.end()));
|
pipeName.end()));
|
||||||
this->d->m_messageServer.setHandlers(this->d->m_messageHandlers);
|
this->d->m_messageServer.setHandlers(this->d->m_messageHandlers);
|
||||||
AkLoggerLog("Recommended port name: ", portName);
|
AkLogInfo() << "Recommended port name: " << portName << std::endl;
|
||||||
|
|
||||||
if (!this->d->m_messageServer.start()) {
|
if (!this->d->m_messageServer.start()) {
|
||||||
AkLoggerLog("Can't start message server");
|
AkLogError() << "Can't start message server" << std::endl;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -260,7 +254,7 @@ bool AkVCam::IpcBridge::registerPeer(bool asClient)
|
||||||
pipeName.c_str(),
|
pipeName.c_str(),
|
||||||
(std::min<size_t>)(pipeName.size(), MAX_STRING));
|
(std::min<size_t>)(pipeName.size(), MAX_STRING));
|
||||||
|
|
||||||
AkLoggerLog("Registering port name: ", portName);
|
AkLogInfo() << "Registering port name: " << portName << std::endl;
|
||||||
|
|
||||||
if (!MessageServer::sendMessage(L"\\\\.\\pipe\\" DSHOW_PLUGIN_ASSISTANT_NAME_L,
|
if (!MessageServer::sendMessage(L"\\\\.\\pipe\\" DSHOW_PLUGIN_ASSISTANT_NAME_L,
|
||||||
&message)) {
|
&message)) {
|
||||||
|
@ -283,14 +277,14 @@ bool AkVCam::IpcBridge::registerPeer(bool asClient)
|
||||||
portName.end())
|
portName.end())
|
||||||
+ L".mutex");
|
+ L".mutex");
|
||||||
this->d->m_portName = portName;
|
this->d->m_portName = portName;
|
||||||
AkLoggerLog("Peer registered as ", portName);
|
AkLogInfo() << "Peer registered as " << portName << std::endl;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::IpcBridge::unregisterPeer()
|
void AkVCam::IpcBridge::unregisterPeer()
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_portName.empty())
|
if (this->d->m_portName.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -311,26 +305,24 @@ void AkVCam::IpcBridge::unregisterPeer()
|
||||||
|
|
||||||
std::vector<std::string> AkVCam::IpcBridge::listDevices() const
|
std::vector<std::string> AkVCam::IpcBridge::listDevices() const
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
std::vector<std::string> devices;
|
std::vector<std::string> devices;
|
||||||
|
|
||||||
for (auto camera: this->d->listCameras())
|
for (auto camera: this->d->listCameras())
|
||||||
if (this->d->isVirtualCamera(camera))
|
if (this->d->isVirtualCamera(camera))
|
||||||
devices.push_back(this->d->cameraPath(camera));
|
devices.push_back(this->d->cameraPath(camera));
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
AkLogInfo() << "Devices:" << std::endl;
|
||||||
AkLoggerLog("Devices:");
|
|
||||||
|
|
||||||
for (auto &device: devices)
|
for (auto &device: devices)
|
||||||
AkLoggerLog(" ", device);
|
AkLogInfo() << " " << device << std::endl;
|
||||||
#endif
|
|
||||||
|
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::wstring AkVCam::IpcBridge::description(const std::string &deviceId) const
|
std::wstring AkVCam::IpcBridge::description(const std::string &deviceId) const
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
for (auto camera: this->d->listCameras()) {
|
for (auto camera: this->d->listCameras()) {
|
||||||
auto propertyBag = this->d->propertyBag(camera.get());
|
auto propertyBag = this->d->propertyBag(camera.get());
|
||||||
|
@ -363,7 +355,7 @@ AkVCam::PixelFormat AkVCam::IpcBridge::defaultOutputPixelFormat() const
|
||||||
|
|
||||||
std::vector<AkVCam::VideoFormat> AkVCam::IpcBridge::formats(const std::string &deviceId) const
|
std::vector<AkVCam::VideoFormat> AkVCam::IpcBridge::formats(const std::string &deviceId) const
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
std::vector<AkVCam::VideoFormat> formats;
|
std::vector<AkVCam::VideoFormat> formats;
|
||||||
|
|
||||||
|
@ -386,7 +378,7 @@ std::vector<AkVCam::VideoFormat> AkVCam::IpcBridge::formats(const std::string &d
|
||||||
|
|
||||||
std::string AkVCam::IpcBridge::broadcaster(const std::string &deviceId) const
|
std::string AkVCam::IpcBridge::broadcaster(const std::string &deviceId) const
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
Message message;
|
Message message;
|
||||||
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_BROADCASTING;
|
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_BROADCASTING;
|
||||||
|
@ -404,15 +396,15 @@ std::string AkVCam::IpcBridge::broadcaster(const std::string &deviceId) const
|
||||||
|
|
||||||
std::string broadcaster(data->broadcaster);
|
std::string broadcaster(data->broadcaster);
|
||||||
|
|
||||||
AkLoggerLog("Device: ", deviceId);
|
AkLogInfo() << "Device: " << deviceId << std::endl;
|
||||||
AkLoggerLog("Broadcaster: ", broadcaster);
|
AkLogInfo() << "Broadcaster: " << broadcaster << std::endl;
|
||||||
|
|
||||||
return broadcaster;
|
return broadcaster;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::isHorizontalMirrored(const std::string &deviceId)
|
bool AkVCam::IpcBridge::isHorizontalMirrored(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
Message message;
|
Message message;
|
||||||
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_MIRRORING;
|
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_MIRRORING;
|
||||||
|
@ -433,7 +425,7 @@ bool AkVCam::IpcBridge::isHorizontalMirrored(const std::string &deviceId)
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::isVerticalMirrored(const std::string &deviceId)
|
bool AkVCam::IpcBridge::isVerticalMirrored(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
Message message;
|
Message message;
|
||||||
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_MIRRORING;
|
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_MIRRORING;
|
||||||
|
@ -454,7 +446,7 @@ bool AkVCam::IpcBridge::isVerticalMirrored(const std::string &deviceId)
|
||||||
|
|
||||||
AkVCam::Scaling AkVCam::IpcBridge::scalingMode(const std::string &deviceId)
|
AkVCam::Scaling AkVCam::IpcBridge::scalingMode(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
Message message;
|
Message message;
|
||||||
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_SCALING;
|
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_SCALING;
|
||||||
|
@ -475,7 +467,7 @@ AkVCam::Scaling AkVCam::IpcBridge::scalingMode(const std::string &deviceId)
|
||||||
|
|
||||||
AkVCam::AspectRatio AkVCam::IpcBridge::aspectRatioMode(const std::string &deviceId)
|
AkVCam::AspectRatio AkVCam::IpcBridge::aspectRatioMode(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
Message message;
|
Message message;
|
||||||
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_ASPECTRATIO;
|
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_ASPECTRATIO;
|
||||||
|
@ -496,7 +488,7 @@ AkVCam::AspectRatio AkVCam::IpcBridge::aspectRatioMode(const std::string &device
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::swapRgb(const std::string &deviceId)
|
bool AkVCam::IpcBridge::swapRgb(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
Message message;
|
Message message;
|
||||||
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_SWAPRGB;
|
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_SWAPRGB;
|
||||||
|
@ -517,7 +509,7 @@ bool AkVCam::IpcBridge::swapRgb(const std::string &deviceId)
|
||||||
|
|
||||||
std::vector<std::string> AkVCam::IpcBridge::listeners(const std::string &deviceId)
|
std::vector<std::string> AkVCam::IpcBridge::listeners(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
Message message;
|
Message message;
|
||||||
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_LISTENERS;
|
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_LISTENERS;
|
||||||
|
@ -668,7 +660,7 @@ bool AkVCam::IpcBridge::canApply(AkVCam::IpcBridge::Operation operation) const
|
||||||
std::string AkVCam::IpcBridge::deviceCreate(const std::wstring &description,
|
std::string AkVCam::IpcBridge::deviceCreate(const std::wstring &description,
|
||||||
const std::vector<VideoFormat> &formats)
|
const std::vector<VideoFormat> &formats)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->canApply(OperationCreate)) {
|
if (!this->canApply(OperationCreate)) {
|
||||||
this->d->m_error = L"The driver is in use";
|
this->d->m_error = L"The driver is in use";
|
||||||
|
@ -898,7 +890,7 @@ bool AkVCam::IpcBridge::deviceEdit(const std::string &deviceId,
|
||||||
const std::wstring &description,
|
const std::wstring &description,
|
||||||
const std::vector<VideoFormat> &formats)
|
const std::vector<VideoFormat> &formats)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->canApply(OperationEdit)) {
|
if (!this->canApply(OperationEdit)) {
|
||||||
this->d->m_error = L"The driver is in use";
|
this->d->m_error = L"The driver is in use";
|
||||||
|
@ -1031,7 +1023,7 @@ bool AkVCam::IpcBridge::deviceEdit(const std::string &deviceId,
|
||||||
bool AkVCam::IpcBridge::changeDescription(const std::string &deviceId,
|
bool AkVCam::IpcBridge::changeDescription(const std::string &deviceId,
|
||||||
const std::wstring &description)
|
const std::wstring &description)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->canApply(OperationEdit)) {
|
if (!this->canApply(OperationEdit)) {
|
||||||
this->d->m_error = L"The driver is in use";
|
this->d->m_error = L"The driver is in use";
|
||||||
|
@ -1100,7 +1092,7 @@ bool AkVCam::IpcBridge::changeDescription(const std::string &deviceId,
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::deviceDestroy(const std::string &deviceId)
|
bool AkVCam::IpcBridge::deviceDestroy(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->canApply(OperationDestroy)) {
|
if (!this->canApply(OperationDestroy)) {
|
||||||
this->d->m_error = L"The driver is in use";
|
this->d->m_error = L"The driver is in use";
|
||||||
|
@ -1212,7 +1204,7 @@ bool AkVCam::IpcBridge::deviceDestroy(const std::string &deviceId)
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::destroyAllDevices()
|
bool AkVCam::IpcBridge::destroyAllDevices()
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->canApply(OperationDestroyAll)) {
|
if (!this->canApply(OperationDestroyAll)) {
|
||||||
this->d->m_error = L"The driver is in use";
|
this->d->m_error = L"The driver is in use";
|
||||||
|
@ -1281,7 +1273,7 @@ bool AkVCam::IpcBridge::deviceStart(const std::string &deviceId,
|
||||||
const VideoFormat &format)
|
const VideoFormat &format)
|
||||||
{
|
{
|
||||||
UNUSED(format)
|
UNUSED(format)
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
auto it = std::find(this->d->m_broadcasting.begin(),
|
auto it = std::find(this->d->m_broadcasting.begin(),
|
||||||
this->d->m_broadcasting.end(),
|
this->d->m_broadcasting.end(),
|
||||||
deviceId);
|
deviceId);
|
||||||
|
@ -1325,7 +1317,7 @@ bool AkVCam::IpcBridge::deviceStart(const std::string &deviceId,
|
||||||
|
|
||||||
void AkVCam::IpcBridge::deviceStop(const std::string &deviceId)
|
void AkVCam::IpcBridge::deviceStop(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
auto it = std::find(this->d->m_broadcasting.begin(),
|
auto it = std::find(this->d->m_broadcasting.begin(),
|
||||||
this->d->m_broadcasting.end(),
|
this->d->m_broadcasting.end(),
|
||||||
deviceId);
|
deviceId);
|
||||||
|
@ -1349,7 +1341,7 @@ void AkVCam::IpcBridge::deviceStop(const std::string &deviceId)
|
||||||
bool AkVCam::IpcBridge::write(const std::string &deviceId,
|
bool AkVCam::IpcBridge::write(const std::string &deviceId,
|
||||||
const VideoFrame &frame)
|
const VideoFrame &frame)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (frame.format().size() < 1)
|
if (frame.format().size() < 1)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1399,7 +1391,7 @@ void AkVCam::IpcBridge::setMirroring(const std::string &deviceId,
|
||||||
bool horizontalMirrored,
|
bool horizontalMirrored,
|
||||||
bool verticalMirrored)
|
bool verticalMirrored)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
Message message;
|
Message message;
|
||||||
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_SETMIRRORING;
|
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_SETMIRRORING;
|
||||||
|
@ -1416,7 +1408,7 @@ void AkVCam::IpcBridge::setMirroring(const std::string &deviceId,
|
||||||
void AkVCam::IpcBridge::setScaling(const std::string &deviceId,
|
void AkVCam::IpcBridge::setScaling(const std::string &deviceId,
|
||||||
Scaling scaling)
|
Scaling scaling)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
Message message;
|
Message message;
|
||||||
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_SETSCALING;
|
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_SETSCALING;
|
||||||
|
@ -1432,7 +1424,7 @@ void AkVCam::IpcBridge::setScaling(const std::string &deviceId,
|
||||||
void AkVCam::IpcBridge::setAspectRatio(const std::string &deviceId,
|
void AkVCam::IpcBridge::setAspectRatio(const std::string &deviceId,
|
||||||
AspectRatio aspectRatio)
|
AspectRatio aspectRatio)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
Message message;
|
Message message;
|
||||||
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_SETASPECTRATIO;
|
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_SETASPECTRATIO;
|
||||||
|
@ -1447,7 +1439,7 @@ void AkVCam::IpcBridge::setAspectRatio(const std::string &deviceId,
|
||||||
|
|
||||||
void AkVCam::IpcBridge::setSwapRgb(const std::string &deviceId, bool swap)
|
void AkVCam::IpcBridge::setSwapRgb(const std::string &deviceId, bool swap)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
Message message;
|
Message message;
|
||||||
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_SETSWAPRGB;
|
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_SETSWAPRGB;
|
||||||
|
@ -1462,7 +1454,7 @@ void AkVCam::IpcBridge::setSwapRgb(const std::string &deviceId, bool swap)
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::addListener(const std::string &deviceId)
|
bool AkVCam::IpcBridge::addListener(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
Message message;
|
Message message;
|
||||||
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_LISTENER_ADD;
|
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_LISTENER_ADD;
|
||||||
|
@ -1483,7 +1475,7 @@ bool AkVCam::IpcBridge::addListener(const std::string &deviceId)
|
||||||
|
|
||||||
bool AkVCam::IpcBridge::removeListener(const std::string &deviceId)
|
bool AkVCam::IpcBridge::removeListener(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkIpcBridgeLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
Message message;
|
Message message;
|
||||||
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_LISTENER_REMOVE;
|
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_LISTENER_REMOVE;
|
||||||
|
@ -1956,12 +1948,12 @@ std::wstring AkVCam::IpcBridgePrivate::locateDriverPath() const
|
||||||
void AkVCam::IpcBridgePrivate::pipeStateChanged(void *userData,
|
void AkVCam::IpcBridgePrivate::pipeStateChanged(void *userData,
|
||||||
MessageServer::PipeState state)
|
MessageServer::PipeState state)
|
||||||
{
|
{
|
||||||
AkIpcBridgePrivateLogMethod();
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<IpcBridgePrivate *>(userData);
|
auto self = reinterpret_cast<IpcBridgePrivate *>(userData);
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case MessageServer::PipeStateAvailable:
|
case MessageServer::PipeStateAvailable:
|
||||||
AkLoggerLog("Server Available");
|
AkLogInfo() << "Server Available" << std::endl;
|
||||||
|
|
||||||
if (self->self->registerPeer(self->m_asClient)) {
|
if (self->self->registerPeer(self->m_asClient)) {
|
||||||
AKVCAM_EMIT(self->self,
|
AKVCAM_EMIT(self->self,
|
||||||
|
@ -1972,7 +1964,7 @@ void AkVCam::IpcBridgePrivate::pipeStateChanged(void *userData,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MessageServer::PipeStateGone:
|
case MessageServer::PipeStateGone:
|
||||||
AkLoggerLog("Server Gone");
|
AkLogWarning() << "Server Gone" << std::endl;
|
||||||
AKVCAM_EMIT(self->self,
|
AKVCAM_EMIT(self->self,
|
||||||
ServerStateChanged,
|
ServerStateChanged,
|
||||||
IpcBridge::ServerStateGone)
|
IpcBridge::ServerStateGone)
|
||||||
|
|
|
@ -27,7 +27,6 @@ exists(commons.pri) {
|
||||||
}
|
}
|
||||||
|
|
||||||
include(../dshow.pri)
|
include(../dshow.pri)
|
||||||
include(../../VCamUtils/VCamUtils.pri)
|
|
||||||
|
|
||||||
CONFIG -= qt
|
CONFIG -= qt
|
||||||
CONFIG += link_prl
|
CONFIG += link_prl
|
||||||
|
|
|
@ -33,11 +33,6 @@
|
||||||
#include "VCamUtils/src/ipcbridge.h"
|
#include "VCamUtils/src/ipcbridge.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "BaseFilter"
|
|
||||||
|
|
||||||
#define AkBaseFilterPrivateLog() \
|
|
||||||
AkLoggerLog("BaseFilterPrivate::", __FUNCTION__, "()")
|
|
||||||
|
|
||||||
#define AkVCamPinCall(pins, func, ...) \
|
#define AkVCamPinCall(pins, func, ...) \
|
||||||
pins->Reset(); \
|
pins->Reset(); \
|
||||||
Pin *pin = nullptr; \
|
Pin *pin = nullptr; \
|
||||||
|
@ -116,7 +111,7 @@ void AkVCam::BaseFilter::addPin(const std::vector<AkVCam::VideoFormat> &formats,
|
||||||
const std::wstring &pinName,
|
const std::wstring &pinName,
|
||||||
bool changed)
|
bool changed)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_pins->addPin(new Pin(this, formats, pinName), changed);
|
this->d->m_pins->addPin(new Pin(this, formats, pinName), changed);
|
||||||
|
|
||||||
if (this->d->m_pins->count() == 1)
|
if (this->d->m_pins->count() == 1)
|
||||||
|
@ -125,24 +120,26 @@ void AkVCam::BaseFilter::addPin(const std::vector<AkVCam::VideoFormat> &formats,
|
||||||
|
|
||||||
void AkVCam::BaseFilter::removePin(IPin *pin, bool changed)
|
void AkVCam::BaseFilter::removePin(IPin *pin, bool changed)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_ipcBridge.disconnectService();
|
this->d->m_ipcBridge.disconnectService();
|
||||||
this->d->m_pins->removePin(pin, changed);
|
this->d->m_pins->removePin(pin, changed);
|
||||||
}
|
}
|
||||||
|
|
||||||
AkVCam::BaseFilter *AkVCam::BaseFilter::create(const GUID &clsid)
|
AkVCam::BaseFilter *AkVCam::BaseFilter::create(const GUID &clsid)
|
||||||
{
|
{
|
||||||
AkLoggerLog("BaseFilter::create()");
|
AkLogFunction();
|
||||||
auto camera = cameraFromId(clsid);
|
auto camera = cameraFromId(clsid);
|
||||||
AkLoggerLog("CLSID: ", stringFromClsid(clsid));
|
AkLogInfo() << "CLSID: " << stringFromClsid(clsid) << std::endl;
|
||||||
AkLoggerLog("ID: ", camera);
|
AkLogInfo() << "ID: " << camera << std::endl;
|
||||||
|
|
||||||
if (camera < 0)
|
if (camera < 0)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto description = cameraDescription(DWORD(camera));
|
auto description = cameraDescription(DWORD(camera));
|
||||||
AkLoggerLog("Description: ", std::string(description.begin(),
|
AkLogInfo() << "Description: "
|
||||||
description.end()));
|
<< std::string(description.begin(),
|
||||||
|
description.end())
|
||||||
|
<< std::endl;
|
||||||
auto baseFilter = new BaseFilter(clsid,
|
auto baseFilter = new BaseFilter(clsid,
|
||||||
description,
|
description,
|
||||||
DSHOW_PLUGIN_VENDOR_L);
|
DSHOW_PLUGIN_VENDOR_L);
|
||||||
|
@ -164,8 +161,8 @@ IReferenceClock *AkVCam::BaseFilter::referenceClock() const
|
||||||
|
|
||||||
HRESULT AkVCam::BaseFilter::QueryInterface(const IID &riid, void **ppvObject)
|
HRESULT AkVCam::BaseFilter::QueryInterface(const IID &riid, void **ppvObject)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("IID: ", AkVCam::stringFromClsid(riid));
|
AkLogInfo() << "IID: " << AkVCam::stringFromClsid(riid) << std::endl;
|
||||||
|
|
||||||
if (!ppvObject)
|
if (!ppvObject)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -238,7 +235,7 @@ HRESULT AkVCam::BaseFilter::QueryInterface(const IID &riid, void **ppvObject)
|
||||||
|
|
||||||
HRESULT AkVCam::BaseFilter::EnumPins(IEnumPins **ppEnum)
|
HRESULT AkVCam::BaseFilter::EnumPins(IEnumPins **ppEnum)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_pins)
|
if (!this->d->m_pins)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
|
@ -253,7 +250,7 @@ HRESULT AkVCam::BaseFilter::EnumPins(IEnumPins **ppEnum)
|
||||||
|
|
||||||
HRESULT AkVCam::BaseFilter::FindPin(LPCWSTR Id, IPin **ppPin)
|
HRESULT AkVCam::BaseFilter::FindPin(LPCWSTR Id, IPin **ppPin)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!ppPin)
|
if (!ppPin)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -290,7 +287,7 @@ HRESULT AkVCam::BaseFilter::FindPin(LPCWSTR Id, IPin **ppPin)
|
||||||
|
|
||||||
HRESULT AkVCam::BaseFilter::QueryFilterInfo(FILTER_INFO *pInfo)
|
HRESULT AkVCam::BaseFilter::QueryFilterInfo(FILTER_INFO *pInfo)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pInfo)
|
if (!pInfo)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -314,21 +311,23 @@ HRESULT AkVCam::BaseFilter::QueryFilterInfo(FILTER_INFO *pInfo)
|
||||||
|
|
||||||
HRESULT AkVCam::BaseFilter::JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName)
|
HRESULT AkVCam::BaseFilter::JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->d->m_filterGraph = pGraph;
|
this->d->m_filterGraph = pGraph;
|
||||||
this->d->m_filterName = std::wstring(pName? pName: L"");
|
this->d->m_filterName = std::wstring(pName? pName: L"");
|
||||||
|
|
||||||
AkLoggerLog("Filter graph: ", this->d->m_filterGraph);
|
AkLogInfo() << "Filter graph: " << this->d->m_filterGraph << std::endl;
|
||||||
AkLoggerLog("Name: ", std::string(this->d->m_filterName.begin(),
|
AkLogInfo() << "Name: "
|
||||||
this->d->m_filterName.end()));
|
<< std::string(this->d->m_filterName.begin(),
|
||||||
|
this->d->m_filterName.end())
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT AkVCam::BaseFilter::QueryVendorInfo(LPWSTR *pVendorInfo)
|
HRESULT AkVCam::BaseFilter::QueryVendorInfo(LPWSTR *pVendorInfo)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_vendor.size() < 1)
|
if (this->d->m_vendor.size() < 1)
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
|
@ -396,7 +395,7 @@ AkVCam::BaseFilterPrivate::~BaseFilterPrivate()
|
||||||
|
|
||||||
IEnumPins *AkVCam::BaseFilterPrivate::pinsForDevice(const std::string &deviceId)
|
IEnumPins *AkVCam::BaseFilterPrivate::pinsForDevice(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
CLSID clsid;
|
CLSID clsid;
|
||||||
self->GetClassID(&clsid);
|
self->GetClassID(&clsid);
|
||||||
|
@ -450,7 +449,7 @@ void AkVCam::BaseFilterPrivate::updatePins()
|
||||||
void AkVCam::BaseFilterPrivate::serverStateChanged(void *userData,
|
void AkVCam::BaseFilterPrivate::serverStateChanged(void *userData,
|
||||||
IpcBridge::ServerState state)
|
IpcBridge::ServerState state)
|
||||||
{
|
{
|
||||||
AkBaseFilterPrivateLog();
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<BaseFilterPrivate *>(userData);
|
auto self = reinterpret_cast<BaseFilterPrivate *>(userData);
|
||||||
IEnumPins *pins = nullptr;
|
IEnumPins *pins = nullptr;
|
||||||
self->self->EnumPins(&pins);
|
self->self->EnumPins(&pins);
|
||||||
|
@ -468,7 +467,7 @@ void AkVCam::BaseFilterPrivate::frameReady(void *userData,
|
||||||
const std::string &deviceId,
|
const std::string &deviceId,
|
||||||
const VideoFrame &frame)
|
const VideoFrame &frame)
|
||||||
{
|
{
|
||||||
AkBaseFilterPrivateLog();
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<BaseFilterPrivate *>(userData);
|
auto self = reinterpret_cast<BaseFilterPrivate *>(userData);
|
||||||
AkVCamDevicePinCall(deviceId, self, frameReady, frame);
|
AkVCamDevicePinCall(deviceId, self, frameReady, frame);
|
||||||
}
|
}
|
||||||
|
@ -477,7 +476,7 @@ void AkVCam::BaseFilterPrivate::setBroadcasting(void *userData,
|
||||||
const std::string &deviceId,
|
const std::string &deviceId,
|
||||||
const std::string &broadcaster)
|
const std::string &broadcaster)
|
||||||
{
|
{
|
||||||
AkBaseFilterPrivateLog();
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<BaseFilterPrivate *>(userData);
|
auto self = reinterpret_cast<BaseFilterPrivate *>(userData);
|
||||||
AkVCamDevicePinCall(deviceId, self, setBroadcasting, broadcaster);
|
AkVCamDevicePinCall(deviceId, self, setBroadcasting, broadcaster);
|
||||||
}
|
}
|
||||||
|
@ -487,7 +486,7 @@ void AkVCam::BaseFilterPrivate::setMirror(void *userData,
|
||||||
bool horizontalMirror,
|
bool horizontalMirror,
|
||||||
bool verticalMirror)
|
bool verticalMirror)
|
||||||
{
|
{
|
||||||
AkBaseFilterPrivateLog();
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<BaseFilterPrivate *>(userData);
|
auto self = reinterpret_cast<BaseFilterPrivate *>(userData);
|
||||||
AkVCamDevicePinCall(deviceId,
|
AkVCamDevicePinCall(deviceId,
|
||||||
self,
|
self,
|
||||||
|
@ -500,7 +499,7 @@ void AkVCam::BaseFilterPrivate::setScaling(void *userData,
|
||||||
const std::string &deviceId,
|
const std::string &deviceId,
|
||||||
Scaling scaling)
|
Scaling scaling)
|
||||||
{
|
{
|
||||||
AkBaseFilterPrivateLog();
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<BaseFilterPrivate *>(userData);
|
auto self = reinterpret_cast<BaseFilterPrivate *>(userData);
|
||||||
AkVCamDevicePinCall(deviceId, self, setScaling, scaling);
|
AkVCamDevicePinCall(deviceId, self, setScaling, scaling);
|
||||||
}
|
}
|
||||||
|
@ -509,7 +508,7 @@ void AkVCam::BaseFilterPrivate::setAspectRatio(void *userData,
|
||||||
const std::string &deviceId,
|
const std::string &deviceId,
|
||||||
AspectRatio aspectRatio)
|
AspectRatio aspectRatio)
|
||||||
{
|
{
|
||||||
AkBaseFilterPrivateLog();
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<BaseFilterPrivate *>(userData);
|
auto self = reinterpret_cast<BaseFilterPrivate *>(userData);
|
||||||
AkVCamDevicePinCall(deviceId, self, setAspectRatio, aspectRatio);
|
AkVCamDevicePinCall(deviceId, self, setAspectRatio, aspectRatio);
|
||||||
}
|
}
|
||||||
|
@ -518,7 +517,7 @@ void AkVCam::BaseFilterPrivate::setSwapRgb(void *userData,
|
||||||
const std::string &deviceId,
|
const std::string &deviceId,
|
||||||
bool swap)
|
bool swap)
|
||||||
{
|
{
|
||||||
AkBaseFilterPrivateLog();
|
AkLogFunction();
|
||||||
auto self = reinterpret_cast<BaseFilterPrivate *>(userData);
|
auto self = reinterpret_cast<BaseFilterPrivate *>(userData);
|
||||||
AkVCamDevicePinCall(deviceId, self, setSwapRgb, swap);
|
AkVCamDevicePinCall(deviceId, self, setSwapRgb, swap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "ClassFactory"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class ClassFactoryPrivate
|
class ClassFactoryPrivate
|
||||||
|
@ -56,8 +54,8 @@ bool AkVCam::ClassFactory::locked()
|
||||||
|
|
||||||
HRESULT AkVCam::ClassFactory::QueryInterface(const IID &riid, void **ppvObject)
|
HRESULT AkVCam::ClassFactory::QueryInterface(const IID &riid, void **ppvObject)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("IID: ", AkVCam::stringFromClsid(riid));
|
AkLogInfo() << "IID: " << AkVCam::stringFromClsid(riid) << std::endl;
|
||||||
|
|
||||||
if (!ppvObject)
|
if (!ppvObject)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -94,9 +92,9 @@ HRESULT AkVCam::ClassFactory::CreateInstance(IUnknown *pUnkOuter,
|
||||||
const IID &riid,
|
const IID &riid,
|
||||||
void **ppvObject)
|
void **ppvObject)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("Outer: ", ULONG_PTR(pUnkOuter));
|
AkLogInfo() << "Outer: " << ULONG_PTR(pUnkOuter) << std::endl;
|
||||||
AkLoggerLog("IID: ", stringFromClsid(riid));
|
AkLogInfo() << "IID: " << stringFromClsid(riid) << std::endl;
|
||||||
|
|
||||||
if (!ppvObject)
|
if (!ppvObject)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
@ -114,7 +112,7 @@ HRESULT AkVCam::ClassFactory::CreateInstance(IUnknown *pUnkOuter,
|
||||||
|
|
||||||
HRESULT AkVCam::ClassFactory::LockServer(BOOL fLock)
|
HRESULT AkVCam::ClassFactory::LockServer(BOOL fLock)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_locked += fLock? 1: -1;
|
this->d->m_locked += fLock? 1: -1;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -24,18 +24,24 @@
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AkCUnknownLogMethod() \
|
#define AkCUnknownLogMethod() \
|
||||||
AkLoggerLog((this->d->m_parent? \
|
AkLogFunction() << " " \
|
||||||
stringFromClsid(this->d->m_parentCLSID): \
|
<< (this->d->m_parent? \
|
||||||
std::string("CUnknown")), \
|
stringFromClsid(this->d->m_parentCLSID): \
|
||||||
"(", (this->d->m_parent? this->d->m_parent: this), \
|
std::string("CUnknown")) \
|
||||||
")::", __FUNCTION__, "()")
|
<< "(" \
|
||||||
|
<< (this->d->m_parent? this->d->m_parent: this) \
|
||||||
|
<< ")" \
|
||||||
|
<< std::endl
|
||||||
|
|
||||||
#define AkCUnknownLogThis() \
|
#define AkCUnknownLogThis() \
|
||||||
AkLoggerLog("Returning ", \
|
AkLogInfo() << "Returning " \
|
||||||
(this->d->m_parent? \
|
<< (this->d->m_parent? \
|
||||||
stringFromClsid(this->d->m_parentCLSID): \
|
stringFromClsid(this->d->m_parentCLSID): \
|
||||||
std::string("CUnknown")), \
|
std::string("CUnknown")) \
|
||||||
"(", (this->d->m_parent? this->d->m_parent: this), ")")
|
<< "(" \
|
||||||
|
<< (this->d->m_parent? this->d->m_parent: this) \
|
||||||
|
<< ")" \
|
||||||
|
<< std::endl
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
|
@ -76,7 +82,7 @@ ULONG AkVCam::CUnknown::ref() const
|
||||||
HRESULT AkVCam::CUnknown::QueryInterface(const IID &riid, void **ppvObject)
|
HRESULT AkVCam::CUnknown::QueryInterface(const IID &riid, void **ppvObject)
|
||||||
{
|
{
|
||||||
AkCUnknownLogMethod();
|
AkCUnknownLogMethod();
|
||||||
AkLoggerLog("IID: ", AkVCam::stringFromClsid(riid));
|
AkLogInfo() << "IID: " << AkVCam::stringFromClsid(riid) << std::endl;
|
||||||
|
|
||||||
if (!ppvObject)
|
if (!ppvObject)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -91,7 +97,7 @@ HRESULT AkVCam::CUnknown::QueryInterface(const IID &riid, void **ppvObject)
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} else {
|
} else {
|
||||||
AkLoggerLog("Unknown interface");
|
AkLogWarning() << "Unknown interface" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
|
@ -101,7 +107,7 @@ ULONG AkVCam::CUnknown::AddRef()
|
||||||
{
|
{
|
||||||
AkCUnknownLogMethod();
|
AkCUnknownLogMethod();
|
||||||
this->d->m_ref++;
|
this->d->m_ref++;
|
||||||
AkLoggerLog("REF: ", this->d->m_ref);
|
AkLogInfo() << "REF: " << this->d->m_ref << std::endl;
|
||||||
|
|
||||||
return this->d->m_ref;
|
return this->d->m_ref;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +115,7 @@ ULONG AkVCam::CUnknown::AddRef()
|
||||||
ULONG AkVCam::CUnknown::Release()
|
ULONG AkVCam::CUnknown::Release()
|
||||||
{
|
{
|
||||||
AkCUnknownLogMethod();
|
AkCUnknownLogMethod();
|
||||||
AkLoggerLog("REF: ", this->d->m_ref);
|
AkLogInfo() << "REF: " << this->d->m_ref << std::endl;
|
||||||
|
|
||||||
if (this->d->m_ref)
|
if (this->d->m_ref)
|
||||||
this->d->m_ref--;
|
this->d->m_ref--;
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
#include "VCamUtils/src/image/videoformat.h"
|
#include "VCamUtils/src/image/videoformat.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "EnumMediaTypes"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class EnumMediaTypesPrivate
|
class EnumMediaTypesPrivate
|
||||||
|
@ -95,7 +93,7 @@ HRESULT AkVCam::EnumMediaTypes::Next(ULONG cMediaTypes,
|
||||||
AM_MEDIA_TYPE **ppMediaTypes,
|
AM_MEDIA_TYPE **ppMediaTypes,
|
||||||
ULONG *pcFetched)
|
ULONG *pcFetched)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (pcFetched)
|
if (pcFetched)
|
||||||
*pcFetched = 0;
|
*pcFetched = 0;
|
||||||
|
@ -134,8 +132,8 @@ HRESULT AkVCam::EnumMediaTypes::Next(ULONG cMediaTypes,
|
||||||
|
|
||||||
HRESULT AkVCam::EnumMediaTypes::Skip(ULONG cMediaTypes)
|
HRESULT AkVCam::EnumMediaTypes::Skip(ULONG cMediaTypes)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("Skip ", cMediaTypes, " media types");
|
AkLogInfo() << "Skip " << cMediaTypes << " media types" << std::endl;
|
||||||
|
|
||||||
if (this->d->m_changed) {
|
if (this->d->m_changed) {
|
||||||
this->d->m_changed = false;
|
this->d->m_changed = false;
|
||||||
|
@ -155,7 +153,7 @@ HRESULT AkVCam::EnumMediaTypes::Skip(ULONG cMediaTypes)
|
||||||
|
|
||||||
HRESULT AkVCam::EnumMediaTypes::Reset()
|
HRESULT AkVCam::EnumMediaTypes::Reset()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_position = 0;
|
this->d->m_position = 0;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -163,7 +161,7 @@ HRESULT AkVCam::EnumMediaTypes::Reset()
|
||||||
|
|
||||||
HRESULT AkVCam::EnumMediaTypes::Clone(IEnumMediaTypes **ppEnum)
|
HRESULT AkVCam::EnumMediaTypes::Clone(IEnumMediaTypes **ppEnum)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!ppEnum)
|
if (!ppEnum)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
|
@ -25,8 +25,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "EnumPins"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class EnumPinsPrivate
|
class EnumPinsPrivate
|
||||||
|
@ -99,7 +97,7 @@ void AkVCam::EnumPins::setBaseFilter(BaseFilter *baseFilter)
|
||||||
|
|
||||||
HRESULT AkVCam::EnumPins::Next(ULONG cPins, IPin **ppPins, ULONG *pcFetched)
|
HRESULT AkVCam::EnumPins::Next(ULONG cPins, IPin **ppPins, ULONG *pcFetched)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (pcFetched)
|
if (pcFetched)
|
||||||
*pcFetched = 0;
|
*pcFetched = 0;
|
||||||
|
@ -139,8 +137,8 @@ HRESULT AkVCam::EnumPins::Next(ULONG cPins, IPin **ppPins, ULONG *pcFetched)
|
||||||
|
|
||||||
HRESULT AkVCam::EnumPins::Skip(ULONG cPins)
|
HRESULT AkVCam::EnumPins::Skip(ULONG cPins)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("Skip ", cPins, " pins");
|
AkLogInfo() << "Skip " << cPins << " pins" << std::endl;
|
||||||
|
|
||||||
if (this->d->m_changed) {
|
if (this->d->m_changed) {
|
||||||
this->d->m_changed = false;
|
this->d->m_changed = false;
|
||||||
|
@ -160,7 +158,7 @@ HRESULT AkVCam::EnumPins::Skip(ULONG cPins)
|
||||||
|
|
||||||
HRESULT AkVCam::EnumPins::Reset()
|
HRESULT AkVCam::EnumPins::Reset()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_position = 0;
|
this->d->m_position = 0;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -168,7 +166,7 @@ HRESULT AkVCam::EnumPins::Reset()
|
||||||
|
|
||||||
HRESULT AkVCam::EnumPins::Clone(IEnumPins **ppEnum)
|
HRESULT AkVCam::EnumPins::Clone(IEnumPins **ppEnum)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!ppEnum)
|
if (!ppEnum)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "FilterMiscFlags"
|
|
||||||
|
|
||||||
AkVCam::FilterMiscFlags::FilterMiscFlags():
|
AkVCam::FilterMiscFlags::FilterMiscFlags():
|
||||||
CUnknown(this, IID_IAMFilterMiscFlags)
|
CUnknown(this, IID_IAMFilterMiscFlags)
|
||||||
{
|
{
|
||||||
|
@ -36,7 +34,7 @@ AkVCam::FilterMiscFlags::~FilterMiscFlags()
|
||||||
|
|
||||||
ULONG AkVCam::FilterMiscFlags::GetMiscFlags()
|
ULONG AkVCam::FilterMiscFlags::GetMiscFlags()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return AM_FILTER_MISC_FLAGS_IS_SOURCE;
|
return AM_FILTER_MISC_FLAGS_IS_SOURCE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "Latency"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class LatencyPrivate
|
class LatencyPrivate
|
||||||
|
@ -51,7 +49,7 @@ AkVCam::Latency::~Latency()
|
||||||
|
|
||||||
HRESULT AkVCam::Latency::GetLatency(REFERENCE_TIME *prtLatency)
|
HRESULT AkVCam::Latency::GetLatency(REFERENCE_TIME *prtLatency)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!prtLatency)
|
if (!prtLatency)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "MediaFilter"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
typedef std::pair<void *, StateChangedCallbackT> StateChangedCallback;
|
typedef std::pair<void *, StateChangedCallbackT> StateChangedCallback;
|
||||||
|
@ -64,14 +62,14 @@ AkVCam::MediaFilter::~MediaFilter()
|
||||||
void AkVCam::MediaFilter::connectStateChanged(void *userData,
|
void AkVCam::MediaFilter::connectStateChanged(void *userData,
|
||||||
StateChangedCallbackT callback)
|
StateChangedCallbackT callback)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_stateChanged.push_back({userData, callback});
|
this->d->m_stateChanged.push_back({userData, callback});
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::MediaFilter::disconnectStateChanged(void *userData,
|
void AkVCam::MediaFilter::disconnectStateChanged(void *userData,
|
||||||
StateChangedCallbackT callback)
|
StateChangedCallbackT callback)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
for (auto it = this->d->m_stateChanged.begin();
|
for (auto it = this->d->m_stateChanged.begin();
|
||||||
it != this->d->m_stateChanged.end();
|
it != this->d->m_stateChanged.end();
|
||||||
|
@ -87,7 +85,7 @@ void AkVCam::MediaFilter::disconnectStateChanged(void *userData,
|
||||||
|
|
||||||
HRESULT AkVCam::MediaFilter::Stop()
|
HRESULT AkVCam::MediaFilter::Stop()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_state = State_Stopped;
|
this->d->m_state = State_Stopped;
|
||||||
HRESULT result = S_OK;
|
HRESULT result = S_OK;
|
||||||
|
|
||||||
|
@ -105,7 +103,7 @@ HRESULT AkVCam::MediaFilter::Stop()
|
||||||
|
|
||||||
HRESULT AkVCam::MediaFilter::Pause()
|
HRESULT AkVCam::MediaFilter::Pause()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_state = State_Paused;
|
this->d->m_state = State_Paused;
|
||||||
HRESULT result = S_OK;
|
HRESULT result = S_OK;
|
||||||
|
|
||||||
|
@ -123,7 +121,7 @@ HRESULT AkVCam::MediaFilter::Pause()
|
||||||
|
|
||||||
HRESULT AkVCam::MediaFilter::Run(REFERENCE_TIME tStart)
|
HRESULT AkVCam::MediaFilter::Run(REFERENCE_TIME tStart)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_start = tStart;
|
this->d->m_start = tStart;
|
||||||
this->d->m_state = State_Running;
|
this->d->m_state = State_Running;
|
||||||
HRESULT result = S_OK;
|
HRESULT result = S_OK;
|
||||||
|
@ -144,20 +142,20 @@ HRESULT AkVCam::MediaFilter::GetState(DWORD dwMilliSecsTimeout,
|
||||||
FILTER_STATE *State)
|
FILTER_STATE *State)
|
||||||
{
|
{
|
||||||
UNUSED(dwMilliSecsTimeout)
|
UNUSED(dwMilliSecsTimeout)
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!State)
|
if (!State)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
*State = this->d->m_state;
|
*State = this->d->m_state;
|
||||||
AkLoggerLog("State: ", *State);
|
AkLogInfo() << "State: " << *State << std::endl;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT AkVCam::MediaFilter::SetSyncSource(IReferenceClock *pClock)
|
HRESULT AkVCam::MediaFilter::SetSyncSource(IReferenceClock *pClock)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_clock)
|
if (this->d->m_clock)
|
||||||
this->d->m_clock->Release();
|
this->d->m_clock->Release();
|
||||||
|
@ -172,7 +170,7 @@ HRESULT AkVCam::MediaFilter::SetSyncSource(IReferenceClock *pClock)
|
||||||
|
|
||||||
HRESULT AkVCam::MediaFilter::GetSyncSource(IReferenceClock **pClock)
|
HRESULT AkVCam::MediaFilter::GetSyncSource(IReferenceClock **pClock)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pClock)
|
if (!pClock)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "MediaSample"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class MediaSamplePrivate
|
class MediaSamplePrivate
|
||||||
|
@ -91,7 +89,7 @@ ULONG AkVCam::MediaSample::Release()
|
||||||
|
|
||||||
HRESULT AkVCam::MediaSample::GetPointer(BYTE **ppBuffer)
|
HRESULT AkVCam::MediaSample::GetPointer(BYTE **ppBuffer)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!ppBuffer)
|
if (!ppBuffer)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -103,7 +101,7 @@ HRESULT AkVCam::MediaSample::GetPointer(BYTE **ppBuffer)
|
||||||
|
|
||||||
LONG AkVCam::MediaSample::GetSize()
|
LONG AkVCam::MediaSample::GetSize()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return this->d->m_bufferSize;
|
return this->d->m_bufferSize;
|
||||||
}
|
}
|
||||||
|
@ -111,7 +109,7 @@ LONG AkVCam::MediaSample::GetSize()
|
||||||
HRESULT AkVCam::MediaSample::GetTime(REFERENCE_TIME *pTimeStart,
|
HRESULT AkVCam::MediaSample::GetTime(REFERENCE_TIME *pTimeStart,
|
||||||
REFERENCE_TIME *pTimeEnd)
|
REFERENCE_TIME *pTimeEnd)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pTimeStart || !pTimeEnd)
|
if (!pTimeStart || !pTimeEnd)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -134,7 +132,7 @@ HRESULT AkVCam::MediaSample::GetTime(REFERENCE_TIME *pTimeStart,
|
||||||
HRESULT AkVCam::MediaSample::SetTime(REFERENCE_TIME *pTimeStart,
|
HRESULT AkVCam::MediaSample::SetTime(REFERENCE_TIME *pTimeStart,
|
||||||
REFERENCE_TIME *pTimeEnd)
|
REFERENCE_TIME *pTimeEnd)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->d->m_sampleTimeStart = pTimeStart? *pTimeStart: -1;
|
this->d->m_sampleTimeStart = pTimeStart? *pTimeStart: -1;
|
||||||
this->d->m_sampleTimeEnd = pTimeEnd? *pTimeEnd: -1;
|
this->d->m_sampleTimeEnd = pTimeEnd? *pTimeEnd: -1;
|
||||||
|
@ -144,14 +142,14 @@ HRESULT AkVCam::MediaSample::SetTime(REFERENCE_TIME *pTimeStart,
|
||||||
|
|
||||||
HRESULT AkVCam::MediaSample::IsSyncPoint()
|
HRESULT AkVCam::MediaSample::IsSyncPoint()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return this->d->m_syncPoint? S_OK: S_FALSE;
|
return this->d->m_syncPoint? S_OK: S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT AkVCam::MediaSample::SetSyncPoint(BOOL bIsSyncPoint)
|
HRESULT AkVCam::MediaSample::SetSyncPoint(BOOL bIsSyncPoint)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_syncPoint = bIsSyncPoint;
|
this->d->m_syncPoint = bIsSyncPoint;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -159,14 +157,14 @@ HRESULT AkVCam::MediaSample::SetSyncPoint(BOOL bIsSyncPoint)
|
||||||
|
|
||||||
HRESULT AkVCam::MediaSample::IsPreroll()
|
HRESULT AkVCam::MediaSample::IsPreroll()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return this->d->m_preroll? S_OK: S_FALSE;
|
return this->d->m_preroll? S_OK: S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT AkVCam::MediaSample::SetPreroll(BOOL bIsPreroll)
|
HRESULT AkVCam::MediaSample::SetPreroll(BOOL bIsPreroll)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_preroll = bIsPreroll;
|
this->d->m_preroll = bIsPreroll;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -174,14 +172,14 @@ HRESULT AkVCam::MediaSample::SetPreroll(BOOL bIsPreroll)
|
||||||
|
|
||||||
LONG AkVCam::MediaSample::GetActualDataLength()
|
LONG AkVCam::MediaSample::GetActualDataLength()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return this->d->m_dataLength;
|
return this->d->m_dataLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT AkVCam::MediaSample::SetActualDataLength(LONG lLen)
|
HRESULT AkVCam::MediaSample::SetActualDataLength(LONG lLen)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (lLen < 0 || lLen > this->d->m_bufferSize)
|
if (lLen < 0 || lLen > this->d->m_bufferSize)
|
||||||
return VFW_E_BUFFER_OVERFLOW;
|
return VFW_E_BUFFER_OVERFLOW;
|
||||||
|
@ -193,7 +191,7 @@ HRESULT AkVCam::MediaSample::SetActualDataLength(LONG lLen)
|
||||||
|
|
||||||
HRESULT AkVCam::MediaSample::GetMediaType(AM_MEDIA_TYPE **ppMediaType)
|
HRESULT AkVCam::MediaSample::GetMediaType(AM_MEDIA_TYPE **ppMediaType)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!ppMediaType)
|
if (!ppMediaType)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -213,7 +211,7 @@ HRESULT AkVCam::MediaSample::GetMediaType(AM_MEDIA_TYPE **ppMediaType)
|
||||||
|
|
||||||
HRESULT AkVCam::MediaSample::SetMediaType(AM_MEDIA_TYPE *pMediaType)
|
HRESULT AkVCam::MediaSample::SetMediaType(AM_MEDIA_TYPE *pMediaType)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pMediaType)
|
if (!pMediaType)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -233,14 +231,14 @@ HRESULT AkVCam::MediaSample::SetMediaType(AM_MEDIA_TYPE *pMediaType)
|
||||||
|
|
||||||
HRESULT AkVCam::MediaSample::IsDiscontinuity()
|
HRESULT AkVCam::MediaSample::IsDiscontinuity()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return this->d->m_discontinuity? S_OK: S_FALSE;
|
return this->d->m_discontinuity? S_OK: S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT AkVCam::MediaSample::SetDiscontinuity(BOOL bDiscontinuity)
|
HRESULT AkVCam::MediaSample::SetDiscontinuity(BOOL bDiscontinuity)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_discontinuity = bDiscontinuity;
|
this->d->m_discontinuity = bDiscontinuity;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -249,7 +247,7 @@ HRESULT AkVCam::MediaSample::SetDiscontinuity(BOOL bDiscontinuity)
|
||||||
HRESULT AkVCam::MediaSample::GetMediaTime(LONGLONG *pTimeStart,
|
HRESULT AkVCam::MediaSample::GetMediaTime(LONGLONG *pTimeStart,
|
||||||
LONGLONG *pTimeEnd)
|
LONGLONG *pTimeEnd)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pTimeStart || !pTimeEnd)
|
if (!pTimeStart || !pTimeEnd)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -266,7 +264,7 @@ HRESULT AkVCam::MediaSample::GetMediaTime(LONGLONG *pTimeStart,
|
||||||
HRESULT AkVCam::MediaSample::SetMediaTime(LONGLONG *pTimeStart,
|
HRESULT AkVCam::MediaSample::SetMediaTime(LONGLONG *pTimeStart,
|
||||||
LONGLONG *pTimeEnd)
|
LONGLONG *pTimeEnd)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->d->m_mediaTimeStart = pTimeStart? *pTimeStart: -1;
|
this->d->m_mediaTimeStart = pTimeStart? *pTimeStart: -1;
|
||||||
this->d->m_mediaTimeEnd = pTimeEnd? *pTimeEnd: -1;
|
this->d->m_mediaTimeEnd = pTimeEnd? *pTimeEnd: -1;
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "MediaFilter2"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class MediaSample2Private
|
class MediaSample2Private
|
||||||
|
@ -60,7 +58,7 @@ AkVCam::MediaSample2::~MediaSample2()
|
||||||
HRESULT AkVCam::MediaSample2::SetProperties(DWORD cbProperties,
|
HRESULT AkVCam::MediaSample2::SetProperties(DWORD cbProperties,
|
||||||
const BYTE *pbProperties)
|
const BYTE *pbProperties)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (cbProperties < sizeof(AM_SAMPLE2_PROPERTIES))
|
if (cbProperties < sizeof(AM_SAMPLE2_PROPERTIES))
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
@ -96,7 +94,7 @@ HRESULT AkVCam::MediaSample2::SetProperties(DWORD cbProperties,
|
||||||
HRESULT AkVCam::MediaSample2::GetProperties(DWORD cbProperties,
|
HRESULT AkVCam::MediaSample2::GetProperties(DWORD cbProperties,
|
||||||
BYTE *pbProperties)
|
BYTE *pbProperties)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (cbProperties < sizeof(AM_SAMPLE2_PROPERTIES))
|
if (cbProperties < sizeof(AM_SAMPLE2_PROPERTIES))
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
#include "VCamUtils/src/image/videoformat.h"
|
#include "VCamUtils/src/image/videoformat.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "MemAllocator"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class MemAllocatorPrivate
|
class MemAllocatorPrivate
|
||||||
|
@ -64,7 +62,7 @@ AkVCam::MemAllocator::~MemAllocator()
|
||||||
HRESULT AkVCam::MemAllocator::SetProperties(ALLOCATOR_PROPERTIES *pRequest,
|
HRESULT AkVCam::MemAllocator::SetProperties(ALLOCATOR_PROPERTIES *pRequest,
|
||||||
ALLOCATOR_PROPERTIES *pActual)
|
ALLOCATOR_PROPERTIES *pActual)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pRequest || !pActual)
|
if (!pRequest || !pActual)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -87,7 +85,7 @@ HRESULT AkVCam::MemAllocator::SetProperties(ALLOCATOR_PROPERTIES *pRequest,
|
||||||
|
|
||||||
HRESULT AkVCam::MemAllocator::GetProperties(ALLOCATOR_PROPERTIES *pProps)
|
HRESULT AkVCam::MemAllocator::GetProperties(ALLOCATOR_PROPERTIES *pProps)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pProps)
|
if (!pProps)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -100,14 +98,14 @@ HRESULT AkVCam::MemAllocator::GetProperties(ALLOCATOR_PROPERTIES *pProps)
|
||||||
|
|
||||||
HRESULT AkVCam::MemAllocator::Commit()
|
HRESULT AkVCam::MemAllocator::Commit()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_commited)
|
if (this->d->m_commited)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
||||||
if (this->d->m_properties.cBuffers < 1
|
if (this->d->m_properties.cBuffers < 1
|
||||||
|| this->d->m_properties.cbBuffer < 1) {
|
|| this->d->m_properties.cbBuffer < 1) {
|
||||||
AkLoggerLog("Wrong memory allocator size");
|
AkLogError() << "Wrong memory allocator size" << std::endl;
|
||||||
|
|
||||||
return VFW_E_SIZENOTSET;
|
return VFW_E_SIZENOTSET;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +129,7 @@ HRESULT AkVCam::MemAllocator::Commit()
|
||||||
|
|
||||||
HRESULT AkVCam::MemAllocator::Decommit()
|
HRESULT AkVCam::MemAllocator::Decommit()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->d->m_commited)
|
if (!this->d->m_commited)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -151,10 +149,14 @@ HRESULT AkVCam::MemAllocator::Decommit()
|
||||||
freeSamples++;
|
freeSamples++;
|
||||||
}
|
}
|
||||||
|
|
||||||
AkLoggerLog("Free samples: ", freeSamples, "/", totalSamples);
|
AkLogInfo() << "Free samples: "
|
||||||
|
<< freeSamples
|
||||||
|
<< "/"
|
||||||
|
<< totalSamples
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
if (freeSamples >= totalSamples) {
|
if (freeSamples >= totalSamples) {
|
||||||
AkLoggerLog("Decommiting");
|
AkLogInfo() << "Decommiting" << std::endl;
|
||||||
this->d->m_samples.clear();
|
this->d->m_samples.clear();
|
||||||
this->d->m_commited = false;
|
this->d->m_commited = false;
|
||||||
this->d->m_decommiting = false;
|
this->d->m_decommiting = false;
|
||||||
|
@ -168,7 +170,7 @@ HRESULT AkVCam::MemAllocator::GetBuffer(IMediaSample **ppBuffer,
|
||||||
REFERENCE_TIME *pEndTime,
|
REFERENCE_TIME *pEndTime,
|
||||||
DWORD dwFlags)
|
DWORD dwFlags)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!ppBuffer)
|
if (!ppBuffer)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -182,7 +184,7 @@ HRESULT AkVCam::MemAllocator::GetBuffer(IMediaSample **ppBuffer,
|
||||||
*pEndTime = 0;
|
*pEndTime = 0;
|
||||||
|
|
||||||
if (!this->d->m_commited || this->d->m_decommiting) {
|
if (!this->d->m_commited || this->d->m_decommiting) {
|
||||||
AkLoggerLog("Allocator not commited.");
|
AkLogError() << "Allocator not commited." << std::endl;
|
||||||
|
|
||||||
return VFW_E_NOT_COMMITTED;
|
return VFW_E_NOT_COMMITTED;
|
||||||
}
|
}
|
||||||
|
@ -219,7 +221,7 @@ HRESULT AkVCam::MemAllocator::GetBuffer(IMediaSample **ppBuffer,
|
||||||
HRESULT AkVCam::MemAllocator::ReleaseBuffer(IMediaSample *pBuffer)
|
HRESULT AkVCam::MemAllocator::ReleaseBuffer(IMediaSample *pBuffer)
|
||||||
{
|
{
|
||||||
UNUSED(pBuffer)
|
UNUSED(pBuffer)
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->d->m_mutex.lock();
|
this->d->m_mutex.lock();
|
||||||
this->d->m_bufferReleased.notify_one();
|
this->d->m_bufferReleased.notify_one();
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "Persist"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class PersistPrivate
|
class PersistPrivate
|
||||||
|
@ -46,7 +44,7 @@ AkVCam::Persist::~Persist()
|
||||||
|
|
||||||
HRESULT AkVCam::Persist::GetClassID(CLSID *pClassID)
|
HRESULT AkVCam::Persist::GetClassID(CLSID *pClassID)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pClassID)
|
if (!pClassID)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "PersistPropertyBag"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class PersistPropertyBagPrivate
|
class PersistPropertyBagPrivate
|
||||||
|
@ -50,8 +48,8 @@ AkVCam::PersistPropertyBag::~PersistPropertyBag()
|
||||||
HRESULT AkVCam::PersistPropertyBag::QueryInterface(const IID &riid,
|
HRESULT AkVCam::PersistPropertyBag::QueryInterface(const IID &riid,
|
||||||
void **ppvObject)
|
void **ppvObject)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("IID: ", AkVCam::stringFromClsid(riid));
|
AkLogInfo() << "IID: " << AkVCam::stringFromClsid(riid) << std::endl;
|
||||||
|
|
||||||
if (!ppvObject)
|
if (!ppvObject)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -89,7 +87,7 @@ HRESULT AkVCam::PersistPropertyBag::QueryInterface(const IID &riid,
|
||||||
|
|
||||||
HRESULT AkVCam::PersistPropertyBag::InitNew()
|
HRESULT AkVCam::PersistPropertyBag::InitNew()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +96,7 @@ HRESULT AkVCam::PersistPropertyBag::Load(IPropertyBag *pPropBag,
|
||||||
IErrorLog *pErrorLog)
|
IErrorLog *pErrorLog)
|
||||||
{
|
{
|
||||||
UNUSED(pErrorLog)
|
UNUSED(pErrorLog)
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pPropBag)
|
if (!pPropBag)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -122,7 +120,7 @@ HRESULT AkVCam::PersistPropertyBag::Save(IPropertyBag *pPropBag,
|
||||||
{
|
{
|
||||||
UNUSED(fClearDirty)
|
UNUSED(fClearDirty)
|
||||||
UNUSED(fSaveAllProperties)
|
UNUSED(fSaveAllProperties)
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pPropBag)
|
if (!pPropBag)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
|
@ -41,8 +41,6 @@
|
||||||
#include "VCamUtils/src/image/videoframe.h"
|
#include "VCamUtils/src/image/videoframe.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "Pin"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class PinPrivate
|
class PinPrivate
|
||||||
|
@ -185,23 +183,23 @@ AkVCam::Pin::~Pin()
|
||||||
|
|
||||||
AkVCam::BaseFilter *AkVCam::Pin::baseFilter() const
|
AkVCam::BaseFilter *AkVCam::Pin::baseFilter() const
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return this->d->m_baseFilter;
|
return this->d->m_baseFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::Pin::setBaseFilter(BaseFilter *baseFilter)
|
void AkVCam::Pin::setBaseFilter(BaseFilter *baseFilter)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_baseFilter = baseFilter;
|
this->d->m_baseFilter = baseFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT AkVCam::Pin::stateChanged(void *userData, FILTER_STATE state)
|
HRESULT AkVCam::Pin::stateChanged(void *userData, FILTER_STATE state)
|
||||||
{
|
{
|
||||||
auto self = reinterpret_cast<Pin *>(userData);
|
auto self = reinterpret_cast<Pin *>(userData);
|
||||||
AkLoggerLog(AK_CUR_INTERFACE, "(", self, ")::", __FUNCTION__, "()");
|
AkLogFunction();
|
||||||
AkLoggerLog("Old state: ", self->d->m_prevState);
|
AkLogInfo() << "Old state: " << self->d->m_prevState << std::endl;
|
||||||
AkLoggerLog("New state: ", state);
|
AkLogInfo() << "New state: " << state << std::endl;
|
||||||
|
|
||||||
if (state == self->d->m_prevState)
|
if (state == self->d->m_prevState)
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
@ -221,7 +219,9 @@ HRESULT AkVCam::Pin::stateChanged(void *userData, FILTER_STATE state)
|
||||||
self->d->m_running = true;
|
self->d->m_running = true;
|
||||||
self->d->m_sendFrameThread =
|
self->d->m_sendFrameThread =
|
||||||
std::thread(&PinPrivate::sendFrameLoop, self->d);
|
std::thread(&PinPrivate::sendFrameLoop, self->d);
|
||||||
AkLoggerLog("Launching thread ", self->d->m_sendFrameThread.get_id());
|
AkLogInfo() << "Launching thread "
|
||||||
|
<< self->d->m_sendFrameThread.get_id()
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
auto clock = self->d->m_baseFilter->referenceClock();
|
auto clock = self->d->m_baseFilter->referenceClock();
|
||||||
REFERENCE_TIME now = 0;
|
REFERENCE_TIME now = 0;
|
||||||
|
@ -260,7 +260,7 @@ HRESULT AkVCam::Pin::stateChanged(void *userData, FILTER_STATE state)
|
||||||
|
|
||||||
void AkVCam::Pin::serverStateChanged(IpcBridge::ServerState state)
|
void AkVCam::Pin::serverStateChanged(IpcBridge::ServerState state)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (state == IpcBridge::ServerStateGone) {
|
if (state == IpcBridge::ServerStateGone) {
|
||||||
this->d->m_broadcaster.clear();
|
this->d->m_broadcaster.clear();
|
||||||
|
@ -279,9 +279,9 @@ void AkVCam::Pin::serverStateChanged(IpcBridge::ServerState state)
|
||||||
|
|
||||||
void AkVCam::Pin::frameReady(const VideoFrame &frame)
|
void AkVCam::Pin::frameReady(const VideoFrame &frame)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("Running: ", this->d->m_running);
|
AkLogInfo() << "Running: " << this->d->m_running << std::endl;
|
||||||
AkLoggerLog("Broadcaster: ", this->d->m_broadcaster);
|
AkLogInfo() << "Broadcaster: " << this->d->m_broadcaster << std::endl;
|
||||||
|
|
||||||
if (!this->d->m_running)
|
if (!this->d->m_running)
|
||||||
return;
|
return;
|
||||||
|
@ -300,8 +300,8 @@ void AkVCam::Pin::frameReady(const VideoFrame &frame)
|
||||||
|
|
||||||
void AkVCam::Pin::setBroadcasting(const std::string &broadcaster)
|
void AkVCam::Pin::setBroadcasting(const std::string &broadcaster)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("Broadcaster: ", broadcaster);
|
AkLogInfo() << "Broadcaster: " << broadcaster << std::endl;
|
||||||
|
|
||||||
if (this->d->m_broadcaster == broadcaster)
|
if (this->d->m_broadcaster == broadcaster)
|
||||||
return;
|
return;
|
||||||
|
@ -317,7 +317,7 @@ void AkVCam::Pin::setBroadcasting(const std::string &broadcaster)
|
||||||
|
|
||||||
void AkVCam::Pin::setMirror(bool horizontalMirror, bool verticalMirror)
|
void AkVCam::Pin::setMirror(bool horizontalMirror, bool verticalMirror)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_horizontalMirror == horizontalMirror
|
if (this->d->m_horizontalMirror == horizontalMirror
|
||||||
&& this->d->m_verticalMirror == verticalMirror)
|
&& this->d->m_verticalMirror == verticalMirror)
|
||||||
|
@ -330,7 +330,7 @@ void AkVCam::Pin::setMirror(bool horizontalMirror, bool verticalMirror)
|
||||||
|
|
||||||
void AkVCam::Pin::setScaling(Scaling scaling)
|
void AkVCam::Pin::setScaling(Scaling scaling)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_scaling == scaling)
|
if (this->d->m_scaling == scaling)
|
||||||
return;
|
return;
|
||||||
|
@ -341,7 +341,7 @@ void AkVCam::Pin::setScaling(Scaling scaling)
|
||||||
|
|
||||||
void AkVCam::Pin::setAspectRatio(AspectRatio aspectRatio)
|
void AkVCam::Pin::setAspectRatio(AspectRatio aspectRatio)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_aspectRatio == aspectRatio)
|
if (this->d->m_aspectRatio == aspectRatio)
|
||||||
return;
|
return;
|
||||||
|
@ -352,7 +352,7 @@ void AkVCam::Pin::setAspectRatio(AspectRatio aspectRatio)
|
||||||
|
|
||||||
void AkVCam::Pin::setSwapRgb(bool swap)
|
void AkVCam::Pin::setSwapRgb(bool swap)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (this->d->m_swapRgb == swap)
|
if (this->d->m_swapRgb == swap)
|
||||||
return;
|
return;
|
||||||
|
@ -383,8 +383,8 @@ void AkVCam::Pin::setVerticalFlip(bool flip)
|
||||||
|
|
||||||
HRESULT AkVCam::Pin::QueryInterface(const IID &riid, void **ppvObject)
|
HRESULT AkVCam::Pin::QueryInterface(const IID &riid, void **ppvObject)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("IID: ", AkVCam::stringFromClsid(riid));
|
AkLogInfo() << "IID: " << AkVCam::stringFromClsid(riid) << std::endl;
|
||||||
|
|
||||||
if (!ppvObject)
|
if (!ppvObject)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -433,9 +433,9 @@ HRESULT AkVCam::Pin::QueryInterface(const IID &riid, void **ppvObject)
|
||||||
|
|
||||||
HRESULT AkVCam::Pin::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
|
HRESULT AkVCam::Pin::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
AkLoggerLog("Receive pin: ", pReceivePin);
|
AkLogInfo() << "Receive pin: " << pReceivePin << std::endl;
|
||||||
AkLoggerLog("Media type: ", stringFromMediaType(pmt));
|
AkLogInfo() << "Media type: " << stringFromMediaType(pmt) << std::endl;
|
||||||
|
|
||||||
if (!pReceivePin)
|
if (!pReceivePin)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -496,7 +496,9 @@ HRESULT AkVCam::Pin::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
|
||||||
mediaTypes->Reset();
|
mediaTypes->Reset();
|
||||||
|
|
||||||
while (mediaTypes->Next(1, &mt, nullptr) == S_OK) {
|
while (mediaTypes->Next(1, &mt, nullptr) == S_OK) {
|
||||||
AkLoggerLog("Testing media type: ", stringFromMediaType(mt));
|
AkLogInfo() << "Testing media type: "
|
||||||
|
<< stringFromMediaType(mt)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
// If the mediatype match our suported mediatypes...
|
// If the mediatype match our suported mediatypes...
|
||||||
if (this->QueryAccept(mt) == S_OK) {
|
if (this->QueryAccept(mt) == S_OK) {
|
||||||
|
@ -535,7 +537,9 @@ HRESULT AkVCam::Pin::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
|
||||||
if (!mediaType)
|
if (!mediaType)
|
||||||
return VFW_E_NO_ACCEPTABLE_TYPES;
|
return VFW_E_NO_ACCEPTABLE_TYPES;
|
||||||
|
|
||||||
AkLoggerLog("Setting Media Type: ", stringFromMediaType(mediaType));
|
AkLogInfo() << "Setting Media Type: "
|
||||||
|
<< stringFromMediaType(mediaType)
|
||||||
|
<< std::endl;
|
||||||
auto result = pReceivePin->ReceiveConnection(this, mediaType);
|
auto result = pReceivePin->ReceiveConnection(this, mediaType);
|
||||||
|
|
||||||
if (FAILED(result)) {
|
if (FAILED(result)) {
|
||||||
|
@ -544,7 +548,7 @@ HRESULT AkVCam::Pin::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
AkLoggerLog("Connection accepted by input pin");
|
AkLogInfo() << "Connection accepted by input pin" << std::endl;
|
||||||
|
|
||||||
// Define memory allocator requirements.
|
// Define memory allocator requirements.
|
||||||
ALLOCATOR_PROPERTIES allocatorRequirements;
|
ALLOCATOR_PROPERTIES allocatorRequirements;
|
||||||
|
@ -606,7 +610,7 @@ HRESULT AkVCam::Pin::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
|
||||||
this->d->m_connectedTo = pReceivePin;
|
this->d->m_connectedTo = pReceivePin;
|
||||||
this->d->m_connectedTo->AddRef();
|
this->d->m_connectedTo->AddRef();
|
||||||
this->d->m_baseFilter->connectStateChanged(this, &Pin::stateChanged);
|
this->d->m_baseFilter->connectStateChanged(this, &Pin::stateChanged);
|
||||||
AkLoggerLog("Connected to ", pReceivePin);
|
AkLogInfo() << "Connected to " << pReceivePin << std::endl;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -616,14 +620,14 @@ HRESULT AkVCam::Pin::ReceiveConnection(IPin *pConnector,
|
||||||
{
|
{
|
||||||
UNUSED(pConnector)
|
UNUSED(pConnector)
|
||||||
UNUSED(pmt)
|
UNUSED(pmt)
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return VFW_E_TYPE_NOT_ACCEPTED;
|
return VFW_E_TYPE_NOT_ACCEPTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT AkVCam::Pin::Disconnect()
|
HRESULT AkVCam::Pin::Disconnect()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_baseFilter->disconnectStateChanged(this, &Pin::stateChanged);
|
this->d->m_baseFilter->disconnectStateChanged(this, &Pin::stateChanged);
|
||||||
|
|
||||||
if (this->d->m_baseFilter) {
|
if (this->d->m_baseFilter) {
|
||||||
|
@ -654,7 +658,7 @@ HRESULT AkVCam::Pin::Disconnect()
|
||||||
|
|
||||||
HRESULT AkVCam::Pin::ConnectedTo(IPin **pPin)
|
HRESULT AkVCam::Pin::ConnectedTo(IPin **pPin)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pPin)
|
if (!pPin)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -672,7 +676,7 @@ HRESULT AkVCam::Pin::ConnectedTo(IPin **pPin)
|
||||||
|
|
||||||
HRESULT AkVCam::Pin::ConnectionMediaType(AM_MEDIA_TYPE *pmt)
|
HRESULT AkVCam::Pin::ConnectionMediaType(AM_MEDIA_TYPE *pmt)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pmt)
|
if (!pmt)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -685,14 +689,16 @@ HRESULT AkVCam::Pin::ConnectionMediaType(AM_MEDIA_TYPE *pmt)
|
||||||
AM_MEDIA_TYPE *mediaType = nullptr;
|
AM_MEDIA_TYPE *mediaType = nullptr;
|
||||||
this->GetFormat(&mediaType);
|
this->GetFormat(&mediaType);
|
||||||
copyMediaType(pmt, mediaType);
|
copyMediaType(pmt, mediaType);
|
||||||
AkLoggerLog("Media Type: ", stringFromMediaType(mediaType));
|
AkLogInfo() << "Media Type: "
|
||||||
|
<< stringFromMediaType(mediaType)
|
||||||
|
<< std::endl;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT AkVCam::Pin::QueryPinInfo(PIN_INFO *pInfo)
|
HRESULT AkVCam::Pin::QueryPinInfo(PIN_INFO *pInfo)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pInfo)
|
if (!pInfo)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -716,7 +722,7 @@ HRESULT AkVCam::Pin::QueryPinInfo(PIN_INFO *pInfo)
|
||||||
|
|
||||||
HRESULT AkVCam::Pin::QueryDirection(PIN_DIRECTION *pPinDir)
|
HRESULT AkVCam::Pin::QueryDirection(PIN_DIRECTION *pPinDir)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pPinDir)
|
if (!pPinDir)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -728,7 +734,7 @@ HRESULT AkVCam::Pin::QueryDirection(PIN_DIRECTION *pPinDir)
|
||||||
|
|
||||||
HRESULT AkVCam::Pin::QueryId(LPWSTR *Id)
|
HRESULT AkVCam::Pin::QueryId(LPWSTR *Id)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!Id)
|
if (!Id)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -749,27 +755,27 @@ HRESULT AkVCam::Pin::QueryId(LPWSTR *Id)
|
||||||
|
|
||||||
HRESULT AkVCam::Pin::QueryAccept(const AM_MEDIA_TYPE *pmt)
|
HRESULT AkVCam::Pin::QueryAccept(const AM_MEDIA_TYPE *pmt)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pmt)
|
if (!pmt)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
AkLoggerLog("Accept? ", stringFromMediaType(pmt));
|
AkLogInfo() << "Accept? " << stringFromMediaType(pmt) << std::endl;
|
||||||
|
|
||||||
if (!containsMediaType(pmt, this->d->m_mediaTypes)) {
|
if (!containsMediaType(pmt, this->d->m_mediaTypes)) {
|
||||||
AkLoggerLog("NO");
|
AkLogInfo() << "NO" << std::endl;
|
||||||
|
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
AkLoggerLog("YES");
|
AkLogInfo() << "YES" << std::endl;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT AkVCam::Pin::EnumMediaTypes(IEnumMediaTypes **ppEnum)
|
HRESULT AkVCam::Pin::EnumMediaTypes(IEnumMediaTypes **ppEnum)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!ppEnum)
|
if (!ppEnum)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -782,7 +788,7 @@ HRESULT AkVCam::Pin::EnumMediaTypes(IEnumMediaTypes **ppEnum)
|
||||||
|
|
||||||
HRESULT AkVCam::Pin::QueryInternalConnections(IPin **apPin, ULONG *nPin)
|
HRESULT AkVCam::Pin::QueryInternalConnections(IPin **apPin, ULONG *nPin)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
UNUSED(apPin)
|
UNUSED(apPin)
|
||||||
UNUSED(nPin)
|
UNUSED(nPin)
|
||||||
|
|
||||||
|
@ -791,21 +797,21 @@ HRESULT AkVCam::Pin::QueryInternalConnections(IPin **apPin, ULONG *nPin)
|
||||||
|
|
||||||
HRESULT AkVCam::Pin::EndOfStream()
|
HRESULT AkVCam::Pin::EndOfStream()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return E_UNEXPECTED;
|
return E_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT AkVCam::Pin::BeginFlush()
|
HRESULT AkVCam::Pin::BeginFlush()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return E_UNEXPECTED;
|
return E_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT AkVCam::Pin::EndFlush()
|
HRESULT AkVCam::Pin::EndFlush()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return E_UNEXPECTED;
|
return E_UNEXPECTED;
|
||||||
}
|
}
|
||||||
|
@ -814,7 +820,7 @@ HRESULT AkVCam::Pin::NewSegment(REFERENCE_TIME tStart,
|
||||||
REFERENCE_TIME tStop,
|
REFERENCE_TIME tStop,
|
||||||
double dRate)
|
double dRate)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->m_start = tStart;
|
this->d->m_start = tStart;
|
||||||
this->d->m_stop = tStop;
|
this->d->m_stop = tStop;
|
||||||
this->d->m_rate = dRate;
|
this->d->m_rate = dRate;
|
||||||
|
@ -824,39 +830,46 @@ HRESULT AkVCam::Pin::NewSegment(REFERENCE_TIME tStart,
|
||||||
|
|
||||||
void AkVCam::PinPrivate::sendFrameOneShot()
|
void AkVCam::PinPrivate::sendFrameOneShot()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
WaitForSingleObject(this->m_sendFrameEvent, INFINITE);
|
WaitForSingleObject(this->m_sendFrameEvent, INFINITE);
|
||||||
this->sendFrame();
|
this->sendFrame();
|
||||||
AkLoggerLog("Thread ", std::this_thread::get_id(), " finnished");
|
AkLogInfo() << "Thread "
|
||||||
|
<< std::this_thread::get_id()
|
||||||
|
<< " finnished"
|
||||||
|
<< std::endl;
|
||||||
this->m_running = false;
|
this->m_running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::PinPrivate::sendFrameLoop()
|
void AkVCam::PinPrivate::sendFrameLoop()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
while (this->m_running) {
|
while (this->m_running) {
|
||||||
WaitForSingleObject(this->m_sendFrameEvent, INFINITE);
|
WaitForSingleObject(this->m_sendFrameEvent, INFINITE);
|
||||||
auto result = this->sendFrame();
|
auto result = this->sendFrame();
|
||||||
|
|
||||||
if (FAILED(result)) {
|
if (FAILED(result)) {
|
||||||
AkLoggerLog("Error sending frame: ",
|
AkLogError() << "Error sending frame: "
|
||||||
result,
|
<< result
|
||||||
": ",
|
<< ": "
|
||||||
stringFromResult(result));
|
<< stringFromResult(result)
|
||||||
|
<< std::endl;
|
||||||
this->m_running = false;
|
this->m_running = false;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AkLoggerLog("Thread ", std::this_thread::get_id(), " finnished");
|
AkLogInfo() << "Thread "
|
||||||
|
<< std::this_thread::get_id()
|
||||||
|
<< " finnished"
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT AkVCam::PinPrivate::sendFrame()
|
HRESULT AkVCam::PinPrivate::sendFrame()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
IMediaSample *sample = nullptr;
|
IMediaSample *sample = nullptr;
|
||||||
|
|
||||||
if (FAILED(this->m_memAllocator->GetBuffer(&sample,
|
if (FAILED(this->m_memAllocator->GetBuffer(&sample,
|
||||||
|
@ -929,9 +942,9 @@ HRESULT AkVCam::PinPrivate::sendFrame()
|
||||||
sample->SetDiscontinuity(false);
|
sample->SetDiscontinuity(false);
|
||||||
sample->SetSyncPoint(true);
|
sample->SetSyncPoint(true);
|
||||||
sample->SetPreroll(false);
|
sample->SetPreroll(false);
|
||||||
AkLoggerLog("Sending ", stringFromMediaSample(sample));
|
AkLogInfo() << "Sending " << stringFromMediaSample(sample) << std::endl;
|
||||||
auto result = this->m_memInputPin->Receive(sample);
|
auto result = this->m_memInputPin->Receive(sample);
|
||||||
AkLoggerLog("Frame sent");
|
AkLogInfo() << "Frame sent" << std::endl;
|
||||||
sample->Release();
|
sample->Release();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -1026,7 +1039,7 @@ void AkVCam::PinPrivate::propertyChanged(void *userData,
|
||||||
LONG lValue,
|
LONG lValue,
|
||||||
LONG Flags)
|
LONG Flags)
|
||||||
{
|
{
|
||||||
AkLoggerLog("PinPrivate::propertyChanged()");
|
AkLogFunction();
|
||||||
UNUSED(Flags)
|
UNUSED(Flags)
|
||||||
auto self = reinterpret_cast<PinPrivate *>(userData);
|
auto self = reinterpret_cast<PinPrivate *>(userData);
|
||||||
|
|
||||||
|
|
|
@ -34,35 +34,43 @@ inline AkVCam::PluginInterface *pluginInterface()
|
||||||
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
{
|
{
|
||||||
UNUSED(lpvReserved)
|
UNUSED(lpvReserved)
|
||||||
|
AkLogFunction();
|
||||||
|
auto logLevel =
|
||||||
|
AkVCam::regReadInt("loglevel", AKVCAM_LOGLEVEL_DEFAULT);
|
||||||
|
AkVCam::Logger::setLogLevel(logLevel);
|
||||||
|
|
||||||
#if defined(QT_DEBUG) && 0
|
if (AkVCam::Logger::logLevel() > AKVCAM_LOGLEVEL_DEFAULT) {
|
||||||
// Turn on lights
|
// Turn on lights
|
||||||
freopen("CONOUT$", "a", stdout);
|
freopen("CONOUT$", "a", stdout);
|
||||||
freopen("CONOUT$", "a", stderr);
|
freopen("CONOUT$", "a", stderr);
|
||||||
setbuf(stdout, nullptr);
|
setbuf(stdout, nullptr);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
auto temp = AkVCam::tempPath();
|
auto temp = AkVCam::tempPath();
|
||||||
AkLoggerStart(std::string(temp.begin(), temp.end())
|
auto logFile =
|
||||||
+ "\\" DSHOW_PLUGIN_NAME, "log");
|
AkVCam::regReadString("logfile",
|
||||||
AkLoggerLog(__FUNCTION__, "()");
|
std::string(temp.begin(), temp.end())
|
||||||
|
+ "\\" DSHOW_PLUGIN_NAME ".log");
|
||||||
|
AkVCam::Logger::setLogFile(logFile);
|
||||||
|
|
||||||
switch (fdwReason) {
|
switch (fdwReason) {
|
||||||
case DLL_PROCESS_ATTACH:
|
case DLL_PROCESS_ATTACH:
|
||||||
AkLoggerLog("Reason Attach");
|
AkLogInfo() << "Reason Attach" << std::endl;
|
||||||
AkLoggerLog("Module file name: ", AkVCam::moduleFileName(hinstDLL));
|
AkLogInfo() << "Module file name: "
|
||||||
|
<< AkVCam::moduleFileName(hinstDLL)
|
||||||
|
<< std::endl;
|
||||||
DisableThreadLibraryCalls(hinstDLL);
|
DisableThreadLibraryCalls(hinstDLL);
|
||||||
pluginInterface()->pluginHinstance() = hinstDLL;
|
pluginInterface()->pluginHinstance() = hinstDLL;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DLL_PROCESS_DETACH:
|
case DLL_PROCESS_DETACH:
|
||||||
AkLoggerLog("Reason Detach");
|
AkLogInfo() << "Reason Detach" << std::endl;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
AkLoggerLog("Reason Unknown: ", fdwReason);
|
AkLogInfo() << "Reason Unknown: " << fdwReason << std::endl;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -72,9 +80,9 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
|
||||||
|
|
||||||
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
||||||
{
|
{
|
||||||
AkLoggerLog(__FUNCTION__, "()");
|
AkLogFunction();
|
||||||
AkLoggerLog("CLSID: ", AkVCam::stringFromClsid(rclsid));
|
AkLogInfo() << "CLSID: " << AkVCam::stringFromClsid(rclsid) << std::endl;
|
||||||
AkLoggerLog("IID: ", AkVCam::stringFromClsid(rclsid));
|
AkLogInfo() << "IID: " << AkVCam::stringFromClsid(rclsid) << std::endl;
|
||||||
|
|
||||||
if (!ppv)
|
if (!ppv)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
@ -95,15 +103,14 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
|
||||||
|
|
||||||
STDAPI DllCanUnloadNow()
|
STDAPI DllCanUnloadNow()
|
||||||
{
|
{
|
||||||
AkLoggerLog(__FUNCTION__, "()");
|
AkLogFunction();
|
||||||
|
|
||||||
return AkVCam::ClassFactory::locked()? S_FALSE: S_OK;
|
return AkVCam::ClassFactory::locked()? S_FALSE: S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
STDAPI DllRegisterServer()
|
STDAPI DllRegisterServer()
|
||||||
{
|
{
|
||||||
AkLoggerLog(__FUNCTION__, "()");
|
AkLogFunction();
|
||||||
|
|
||||||
DllUnregisterServer();
|
DllUnregisterServer();
|
||||||
|
|
||||||
bool ok = true;
|
bool ok = true;
|
||||||
|
@ -111,16 +118,17 @@ STDAPI DllRegisterServer()
|
||||||
for (DWORD i = 0; i < AkVCam::camerasCount(); i++) {
|
for (DWORD i = 0; i < AkVCam::camerasCount(); i++) {
|
||||||
auto description = AkVCam::cameraDescription(i);
|
auto description = AkVCam::cameraDescription(i);
|
||||||
auto path = AkVCam::cameraPath(i);
|
auto path = AkVCam::cameraPath(i);
|
||||||
|
|
||||||
#ifdef QT_DEBUG
|
|
||||||
auto clsid = AkVCam::createClsidFromStr(path);
|
auto clsid = AkVCam::createClsidFromStr(path);
|
||||||
#endif
|
|
||||||
|
|
||||||
AkLoggerLog("Creating Camera");
|
AkLogInfo() << "Creating Camera" << std::endl;
|
||||||
AkLoggerLog("\tDescription: ", std::string(description.begin(),
|
AkLogInfo() << "\tDescription: "
|
||||||
description.end()));
|
<< std::string(description.begin(),
|
||||||
AkLoggerLog("\tPath: ", std::string(path.begin(), path.end()));
|
description.end())
|
||||||
AkLoggerLog("\tCLSID: ", AkVCam::stringFromIid(clsid));
|
<< std::endl;
|
||||||
|
AkLogInfo() << "\tPath: "
|
||||||
|
<< std::string(path.begin(), path.end())
|
||||||
|
<< std::endl;
|
||||||
|
AkLogInfo() << "\tCLSID: " << AkVCam::stringFromIid(clsid) << std::endl;
|
||||||
|
|
||||||
ok &= pluginInterface()->createDevice(path, description);
|
ok &= pluginInterface()->createDevice(path, description);
|
||||||
}
|
}
|
||||||
|
@ -130,22 +138,16 @@ STDAPI DllRegisterServer()
|
||||||
|
|
||||||
STDAPI DllUnregisterServer()
|
STDAPI DllUnregisterServer()
|
||||||
{
|
{
|
||||||
AkLoggerLog(__FUNCTION__, "()");
|
AkLogFunction();
|
||||||
|
|
||||||
auto cameras =
|
auto cameras =
|
||||||
AkVCam::listRegisteredCameras(pluginInterface()->pluginHinstance());
|
AkVCam::listRegisteredCameras(pluginInterface()->pluginHinstance());
|
||||||
|
|
||||||
for (auto camera: cameras) {
|
for (auto camera: cameras) {
|
||||||
AkLoggerLog("Deleting ", AkVCam::stringFromClsid(camera));
|
AkLogInfo() << "Deleting "
|
||||||
|
<< AkVCam::stringFromClsid(camera)
|
||||||
|
<< std::endl;
|
||||||
pluginInterface()->destroyDevice(camera);
|
pluginInterface()->destroyDevice(camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unregister old virtual camera filter.
|
|
||||||
// NOTE: This code must be removed in future versions.
|
|
||||||
CLSID clsid;
|
|
||||||
CLSIDFromString(L"{41764B79-7320-5669-7274-75616C43616D}", &clsid);
|
|
||||||
AkLoggerLog("Deleting ", AkVCam::stringFromClsid(clsid));
|
|
||||||
pluginInterface()->destroyDevice(clsid);
|
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "PluginInterface"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class PluginInterfacePrivate
|
class PluginInterfacePrivate
|
||||||
|
@ -62,7 +60,7 @@ HINSTANCE &AkVCam::PluginInterface::pluginHinstance()
|
||||||
bool AkVCam::PluginInterface::registerServer(const std::wstring &deviceId,
|
bool AkVCam::PluginInterface::registerServer(const std::wstring &deviceId,
|
||||||
const std::wstring &description) const
|
const std::wstring &description) const
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
// Define the layout in registry of the filter.
|
// Define the layout in registry of the filter.
|
||||||
|
|
||||||
|
@ -70,9 +68,9 @@ bool AkVCam::PluginInterface::registerServer(const std::wstring &deviceId,
|
||||||
auto fileName = AkVCam::moduleFileNameW(this->d->m_pluginHinstance);
|
auto fileName = AkVCam::moduleFileNameW(this->d->m_pluginHinstance);
|
||||||
std::wstring threadingModel = L"Both";
|
std::wstring threadingModel = L"Both";
|
||||||
|
|
||||||
AkLoggerLog("CLSID: ", std::string(clsid.begin(), clsid.end()));
|
AkLogInfo() << "CLSID: " << std::string(clsid.begin(), clsid.end()) << std::endl;
|
||||||
AkLoggerLog("Description: ", std::string(description.begin(), description.end()));
|
AkLogInfo() << "Description: " << std::string(description.begin(), description.end()) << std::endl;
|
||||||
AkLoggerLog("Filename: ", std::string(fileName.begin(), fileName.end()));
|
AkLogInfo() << "Filename: " << std::string(fileName.begin(), fileName.end()) << std::endl;
|
||||||
|
|
||||||
auto subkey = L"CLSID\\" + clsid;
|
auto subkey = L"CLSID\\" + clsid;
|
||||||
|
|
||||||
|
@ -126,31 +124,31 @@ registerServer_failed:
|
||||||
if (keyCLSID)
|
if (keyCLSID)
|
||||||
RegCloseKey(keyCLSID);
|
RegCloseKey(keyCLSID);
|
||||||
|
|
||||||
AkLoggerLog("Result: ", stringFromResult(result));
|
AkLogInfo() << "Result: " << stringFromResult(result) << std::endl;
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::PluginInterface::unregisterServer(const std::string &deviceId) const
|
void AkVCam::PluginInterface::unregisterServer(const std::string &deviceId) const
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->unregisterServer(createClsidFromStr(deviceId));
|
this->unregisterServer(createClsidFromStr(deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::PluginInterface::unregisterServer(const std::wstring &deviceId) const
|
void AkVCam::PluginInterface::unregisterServer(const std::wstring &deviceId) const
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->unregisterServer(createClsidFromStr(deviceId));
|
this->unregisterServer(createClsidFromStr(deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::PluginInterface::unregisterServer(const CLSID &clsid) const
|
void AkVCam::PluginInterface::unregisterServer(const CLSID &clsid) const
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
auto clsidStr = stringFromClsid(clsid);
|
auto clsidStr = stringFromClsid(clsid);
|
||||||
AkLoggerLog("CLSID: ", clsidStr);
|
AkLogInfo() << "CLSID: " << clsidStr << std::endl;
|
||||||
auto subkey = L"CLSID\\" + std::wstring(clsidStr.begin(), clsidStr.end());
|
auto subkey = L"CLSID\\" + std::wstring(clsidStr.begin(), clsidStr.end());
|
||||||
|
|
||||||
this->d->deleteTree(HKEY_CLASSES_ROOT, subkey.c_str());
|
this->d->deleteTree(HKEY_CLASSES_ROOT, subkey.c_str());
|
||||||
|
@ -159,7 +157,7 @@ void AkVCam::PluginInterface::unregisterServer(const CLSID &clsid) const
|
||||||
bool AkVCam::PluginInterface::registerFilter(const std::wstring &deviceId,
|
bool AkVCam::PluginInterface::registerFilter(const std::wstring &deviceId,
|
||||||
const std::wstring &description) const
|
const std::wstring &description) const
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
auto clsid = AkVCam::createClsidFromStr(deviceId);
|
auto clsid = AkVCam::createClsidFromStr(deviceId);
|
||||||
IFilterMapper2 *filterMapper = nullptr;
|
IFilterMapper2 *filterMapper = nullptr;
|
||||||
|
@ -216,28 +214,28 @@ registerFilter_failed:
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
|
|
||||||
AkLoggerLog("Result: ", stringFromResult(result));
|
AkLogInfo() << "Result: " << stringFromResult(result) << std::endl;
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::PluginInterface::unregisterFilter(const std::string &deviceId) const
|
void AkVCam::PluginInterface::unregisterFilter(const std::string &deviceId) const
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->unregisterFilter(AkVCam::createClsidFromStr(deviceId));
|
this->unregisterFilter(AkVCam::createClsidFromStr(deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::PluginInterface::unregisterFilter(const std::wstring &deviceId) const
|
void AkVCam::PluginInterface::unregisterFilter(const std::wstring &deviceId) const
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->unregisterFilter(AkVCam::createClsidFromStr(deviceId));
|
this->unregisterFilter(AkVCam::createClsidFromStr(deviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::PluginInterface::unregisterFilter(const CLSID &clsid) const
|
void AkVCam::PluginInterface::unregisterFilter(const CLSID &clsid) const
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
IFilterMapper2 *filterMapper = nullptr;
|
IFilterMapper2 *filterMapper = nullptr;
|
||||||
auto result = CoInitialize(nullptr);
|
auto result = CoInitialize(nullptr);
|
||||||
|
|
||||||
|
@ -263,20 +261,20 @@ unregisterFilter_failed:
|
||||||
filterMapper->Release();
|
filterMapper->Release();
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
AkLoggerLog("Result: ", stringFromResult(result));
|
AkLogInfo() << "Result: " << stringFromResult(result) << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AkVCam::PluginInterface::setDevicePath(const std::wstring &deviceId) const
|
bool AkVCam::PluginInterface::setDevicePath(const std::wstring &deviceId) const
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
std::wstring subKey =
|
std::wstring subKey =
|
||||||
L"CLSID\\"
|
L"CLSID\\"
|
||||||
+ wstringFromIid(CLSID_VideoInputDeviceCategory)
|
+ wstringFromIid(CLSID_VideoInputDeviceCategory)
|
||||||
+ L"\\Instance\\"
|
+ L"\\Instance\\"
|
||||||
+ createClsidWStrFromStr(deviceId);
|
+ createClsidWStrFromStr(deviceId);
|
||||||
AkLoggerLog("Key: HKEY_CLASSES_ROOT");
|
AkLogInfo() << "Key: HKEY_CLASSES_ROOT" << std::endl;
|
||||||
AkLoggerLog("SubKey: ", std::string(subKey.begin(), subKey.end()));
|
AkLogInfo() << "SubKey: " << std::string(subKey.begin(), subKey.end()) << std::endl;
|
||||||
|
|
||||||
HKEY hKey = nullptr;
|
HKEY hKey = nullptr;
|
||||||
auto result = RegOpenKeyEx(HKEY_CLASSES_ROOT,
|
auto result = RegOpenKeyEx(HKEY_CLASSES_ROOT,
|
||||||
|
@ -305,7 +303,7 @@ setDevicePath_failed:
|
||||||
if (hKey)
|
if (hKey)
|
||||||
RegCloseKey(hKey);
|
RegCloseKey(hKey);
|
||||||
|
|
||||||
AkLoggerLog("Result: ", stringFromResult(result));
|
AkLogInfo() << "Result: " << stringFromResult(result) << std::endl;
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
@ -313,7 +311,7 @@ setDevicePath_failed:
|
||||||
bool AkVCam::PluginInterface::createDevice(const std::wstring &deviceId,
|
bool AkVCam::PluginInterface::createDevice(const std::wstring &deviceId,
|
||||||
const std::wstring &description)
|
const std::wstring &description)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!this->registerServer(deviceId, description))
|
if (!this->registerServer(deviceId, description))
|
||||||
goto createDevice_failed;
|
goto createDevice_failed;
|
||||||
|
@ -334,7 +332,7 @@ createDevice_failed:
|
||||||
|
|
||||||
void AkVCam::PluginInterface::destroyDevice(const std::string &deviceId)
|
void AkVCam::PluginInterface::destroyDevice(const std::string &deviceId)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->unregisterFilter(deviceId);
|
this->unregisterFilter(deviceId);
|
||||||
this->unregisterServer(deviceId);
|
this->unregisterServer(deviceId);
|
||||||
|
@ -342,7 +340,7 @@ void AkVCam::PluginInterface::destroyDevice(const std::string &deviceId)
|
||||||
|
|
||||||
void AkVCam::PluginInterface::destroyDevice(const std::wstring &deviceId)
|
void AkVCam::PluginInterface::destroyDevice(const std::wstring &deviceId)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->unregisterFilter(deviceId);
|
this->unregisterFilter(deviceId);
|
||||||
this->unregisterServer(deviceId);
|
this->unregisterServer(deviceId);
|
||||||
|
@ -350,7 +348,7 @@ void AkVCam::PluginInterface::destroyDevice(const std::wstring &deviceId)
|
||||||
|
|
||||||
void AkVCam::PluginInterface::destroyDevice(const CLSID &clsid)
|
void AkVCam::PluginInterface::destroyDevice(const CLSID &clsid)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->unregisterFilter(clsid);
|
this->unregisterFilter(clsid);
|
||||||
this->unregisterServer(clsid);
|
this->unregisterServer(clsid);
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "PropertySet"
|
|
||||||
|
|
||||||
AkVCam::PropertySet::PropertySet():
|
AkVCam::PropertySet::PropertySet():
|
||||||
CUnknown(this, IID_IKsPropertySet)
|
CUnknown(this, IID_IKsPropertySet)
|
||||||
{
|
{
|
||||||
|
@ -49,7 +47,7 @@ HRESULT AkVCam::PropertySet::Set(const GUID &guidPropSet,
|
||||||
UNUSED(cbInstanceData)
|
UNUSED(cbInstanceData)
|
||||||
UNUSED(pPropData)
|
UNUSED(pPropData)
|
||||||
UNUSED(cbPropData)
|
UNUSED(cbPropData)
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +62,7 @@ HRESULT AkVCam::PropertySet::Get(const GUID &guidPropSet,
|
||||||
{
|
{
|
||||||
UNUSED(pInstanceData)
|
UNUSED(pInstanceData)
|
||||||
UNUSED(cbInstanceData)
|
UNUSED(cbInstanceData)
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!IsEqualGUID(guidPropSet, AMPROPSETID_Pin))
|
if (!IsEqualGUID(guidPropSet, AMPROPSETID_Pin))
|
||||||
return E_PROP_SET_UNSUPPORTED;
|
return E_PROP_SET_UNSUPPORTED;
|
||||||
|
@ -94,7 +92,7 @@ HRESULT AkVCam::PropertySet::QuerySupported(const GUID &guidPropSet,
|
||||||
DWORD dwPropID,
|
DWORD dwPropID,
|
||||||
DWORD *pTypeSupport)
|
DWORD *pTypeSupport)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!IsEqualGUID(guidPropSet, AMPROPSETID_Pin))
|
if (!IsEqualGUID(guidPropSet, AMPROPSETID_Pin))
|
||||||
return E_PROP_SET_UNSUPPORTED;
|
return E_PROP_SET_UNSUPPORTED;
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "PushSource"
|
|
||||||
|
|
||||||
AkVCam::PushSource::PushSource(IAMStreamConfig *streamConfig):
|
AkVCam::PushSource::PushSource(IAMStreamConfig *streamConfig):
|
||||||
Latency(streamConfig)
|
Latency(streamConfig)
|
||||||
{
|
{
|
||||||
|
@ -35,7 +33,7 @@ AkVCam::PushSource::~PushSource()
|
||||||
|
|
||||||
HRESULT AkVCam::PushSource::GetPushSourceFlags(ULONG *pFlags)
|
HRESULT AkVCam::PushSource::GetPushSourceFlags(ULONG *pFlags)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pFlags)
|
if (!pFlags)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -48,7 +46,7 @@ HRESULT AkVCam::PushSource::GetPushSourceFlags(ULONG *pFlags)
|
||||||
HRESULT AkVCam::PushSource::SetPushSourceFlags(ULONG Flags)
|
HRESULT AkVCam::PushSource::SetPushSourceFlags(ULONG Flags)
|
||||||
{
|
{
|
||||||
UNUSED(Flags)
|
UNUSED(Flags)
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +54,7 @@ HRESULT AkVCam::PushSource::SetPushSourceFlags(ULONG Flags)
|
||||||
HRESULT AkVCam::PushSource::SetStreamOffset(REFERENCE_TIME rtOffset)
|
HRESULT AkVCam::PushSource::SetStreamOffset(REFERENCE_TIME rtOffset)
|
||||||
{
|
{
|
||||||
UNUSED(rtOffset)
|
UNUSED(rtOffset)
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +62,7 @@ HRESULT AkVCam::PushSource::SetStreamOffset(REFERENCE_TIME rtOffset)
|
||||||
HRESULT AkVCam::PushSource::GetStreamOffset(REFERENCE_TIME *prtOffset)
|
HRESULT AkVCam::PushSource::GetStreamOffset(REFERENCE_TIME *prtOffset)
|
||||||
{
|
{
|
||||||
UNUSED(prtOffset)
|
UNUSED(prtOffset)
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
@ -72,7 +70,7 @@ HRESULT AkVCam::PushSource::GetStreamOffset(REFERENCE_TIME *prtOffset)
|
||||||
HRESULT AkVCam::PushSource::GetMaxStreamOffset(REFERENCE_TIME *prtMaxOffset)
|
HRESULT AkVCam::PushSource::GetMaxStreamOffset(REFERENCE_TIME *prtMaxOffset)
|
||||||
{
|
{
|
||||||
UNUSED(prtMaxOffset)
|
UNUSED(prtMaxOffset)
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +78,7 @@ HRESULT AkVCam::PushSource::GetMaxStreamOffset(REFERENCE_TIME *prtMaxOffset)
|
||||||
HRESULT AkVCam::PushSource::SetMaxStreamOffset(REFERENCE_TIME rtMaxOffset)
|
HRESULT AkVCam::PushSource::SetMaxStreamOffset(REFERENCE_TIME rtMaxOffset)
|
||||||
{
|
{
|
||||||
UNUSED(rtMaxOffset)
|
UNUSED(rtMaxOffset)
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "QualityControl"
|
|
||||||
|
|
||||||
AkVCam::QualityControl::QualityControl():
|
AkVCam::QualityControl::QualityControl():
|
||||||
CUnknown(this, IID_IQualityControl)
|
CUnknown(this, IID_IQualityControl)
|
||||||
{
|
{
|
||||||
|
@ -37,15 +35,15 @@ AkVCam::QualityControl::~QualityControl()
|
||||||
HRESULT AkVCam::QualityControl::Notify(IBaseFilter *pSelf, Quality q)
|
HRESULT AkVCam::QualityControl::Notify(IBaseFilter *pSelf, Quality q)
|
||||||
{
|
{
|
||||||
UNUSED(q)
|
UNUSED(q)
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pSelf)
|
if (!pSelf)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
AkLoggerLog("Type: ", q.Type == Famine? "Famine": "Flood");
|
AkLogInfo() << "Type: " << (q.Type == Famine? "Famine": "Flood") << std::endl;
|
||||||
AkLoggerLog("Proportion: ", q.Proportion);
|
AkLogInfo() << "Proportion: " << q.Proportion << std::endl;
|
||||||
AkLoggerLog("Late: ", q.Late);
|
AkLogInfo() << "Late: " << q.Late << std::endl;
|
||||||
AkLoggerLog("TimeStamp:", q.TimeStamp);
|
AkLogInfo() << "TimeStamp:" << q.TimeStamp << std::endl;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -53,7 +51,7 @@ HRESULT AkVCam::QualityControl::Notify(IBaseFilter *pSelf, Quality q)
|
||||||
HRESULT AkVCam::QualityControl::SetSink(IQualityControl *piqc)
|
HRESULT AkVCam::QualityControl::SetSink(IQualityControl *piqc)
|
||||||
{
|
{
|
||||||
UNUSED(piqc)
|
UNUSED(piqc)
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
return E_NOTIMPL;
|
return E_NOTIMPL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "ReferenceClock"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class AdviseCookiePrivate
|
class AdviseCookiePrivate
|
||||||
|
@ -90,7 +88,7 @@ AkVCam::ReferenceClock::~ReferenceClock()
|
||||||
|
|
||||||
HRESULT AkVCam::ReferenceClock::GetTime(REFERENCE_TIME *pTime)
|
HRESULT AkVCam::ReferenceClock::GetTime(REFERENCE_TIME *pTime)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pTime)
|
if (!pTime)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -110,7 +108,7 @@ HRESULT AkVCam::ReferenceClock::AdviseTime(REFERENCE_TIME baseTime,
|
||||||
HEVENT hEvent,
|
HEVENT hEvent,
|
||||||
DWORD_PTR *pdwAdviseCookie)
|
DWORD_PTR *pdwAdviseCookie)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->cleanup();
|
this->d->cleanup();
|
||||||
|
|
||||||
if (!pdwAdviseCookie)
|
if (!pdwAdviseCookie)
|
||||||
|
@ -136,7 +134,7 @@ HRESULT AkVCam::ReferenceClock::AdvisePeriodic(REFERENCE_TIME startTime,
|
||||||
HSEMAPHORE hSemaphore,
|
HSEMAPHORE hSemaphore,
|
||||||
DWORD_PTR *pdwAdviseCookie)
|
DWORD_PTR *pdwAdviseCookie)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
this->d->cleanup();
|
this->d->cleanup();
|
||||||
|
|
||||||
if (!pdwAdviseCookie)
|
if (!pdwAdviseCookie)
|
||||||
|
@ -159,7 +157,7 @@ HRESULT AkVCam::ReferenceClock::AdvisePeriodic(REFERENCE_TIME startTime,
|
||||||
|
|
||||||
HRESULT AkVCam::ReferenceClock::Unadvise(DWORD_PTR dwAdviseCookie)
|
HRESULT AkVCam::ReferenceClock::Unadvise(DWORD_PTR dwAdviseCookie)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
auto it = std::find(this->d->m_cookies.begin(),
|
auto it = std::find(this->d->m_cookies.begin(),
|
||||||
this->d->m_cookies.end(),
|
this->d->m_cookies.end(),
|
||||||
|
@ -186,7 +184,7 @@ void AkVCam::AdviseCookiePrivate::adviseTime(REFERENCE_TIME baseTime,
|
||||||
REFERENCE_TIME streamTime,
|
REFERENCE_TIME streamTime,
|
||||||
HEVENT hEvent)
|
HEVENT hEvent)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->m_run = true;
|
this->m_run = true;
|
||||||
this->m_thread = std::thread(&AdviseCookiePrivate::adviseTimeTh,
|
this->m_thread = std::thread(&AdviseCookiePrivate::adviseTimeTh,
|
||||||
|
@ -194,14 +192,14 @@ void AkVCam::AdviseCookiePrivate::adviseTime(REFERENCE_TIME baseTime,
|
||||||
baseTime,
|
baseTime,
|
||||||
streamTime,
|
streamTime,
|
||||||
hEvent);
|
hEvent);
|
||||||
AkLoggerLog("Launching thread ", this->m_thread.get_id());
|
AkLogInfo() << "Launching thread " << this->m_thread.get_id() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::AdviseCookiePrivate::adviseTimeTh(REFERENCE_TIME baseTime,
|
void AkVCam::AdviseCookiePrivate::adviseTimeTh(REFERENCE_TIME baseTime,
|
||||||
REFERENCE_TIME streamTime,
|
REFERENCE_TIME streamTime,
|
||||||
HEVENT hEvent)
|
HEVENT hEvent)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
REFERENCE_TIME clockTime;
|
REFERENCE_TIME clockTime;
|
||||||
this->m_clock->GetTime(&clockTime);
|
this->m_clock->GetTime(&clockTime);
|
||||||
|
@ -222,14 +220,17 @@ void AkVCam::AdviseCookiePrivate::adviseTimeTh(REFERENCE_TIME baseTime,
|
||||||
SetEvent(HANDLE(hEvent));
|
SetEvent(HANDLE(hEvent));
|
||||||
|
|
||||||
this->m_run = false;
|
this->m_run = false;
|
||||||
AkLoggerLog("Thread ", std::this_thread::get_id(), " finnished");
|
AkLogInfo() << "Thread "
|
||||||
|
<< std::this_thread::get_id()
|
||||||
|
<< " finnished"
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::AdviseCookiePrivate::advisePeriodic(REFERENCE_TIME startTime,
|
void AkVCam::AdviseCookiePrivate::advisePeriodic(REFERENCE_TIME startTime,
|
||||||
REFERENCE_TIME periodTime,
|
REFERENCE_TIME periodTime,
|
||||||
HSEMAPHORE hSemaphore)
|
HSEMAPHORE hSemaphore)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->m_run = true;
|
this->m_run = true;
|
||||||
this->m_thread = std::thread(&AdviseCookiePrivate::advisePeriodicTh,
|
this->m_thread = std::thread(&AdviseCookiePrivate::advisePeriodicTh,
|
||||||
|
@ -237,14 +238,14 @@ void AkVCam::AdviseCookiePrivate::advisePeriodic(REFERENCE_TIME startTime,
|
||||||
startTime,
|
startTime,
|
||||||
periodTime,
|
periodTime,
|
||||||
hSemaphore);
|
hSemaphore);
|
||||||
AkLoggerLog("Launching thread ", this->m_thread.get_id());
|
AkLogInfo() << "Launching thread " << this->m_thread.get_id() << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::AdviseCookiePrivate::advisePeriodicTh(REFERENCE_TIME startTime,
|
void AkVCam::AdviseCookiePrivate::advisePeriodicTh(REFERENCE_TIME startTime,
|
||||||
REFERENCE_TIME periodTime,
|
REFERENCE_TIME periodTime,
|
||||||
HSEMAPHORE hSemaphore)
|
HSEMAPHORE hSemaphore)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
REFERENCE_TIME clockTime;
|
REFERENCE_TIME clockTime;
|
||||||
this->m_clock->GetTime(&clockTime);
|
this->m_clock->GetTime(&clockTime);
|
||||||
|
@ -271,12 +272,15 @@ void AkVCam::AdviseCookiePrivate::advisePeriodicTh(REFERENCE_TIME startTime,
|
||||||
this->m_mutex.unlock();
|
this->m_mutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
AkLoggerLog("Thread ", std::this_thread::get_id(), " finnished");
|
AkLogInfo() << "Thread "
|
||||||
|
<< std::this_thread::get_id()
|
||||||
|
<< " finnished"
|
||||||
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AkVCam::AdviseCookiePrivate::unadvise()
|
void AkVCam::AdviseCookiePrivate::unadvise()
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
this->m_run = false;
|
this->m_run = false;
|
||||||
this->m_mutex.lock();
|
this->m_mutex.lock();
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "SpecifyPropertyPages"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class SpecifyPropertyPagesPrivate
|
class SpecifyPropertyPagesPrivate
|
||||||
|
@ -55,7 +53,7 @@ AkVCam::SpecifyPropertyPages::~SpecifyPropertyPages()
|
||||||
|
|
||||||
HRESULT AkVCam::SpecifyPropertyPages::GetPages(CAUUID *pPages)
|
HRESULT AkVCam::SpecifyPropertyPages::GetPages(CAUUID *pPages)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pPages)
|
if (!pPages)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -80,11 +78,11 @@ HRESULT AkVCam::SpecifyPropertyPages::GetPages(CAUUID *pPages)
|
||||||
pPages->cElems = ULONG(pages.size());
|
pPages->cElems = ULONG(pages.size());
|
||||||
pPages->pElems =
|
pPages->pElems =
|
||||||
reinterpret_cast<GUID *>(CoTaskMemAlloc(sizeof(GUID) * pages.size()));
|
reinterpret_cast<GUID *>(CoTaskMemAlloc(sizeof(GUID) * pages.size()));
|
||||||
AkLoggerLog("Returning property pages:");
|
AkLogInfo() << "Returning property pages:" << std::endl;
|
||||||
|
|
||||||
for (size_t i = 0; i < pages.size(); i++) {
|
for (size_t i = 0; i < pages.size(); i++) {
|
||||||
memcpy(&pPages->pElems[i], &pages[i], sizeof(GUID));
|
memcpy(&pPages->pElems[i], &pages[i], sizeof(GUID));
|
||||||
AkLoggerLog(" ", stringFromClsid(pages[i]));
|
AkLogInfo() << " " << stringFromClsid(pages[i]) << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
|
@ -29,8 +29,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "StreamConfig"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class StreamConfigPrivate
|
class StreamConfigPrivate
|
||||||
|
@ -62,7 +60,7 @@ void AkVCam::StreamConfig::setPin(Pin *pin)
|
||||||
|
|
||||||
HRESULT AkVCam::StreamConfig::SetFormat(AM_MEDIA_TYPE *pmt)
|
HRESULT AkVCam::StreamConfig::SetFormat(AM_MEDIA_TYPE *pmt)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pmt)
|
if (!pmt)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -103,7 +101,7 @@ HRESULT AkVCam::StreamConfig::SetFormat(AM_MEDIA_TYPE *pmt)
|
||||||
|
|
||||||
HRESULT AkVCam::StreamConfig::GetFormat(AM_MEDIA_TYPE **pmt)
|
HRESULT AkVCam::StreamConfig::GetFormat(AM_MEDIA_TYPE **pmt)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pmt)
|
if (!pmt)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -127,7 +125,7 @@ HRESULT AkVCam::StreamConfig::GetFormat(AM_MEDIA_TYPE **pmt)
|
||||||
mediaTypes->Release();
|
mediaTypes->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
AkLoggerLog("MediaType: ", stringFromMediaType(*pmt));
|
AkLogInfo() << "MediaType: " << stringFromMediaType(*pmt) << std::endl;
|
||||||
|
|
||||||
return *pmt? S_OK: E_FAIL;
|
return *pmt? S_OK: E_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -135,7 +133,7 @@ HRESULT AkVCam::StreamConfig::GetFormat(AM_MEDIA_TYPE **pmt)
|
||||||
HRESULT AkVCam::StreamConfig::GetNumberOfCapabilities(int *piCount,
|
HRESULT AkVCam::StreamConfig::GetNumberOfCapabilities(int *piCount,
|
||||||
int *piSize)
|
int *piSize)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!piCount || !piSize)
|
if (!piCount || !piSize)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -169,7 +167,7 @@ HRESULT AkVCam::StreamConfig::GetStreamCaps(int iIndex,
|
||||||
AM_MEDIA_TYPE **pmt,
|
AM_MEDIA_TYPE **pmt,
|
||||||
BYTE *pSCC)
|
BYTE *pSCC)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pmt || !pSCC)
|
if (!pmt || !pSCC)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -262,7 +260,7 @@ HRESULT AkVCam::StreamConfig::GetStreamCaps(int iIndex,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AkLoggerLog("Media Type: ", stringFromMediaType(*pmt));
|
AkLogInfo() << "Media Type: " << stringFromMediaType(*pmt) << std::endl;
|
||||||
|
|
||||||
return *pmt? S_OK: S_FALSE;
|
return *pmt? S_OK: S_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,6 @@
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/image/videoformat.h"
|
#include "VCamUtils/src/image/videoformat.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "VideoControl"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class VideoControlPrivate
|
class VideoControlPrivate
|
||||||
|
@ -58,7 +56,7 @@ AkVCam::VideoControl::~VideoControl()
|
||||||
|
|
||||||
HRESULT AkVCam::VideoControl::GetCaps(IPin *pPin, LONG *pCapsFlags)
|
HRESULT AkVCam::VideoControl::GetCaps(IPin *pPin, LONG *pCapsFlags)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pPin || !pCapsFlags)
|
if (!pPin || !pCapsFlags)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -86,7 +84,7 @@ HRESULT AkVCam::VideoControl::GetCaps(IPin *pPin, LONG *pCapsFlags)
|
||||||
|
|
||||||
HRESULT AkVCam::VideoControl::SetMode(IPin *pPin, LONG Mode)
|
HRESULT AkVCam::VideoControl::SetMode(IPin *pPin, LONG Mode)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pPin)
|
if (!pPin)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -114,7 +112,7 @@ HRESULT AkVCam::VideoControl::SetMode(IPin *pPin, LONG Mode)
|
||||||
|
|
||||||
HRESULT AkVCam::VideoControl::GetMode(IPin *pPin, LONG *Mode)
|
HRESULT AkVCam::VideoControl::GetMode(IPin *pPin, LONG *Mode)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pPin || !Mode)
|
if (!pPin || !Mode)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -149,7 +147,7 @@ HRESULT AkVCam::VideoControl::GetMode(IPin *pPin, LONG *Mode)
|
||||||
HRESULT AkVCam::VideoControl::GetCurrentActualFrameRate(IPin *pPin,
|
HRESULT AkVCam::VideoControl::GetCurrentActualFrameRate(IPin *pPin,
|
||||||
LONGLONG *ActualFrameRate)
|
LONGLONG *ActualFrameRate)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pPin || !ActualFrameRate)
|
if (!pPin || !ActualFrameRate)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -202,7 +200,7 @@ HRESULT AkVCam::VideoControl::GetMaxAvailableFrameRate(IPin *pPin,
|
||||||
SIZE Dimensions,
|
SIZE Dimensions,
|
||||||
LONGLONG *MaxAvailableFrameRate)
|
LONGLONG *MaxAvailableFrameRate)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pPin || !MaxAvailableFrameRate)
|
if (!pPin || !MaxAvailableFrameRate)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -256,7 +254,7 @@ HRESULT AkVCam::VideoControl::GetFrameRateList(IPin *pPin,
|
||||||
LONG *ListSize,
|
LONG *ListSize,
|
||||||
LONGLONG **FrameRates)
|
LONGLONG **FrameRates)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pPin || !ListSize || !FrameRates)
|
if (!pPin || !ListSize || !FrameRates)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
|
@ -25,8 +25,6 @@
|
||||||
#include "PlatformUtils/src/utils.h"
|
#include "PlatformUtils/src/utils.h"
|
||||||
#include "VCamUtils/src/utils.h"
|
#include "VCamUtils/src/utils.h"
|
||||||
|
|
||||||
#define AK_CUR_INTERFACE "VideoProcAmp"
|
|
||||||
|
|
||||||
namespace AkVCam
|
namespace AkVCam
|
||||||
{
|
{
|
||||||
class VideoProcAmpPrivate
|
class VideoProcAmpPrivate
|
||||||
|
@ -88,7 +86,7 @@ HRESULT AkVCam::VideoProcAmp::GetRange(LONG Property,
|
||||||
LONG *pDefault,
|
LONG *pDefault,
|
||||||
LONG *pCapsFlags)
|
LONG *pCapsFlags)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!pMin || !pMax || !pSteppingDelta || !pDefault || !pCapsFlags)
|
if (!pMin || !pMax || !pSteppingDelta || !pDefault || !pCapsFlags)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
@ -115,7 +113,7 @@ HRESULT AkVCam::VideoProcAmp::GetRange(LONG Property,
|
||||||
|
|
||||||
HRESULT AkVCam::VideoProcAmp::Set(LONG Property, LONG lValue, LONG Flags)
|
HRESULT AkVCam::VideoProcAmp::Set(LONG Property, LONG lValue, LONG Flags)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
for (auto &control: ProcAmpPrivate::controls())
|
for (auto &control: ProcAmpPrivate::controls())
|
||||||
if (control.property == Property) {
|
if (control.property == Property) {
|
||||||
|
@ -135,7 +133,7 @@ HRESULT AkVCam::VideoProcAmp::Set(LONG Property, LONG lValue, LONG Flags)
|
||||||
|
|
||||||
HRESULT AkVCam::VideoProcAmp::Get(LONG Property, LONG *lValue, LONG *Flags)
|
HRESULT AkVCam::VideoProcAmp::Get(LONG Property, LONG *lValue, LONG *Flags)
|
||||||
{
|
{
|
||||||
AkLogMethod();
|
AkLogFunction();
|
||||||
|
|
||||||
if (!lValue || !Flags)
|
if (!lValue || !Flags)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
|
@ -59,6 +59,10 @@ Component.prototype.createOperations = function()
|
||||||
+ " <key>org.webcamoid.cmio.AkVCam.Assistant</key>\n"
|
+ " <key>org.webcamoid.cmio.AkVCam.Assistant</key>\n"
|
||||||
+ " <true/>\n"
|
+ " <true/>\n"
|
||||||
+ " </dict>\n"
|
+ " </dict>\n"
|
||||||
|
+ " <key>StandardOutPath</key>\n"
|
||||||
|
+ " <string>/tmp/AkVCamAssistant.log</string>\n"
|
||||||
|
+ " <key>StandardErrorPath</key>\n"
|
||||||
|
+ " <string>/tmp/AkVCamAssistant.log</string>\n"
|
||||||
+ " </dict>\n"
|
+ " </dict>\n"
|
||||||
+ "</plist>\n";
|
+ "</plist>\n";
|
||||||
component.addElevatedOperation("Delete", daemonPlist);
|
component.addElevatedOperation("Delete", daemonPlist);
|
||||||
|
|
Loading…
Reference in a new issue