Use std::string instead of std::wstring. Removed TestFrame.bmp.
This commit is contained in:
parent
f7a1dcd218
commit
1cf50519bc
48 changed files with 395 additions and 1110 deletions
|
@ -707,13 +707,10 @@ int AkVCam::CmdParserPrivate::showDevices(const StringMap &flags,
|
|||
"Description"
|
||||
};
|
||||
auto columns = table.size();
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> cv;
|
||||
|
||||
for (auto &device: devices) {
|
||||
table.push_back(device);
|
||||
auto description =
|
||||
cv.to_bytes(this->m_ipcBridge.description(device));
|
||||
table.push_back(description);
|
||||
table.push_back(this->m_ipcBridge.description(device));
|
||||
}
|
||||
|
||||
this->drawTable(table, columns);
|
||||
|
@ -733,8 +730,7 @@ int AkVCam::CmdParserPrivate::addDevice(const StringMap &flags,
|
|||
return -1;
|
||||
}
|
||||
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> cv;
|
||||
auto deviceId = this->m_ipcBridge.addDevice(cv.from_bytes(args[1]));
|
||||
auto deviceId = this->m_ipcBridge.addDevice(args[1]);
|
||||
|
||||
if (deviceId.empty()) {
|
||||
std::cerr << "Failed to create device." << std::endl;
|
||||
|
@ -810,7 +806,7 @@ int AkVCam::CmdParserPrivate::showDeviceDescription(const StringMap &flags,
|
|||
return -1;
|
||||
}
|
||||
|
||||
std::wcout << this->m_ipcBridge.description(args[1]) << std::endl;
|
||||
std::cout << this->m_ipcBridge.description(args[1]) << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -836,8 +832,7 @@ int AkVCam::CmdParserPrivate::setDeviceDescription(const AkVCam::StringMap &flag
|
|||
return -1;
|
||||
}
|
||||
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> cv;
|
||||
this->m_ipcBridge.setDescription(deviceId, cv.from_bytes(args[2]));
|
||||
this->m_ipcBridge.setDescription(deviceId, args[2]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1492,7 +1487,7 @@ int AkVCam::CmdParserPrivate::picture(const AkVCam::StringMap &flags,
|
|||
UNUSED(flags);
|
||||
UNUSED(args);
|
||||
|
||||
std::wcout << this->m_ipcBridge.picture() << std::endl;
|
||||
std::cout << this->m_ipcBridge.picture() << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1508,8 +1503,7 @@ int AkVCam::CmdParserPrivate::setPicture(const AkVCam::StringMap &flags,
|
|||
return -1;
|
||||
}
|
||||
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> cv;
|
||||
this->m_ipcBridge.setPicture(cv.from_bytes(args[1]));
|
||||
this->m_ipcBridge.setPicture(args[1]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1591,11 +1585,8 @@ void AkVCam::CmdParserPrivate::loadGenerals(Settings &settings)
|
|||
{
|
||||
settings.beginGroup("General");
|
||||
|
||||
if (settings.contains("default_frame")) {
|
||||
auto defaultFrame = settings.value("default_frame");
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> cv;
|
||||
this->m_ipcBridge.setPicture(cv.from_bytes(defaultFrame));
|
||||
}
|
||||
if (settings.contains("default_frame"))
|
||||
this->m_ipcBridge.setPicture(settings.value("default_frame"));
|
||||
|
||||
if (settings.contains("loglevel")) {
|
||||
auto logLevel= settings.value("loglevel");
|
||||
|
@ -1742,8 +1733,7 @@ void AkVCam::CmdParserPrivate::createDevice(Settings &settings,
|
|||
return;
|
||||
}
|
||||
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> cv;
|
||||
auto deviceId = this->m_ipcBridge.addDevice(cv.from_bytes(description));
|
||||
auto deviceId = this->m_ipcBridge.addDevice(description);
|
||||
auto supportedFormats = this->m_ipcBridge.supportedPixelFormats(IpcBridge::StreamTypeOutput);
|
||||
|
||||
for (auto &format: formats) {
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
namespace AkVCam {
|
||||
class CmdParserPrivate;
|
||||
using StringVector = std::vector<std::string>;
|
||||
using WStringVector = std::vector<std::wstring>;
|
||||
using StringMap = std::map<std::string, std::string>;
|
||||
using ProgramOptionsFunc = std::function<int (const StringMap &flags,
|
||||
const StringVector &args)>;
|
||||
|
|
|
@ -73,31 +73,6 @@ AkVCam::Fraction::Fraction(const std::string &str)
|
|||
}
|
||||
}
|
||||
|
||||
AkVCam::Fraction::Fraction(const std::wstring &str)
|
||||
{
|
||||
this->d = new FractionPrivate;
|
||||
this->d->m_num = 0;
|
||||
this->d->m_den = 1;
|
||||
auto pos = str.find(L'/');
|
||||
|
||||
if (pos == std::wstring::npos) {
|
||||
auto strCpy = trimmed(str);
|
||||
|
||||
this->d->m_num = uint32_t(wcstol(strCpy.c_str(), nullptr, 10));
|
||||
} else {
|
||||
auto numStr = trimmed(str.substr(0, pos));
|
||||
auto denStr = trimmed(str.substr(pos + 1));
|
||||
|
||||
this->d->m_num = uint32_t(wcstol(numStr.c_str(), nullptr, 10));
|
||||
this->d->m_den = uint32_t(wcstol(denStr.c_str(), nullptr, 10));
|
||||
|
||||
if (this->d->m_den < 1) {
|
||||
this->d->m_num = 0;
|
||||
this->d->m_den = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AkVCam::Fraction::Fraction(const Fraction &other)
|
||||
{
|
||||
this->d = new FractionPrivate;
|
||||
|
@ -168,11 +143,3 @@ std::string AkVCam::Fraction::toString() const
|
|||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::wstring AkVCam::Fraction::toWString() const
|
||||
{
|
||||
std::wstringstream ss;
|
||||
ss << this->d->m_num << L'/' << this->d->m_den;
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ namespace AkVCam
|
|||
Fraction();
|
||||
Fraction(int64_t num, int64_t den);
|
||||
Fraction(const std::string &str);
|
||||
Fraction(const std::wstring &str);
|
||||
Fraction(const Fraction &other);
|
||||
virtual ~Fraction();
|
||||
Fraction &operator =(const Fraction &other);
|
||||
|
@ -48,7 +47,6 @@ namespace AkVCam
|
|||
int64_t &den();
|
||||
double value() const;
|
||||
std::string toString() const;
|
||||
std::wstring toWString() const;
|
||||
|
||||
private:
|
||||
FractionPrivate *d;
|
||||
|
|
|
@ -355,13 +355,6 @@ std::string AkVCam::VideoFormat::stringFromFourcc(AkVCam::FourCC fourcc)
|
|||
return vf? vf->str: std::string();
|
||||
}
|
||||
|
||||
std::wstring AkVCam::VideoFormat::wstringFromFourcc(AkVCam::FourCC fourcc)
|
||||
{
|
||||
auto str = stringFromFourcc(fourcc);
|
||||
|
||||
return std::wstring(str.begin(), str.end());
|
||||
}
|
||||
|
||||
AkVCam::VideoFormatPrivate::VideoFormatPrivate(FourCC fourcc,
|
||||
int width,
|
||||
int height,
|
||||
|
|
|
@ -70,7 +70,6 @@ namespace AkVCam
|
|||
int align=32);
|
||||
static FourCC fourccFromString(const std::string &fourccStr);
|
||||
static std::string stringFromFourcc(FourCC fourcc);
|
||||
static std::wstring wstringFromFourcc(FourCC fourcc);
|
||||
|
||||
private:
|
||||
VideoFormatPrivate *d;
|
||||
|
|
|
@ -96,8 +96,8 @@ namespace AkVCam
|
|||
|
||||
/* Server & Client */
|
||||
|
||||
std::wstring picture() const;
|
||||
void setPicture(const std::wstring &picture);
|
||||
std::string picture() const;
|
||||
void setPicture(const std::string &picture);
|
||||
int logLevel() const;
|
||||
void setLogLevel(int logLevel);
|
||||
|
||||
|
@ -111,9 +111,9 @@ namespace AkVCam
|
|||
std::vector<std::string> devices() const;
|
||||
|
||||
// Return human readable description of the device.
|
||||
std::wstring description(const std::string &deviceId) const;
|
||||
std::string description(const std::string &deviceId) const;
|
||||
void setDescription(const std::string &deviceId,
|
||||
const std::wstring &description);
|
||||
const std::string &description);
|
||||
|
||||
// Output pixel formats supported by the driver.
|
||||
std::vector<PixelFormat> supportedPixelFormats(StreamType type) const;
|
||||
|
@ -144,7 +144,7 @@ namespace AkVCam
|
|||
|
||||
/* Server */
|
||||
|
||||
std::string addDevice(const std::wstring &description);
|
||||
std::string addDevice(const std::string &description);
|
||||
void removeDevice(const std::string &deviceId);
|
||||
void addFormat(const std::string &deviceId,
|
||||
const VideoFormat &format,
|
||||
|
|
|
@ -54,50 +54,6 @@ std::string AkVCam::replace(const std::string &str,
|
|||
return newStr;
|
||||
}
|
||||
|
||||
std::wstring AkVCam::replace(const std::wstring &str,
|
||||
const std::wstring &from,
|
||||
const std::wstring &to)
|
||||
{
|
||||
auto newStr = str;
|
||||
|
||||
for (auto pos = newStr.find(from);
|
||||
pos != std::wstring::npos;
|
||||
pos = newStr.find(from))
|
||||
newStr.replace(pos, from.size(), to);
|
||||
|
||||
return newStr;
|
||||
}
|
||||
|
||||
bool AkVCam::isEqualFile(const std::wstring &file1, const std::wstring &file2)
|
||||
{
|
||||
if (file1 == file2)
|
||||
return true;
|
||||
|
||||
std::fstream f1;
|
||||
std::fstream f2;
|
||||
f1.open(std::string(file1.begin(), file1.end()), std::ios_base::in);
|
||||
f2.open(std::string(file2.begin(), file2.end()), std::ios_base::in);
|
||||
|
||||
if (!f1.is_open() || !f2.is_open())
|
||||
return false;
|
||||
|
||||
const size_t bufferSize = 1024;
|
||||
char buffer1[bufferSize];
|
||||
char buffer2[bufferSize];
|
||||
memset(buffer1, 0, bufferSize);
|
||||
memset(buffer2, 0, bufferSize);
|
||||
|
||||
while (!f1.eof() && !f2.eof()) {
|
||||
f1.read(buffer1, bufferSize);
|
||||
f2.read(buffer2, bufferSize);
|
||||
|
||||
if (memcmp(buffer1, buffer2, bufferSize) != 0)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AkVCam::trimmed(const std::string &str)
|
||||
{
|
||||
auto left = uint64_t(str.size());
|
||||
|
@ -128,36 +84,6 @@ std::string AkVCam::trimmed(const std::string &str)
|
|||
return str.substr(size_t(left), strippedLen);
|
||||
}
|
||||
|
||||
std::wstring AkVCam::trimmed(const std::wstring &str)
|
||||
{
|
||||
auto left = uint64_t(str.size());
|
||||
auto right = uint64_t(str.size());
|
||||
|
||||
for (size_t i = 0; i < str.size(); i++)
|
||||
if (!iswspace(str[i])) {
|
||||
left = uint64_t(i);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
auto strippedLen = str.size();
|
||||
|
||||
if (left == str.size()) {
|
||||
strippedLen = 0;
|
||||
} else {
|
||||
for (int64_t i = str.size() - 1; i >= 0; i--)
|
||||
if (!iswspace(str[size_t(i)])) {
|
||||
right = uint64_t(i);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
strippedLen = size_t(right - left + 1);
|
||||
}
|
||||
|
||||
return str.substr(size_t(left), strippedLen);
|
||||
}
|
||||
|
||||
std::string AkVCam::fill(const std::string &str, size_t maxSize)
|
||||
{
|
||||
std::stringstream ss;
|
||||
|
@ -167,15 +93,6 @@ std::string AkVCam::fill(const std::string &str, size_t maxSize)
|
|||
return ss.str();
|
||||
}
|
||||
|
||||
std::wstring AkVCam::fill(const std::wstring &str, size_t maxSize)
|
||||
{
|
||||
std::wstringstream ss;
|
||||
std::vector<wchar_t> spaces(maxSize, ' ');
|
||||
ss << str << std::wstring(spaces.data(), maxSize - str.size());
|
||||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
std::string AkVCam::join(const std::vector<std::string> &strs,
|
||||
const std::string &separator)
|
||||
{
|
||||
|
|
|
@ -147,14 +147,8 @@ namespace AkVCam
|
|||
std::string replace(const std::string &str,
|
||||
const std::string &from,
|
||||
const std::string &to);
|
||||
std::wstring replace(const std::wstring &str,
|
||||
const std::wstring &from,
|
||||
const std::wstring &to);
|
||||
bool isEqualFile(const std::wstring &file1, const std::wstring &file2);
|
||||
std::string trimmed(const std::string &str);
|
||||
std::wstring trimmed(const std::wstring &str);
|
||||
std::string fill(const std::string &str, size_t maxSize);
|
||||
std::wstring fill(const std::wstring &str, size_t maxSize);
|
||||
std::string join(const std::vector<std::string> &strs,
|
||||
const std::string &separator);
|
||||
std::vector<std::string> split(const std::string &str, char separator);
|
||||
|
|
|
@ -74,19 +74,6 @@ void AkVCam::Preferences::write(const std::string &key,
|
|||
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();
|
||||
|
@ -147,24 +134,6 @@ std::string AkVCam::Preferences::readString(const std::string &key,
|
|||
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();
|
||||
|
@ -284,7 +253,7 @@ void AkVCam::Preferences::sync()
|
|||
CFPreferencesAppSynchronize(PREFERENCES_ID);
|
||||
}
|
||||
|
||||
std::string AkVCam::Preferences::addDevice(const std::wstring &description)
|
||||
std::string AkVCam::Preferences::addDevice(const std::string &description)
|
||||
{
|
||||
AkLogFunction();
|
||||
auto path = createDevicePath();
|
||||
|
@ -303,14 +272,14 @@ std::string AkVCam::Preferences::addDevice(const std::wstring &description)
|
|||
return path;
|
||||
}
|
||||
|
||||
std::string AkVCam::Preferences::addCamera(const std::wstring &description,
|
||||
std::string AkVCam::Preferences::addCamera(const std::string &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::string &description,
|
||||
const std::vector<VideoFormat> &formats)
|
||||
{
|
||||
AkLogFunction();
|
||||
|
@ -433,18 +402,18 @@ bool AkVCam::Preferences::cameraExists(const std::string &path)
|
|||
return false;
|
||||
}
|
||||
|
||||
std::wstring AkVCam::Preferences::cameraDescription(size_t cameraIndex)
|
||||
std::string AkVCam::Preferences::cameraDescription(size_t cameraIndex)
|
||||
{
|
||||
if (cameraIndex >= camerasCount())
|
||||
return {};
|
||||
|
||||
return readWString("cameras."
|
||||
return readString("cameras."
|
||||
+ std::to_string(cameraIndex)
|
||||
+ ".description");
|
||||
}
|
||||
|
||||
void AkVCam::Preferences::cameraSetDescription(size_t cameraIndex,
|
||||
const std::wstring &description)
|
||||
const std::string &description)
|
||||
{
|
||||
if (cameraIndex >= camerasCount())
|
||||
return;
|
||||
|
@ -606,12 +575,12 @@ void AkVCam::Preferences::cameraSetControlValue(size_t cameraIndex,
|
|||
sync();
|
||||
}
|
||||
|
||||
std::wstring AkVCam::Preferences::picture()
|
||||
std::string AkVCam::Preferences::picture()
|
||||
{
|
||||
return readWString("picture");
|
||||
return readString("picture");
|
||||
}
|
||||
|
||||
void AkVCam::Preferences::setPicture(const std::wstring &picture)
|
||||
void AkVCam::Preferences::setPicture(const std::string &picture)
|
||||
{
|
||||
write("picture", picture);
|
||||
sync();
|
||||
|
|
|
@ -35,15 +35,12 @@ namespace AkVCam
|
|||
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);
|
||||
void write(const std::string &key, std::vector<std::string> &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);
|
||||
bool readBool(const std::string &key, bool defaultValue=false);
|
||||
|
@ -54,20 +51,20 @@ namespace AkVCam
|
|||
void move(const std::string &keyFrom, const std::string &keyTo);
|
||||
void moveAll(const std::string &keyFrom, const std::string &keyTo);
|
||||
void sync();
|
||||
std::string addDevice(const std::wstring &description);
|
||||
std::string addCamera(const std::wstring &description,
|
||||
std::string addDevice(const std::string &description);
|
||||
std::string addCamera(const std::string &description,
|
||||
const std::vector<VideoFormat> &formats);
|
||||
std::string addCamera(const std::string &path,
|
||||
const std::wstring &description,
|
||||
const std::string &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 cameraDescription(size_t cameraIndex);
|
||||
void cameraSetDescription(size_t cameraIndex,
|
||||
const std::wstring &description);
|
||||
const std::string &description);
|
||||
std::string cameraPath(size_t cameraIndex);
|
||||
size_t formatsCount(size_t cameraIndex);
|
||||
VideoFormat cameraFormat(size_t cameraIndex, size_t formatIndex);
|
||||
|
@ -83,8 +80,8 @@ namespace AkVCam
|
|||
void cameraSetControlValue(size_t cameraIndex,
|
||||
const std::string &key,
|
||||
int value);
|
||||
std::wstring picture();
|
||||
void setPicture(const std::wstring &picture);
|
||||
std::string picture();
|
||||
void setPicture(const std::string &picture);
|
||||
int logLevel();
|
||||
void setLogLevel(int logLevel);
|
||||
}
|
||||
|
|
|
@ -122,21 +122,6 @@ std::shared_ptr<CFTypeRef> AkVCam::cfTypeFromStd(const std::string &str)
|
|||
});
|
||||
}
|
||||
|
||||
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 =
|
||||
|
@ -192,40 +177,6 @@ std::string AkVCam::stringFromCFType(CFTypeRef cfType)
|
|||
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));
|
||||
}
|
||||
|
||||
std::string AkVCam::realPath(const std::string &path)
|
||||
{
|
||||
char resolvedPath[PATH_MAX];
|
||||
|
|
|
@ -36,11 +36,9 @@ namespace AkVCam
|
|||
FourCharCode formatToCM(PixelFormat format);
|
||||
PixelFormat formatFromCM(FourCharCode format);
|
||||
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);
|
||||
std::string realPath(const std::string &path);
|
||||
VideoFrame loadPicture(const std::string &fileName);
|
||||
}
|
||||
|
|
|
@ -110,12 +110,12 @@ AkVCam::IpcBridge::~IpcBridge()
|
|||
delete this->d;
|
||||
}
|
||||
|
||||
std::wstring AkVCam::IpcBridge::picture() const
|
||||
std::string AkVCam::IpcBridge::picture() const
|
||||
{
|
||||
return Preferences::picture();
|
||||
}
|
||||
|
||||
void AkVCam::IpcBridge::setPicture(const std::wstring &picture)
|
||||
void AkVCam::IpcBridge::setPicture(const std::string &picture)
|
||||
{
|
||||
AkLogFunction();
|
||||
Preferences::setPicture(picture);
|
||||
|
@ -123,10 +123,9 @@ void AkVCam::IpcBridge::setPicture(const std::wstring &picture)
|
|||
if (!this->d->m_serverMessagePort)
|
||||
return;
|
||||
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> cv;
|
||||
auto dictionary = xpc_dictionary_create(nullptr, nullptr, 0);
|
||||
xpc_dictionary_set_int64(dictionary, "message", AKVCAM_ASSISTANT_MSG_PICTURE_UPDATED);
|
||||
xpc_dictionary_set_string(dictionary, "picture", cv.to_bytes(picture).c_str());
|
||||
xpc_dictionary_set_string(dictionary, "picture", picture.c_str());
|
||||
xpc_connection_send_message(this->d->m_serverMessagePort, dictionary);
|
||||
xpc_release(dictionary);
|
||||
}
|
||||
|
@ -287,7 +286,7 @@ std::vector<std::string> AkVCam::IpcBridge::devices() const
|
|||
return devices;
|
||||
}
|
||||
|
||||
std::wstring AkVCam::IpcBridge::description(const std::string &deviceId) const
|
||||
std::string AkVCam::IpcBridge::description(const std::string &deviceId) const
|
||||
{
|
||||
AkLogFunction();
|
||||
auto cameraIndex = Preferences::cameraFromPath(deviceId);
|
||||
|
@ -299,7 +298,7 @@ std::wstring AkVCam::IpcBridge::description(const std::string &deviceId) const
|
|||
}
|
||||
|
||||
void AkVCam::IpcBridge::setDescription(const std::string &deviceId,
|
||||
const std::wstring &description)
|
||||
const std::string &description)
|
||||
{
|
||||
AkLogFunction();
|
||||
auto cameraIndex = Preferences::cameraFromPath(deviceId);
|
||||
|
@ -521,7 +520,7 @@ std::string AkVCam::IpcBridge::clientExe(uint64_t pid) const
|
|||
return {path};
|
||||
}
|
||||
|
||||
std::string AkVCam::IpcBridge::addDevice(const std::wstring &description)
|
||||
std::string AkVCam::IpcBridge::addDevice(const std::string &description)
|
||||
{
|
||||
return Preferences::addDevice(description);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ namespace AkVCam
|
|||
PropertyTypeFloat64,
|
||||
PropertyTypePidT,
|
||||
PropertyTypeString,
|
||||
PropertyTypeWString,
|
||||
PropertyTypeObjectVector,
|
||||
PropertyTypeObjectPtrVector,
|
||||
PropertyTypeVideoFormat,
|
||||
|
@ -55,7 +54,6 @@ namespace AkVCam
|
|||
} num;
|
||||
|
||||
std::string str;
|
||||
std::wstring wstr;
|
||||
std::vector<Object *> objects;
|
||||
std::vector<ObjectPtr> objectsPtr;
|
||||
std::vector<VideoFormat> videoFormats;
|
||||
|
@ -118,17 +116,6 @@ bool AkVCam::ObjectProperties::setProperty(UInt32 property,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool AkVCam::ObjectProperties::setProperty(UInt32 property,
|
||||
const std::wstring &value,
|
||||
bool isSettable)
|
||||
{
|
||||
this->d->m_properties[property].type = PropertyTypeWString;
|
||||
this->d->m_properties[property].isSettable = isSettable;
|
||||
this->d->m_properties[property].wstr = value;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AkVCam::ObjectProperties::setProperty(UInt32 property,
|
||||
UInt32 value,
|
||||
bool isSettable)
|
||||
|
@ -460,26 +447,6 @@ bool AkVCam::ObjectProperties::getProperty(UInt32 property,
|
|||
|
||||
break;
|
||||
|
||||
case PropertyTypeWString:
|
||||
if (dataUsed) {
|
||||
*dataUsed = sizeof(CFStringRef);
|
||||
|
||||
if (data)
|
||||
ok = dataSize == *dataUsed;
|
||||
}
|
||||
|
||||
if (ok && data) {
|
||||
auto value = this->d->m_properties[property].wstr;
|
||||
*static_cast<CFStringRef *>(data) =
|
||||
CFStringCreateWithBytes(kCFAllocatorDefault,
|
||||
reinterpret_cast<const UInt8 *>(value.c_str()),
|
||||
CFIndex(value.size() * sizeof(wchar_t)),
|
||||
kCFStringEncodingUTF32LE,
|
||||
false);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case PropertyTypeObjectVector: {
|
||||
auto &objects = this->d->m_properties[property].objects;
|
||||
auto objectList = static_cast<CMIOObjectID *>(data);
|
||||
|
|
|
@ -49,9 +49,6 @@ namespace AkVCam
|
|||
bool setProperty(UInt32 property,
|
||||
const std::string &value,
|
||||
bool isSettable=true);
|
||||
bool setProperty(UInt32 property,
|
||||
const std::wstring &value,
|
||||
bool isSettable=true);
|
||||
bool setProperty(UInt32 property,
|
||||
UInt32 value,
|
||||
bool isSettable=true);
|
||||
|
|
|
@ -373,7 +373,7 @@ void AkVCam::PluginInterface::removeListener(void *userData,
|
|||
}
|
||||
|
||||
bool AkVCam::PluginInterface::createDevice(const std::string &deviceId,
|
||||
const std::wstring &description,
|
||||
const std::string &description,
|
||||
const std::vector<VideoFormat> &formats)
|
||||
{
|
||||
AkLogFunction();
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace AkVCam
|
|||
static void removeListener(void *userData,
|
||||
const std::string &deviceId);
|
||||
bool createDevice(const std::string &deviceId,
|
||||
const std::wstring &description,
|
||||
const std::string &description,
|
||||
const std::vector<VideoFormat> &formats);
|
||||
void destroyDevice(const std::string &deviceId);
|
||||
|
||||
|
|
|
@ -79,10 +79,8 @@ AkVCam::Stream::Stream(bool registerObject,
|
|||
this->m_classID = kCMIOStreamClassID;
|
||||
auto picture = Preferences::picture();
|
||||
|
||||
if (!picture.empty()) {
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> cv;
|
||||
this->d->m_testFrame = loadPicture(cv.to_bytes(picture));
|
||||
}
|
||||
if (!picture.empty())
|
||||
this->d->m_testFrame = loadPicture(picture);
|
||||
|
||||
this->d->m_clock =
|
||||
std::make_shared<Clock>("CMIO::VirtualCamera::Stream",
|
||||
|
|
|
@ -55,7 +55,7 @@ int main(int argc, char **argv)
|
|||
|
||||
AkLogInfo() << "Setting service dispatcher" << std::endl;
|
||||
|
||||
WCHAR serviceName[] = TEXT(DSHOW_PLUGIN_ASSISTANT_NAME);
|
||||
TCHAR serviceName[] = TEXT(DSHOW_PLUGIN_ASSISTANT_NAME);
|
||||
SERVICE_TABLE_ENTRY serviceTable[] = {
|
||||
{serviceName, serviceMain},
|
||||
{nullptr , nullptr }
|
||||
|
|
|
@ -102,7 +102,7 @@ AkVCam::Service::~Service()
|
|||
BOOL AkVCam::Service::install()
|
||||
{
|
||||
AkLogFunction();
|
||||
WCHAR fileName[MAX_PATH];
|
||||
TCHAR fileName[MAX_PATH];
|
||||
|
||||
if (!GetModuleFileName(nullptr, fileName, MAX_PATH)) {
|
||||
AkLogError() << "Can't read module file name" << std::endl;
|
||||
|
@ -142,7 +142,7 @@ BOOL AkVCam::Service::install()
|
|||
|
||||
// Add detailed description to the service.
|
||||
SERVICE_DESCRIPTION serviceDescription;
|
||||
WCHAR description[] = TEXT(DSHOW_PLUGIN_DESCRIPTION_EXT);
|
||||
TCHAR description[] = TEXT(DSHOW_PLUGIN_DESCRIPTION_EXT);
|
||||
serviceDescription.lpDescription = description;
|
||||
auto result =
|
||||
ChangeServiceConfig2(service,
|
||||
|
@ -150,7 +150,7 @@ BOOL AkVCam::Service::install()
|
|||
&serviceDescription);
|
||||
|
||||
// Configure the service so it will restart if fail.
|
||||
WCHAR rebootMsg[] = L"Service failed restarting...";
|
||||
TCHAR rebootMsg[] = TEXT("Service failed restarting...");
|
||||
|
||||
std::vector<SC_ACTION> actions {
|
||||
{SC_ACTION_RESTART, 5000}
|
||||
|
@ -264,7 +264,7 @@ AkVCam::ServicePrivate::ServicePrivate()
|
|||
0
|
||||
};
|
||||
this->m_statusHandler = nullptr;
|
||||
this->m_messageServer.setPipeName(L"\\\\.\\pipe\\" DSHOW_PLUGIN_ASSISTANT_NAME_L);
|
||||
this->m_messageServer.setPipeName("\\\\.\\pipe\\" DSHOW_PLUGIN_ASSISTANT_NAME);
|
||||
this->m_messageServer.setHandlers({
|
||||
{AKVCAM_ASSISTANT_MSG_FRAME_READY , AKVCAM_BIND_FUNC(ServicePrivate::frameReady) },
|
||||
{AKVCAM_ASSISTANT_MSG_PICTURE_UPDATED , AKVCAM_BIND_FUNC(ServicePrivate::pictureUpdated) },
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace AkVCam
|
|||
{
|
||||
public:
|
||||
MessageServer *self;
|
||||
std::wstring m_pipeName;
|
||||
std::string m_pipeName;
|
||||
std::map<uint32_t, MessageHandler> m_handlers;
|
||||
MessageServer::ServerMode m_mode {MessageServer::ServerModeReceive};
|
||||
MessageServer::PipeState m_pipeState {MessageServer::PipeStateGone};
|
||||
|
@ -70,17 +70,17 @@ AkVCam::MessageServer::~MessageServer()
|
|||
delete this->d;
|
||||
}
|
||||
|
||||
std::wstring AkVCam::MessageServer::pipeName() const
|
||||
std::string AkVCam::MessageServer::pipeName() const
|
||||
{
|
||||
return this->d->m_pipeName;
|
||||
}
|
||||
|
||||
std::wstring &AkVCam::MessageServer::pipeName()
|
||||
std::string &AkVCam::MessageServer::pipeName()
|
||||
{
|
||||
return this->d->m_pipeName;
|
||||
}
|
||||
|
||||
void AkVCam::MessageServer::setPipeName(const std::wstring &pipeName)
|
||||
void AkVCam::MessageServer::setPipeName(const std::string &pipeName)
|
||||
{
|
||||
this->d->m_pipeName = pipeName;
|
||||
}
|
||||
|
@ -169,29 +169,17 @@ BOOL AkVCam::MessageServer::sendMessage(const std::string &pipeName,
|
|||
Message *message,
|
||||
uint32_t timeout)
|
||||
{
|
||||
return sendMessage(std::wstring(pipeName.begin(), pipeName.end()),
|
||||
message,
|
||||
timeout);
|
||||
return sendMessage(pipeName, *message, message, timeout);
|
||||
}
|
||||
|
||||
BOOL AkVCam::MessageServer::sendMessage(const std::wstring &pipeName,
|
||||
Message *message,
|
||||
uint32_t timeout)
|
||||
{
|
||||
return sendMessage(pipeName,
|
||||
*message,
|
||||
message,
|
||||
timeout);
|
||||
}
|
||||
|
||||
BOOL AkVCam::MessageServer::sendMessage(const std::wstring &pipeName,
|
||||
BOOL AkVCam::MessageServer::sendMessage(const std::string &pipeName,
|
||||
const Message &messageIn,
|
||||
Message *messageOut,
|
||||
uint32_t timeout)
|
||||
{
|
||||
DWORD bytesTransferred = 0;
|
||||
|
||||
return CallNamedPipe(pipeName.c_str(),
|
||||
return CallNamedPipeA(pipeName.c_str(),
|
||||
const_cast<Message *>(&messageIn),
|
||||
DWORD(sizeof(Message)),
|
||||
messageOut,
|
||||
|
@ -217,12 +205,12 @@ bool AkVCam::MessageServerPrivate::startReceive(bool wait)
|
|||
*
|
||||
* https://msdn.microsoft.com/en-us/library/windows/desktop/aa379570(v=vs.85).aspx
|
||||
*/
|
||||
WCHAR descriptor[] =
|
||||
L"D:" // Discretionary ACL
|
||||
L"(D;OICI;GA;;;BG)" // Deny access to Built-in Guests
|
||||
L"(D;OICI;GA;;;AN)" // Deny access to Anonymous Logon
|
||||
L"(A;OICI;GRGWGX;;;AU)" // Allow read/write/execute to Authenticated Users
|
||||
L"(A;OICI;GA;;;BA)"; // Allow full control to Administrators
|
||||
TCHAR descriptor[] =
|
||||
TEXT("D:") // Discretionary ACL
|
||||
TEXT("(D;OICI;GA;;;BG)") // Deny access to Built-in Guests
|
||||
TEXT("(D;OICI;GA;;;AN)") // Deny access to Anonymous Logon
|
||||
TEXT("(A;OICI;GRGWGX;;;AU)") // Allow read/write/execute to Authenticated Users
|
||||
TEXT("(A;OICI;GA;;;BA)"); // Allow full control to Administrators
|
||||
|
||||
SECURITY_ATTRIBUTES securityAttributes;
|
||||
PSECURITY_DESCRIPTOR securityDescriptor =
|
||||
|
@ -246,7 +234,7 @@ bool AkVCam::MessageServerPrivate::startReceive(bool wait)
|
|||
securityAttributes.bInheritHandle = TRUE;
|
||||
|
||||
// Create a read/write message type pipe.
|
||||
this->m_pipe = CreateNamedPipe(this->m_pipeName.c_str(),
|
||||
this->m_pipe = CreateNamedPipeA(this->m_pipeName.c_str(),
|
||||
PIPE_ACCESS_DUPLEX
|
||||
| FILE_FLAG_OVERLAPPED,
|
||||
PIPE_TYPE_MESSAGE
|
||||
|
@ -366,23 +354,17 @@ void AkVCam::MessageServerPrivate::messagesLoop()
|
|||
void AkVCam::MessageServerPrivate::checkLoop()
|
||||
{
|
||||
while (this->m_running) {
|
||||
auto result = WaitNamedPipe(this->m_pipeName.c_str(), NMPWAIT_NOWAIT);
|
||||
auto result = WaitNamedPipeA(this->m_pipeName.c_str(), NMPWAIT_NOWAIT);
|
||||
|
||||
if (result
|
||||
&& this->m_pipeState != AkVCam::MessageServer::PipeStateAvailable) {
|
||||
AkLogInfo() << "Pipe Available: "
|
||||
<< std::string(this->m_pipeName.begin(),
|
||||
this->m_pipeName.end())
|
||||
<< std::endl;
|
||||
AkLogInfo() << "Pipe Available: " << this->m_pipeName << std::endl;
|
||||
this->m_pipeState = AkVCam::MessageServer::PipeStateAvailable;
|
||||
AKVCAM_EMIT(this->self, PipeStateChanged, this->m_pipeState)
|
||||
} else if (!result
|
||||
&& this->m_pipeState != AkVCam::MessageServer::PipeStateGone
|
||||
&& GetLastError() != ERROR_SEM_TIMEOUT) {
|
||||
AkLogInfo() << "Pipe Gone: "
|
||||
<< std::string(this->m_pipeName.begin(),
|
||||
this->m_pipeName.end())
|
||||
<< std::endl;
|
||||
AkLogInfo() << "Pipe Gone: " << this->m_pipeName << std::endl;
|
||||
this->m_pipeState = AkVCam::MessageServer::PipeStateGone;
|
||||
AKVCAM_EMIT(this->self, PipeStateChanged, this->m_pipeState)
|
||||
}
|
||||
|
|
|
@ -66,9 +66,9 @@ namespace AkVCam
|
|||
MessageServer(const MessageServer &other) = delete;
|
||||
~MessageServer();
|
||||
|
||||
std::wstring pipeName() const;
|
||||
std::wstring &pipeName();
|
||||
void setPipeName(const std::wstring &pipeName);
|
||||
std::string pipeName() const;
|
||||
std::string &pipeName();
|
||||
void setPipeName(const std::string &pipeName);
|
||||
ServerMode mode() const;
|
||||
ServerMode &mode();
|
||||
void setMode(ServerMode mode);
|
||||
|
@ -87,10 +87,7 @@ namespace AkVCam
|
|||
static BOOL sendMessage(const std::string &pipeName,
|
||||
Message *message,
|
||||
uint32_t timeout=MSERVER_TIMEOUT_MAX);
|
||||
static BOOL sendMessage(const std::wstring &pipeName,
|
||||
Message *message,
|
||||
uint32_t timeout=MSERVER_TIMEOUT_MAX);
|
||||
static BOOL sendMessage(const std::wstring &pipeName,
|
||||
static BOOL sendMessage(const std::string &pipeName,
|
||||
const Message &messageIn,
|
||||
Message *messageOut,
|
||||
uint32_t timeout=MSERVER_TIMEOUT_MAX);
|
||||
|
|
|
@ -27,24 +27,23 @@ namespace AkVCam
|
|||
{
|
||||
public:
|
||||
HANDLE m_mutex;
|
||||
std::wstring m_name;
|
||||
std::string m_name;
|
||||
};
|
||||
}
|
||||
|
||||
AkVCam::Mutex::Mutex(const std::wstring &name)
|
||||
AkVCam::Mutex::Mutex(const std::string &name)
|
||||
{
|
||||
this->d = new MutexPrivate();
|
||||
this->d->m_mutex = CreateMutex(nullptr,
|
||||
this->d->m_mutex = CreateMutexA(nullptr,
|
||||
FALSE,
|
||||
name.empty()?
|
||||
nullptr: name.c_str());
|
||||
name.empty()? nullptr: name.c_str());
|
||||
this->d->m_name = name;
|
||||
}
|
||||
|
||||
AkVCam::Mutex::Mutex(const Mutex &other)
|
||||
{
|
||||
this->d = new MutexPrivate();
|
||||
this->d->m_mutex = CreateMutex(nullptr,
|
||||
this->d->m_mutex = CreateMutexA(nullptr,
|
||||
FALSE,
|
||||
other.d->m_name.empty()?
|
||||
nullptr: other.d->m_name.c_str());
|
||||
|
@ -67,7 +66,7 @@ AkVCam::Mutex &AkVCam::Mutex::operator =(const Mutex &other)
|
|||
if (this->d->m_mutex)
|
||||
CloseHandle(this->d->m_mutex);
|
||||
|
||||
this->d->m_mutex = CreateMutex(nullptr,
|
||||
this->d->m_mutex = CreateMutexA(nullptr,
|
||||
FALSE,
|
||||
other.d->m_name.empty()?
|
||||
nullptr: other.d->m_name.c_str());
|
||||
|
@ -77,7 +76,7 @@ AkVCam::Mutex &AkVCam::Mutex::operator =(const Mutex &other)
|
|||
return *this;
|
||||
}
|
||||
|
||||
std::wstring AkVCam::Mutex::name() const
|
||||
std::string AkVCam::Mutex::name() const
|
||||
{
|
||||
return this->d->m_name;
|
||||
}
|
||||
|
|
|
@ -29,12 +29,12 @@ namespace AkVCam
|
|||
class Mutex
|
||||
{
|
||||
public:
|
||||
Mutex(const std::wstring &name={});
|
||||
Mutex(const std::string &name={});
|
||||
Mutex(const Mutex &other);
|
||||
~Mutex();
|
||||
Mutex &operator =(const Mutex &other);
|
||||
|
||||
std::wstring name() const;
|
||||
std::string name() const;
|
||||
void lock();
|
||||
bool tryLock(int timeout=0);
|
||||
void unlock();
|
||||
|
|
|
@ -39,22 +39,14 @@ namespace AkVCam
|
|||
void splitSubKey(const std::string &key,
|
||||
std::string &subKey,
|
||||
std::string &value);
|
||||
bool valueA(const std::string &key,
|
||||
bool readValue(const std::string &key,
|
||||
DWORD dataTypeFlags,
|
||||
PVOID data,
|
||||
LPDWORD dataSize);
|
||||
bool valueW(const std::string &key,
|
||||
DWORD dataTypeFlags,
|
||||
PVOID data,
|
||||
LPDWORD dataSize);
|
||||
void setValueA(const std::string &key,
|
||||
void setValue(const std::string &key,
|
||||
DWORD dataType,
|
||||
LPCSTR data,
|
||||
DWORD dataSize);
|
||||
void setValueW(const std::string &key,
|
||||
DWORD dataType,
|
||||
LPCWSTR data,
|
||||
DWORD dataSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,25 +55,14 @@ void AkVCam::Preferences::write(const std::string &key,
|
|||
{
|
||||
AkLogFunction();
|
||||
AkLogInfo() << "Writing: " << key << " = " << value << std::endl;
|
||||
setValueA(key, REG_SZ, value.c_str(), DWORD(value.size()));
|
||||
}
|
||||
|
||||
void AkVCam::Preferences::write(const std::string &key,
|
||||
const std::wstring &value)
|
||||
{
|
||||
AkLogFunction();
|
||||
AkLogInfo() << "Writing: "
|
||||
<< key
|
||||
<< " = "
|
||||
<< std::string(value.begin(), value.end()) << std::endl;
|
||||
setValueW(key, REG_SZ, value.c_str(), DWORD(value.size()));
|
||||
setValue(key, REG_SZ, value.c_str(), DWORD(value.size()));
|
||||
}
|
||||
|
||||
void AkVCam::Preferences::write(const std::string &key, int value)
|
||||
{
|
||||
AkLogFunction();
|
||||
AkLogInfo() << "Writing: " << key << " = " << value << std::endl;
|
||||
setValueA(key,
|
||||
setValue(key,
|
||||
REG_DWORD,
|
||||
reinterpret_cast<const char *>(&value),
|
||||
DWORD(sizeof(int)));
|
||||
|
@ -92,7 +73,7 @@ void AkVCam::Preferences::write(const std::string &key, double value)
|
|||
AkLogFunction();
|
||||
AkLogInfo() << "Writing: " << key << " = " << value << std::endl;
|
||||
auto val = std::to_string(value);
|
||||
setValueA(key,
|
||||
setValue(key,
|
||||
REG_SZ,
|
||||
val.c_str(),
|
||||
DWORD(val.size()));
|
||||
|
@ -113,21 +94,7 @@ std::string AkVCam::Preferences::readString(const std::string &key,
|
|||
memset(value, 0, MAX_PATH * sizeof(char));
|
||||
DWORD valueSize = MAX_PATH;
|
||||
|
||||
if (!valueA(key, RRF_RT_REG_SZ, &value, &valueSize))
|
||||
return defaultValue;
|
||||
|
||||
return {value};
|
||||
}
|
||||
|
||||
std::wstring AkVCam::Preferences::readWString(const std::string &key,
|
||||
const std::wstring &defaultValue)
|
||||
{
|
||||
AkLogFunction();
|
||||
TCHAR value[MAX_PATH];
|
||||
memset(value, 0, MAX_PATH * sizeof(TCHAR));
|
||||
DWORD valueSize = MAX_PATH;
|
||||
|
||||
if (!valueW(key, RRF_RT_REG_SZ, &value, &valueSize))
|
||||
if (!readValue(key, RRF_RT_REG_SZ, &value, &valueSize))
|
||||
return defaultValue;
|
||||
|
||||
return {value};
|
||||
|
@ -139,7 +106,7 @@ int AkVCam::Preferences::readInt(const std::string &key, int defaultValue)
|
|||
DWORD value = 0;
|
||||
DWORD valueSize = sizeof(DWORD);
|
||||
|
||||
if (!valueA(key, RRF_RT_REG_DWORD, &value, &valueSize))
|
||||
if (!readValue(key, RRF_RT_REG_DWORD, &value, &valueSize))
|
||||
return defaultValue;
|
||||
|
||||
return int(value);
|
||||
|
@ -174,7 +141,7 @@ std::vector<CLSID> AkVCam::Preferences::listRegisteredCameras(HINSTANCE hinstDLL
|
|||
CoTaskMemFree(strIID);
|
||||
|
||||
HKEY key = nullptr;
|
||||
auto result = RegOpenKeyEx(HKEY_CLASSES_ROOT,
|
||||
auto result = RegOpenKeyExW(HKEY_CLASSES_ROOT,
|
||||
ss.str().c_str(),
|
||||
0,
|
||||
MAXIMUM_ALLOWED,
|
||||
|
@ -208,10 +175,10 @@ std::vector<CLSID> AkVCam::Preferences::listRegisteredCameras(HINSTANCE hinstDLL
|
|||
FILETIME lastWrite;
|
||||
|
||||
for (DWORD i = 0; i < subkeys; i++) {
|
||||
TCHAR subKey[MAX_PATH];
|
||||
memset(subKey, 0, MAX_PATH * sizeof(TCHAR));
|
||||
WCHAR subKey[MAX_PATH];
|
||||
memset(subKey, 0, MAX_PATH * sizeof(WCHAR));
|
||||
DWORD subKeyLen = MAX_PATH;
|
||||
result = RegEnumKeyEx(key,
|
||||
result = RegEnumKeyExW(key,
|
||||
i,
|
||||
subKey,
|
||||
&subKeyLen,
|
||||
|
@ -229,7 +196,7 @@ std::vector<CLSID> AkVCam::Preferences::listRegisteredCameras(HINSTANCE hinstDLL
|
|||
memset(path, 0, MAX_PATH * sizeof(WCHAR));
|
||||
DWORD pathSize = MAX_PATH;
|
||||
|
||||
if (RegGetValue(HKEY_CLASSES_ROOT,
|
||||
if (RegGetValueW(HKEY_CLASSES_ROOT,
|
||||
ss.str().c_str(),
|
||||
nullptr,
|
||||
RRF_RT_REG_SZ,
|
||||
|
@ -238,9 +205,9 @@ std::vector<CLSID> AkVCam::Preferences::listRegisteredCameras(HINSTANCE hinstDLL
|
|||
&pathSize) == ERROR_SUCCESS) {
|
||||
WCHAR modulePath[MAX_PATH];
|
||||
memset(modulePath, 0, MAX_PATH * sizeof(WCHAR));
|
||||
GetModuleFileName(hinstDLL, modulePath, MAX_PATH);
|
||||
GetModuleFileNameW(hinstDLL, modulePath, MAX_PATH);
|
||||
|
||||
if (!lstrcmpi(path, modulePath)) {
|
||||
if (!lstrcmpiW(path, modulePath)) {
|
||||
CLSID clsid;
|
||||
memset(&clsid, 0, sizeof(CLSID));
|
||||
CLSIDFromString(subKey, &clsid);
|
||||
|
@ -320,7 +287,7 @@ void AkVCam::Preferences::move(const std::string &keyFrom,
|
|||
}
|
||||
}
|
||||
|
||||
std::string AkVCam::Preferences::addDevice(const std::wstring &description)
|
||||
std::string AkVCam::Preferences::addDevice(const std::string &description)
|
||||
{
|
||||
AkLogFunction();
|
||||
auto path = createDevicePath();
|
||||
|
@ -333,14 +300,14 @@ std::string AkVCam::Preferences::addDevice(const std::wstring &description)
|
|||
return path;
|
||||
}
|
||||
|
||||
std::string AkVCam::Preferences::addCamera(const std::wstring &description,
|
||||
std::string AkVCam::Preferences::addCamera(const std::string &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::string &description,
|
||||
const std::vector<VideoFormat> &formats)
|
||||
{
|
||||
AkLogFunction();
|
||||
|
@ -471,18 +438,18 @@ bool AkVCam::Preferences::cameraExists(const std::string &path)
|
|||
return false;
|
||||
}
|
||||
|
||||
std::wstring AkVCam::Preferences::cameraDescription(size_t cameraIndex)
|
||||
std::string AkVCam::Preferences::cameraDescription(size_t cameraIndex)
|
||||
{
|
||||
if (cameraIndex >= camerasCount())
|
||||
return {};
|
||||
|
||||
return readWString("Cameras\\"
|
||||
return readString("Cameras\\"
|
||||
+ std::to_string(cameraIndex + 1)
|
||||
+ "\\description");
|
||||
}
|
||||
|
||||
void AkVCam::Preferences::cameraSetDescription(size_t cameraIndex,
|
||||
const std::wstring &description)
|
||||
const std::string &description)
|
||||
{
|
||||
if (cameraIndex >= camerasCount())
|
||||
return;
|
||||
|
@ -642,12 +609,12 @@ void AkVCam::Preferences::cameraSetControlValue(size_t cameraIndex,
|
|||
value);
|
||||
}
|
||||
|
||||
std::wstring AkVCam::Preferences::picture()
|
||||
std::string AkVCam::Preferences::picture()
|
||||
{
|
||||
return readWString("picture");
|
||||
return readString("picture");
|
||||
}
|
||||
|
||||
void AkVCam::Preferences::setPicture(const std::wstring &picture)
|
||||
void AkVCam::Preferences::setPicture(const std::string &picture)
|
||||
{
|
||||
write("picture", picture);
|
||||
}
|
||||
|
@ -679,7 +646,7 @@ void AkVCam::Preferences::splitSubKey(const std::string &key,
|
|||
}
|
||||
}
|
||||
|
||||
bool AkVCam::Preferences::valueA(const std::string &key,
|
||||
bool AkVCam::Preferences::readValue(const std::string &key,
|
||||
DWORD dataTypeFlags,
|
||||
PVOID data,
|
||||
LPDWORD dataSize)
|
||||
|
@ -709,39 +676,7 @@ bool AkVCam::Preferences::valueA(const std::string &key,
|
|||
return result == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
bool AkVCam::Preferences::valueW(const std::string &key,
|
||||
DWORD dataTypeFlags,
|
||||
PVOID data,
|
||||
LPDWORD dataSize)
|
||||
{
|
||||
std::string subKey;
|
||||
std::string val;
|
||||
splitSubKey(key, subKey, val);
|
||||
HKEY hkey = nullptr;
|
||||
auto result = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
|
||||
subKey.c_str(),
|
||||
0,
|
||||
KEY_READ | KEY_WOW64_64KEY,
|
||||
&hkey);
|
||||
|
||||
if (result != ERROR_SUCCESS)
|
||||
return false;
|
||||
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> cv;
|
||||
auto wval = cv.from_bytes(val);
|
||||
result = RegGetValueW(hkey,
|
||||
nullptr,
|
||||
wval.c_str(),
|
||||
dataTypeFlags,
|
||||
nullptr,
|
||||
data,
|
||||
dataSize);
|
||||
RegCloseKey(hkey);
|
||||
|
||||
return result == ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
void AkVCam::Preferences::setValueA(const std::string &key,
|
||||
void AkVCam::Preferences::setValue(const std::string &key,
|
||||
DWORD dataType,
|
||||
LPCSTR data,
|
||||
DWORD dataSize)
|
||||
|
@ -770,35 +705,3 @@ void AkVCam::Preferences::setValueA(const std::string &key,
|
|||
dataSize);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
void AkVCam::Preferences::setValueW(const std::string &key,
|
||||
DWORD dataType,
|
||||
LPCWSTR data,
|
||||
DWORD dataSize)
|
||||
{
|
||||
std::string subKey;
|
||||
std::string val;
|
||||
splitSubKey(key, subKey, val);
|
||||
HKEY hkey = nullptr;
|
||||
LONG result = RegCreateKeyExA(HKEY_LOCAL_MACHINE,
|
||||
subKey.c_str(),
|
||||
0,
|
||||
nullptr,
|
||||
REG_OPTION_NON_VOLATILE,
|
||||
KEY_WRITE | KEY_WOW64_64KEY,
|
||||
nullptr,
|
||||
&hkey,
|
||||
nullptr);
|
||||
|
||||
if (result != ERROR_SUCCESS)
|
||||
return;
|
||||
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> cv;
|
||||
auto wval = cv.from_bytes(val);
|
||||
RegSetValueW(hkey,
|
||||
wval.c_str(),
|
||||
dataType,
|
||||
data,
|
||||
dataSize);
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
|
|
@ -32,25 +32,22 @@ namespace AkVCam
|
|||
namespace Preferences
|
||||
{
|
||||
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);
|
||||
void write(const std::string &key, std::vector<std::string> &value);
|
||||
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);
|
||||
bool readBool(const std::string &key, bool defaultValue=false);
|
||||
std::vector<CLSID> listRegisteredCameras(HINSTANCE hinstDLL);
|
||||
void deleteKey(const std::string &key);
|
||||
void move(const std::string &keyFrom, const std::string &keyTo);
|
||||
std::string addDevice(const std::wstring &description);
|
||||
std::string addCamera(const std::wstring &description,
|
||||
std::string addDevice(const std::string &description);
|
||||
std::string addCamera(const std::string &description,
|
||||
const std::vector<VideoFormat> &formats);
|
||||
std::string addCamera(const std::string &path,
|
||||
const std::wstring &description,
|
||||
const std::string &description,
|
||||
const std::vector<VideoFormat> &formats);
|
||||
void removeCamera(const std::string &path);
|
||||
size_t camerasCount();
|
||||
|
@ -58,9 +55,9 @@ namespace AkVCam
|
|||
int cameraFromCLSID(const CLSID &clsid);
|
||||
int cameraFromPath(const std::string &path);
|
||||
bool cameraExists(const std::string &path);
|
||||
std::wstring cameraDescription(size_t cameraIndex);
|
||||
std::string cameraDescription(size_t cameraIndex);
|
||||
void cameraSetDescription(size_t cameraIndex,
|
||||
const std::wstring &description);
|
||||
const std::string &description);
|
||||
std::string cameraPath(size_t cameraIndex);
|
||||
size_t formatsCount(size_t cameraIndex);
|
||||
VideoFormat cameraFormat(size_t cameraIndex, size_t formatIndex);
|
||||
|
@ -76,8 +73,8 @@ namespace AkVCam
|
|||
void cameraSetControlValue(size_t cameraIndex,
|
||||
const std::string &key,
|
||||
int value);
|
||||
std::wstring picture();
|
||||
void setPicture(const std::wstring &picture);
|
||||
std::string picture();
|
||||
void setPicture(const std::string &picture);
|
||||
int logLevel();
|
||||
void setLogLevel(int logLevel);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace AkVCam
|
|||
{
|
||||
public:
|
||||
HANDLE m_sharedHandle;
|
||||
std::wstring m_name;
|
||||
std::string m_name;
|
||||
void *m_buffer;
|
||||
size_t m_pageSize;
|
||||
SharedMemory::OpenMode m_mode;
|
||||
|
@ -85,17 +85,17 @@ AkVCam::SharedMemory &AkVCam::SharedMemory::operator =(const SharedMemory &other
|
|||
return *this;
|
||||
}
|
||||
|
||||
std::wstring AkVCam::SharedMemory::name() const
|
||||
std::string AkVCam::SharedMemory::name() const
|
||||
{
|
||||
return this->d->m_name;
|
||||
}
|
||||
|
||||
std::wstring &AkVCam::SharedMemory::name()
|
||||
std::string &AkVCam::SharedMemory::name()
|
||||
{
|
||||
return this->d->m_name;
|
||||
}
|
||||
|
||||
void AkVCam::SharedMemory::setName(const std::wstring &name)
|
||||
void AkVCam::SharedMemory::setName(const std::string &name)
|
||||
{
|
||||
this->d->m_name = name;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ bool AkVCam::SharedMemory::open(size_t pageSize, OpenMode mode)
|
|||
|
||||
if (mode == OpenModeRead) {
|
||||
this->d->m_sharedHandle =
|
||||
OpenFileMapping(FILE_MAP_ALL_ACCESS,
|
||||
OpenFileMappingA(FILE_MAP_ALL_ACCESS,
|
||||
FALSE,
|
||||
this->d->m_name.c_str());
|
||||
} else {
|
||||
|
@ -118,7 +118,7 @@ bool AkVCam::SharedMemory::open(size_t pageSize, OpenMode mode)
|
|||
return false;
|
||||
|
||||
this->d->m_sharedHandle =
|
||||
CreateFileMapping(INVALID_HANDLE_VALUE,
|
||||
CreateFileMappingA(INVALID_HANDLE_VALUE,
|
||||
nullptr,
|
||||
PAGE_READWRITE,
|
||||
0,
|
||||
|
@ -128,8 +128,7 @@ bool AkVCam::SharedMemory::open(size_t pageSize, OpenMode mode)
|
|||
|
||||
if (!this->d->m_sharedHandle) {
|
||||
AkLogError() << "Error opening shared memory ("
|
||||
<< std::string(this->d->m_name.begin(),
|
||||
this->d->m_name.end())
|
||||
<< this->d->m_name
|
||||
<< "): "
|
||||
<< errorToString(GetLastError())
|
||||
<< " (" << GetLastError() << ")"
|
||||
|
|
|
@ -41,9 +41,9 @@ namespace AkVCam
|
|||
~SharedMemory();
|
||||
SharedMemory &operator =(const SharedMemory &other);
|
||||
|
||||
std::wstring name() const;
|
||||
std::wstring &name();
|
||||
void setName(const std::wstring &name);
|
||||
std::string name() const;
|
||||
std::string &name();
|
||||
void setName(const std::string &name);
|
||||
bool open(size_t pageSize=0, OpenMode mode=OpenModeRead);
|
||||
bool isOpen() const;
|
||||
size_t pageSize() const;
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "utils.h"
|
||||
#include "VCamUtils/src/utils.h"
|
||||
#include "VCamUtils/src/image/videoformat.h"
|
||||
#include "VCamUtils/src/image/videoframe.h"
|
||||
|
||||
#define TIME_BASE 1.0e7
|
||||
|
||||
|
@ -85,16 +86,6 @@ bool operator <(const CLSID &a, const CLSID &b)
|
|||
return AkVCam::stringFromIid(a) < AkVCam::stringFromIid(b);
|
||||
}
|
||||
|
||||
BOOL AkVCam::isWow64()
|
||||
{
|
||||
BOOL isWow64 = FALSE;
|
||||
|
||||
if (!IsWow64Process(GetCurrentProcess(), &isWow64))
|
||||
return false;
|
||||
|
||||
return isWow64;
|
||||
}
|
||||
|
||||
std::string AkVCam::tempPath()
|
||||
{
|
||||
CHAR tempPath[MAX_PATH];
|
||||
|
@ -104,90 +95,35 @@ std::string AkVCam::tempPath()
|
|||
return std::string(tempPath);
|
||||
}
|
||||
|
||||
std::wstring AkVCam::programFilesPath()
|
||||
{
|
||||
bool ok = false;
|
||||
TCHAR programFiles[MAX_PATH];
|
||||
DWORD programFilesSize = MAX_PATH * sizeof(TCHAR);
|
||||
memset(programFiles, 0, programFilesSize);
|
||||
HKEY hkey = nullptr;
|
||||
auto result = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion",
|
||||
0,
|
||||
KEY_READ | KEY_WOW64_64KEY,
|
||||
&hkey);
|
||||
|
||||
if (result == ERROR_SUCCESS) {
|
||||
result = RegGetValue(hkey,
|
||||
nullptr,
|
||||
L"ProgramFilesDir",
|
||||
RRF_RT_REG_SZ,
|
||||
nullptr,
|
||||
&programFiles,
|
||||
&programFilesSize);
|
||||
if (isWow64())
|
||||
ok = true;
|
||||
|
||||
RegCloseKey(hkey);
|
||||
}
|
||||
|
||||
if (!ok)
|
||||
SHGetSpecialFolderPath(nullptr,
|
||||
programFiles,
|
||||
CSIDL_PROGRAM_FILES,
|
||||
FALSE);
|
||||
|
||||
return std::wstring(programFiles);
|
||||
}
|
||||
|
||||
std::wstring AkVCam::moduleFileNameW(HINSTANCE hinstDLL)
|
||||
{
|
||||
WCHAR fileName[MAX_PATH];
|
||||
memset(fileName, 0, MAX_PATH * sizeof(WCHAR));
|
||||
GetModuleFileName(hinstDLL, fileName, MAX_PATH);
|
||||
|
||||
return std::wstring(fileName);
|
||||
}
|
||||
|
||||
std::string AkVCam::moduleFileName(HINSTANCE hinstDLL)
|
||||
{
|
||||
auto fileName = moduleFileNameW(hinstDLL);
|
||||
CHAR fileName[MAX_PATH];
|
||||
memset(fileName, 0, MAX_PATH * sizeof(CHAR));
|
||||
GetModuleFileNameA(hinstDLL, fileName, MAX_PATH);
|
||||
|
||||
return std::string(fileName.begin(), fileName.end());
|
||||
return std::string(fileName);
|
||||
}
|
||||
|
||||
std::wstring AkVCam::errorToStringW(DWORD errorCode)
|
||||
std::string AkVCam::errorToString(DWORD errorCode)
|
||||
{
|
||||
WCHAR *errorStr = nullptr;
|
||||
auto size = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
|
||||
CHAR *errorStr = nullptr;
|
||||
auto size = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER
|
||||
| FORMAT_MESSAGE_FROM_SYSTEM
|
||||
| FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
nullptr,
|
||||
errorCode,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
|
||||
reinterpret_cast<LPWSTR>(&errorStr),
|
||||
reinterpret_cast<LPSTR>(&errorStr),
|
||||
0,
|
||||
nullptr);
|
||||
std::wstring error(errorStr, size);
|
||||
std::string error(errorStr, size);
|
||||
LocalFree(errorStr);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
std::string AkVCam::errorToString(DWORD errorCode)
|
||||
{
|
||||
auto errorStr = errorToStringW(errorCode);
|
||||
|
||||
return std::string(errorStr.begin(), errorStr.end());
|
||||
}
|
||||
|
||||
// Converts a human redable string to a CLSID using MD5 hash.
|
||||
CLSID AkVCam::createClsidFromStr(const std::string &str)
|
||||
{
|
||||
return createClsidFromStr(std::wstring(str.begin(), str.end()));
|
||||
}
|
||||
|
||||
CLSID AkVCam::createClsidFromStr(const std::wstring &str)
|
||||
{
|
||||
HCRYPTPROV provider = 0;
|
||||
HCRYPTHASH hash = 0;
|
||||
|
@ -227,47 +163,35 @@ clsidFromStr_failed:
|
|||
return clsid;
|
||||
}
|
||||
|
||||
std::wstring AkVCam::createClsidWStrFromStr(const std::string &str)
|
||||
{
|
||||
return createClsidWStrFromStr(std::wstring(str.begin(), str.end()));
|
||||
}
|
||||
|
||||
std::wstring AkVCam::createClsidWStrFromStr(const std::wstring &str)
|
||||
std::string AkVCam::createClsidStrFromStr(const std::string &str)
|
||||
{
|
||||
auto clsid = createClsidFromStr(str);
|
||||
OLECHAR *clsidWStr = nullptr;
|
||||
LPWSTR clsidWStr = nullptr;
|
||||
|
||||
if (StringFromCLSID(clsid, &clsidWStr) != S_OK)
|
||||
return std::wstring();
|
||||
return {};
|
||||
|
||||
std::wstring wstr(clsidWStr);
|
||||
auto str_ = stringFromWSTR(clsidWStr);
|
||||
CoTaskMemFree(clsidWStr);
|
||||
|
||||
return wstr;
|
||||
return str_;
|
||||
}
|
||||
|
||||
std::string AkVCam::stringFromIid(const IID &iid)
|
||||
{
|
||||
auto wstr = wstringFromIid(iid);
|
||||
|
||||
return std::string(wstr.begin(), wstr.end());
|
||||
}
|
||||
|
||||
std::wstring AkVCam::wstringFromIid(const IID &iid)
|
||||
{
|
||||
WCHAR *strIID = nullptr;
|
||||
LPWSTR strIID = nullptr;
|
||||
StringFromIID(iid, &strIID);
|
||||
std::wstring wstr(strIID);
|
||||
auto str = stringFromWSTR(strIID);
|
||||
CoTaskMemFree(strIID);
|
||||
|
||||
return wstr;
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string AkVCam::stringFromResult(HRESULT result)
|
||||
{
|
||||
auto msg = std::wstring(_com_error(result).ErrorMessage());
|
||||
auto msg = stringFromWSTR(_com_error(result).ErrorMessage());
|
||||
|
||||
return std::string(msg.begin(), msg.end());
|
||||
return msg;
|
||||
}
|
||||
|
||||
std::string AkVCam::stringFromClsid(const CLSID &clsid)
|
||||
|
@ -332,17 +256,48 @@ std::string AkVCam::stringFromClsid(const CLSID &clsid)
|
|||
return stringFromIid(clsid);
|
||||
}
|
||||
|
||||
wchar_t *AkVCam::wcharStrFromWStr(const std::wstring &wstr)
|
||||
std::string AkVCam::stringFromWSTR(LPCWSTR wstr)
|
||||
{
|
||||
if (wstr.size() < 1)
|
||||
return nullptr;
|
||||
auto len = WideCharToMultiByte(CP_ACP,
|
||||
0,
|
||||
wstr,
|
||||
-1,
|
||||
nullptr,
|
||||
0,
|
||||
nullptr,
|
||||
nullptr);
|
||||
CHAR *cstr = new CHAR[len];
|
||||
WideCharToMultiByte(CP_ACP,
|
||||
0,
|
||||
wstr,
|
||||
-1,
|
||||
cstr,
|
||||
len,
|
||||
nullptr,
|
||||
nullptr);
|
||||
std::string str(cstr);
|
||||
delete [] cstr;
|
||||
|
||||
auto wcstrSize = wstr.size() * sizeof(wchar_t);
|
||||
auto wcstr = reinterpret_cast<wchar_t *>(CoTaskMemAlloc(wcstrSize + 1));
|
||||
wcstr[wstr.size()] = 0;
|
||||
memcpy(wcstr, wstr.data(), wcstrSize);
|
||||
return str;
|
||||
}
|
||||
|
||||
return wcstr;
|
||||
LPWSTR AkVCam::stringToWSTR(const std::string &str)
|
||||
{
|
||||
auto len = MultiByteToWideChar(CP_ACP,
|
||||
0,
|
||||
str.c_str(),
|
||||
str.size(),
|
||||
nullptr,
|
||||
0);
|
||||
auto wstr = reinterpret_cast<LPWSTR>(CoTaskMemAlloc(len * sizeof(WCHAR)));
|
||||
MultiByteToWideChar(CP_ACP,
|
||||
0,
|
||||
str.c_str(),
|
||||
str.size(),
|
||||
wstr,
|
||||
len);
|
||||
|
||||
return wstr;
|
||||
}
|
||||
|
||||
AkVCam::FourCC AkVCam::formatFromGuid(const GUID &guid)
|
||||
|
@ -999,3 +954,21 @@ LSTATUS AkVCam::copyTree(HKEY src, LPCSTR subkey, HKEY dst, REGSAM samFlags)
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
AkVCam::VideoFrame AkVCam::loadPicture(const std::string &fileName)
|
||||
{
|
||||
AkLogFunction();
|
||||
VideoFrame frame;
|
||||
|
||||
if (frame.load(fileName)) {
|
||||
AkLogInfo() << "Picture loaded as BMP" << std::endl;
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
AkLogDebug() << "Error loading picture: "
|
||||
<< fileName
|
||||
<< std::endl;
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
|
|
@ -32,23 +32,18 @@
|
|||
namespace AkVCam
|
||||
{
|
||||
class VideoFormat;
|
||||
class VideoFrame;
|
||||
|
||||
BOOL isWow64();
|
||||
std::string tempPath();
|
||||
std::wstring programFilesPath();
|
||||
std::wstring moduleFileNameW(HINSTANCE hinstDLL);
|
||||
std::string moduleFileName(HINSTANCE hinstDLL);
|
||||
std::wstring errorToStringW(DWORD errorCode);
|
||||
std::string errorToString(DWORD errorCode);
|
||||
CLSID createClsidFromStr(const std::string &str);
|
||||
CLSID createClsidFromStr(const std::wstring &str);
|
||||
std::wstring createClsidWStrFromStr(const std::string &str);
|
||||
std::wstring createClsidWStrFromStr(const std::wstring &str);
|
||||
std::string createClsidStrFromStr(const std::string &str);
|
||||
std::string stringFromIid(const IID &iid);
|
||||
std::wstring wstringFromIid(const IID &iid);
|
||||
std::string stringFromResult(HRESULT result);
|
||||
std::string stringFromClsid(const CLSID &clsid);
|
||||
wchar_t *wcharStrFromWStr(const std::wstring &wstr);
|
||||
std::string stringFromWSTR(LPCWSTR wstr);
|
||||
LPWSTR stringToWSTR(const std::string &str);
|
||||
FourCC formatFromGuid(const GUID &guid);
|
||||
const GUID &guidFromFormat(FourCC format);
|
||||
DWORD compressionFromFormat(FourCC format);
|
||||
|
@ -71,6 +66,7 @@ namespace AkVCam
|
|||
std::string stringFromMediaSample(IMediaSample *mediaSample);
|
||||
LSTATUS deleteTree(HKEY key, LPCSTR subkey, REGSAM samFlags);
|
||||
LSTATUS copyTree(HKEY src, LPCSTR subkey, HKEY dst, REGSAM samFlags);
|
||||
VideoFrame loadPicture(const std::string &fileName);
|
||||
}
|
||||
|
||||
#endif // PLATFORM_UTILS_H
|
||||
|
|
|
@ -109,23 +109,21 @@ AkVCam::IpcBridge::~IpcBridge()
|
|||
delete this->d;
|
||||
}
|
||||
|
||||
std::wstring AkVCam::IpcBridge::picture() const
|
||||
std::string AkVCam::IpcBridge::picture() const
|
||||
{
|
||||
return Preferences::picture();
|
||||
}
|
||||
|
||||
void AkVCam::IpcBridge::setPicture(const std::wstring &picture)
|
||||
void AkVCam::IpcBridge::setPicture(const std::string &picture)
|
||||
{
|
||||
Preferences::setPicture(picture);
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> cv;
|
||||
auto picture_ = cv.to_bytes(picture);
|
||||
Message message;
|
||||
message.messageId = AKVCAM_ASSISTANT_MSG_PICTURE_UPDATED;
|
||||
message.dataSize = sizeof(MsgPictureUpdated);
|
||||
auto data = messageData<MsgPictureUpdated>(&message);
|
||||
memcpy(data->picture,
|
||||
picture_.c_str(),
|
||||
(std::min<size_t>)(picture_.size(), MAX_STRING));
|
||||
picture.c_str(),
|
||||
(std::min<size_t>)(picture.size(), MAX_STRING));
|
||||
this->d->m_mainServer.sendMessage(&message);
|
||||
}
|
||||
|
||||
|
@ -149,14 +147,13 @@ bool AkVCam::IpcBridge::registerPeer()
|
|||
message.dataSize = sizeof(MsgRequestPort);
|
||||
auto requestData = messageData<MsgRequestPort>(&message);
|
||||
|
||||
if (!MessageServer::sendMessage(L"\\\\.\\pipe\\" DSHOW_PLUGIN_ASSISTANT_NAME_L,
|
||||
if (!MessageServer::sendMessage("\\\\.\\pipe\\" DSHOW_PLUGIN_ASSISTANT_NAME,
|
||||
&message))
|
||||
return false;
|
||||
|
||||
std::string portName(requestData->port);
|
||||
auto pipeName = "\\\\.\\pipe\\" + portName;
|
||||
this->d->m_messageServer.setPipeName(std::wstring(pipeName.begin(),
|
||||
pipeName.end()));
|
||||
this->d->m_messageServer.setPipeName(pipeName);
|
||||
this->d->m_messageServer.setHandlers(this->d->m_messageHandlers);
|
||||
AkLogInfo() << "Recommended port name: " << portName << std::endl;
|
||||
|
||||
|
@ -179,7 +176,7 @@ bool AkVCam::IpcBridge::registerPeer()
|
|||
|
||||
AkLogInfo() << "Registering port name: " << portName << std::endl;
|
||||
|
||||
if (!MessageServer::sendMessage(L"\\\\.\\pipe\\" DSHOW_PLUGIN_ASSISTANT_NAME_L,
|
||||
if (!MessageServer::sendMessage("\\\\.\\pipe\\" DSHOW_PLUGIN_ASSISTANT_NAME,
|
||||
&message)) {
|
||||
this->d->m_messageServer.stop(true);
|
||||
|
||||
|
@ -192,13 +189,8 @@ bool AkVCam::IpcBridge::registerPeer()
|
|||
return false;
|
||||
}
|
||||
|
||||
this->d->m_sharedMemory.setName(L"Local\\"
|
||||
+ std::wstring(portName.begin(),
|
||||
portName.end())
|
||||
+ L".data");
|
||||
this->d->m_globalMutex = Mutex(std::wstring(portName.begin(),
|
||||
portName.end())
|
||||
+ L".mutex");
|
||||
this->d->m_sharedMemory.setName("Local\\" + portName + ".data");
|
||||
this->d->m_globalMutex = Mutex(portName + ".mutex");
|
||||
this->d->m_portName = portName;
|
||||
AkLogInfo() << "Peer registered as " << portName << std::endl;
|
||||
|
||||
|
@ -220,7 +212,7 @@ void AkVCam::IpcBridge::unregisterPeer()
|
|||
memcpy(data->port,
|
||||
this->d->m_portName.c_str(),
|
||||
(std::min<size_t>)(this->d->m_portName.size(), MAX_STRING));
|
||||
MessageServer::sendMessage(L"\\\\.\\pipe\\" DSHOW_PLUGIN_ASSISTANT_NAME_L,
|
||||
MessageServer::sendMessage("\\\\.\\pipe\\" DSHOW_PLUGIN_ASSISTANT_NAME,
|
||||
&message);
|
||||
this->d->m_messageServer.stop(true);
|
||||
this->d->m_portName.clear();
|
||||
|
@ -242,7 +234,7 @@ std::vector<std::string> AkVCam::IpcBridge::devices() const
|
|||
return devices;
|
||||
}
|
||||
|
||||
std::wstring AkVCam::IpcBridge::description(const std::string &deviceId) const
|
||||
std::string AkVCam::IpcBridge::description(const std::string &deviceId) const
|
||||
{
|
||||
AkLogFunction();
|
||||
auto cameraIndex = Preferences::cameraFromPath(deviceId);
|
||||
|
@ -254,7 +246,7 @@ std::wstring AkVCam::IpcBridge::description(const std::string &deviceId) const
|
|||
}
|
||||
|
||||
void AkVCam::IpcBridge::setDescription(const std::string &deviceId,
|
||||
const std::wstring &description)
|
||||
const std::string &description)
|
||||
{
|
||||
AkLogFunction();
|
||||
auto cameraIndex = Preferences::cameraFromPath(deviceId);
|
||||
|
@ -456,8 +448,8 @@ std::vector<uint64_t> AkVCam::IpcBridge::clientsPids() const
|
|||
auto currentPid = GetCurrentProcessId();
|
||||
|
||||
for (size_t i = 0; i < nProcess; i++) {
|
||||
auto processHnd = OpenProcess(PROCESS_QUERY_INFORMATION |
|
||||
PROCESS_VM_READ,
|
||||
auto processHnd = OpenProcess(PROCESS_QUERY_INFORMATION
|
||||
| PROCESS_VM_READ,
|
||||
FALSE,
|
||||
process[i]);
|
||||
if (!processHnd)
|
||||
|
@ -522,7 +514,7 @@ std::string AkVCam::IpcBridge::clientExe(uint64_t pid) const
|
|||
return exe;
|
||||
}
|
||||
|
||||
std::string AkVCam::IpcBridge::addDevice(const std::wstring &description)
|
||||
std::string AkVCam::IpcBridge::addDevice(const std::string &description)
|
||||
{
|
||||
return Preferences::addDevice(description);
|
||||
}
|
||||
|
@ -602,10 +594,8 @@ bool AkVCam::IpcBridge::deviceStart(const std::string &deviceId,
|
|||
return false;
|
||||
}
|
||||
|
||||
std::wstring portName(this->d->m_portName.begin(),
|
||||
this->d->m_portName.end());
|
||||
this->d->m_sharedMemory.setName(L"Local\\" + portName + L".data");
|
||||
this->d->m_globalMutex = Mutex(portName + L".mutex");
|
||||
this->d->m_sharedMemory.setName("Local\\" + this->d->m_portName + ".data");
|
||||
this->d->m_globalMutex = Mutex(this->d->m_portName + ".mutex");
|
||||
|
||||
if (!this->d->m_sharedMemory.open(maxBufferSize,
|
||||
SharedMemory::OpenModeWrite)) {
|
||||
|
@ -755,7 +745,7 @@ bool AkVCam::IpcBridge::removeListener(const std::string &deviceId)
|
|||
AkVCam::IpcBridgePrivate::IpcBridgePrivate(IpcBridge *self):
|
||||
self(self)
|
||||
{
|
||||
this->m_mainServer.setPipeName(L"\\\\.\\pipe\\" DSHOW_PLUGIN_ASSISTANT_NAME_L);
|
||||
this->m_mainServer.setPipeName("\\\\.\\pipe\\" DSHOW_PLUGIN_ASSISTANT_NAME);
|
||||
this->m_mainServer.setMode(MessageServer::ServerModeSend);
|
||||
this->m_mainServer.connectPipeStateChanged(this,
|
||||
&IpcBridgePrivate::pipeStateChanged);
|
||||
|
@ -811,18 +801,16 @@ std::string AkVCam::IpcBridgePrivate::dirname(const std::string &path)
|
|||
void AkVCam::IpcBridgePrivate::updateDeviceSharedProperties()
|
||||
{
|
||||
for (size_t i = 0; i < Preferences::camerasCount(); i++) {
|
||||
auto cameraPath = Preferences::cameraPath(i);
|
||||
std::string deviceId(cameraPath.begin(), cameraPath.end());
|
||||
|
||||
auto path = Preferences::cameraPath(i);
|
||||
Message message;
|
||||
message.messageId = AKVCAM_ASSISTANT_MSG_DEVICE_BROADCASTING;
|
||||
message.dataSize = sizeof(MsgBroadcasting);
|
||||
auto data = messageData<MsgBroadcasting>(&message);
|
||||
memcpy(data->device,
|
||||
deviceId.c_str(),
|
||||
(std::min<size_t>)(deviceId.size(), MAX_STRING));
|
||||
path.c_str(),
|
||||
(std::min<size_t>)(path.size(), MAX_STRING));
|
||||
this->m_mainServer.sendMessage(&message);
|
||||
this->updateDeviceSharedProperties(deviceId,
|
||||
this->updateDeviceSharedProperties(path,
|
||||
std::string(data->broadcaster));
|
||||
}
|
||||
}
|
||||
|
@ -833,11 +821,9 @@ void AkVCam::IpcBridgePrivate::updateDeviceSharedProperties(const std::string &d
|
|||
if (owner.empty()) {
|
||||
this->m_devices[deviceId] = {SharedMemory(), Mutex()};
|
||||
} else {
|
||||
Mutex mutex(std::wstring(owner.begin(), owner.end()) + L".mutex");
|
||||
Mutex mutex(owner + ".mutex");
|
||||
SharedMemory sharedMemory;
|
||||
sharedMemory.setName(L"Local\\"
|
||||
+ std::wstring(owner.begin(), owner.end())
|
||||
+ L".data");
|
||||
sharedMemory.setName("Local\\" + owner + ".data");
|
||||
|
||||
if (sharedMemory.open())
|
||||
this->m_devices[deviceId] = {sharedMemory, mutex};
|
||||
|
@ -936,9 +922,7 @@ void AkVCam::IpcBridgePrivate::pictureUpdated(Message *message)
|
|||
{
|
||||
AkLogFunction();
|
||||
auto data = messageData<MsgPictureUpdated>(message);
|
||||
AKVCAM_EMIT(this->self,
|
||||
PictureChanged,
|
||||
std::string(data->picture))
|
||||
AKVCAM_EMIT(this->self, PictureChanged, std::string(data->picture))
|
||||
}
|
||||
|
||||
void AkVCam::IpcBridgePrivate::deviceUpdate(Message *message)
|
||||
|
|
|
@ -121,17 +121,6 @@ RESOURCESPATH = $${DSHOW_PLUGIN_NAME}.plugin/share
|
|||
DESTDIR = $${OUT_PWD}/../../$${INSTALLPATH}
|
||||
|
||||
INSTALLS += \
|
||||
target \
|
||||
resources
|
||||
target
|
||||
|
||||
target.path = $${PREFIX}/$${INSTALLPATH}
|
||||
|
||||
resources.files = ../../share/TestFrame/TestFrame.bmp
|
||||
resources.path = $${PREFIX}/$${RESOURCESPATH}
|
||||
|
||||
QMAKE_POST_LINK = \
|
||||
$$sprintf($$QMAKE_MKDIR_CMD, \
|
||||
$$shell_quote($$shell_path($${OUT_PWD}/../../$${RESOURCESPATH}))) \
|
||||
$${CMD_SEP} \
|
||||
$(COPY) $$shell_quote($$shell_path($${PWD}/../../share/TestFrame/TestFrame.bmp)) \
|
||||
$$shell_quote($$shell_path($${OUT_PWD}/../../$${RESOURCESPATH}/TestFrame.bmp))
|
||||
|
|
|
@ -58,14 +58,14 @@ namespace AkVCam
|
|||
EnumPins *m_pins;
|
||||
VideoProcAmp *m_videoProcAmp;
|
||||
ReferenceClock *m_referenceClock;
|
||||
std::wstring m_vendor;
|
||||
std::wstring m_filterName;
|
||||
std::string m_vendor;
|
||||
std::string m_filterName;
|
||||
IFilterGraph *m_filterGraph;
|
||||
IpcBridge m_ipcBridge;
|
||||
|
||||
BaseFilterPrivate(BaseFilter *self,
|
||||
const std::wstring &filterName,
|
||||
const std::wstring &vendor);
|
||||
const std::string &filterName,
|
||||
const std::string &vendor);
|
||||
BaseFilterPrivate(const BaseFilterPrivate &other) = delete;
|
||||
~BaseFilterPrivate();
|
||||
IEnumPins *pinsForDevice(const std::string &deviceId);
|
||||
|
@ -85,8 +85,8 @@ namespace AkVCam
|
|||
}
|
||||
|
||||
AkVCam::BaseFilter::BaseFilter(const GUID &clsid,
|
||||
const std::wstring &filterName,
|
||||
const std::wstring &vendor):
|
||||
const std::string &filterName,
|
||||
const std::string &vendor):
|
||||
MediaFilter(clsid, this)
|
||||
{
|
||||
this->setParent(this, &IID_IBaseFilter);
|
||||
|
@ -99,7 +99,7 @@ AkVCam::BaseFilter::~BaseFilter()
|
|||
}
|
||||
|
||||
void AkVCam::BaseFilter::addPin(const std::vector<AkVCam::VideoFormat> &formats,
|
||||
const std::wstring &pinName,
|
||||
const std::string &pinName,
|
||||
bool changed)
|
||||
{
|
||||
AkLogFunction();
|
||||
|
@ -123,15 +123,12 @@ AkVCam::BaseFilter *AkVCam::BaseFilter::create(const GUID &clsid)
|
|||
return nullptr;
|
||||
|
||||
auto description = Preferences::cameraDescription(size_t(camera));
|
||||
AkLogInfo() << "Description: "
|
||||
<< std::string(description.begin(),
|
||||
description.end())
|
||||
<< std::endl;
|
||||
AkLogInfo() << "Description: " << description << std::endl;
|
||||
auto baseFilter = new BaseFilter(clsid,
|
||||
description,
|
||||
DSHOW_PLUGIN_VENDOR_L);
|
||||
DSHOW_PLUGIN_VENDOR);
|
||||
auto formats = Preferences::cameraFormats(size_t(camera));
|
||||
baseFilter->addPin(formats, L"Video", false);
|
||||
baseFilter->addPin(formats, "Video", false);
|
||||
|
||||
return baseFilter;
|
||||
}
|
||||
|
@ -282,10 +279,12 @@ HRESULT AkVCam::BaseFilter::QueryFilterInfo(FILTER_INFO *pInfo)
|
|||
memset(pInfo->achName, 0, MAX_FILTER_NAME * sizeof(WCHAR));
|
||||
|
||||
if (this->d->m_filterName.size() > 0) {
|
||||
auto filterName = stringToWSTR(this->d->m_filterName);
|
||||
memcpy(pInfo->achName,
|
||||
this->d->m_filterName.c_str(),
|
||||
filterName,
|
||||
std::max<size_t>(this->d->m_filterName.size() * sizeof(WCHAR),
|
||||
MAX_FILTER_NAME));
|
||||
CoTaskMemFree(filterName);
|
||||
}
|
||||
|
||||
pInfo->pGraph = this->d->m_filterGraph;
|
||||
|
@ -301,13 +300,10 @@ HRESULT AkVCam::BaseFilter::JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName)
|
|||
AkLogFunction();
|
||||
|
||||
this->d->m_filterGraph = pGraph;
|
||||
this->d->m_filterName = std::wstring(pName? pName: L"");
|
||||
this->d->m_filterName = pName? stringFromWSTR(pName): "";
|
||||
|
||||
AkLogInfo() << "Filter graph: " << this->d->m_filterGraph << std::endl;
|
||||
AkLogInfo() << "Name: "
|
||||
<< std::string(this->d->m_filterName.begin(),
|
||||
this->d->m_filterName.end())
|
||||
<< std::endl;
|
||||
AkLogInfo() << "Name: " << this->d->m_filterName << std::endl;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -322,7 +318,7 @@ HRESULT AkVCam::BaseFilter::QueryVendorInfo(LPWSTR *pVendorInfo)
|
|||
if (!pVendorInfo)
|
||||
return E_POINTER;
|
||||
|
||||
*pVendorInfo = wcharStrFromWStr(this->d->m_vendor);
|
||||
*pVendorInfo = stringToWSTR(this->d->m_vendor);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -345,8 +341,8 @@ void AkVCam::BaseFilter::stateChanged(FILTER_STATE state)
|
|||
}
|
||||
|
||||
AkVCam::BaseFilterPrivate::BaseFilterPrivate(AkVCam::BaseFilter *self,
|
||||
const std::wstring &filterName,
|
||||
const std::wstring &vendor):
|
||||
const std::string &filterName,
|
||||
const std::string &vendor):
|
||||
self(self),
|
||||
m_pins(new AkVCam::EnumPins),
|
||||
m_videoProcAmp(new VideoProcAmp),
|
||||
|
|
|
@ -36,12 +36,12 @@ namespace AkVCam
|
|||
{
|
||||
public:
|
||||
BaseFilter(const GUID &clsid,
|
||||
const std::wstring &filterName={},
|
||||
const std::wstring &vendor={});
|
||||
const std::string &filterName={},
|
||||
const std::string &vendor={});
|
||||
virtual ~BaseFilter();
|
||||
|
||||
void addPin(const std::vector<VideoFormat> &formats={},
|
||||
const std::wstring &pinName={},
|
||||
const std::string &pinName={},
|
||||
bool changed=true);
|
||||
void removePin(IPin *pin, bool changed=true);
|
||||
static BaseFilter *create(const GUID &clsid);
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "qualitycontrol.h"
|
||||
#include "referenceclock.h"
|
||||
#include "videoprocamp.h"
|
||||
#include "PlatformUtils/src/preferences.h"
|
||||
#include "PlatformUtils/src/utils.h"
|
||||
#include "VCamUtils/src/image/videoformat.h"
|
||||
#include "VCamUtils/src/image/videoframe.h"
|
||||
|
@ -49,8 +50,8 @@ namespace AkVCam
|
|||
Pin *self;
|
||||
BaseFilter *m_baseFilter;
|
||||
VideoProcAmp *m_videoProcAmp;
|
||||
std::wstring m_pinName;
|
||||
std::wstring m_pinId;
|
||||
std::string m_pinName;
|
||||
std::string m_pinId;
|
||||
EnumMediaTypes *m_mediaTypes;
|
||||
IPin *m_connectedTo;
|
||||
IMemInputPin *m_memInputPin;
|
||||
|
@ -96,7 +97,7 @@ namespace AkVCam
|
|||
|
||||
AkVCam::Pin::Pin(BaseFilter *baseFilter,
|
||||
const std::vector<VideoFormat> &formats,
|
||||
const std::wstring &pinName):
|
||||
const std::string &pinName):
|
||||
StreamConfig(this)
|
||||
{
|
||||
this->setParent(this, &IID_IPin);
|
||||
|
@ -105,9 +106,9 @@ AkVCam::Pin::Pin(BaseFilter *baseFilter,
|
|||
this->d->self = this;
|
||||
this->d->m_baseFilter = baseFilter;
|
||||
this->d->m_pinName = pinName;
|
||||
std::wstringstream wss;
|
||||
wss << L"pin(" << this << L")";
|
||||
this->d->m_pinId = wss.str();
|
||||
std::stringstream ss;
|
||||
ss << "pin(" << this << ")";
|
||||
this->d->m_pinId = ss.str();
|
||||
this->d->m_mediaTypes = new AkVCam::EnumMediaTypes(formats);
|
||||
this->d->m_mediaTypes->AddRef();
|
||||
this->d->m_connectedTo = nullptr;
|
||||
|
@ -124,9 +125,10 @@ AkVCam::Pin::Pin(BaseFilter *baseFilter,
|
|||
this->d->m_adviseCookie = 0;
|
||||
this->d->m_sendFrameEvent = nullptr;
|
||||
this->d->m_running = false;
|
||||
auto bmp = programFilesPath()
|
||||
+ L"\\" DSHOW_PLUGIN_NAME_L L".plugin\\share\\TestFrame.bmp";
|
||||
this->d->m_testFrame.load(std::string(bmp.begin(), bmp.end()));
|
||||
auto picture = Preferences::picture();
|
||||
|
||||
if (!picture.empty())
|
||||
this->d->m_testFrame = loadPicture(picture);
|
||||
|
||||
baseFilter->QueryInterface(IID_IAMVideoProcAmp,
|
||||
reinterpret_cast<void **>(&this->d->m_videoProcAmp));
|
||||
|
@ -671,11 +673,14 @@ HRESULT AkVCam::Pin::QueryPinInfo(PIN_INFO *pInfo)
|
|||
pInfo->dir = PINDIR_OUTPUT;
|
||||
memset(pInfo->achName, 0, MAX_PIN_NAME * sizeof(WCHAR));
|
||||
|
||||
if (!this->d->m_pinName.empty())
|
||||
if (!this->d->m_pinName.empty()) {
|
||||
auto pinName = stringToWSTR(this->d->m_pinName);
|
||||
memcpy(pInfo->achName,
|
||||
this->d->m_pinName.c_str(),
|
||||
pinName,
|
||||
(std::min<size_t>)(this->d->m_pinName.size() * sizeof(WCHAR),
|
||||
MAX_PIN_NAME));
|
||||
CoTaskMemFree(pinName);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -706,9 +711,9 @@ HRESULT AkVCam::Pin::QueryId(LPWSTR *Id)
|
|||
return E_OUTOFMEMORY;
|
||||
|
||||
memset(*Id, 0, wstrSize);
|
||||
memcpy(*Id,
|
||||
this->d->m_pinId.c_str(),
|
||||
this->d->m_pinId.size() * sizeof(WCHAR));
|
||||
auto pinId = stringToWSTR(this->d->m_pinId);
|
||||
memcpy(*Id, pinId, this->d->m_pinId.size() * sizeof(WCHAR));
|
||||
CoTaskMemFree(pinId);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ namespace AkVCam
|
|||
public:
|
||||
Pin(BaseFilter *baseFilter=nullptr,
|
||||
const std::vector<AkVCam::VideoFormat> &formats={},
|
||||
const std::wstring &pinName={});
|
||||
const std::string &pinName={});
|
||||
virtual ~Pin();
|
||||
|
||||
BaseFilter *baseFilter() const;
|
||||
|
|
|
@ -118,13 +118,8 @@ STDAPI DllRegisterServer()
|
|||
auto clsid = AkVCam::createClsidFromStr(path);
|
||||
|
||||
AkLogInfo() << "Creating Camera" << std::endl;
|
||||
AkLogInfo() << "\tDescription: "
|
||||
<< std::string(description.begin(),
|
||||
description.end())
|
||||
<< std::endl;
|
||||
AkLogInfo() << "\tPath: "
|
||||
<< std::string(path.begin(), path.end())
|
||||
<< std::endl;
|
||||
AkLogInfo() << "\tDescription: " << description << std::endl;
|
||||
AkLogInfo() << "\tPath: " << path << std::endl;
|
||||
AkLogInfo() << "\tCLSID: " << AkVCam::stringFromIid(clsid) << std::endl;
|
||||
|
||||
ok &= pluginInterface()->createDevice(path, description);
|
||||
|
|
|
@ -56,32 +56,32 @@ HINSTANCE &AkVCam::PluginInterface::pluginHinstance()
|
|||
}
|
||||
|
||||
bool AkVCam::PluginInterface::registerServer(const std::string &deviceId,
|
||||
const std::wstring &description) const
|
||||
const std::string &description) const
|
||||
{
|
||||
AkLogFunction();
|
||||
|
||||
// Define the layout in registry of the filter.
|
||||
|
||||
auto clsid = createClsidWStrFromStr(deviceId);
|
||||
auto fileName = AkVCam::moduleFileNameW(this->d->m_pluginHinstance);
|
||||
std::wstring threadingModel = L"Both";
|
||||
auto clsid = createClsidStrFromStr(deviceId);
|
||||
auto fileName = moduleFileName(this->d->m_pluginHinstance);
|
||||
std::string threadingModel = "Both";
|
||||
|
||||
AkLogInfo() << "CLSID: " << std::string(clsid.begin(), clsid.end()) << std::endl;
|
||||
AkLogInfo() << "Description: " << std::string(description.begin(), description.end()) << std::endl;
|
||||
AkLogInfo() << "Filename: " << std::string(fileName.begin(), fileName.end()) << std::endl;
|
||||
AkLogInfo() << "CLSID: " << clsid << std::endl;
|
||||
AkLogInfo() << "Description: " << description << std::endl;
|
||||
AkLogInfo() << "Filename: " << fileName << std::endl;
|
||||
|
||||
auto subkey = L"CLSID\\" + clsid;
|
||||
auto subkey = "CLSID\\" + clsid;
|
||||
|
||||
HKEY keyCLSID = nullptr;
|
||||
HKEY keyServerType = nullptr;
|
||||
LONG result = RegCreateKey(HKEY_CLASSES_ROOT, subkey.c_str(), &keyCLSID);
|
||||
LONG result = RegCreateKeyA(HKEY_CLASSES_ROOT, subkey.c_str(), &keyCLSID);
|
||||
bool ok = false;
|
||||
|
||||
if (result != ERROR_SUCCESS)
|
||||
goto registerServer_failed;
|
||||
|
||||
result =
|
||||
RegSetValue(keyCLSID,
|
||||
RegSetValueA(keyCLSID,
|
||||
nullptr,
|
||||
REG_SZ,
|
||||
description.c_str(),
|
||||
|
@ -90,13 +90,13 @@ bool AkVCam::PluginInterface::registerServer(const std::string &deviceId,
|
|||
if (result != ERROR_SUCCESS)
|
||||
goto registerServer_failed;
|
||||
|
||||
result = RegCreateKey(keyCLSID, L"InprocServer32", &keyServerType);
|
||||
result = RegCreateKey(keyCLSID, TEXT("InprocServer32"), &keyServerType);
|
||||
|
||||
if (result != ERROR_SUCCESS)
|
||||
goto registerServer_failed;
|
||||
|
||||
result =
|
||||
RegSetValue(keyServerType,
|
||||
RegSetValueA(keyServerType,
|
||||
nullptr,
|
||||
REG_SZ,
|
||||
fileName.c_str(),
|
||||
|
@ -106,8 +106,8 @@ bool AkVCam::PluginInterface::registerServer(const std::string &deviceId,
|
|||
goto registerServer_failed;
|
||||
|
||||
result =
|
||||
RegSetValueEx(keyServerType,
|
||||
L"ThreadingModel",
|
||||
RegSetValueExA(keyServerType,
|
||||
"ThreadingModel",
|
||||
0L,
|
||||
REG_SZ,
|
||||
reinterpret_cast<const BYTE *>(threadingModel.c_str()),
|
||||
|
@ -134,13 +134,6 @@ void AkVCam::PluginInterface::unregisterServer(const std::string &deviceId) cons
|
|||
this->unregisterServer(createClsidFromStr(deviceId));
|
||||
}
|
||||
|
||||
void AkVCam::PluginInterface::unregisterServer(const std::wstring &deviceId) const
|
||||
{
|
||||
AkLogFunction();
|
||||
|
||||
this->unregisterServer(createClsidFromStr(deviceId));
|
||||
}
|
||||
|
||||
void AkVCam::PluginInterface::unregisterServer(const CLSID &clsid) const
|
||||
{
|
||||
AkLogFunction();
|
||||
|
@ -152,7 +145,7 @@ void AkVCam::PluginInterface::unregisterServer(const CLSID &clsid) const
|
|||
}
|
||||
|
||||
bool AkVCam::PluginInterface::registerFilter(const std::string &deviceId,
|
||||
const std::wstring &description) const
|
||||
const std::string &description) const
|
||||
{
|
||||
AkLogFunction();
|
||||
|
||||
|
@ -182,6 +175,7 @@ bool AkVCam::PluginInterface::registerFilter(const std::string &deviceId,
|
|||
|
||||
auto result = CoInitialize(nullptr);
|
||||
bool ok = false;
|
||||
LPWSTR wdescription = nullptr;
|
||||
|
||||
if (FAILED(result))
|
||||
goto registerFilter_failed;
|
||||
|
@ -195,13 +189,14 @@ bool AkVCam::PluginInterface::registerFilter(const std::string &deviceId,
|
|||
if (FAILED(result))
|
||||
goto registerFilter_failed;
|
||||
|
||||
wdescription = stringToWSTR(description);
|
||||
result = filterMapper->RegisterFilter(clsid,
|
||||
description.c_str(),
|
||||
wdescription,
|
||||
&pMoniker,
|
||||
&CLSID_VideoInputDeviceCategory,
|
||||
nullptr,
|
||||
®Filter);
|
||||
|
||||
CoTaskMemFree(wdescription);
|
||||
ok = true;
|
||||
|
||||
registerFilter_failed:
|
||||
|
@ -223,13 +218,6 @@ void AkVCam::PluginInterface::unregisterFilter(const std::string &deviceId) cons
|
|||
this->unregisterFilter(AkVCam::createClsidFromStr(deviceId));
|
||||
}
|
||||
|
||||
void AkVCam::PluginInterface::unregisterFilter(const std::wstring &deviceId) const
|
||||
{
|
||||
AkLogFunction();
|
||||
|
||||
this->unregisterFilter(AkVCam::createClsidFromStr(deviceId));
|
||||
}
|
||||
|
||||
void AkVCam::PluginInterface::unregisterFilter(const CLSID &clsid) const
|
||||
{
|
||||
AkLogFunction();
|
||||
|
@ -265,16 +253,16 @@ bool AkVCam::PluginInterface::setDevicePath(const std::string &deviceId) const
|
|||
{
|
||||
AkLogFunction();
|
||||
|
||||
std::wstring subKey =
|
||||
L"CLSID\\"
|
||||
+ wstringFromIid(CLSID_VideoInputDeviceCategory)
|
||||
+ L"\\Instance\\"
|
||||
+ createClsidWStrFromStr(deviceId);
|
||||
std::string subKey =
|
||||
"CLSID\\"
|
||||
+ stringFromIid(CLSID_VideoInputDeviceCategory)
|
||||
+ "\\Instance\\"
|
||||
+ createClsidStrFromStr(deviceId);
|
||||
AkLogInfo() << "Key: HKEY_CLASSES_ROOT" << std::endl;
|
||||
AkLogInfo() << "SubKey: " << std::string(subKey.begin(), subKey.end()) << std::endl;
|
||||
AkLogInfo() << "SubKey: " << subKey << std::endl;
|
||||
|
||||
HKEY hKey = nullptr;
|
||||
auto result = RegOpenKeyEx(HKEY_CLASSES_ROOT,
|
||||
auto result = RegOpenKeyExA(HKEY_CLASSES_ROOT,
|
||||
subKey.c_str(),
|
||||
0,
|
||||
KEY_ALL_ACCESS,
|
||||
|
@ -306,7 +294,7 @@ setDevicePath_failed:
|
|||
}
|
||||
|
||||
bool AkVCam::PluginInterface::createDevice(const std::string &deviceId,
|
||||
const std::wstring &description)
|
||||
const std::string &description)
|
||||
{
|
||||
AkLogFunction();
|
||||
|
||||
|
@ -335,14 +323,6 @@ void AkVCam::PluginInterface::destroyDevice(const std::string &deviceId)
|
|||
this->unregisterServer(deviceId);
|
||||
}
|
||||
|
||||
void AkVCam::PluginInterface::destroyDevice(const std::wstring &deviceId)
|
||||
{
|
||||
AkLogFunction();
|
||||
|
||||
this->unregisterFilter(deviceId);
|
||||
this->unregisterServer(deviceId);
|
||||
}
|
||||
|
||||
void AkVCam::PluginInterface::destroyDevice(const CLSID &clsid)
|
||||
{
|
||||
AkLogFunction();
|
||||
|
|
|
@ -37,20 +37,17 @@ namespace AkVCam
|
|||
HINSTANCE pluginHinstance() const;
|
||||
HINSTANCE &pluginHinstance();
|
||||
bool registerServer(const std::string &deviceId,
|
||||
const std::wstring &description) const;
|
||||
const std::string &description) const;
|
||||
void unregisterServer(const std::string &deviceId) const;
|
||||
void unregisterServer(const std::wstring &deviceId) const;
|
||||
void unregisterServer(const CLSID &clsid) const;
|
||||
bool registerFilter(const std::string &deviceId,
|
||||
const std::wstring &description) const;
|
||||
const std::string &description) const;
|
||||
void unregisterFilter(const std::string &deviceId) const;
|
||||
void unregisterFilter(const std::wstring &deviceId) const;
|
||||
void unregisterFilter(const CLSID &clsid) const;
|
||||
bool setDevicePath(const std::string &deviceId) const;
|
||||
bool createDevice(const std::string &deviceId,
|
||||
const std::wstring &description);
|
||||
const std::string &description);
|
||||
void destroyDevice(const std::string &deviceId);
|
||||
void destroyDevice(const std::wstring &deviceId);
|
||||
void destroyDevice(const CLSID &clsid);
|
||||
|
||||
private:
|
||||
|
|
|
@ -33,19 +33,12 @@ isEmpty(DSHOW_PLUGIN_VENDOR):
|
|||
|
||||
DEFINES += \
|
||||
DSHOW_PLUGIN_NAME=\"\\\"$$DSHOW_PLUGIN_NAME\\\"\" \
|
||||
DSHOW_PLUGIN_NAME_L=\"L\\\"$$DSHOW_PLUGIN_NAME\\\"\" \
|
||||
DSHOW_PLUGIN_ASSISTANT_NAME=\"\\\"$$DSHOW_PLUGIN_ASSISTANT_NAME\\\"\" \
|
||||
DSHOW_PLUGIN_ASSISTANT_NAME_L=\"L\\\"$$DSHOW_PLUGIN_ASSISTANT_NAME\\\"\" \
|
||||
DSHOW_PLUGIN_ASSISTANT_DESCRIPTION=\"\\\"$$DSHOW_PLUGIN_ASSISTANT_DESCRIPTION\\\"\" \
|
||||
DSHOW_PLUGIN_ASSISTANT_DESCRIPTION_L=\"L\\\"$$DSHOW_PLUGIN_ASSISTANT_DESCRIPTION\\\"\" \
|
||||
DSHOW_PLUGIN_DESCRIPTION=\"\\\"$$DSHOW_PLUGIN_DESCRIPTION\\\"\" \
|
||||
DSHOW_PLUGIN_DESCRIPTION_L=\"L\\\"$$DSHOW_PLUGIN_DESCRIPTION\\\"\" \
|
||||
DSHOW_PLUGIN_DESCRIPTION_EXT=\"\\\"$$DSHOW_PLUGIN_DESCRIPTION_EXT\\\"\" \
|
||||
DSHOW_PLUGIN_DESCRIPTION_EXT_L=\"L\\\"$$DSHOW_PLUGIN_DESCRIPTION_EXT\\\"\" \
|
||||
DSHOW_PLUGIN_DEVICE_PREFIX=\"\\\"$$DSHOW_PLUGIN_DEVICE_PREFIX\\\"\" \
|
||||
DSHOW_PLUGIN_DEVICE_PREFIX_L=\"L\\\"$$DSHOW_PLUGIN_DEVICE_PREFIX\\\"\" \
|
||||
DSHOW_PLUGIN_VENDOR=\"\\\"$$DSHOW_PLUGIN_VENDOR\\\"\" \
|
||||
DSHOW_PLUGIN_VENDOR_L=\"L\\\"$$DSHOW_PLUGIN_VENDOR\\\"\"
|
||||
DSHOW_PLUGIN_VENDOR=\"\\\"$$DSHOW_PLUGIN_VENDOR\\\"\"
|
||||
|
||||
defineReplace(normalizedArch) {
|
||||
arch = $$replace($$1, i386, x86)
|
||||
|
|
|
@ -53,7 +53,7 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
|
|||
self.dependencies = []
|
||||
self.installerConfig = os.path.join(self.installDir, 'installer/config')
|
||||
self.installerPackages = os.path.join(self.installDir, 'installer/packages')
|
||||
self.appIcon = os.path.join(self.rootDir, 'share/TestFrame/webcamoid.png')
|
||||
self.appIcon = os.path.join(self.rootDir, 'share/icons/webcamoid.png')
|
||||
self.licenseFile = os.path.join(self.rootDir, 'COPYING')
|
||||
self.installerTargetDir = '@ApplicationsDir@/' + self.programName
|
||||
self.installerScript = os.path.join(self.rootDir, 'ports/deploy/installscript.mac.qs')
|
||||
|
|
|
@ -51,7 +51,7 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
|
|||
self.dependencies = []
|
||||
self.installerConfig = os.path.join(self.installDir, 'installer/config')
|
||||
self.installerPackages = os.path.join(self.installDir, 'installer/packages')
|
||||
self.appIcon = os.path.join(self.rootDir, 'share/TestFrame/webcamoid.png')
|
||||
self.appIcon = os.path.join(self.rootDir, 'share/icons/webcamoid.png')
|
||||
self.licenseFile = os.path.join(self.rootDir, 'COPYING')
|
||||
self.installerScript = os.path.join(self.rootDir, 'ports/deploy/installscript.windows.qs')
|
||||
self.changeLog = os.path.join(self.rootDir, 'ChangeLog')
|
||||
|
|
|
@ -51,7 +51,7 @@ class Deploy(deploy_base.DeployBase, tools.qt5.DeployToolsQt):
|
|||
self.dependencies = []
|
||||
self.installerConfig = os.path.join(self.installDir, 'installer/config')
|
||||
self.installerPackages = os.path.join(self.installDir, 'installer/packages')
|
||||
self.appIcon = os.path.join(self.rootDir, 'share/TestFrame/webcamoid.png')
|
||||
self.appIcon = os.path.join(self.rootDir, 'share/icons/webcamoid.png')
|
||||
self.licenseFile = os.path.join(self.rootDir, 'COPYING')
|
||||
self.installerScript = os.path.join(self.rootDir, 'ports/deploy/installscript.windows.qs')
|
||||
self.changeLog = os.path.join(self.rootDir, 'ChangeLog')
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 900 KiB |
|
@ -1,39 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
#
|
||||
# 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/
|
||||
|
||||
import sys
|
||||
from PyQt5 import QtWidgets, QtQml, QtQuick
|
||||
|
||||
|
||||
if __name__ =='__main__':
|
||||
app = QtWidgets.QApplication(sys.argv);
|
||||
engine = QtQml.QQmlApplicationEngine()
|
||||
engine.load("TestFrame.qml")
|
||||
|
||||
def capture():
|
||||
for obj in engine.rootObjects():
|
||||
image = obj.grabWindow()
|
||||
image.save("TestFrame.bmp")
|
||||
obj.close()
|
||||
|
||||
for obj in engine.rootObjects():
|
||||
obj.sceneGraphInitialized.connect(capture)
|
||||
|
||||
app.exec_()
|
|
@ -1,194 +0,0 @@
|
|||
/* 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/
|
||||
*/
|
||||
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Window 2.12
|
||||
import QtQuick.Controls 2.5
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
ApplicationWindow {
|
||||
width: 640
|
||||
height: 480
|
||||
color: "#3f2a7e"
|
||||
visible: true
|
||||
|
||||
property int patternSize: 24
|
||||
|
||||
ColumnLayout {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
GridLayout {
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
columns: 2
|
||||
|
||||
// Info
|
||||
Image {
|
||||
id: icon
|
||||
width: 128
|
||||
height: width
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
source: "webcamoid.png"
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Text {
|
||||
id: programName
|
||||
color: "#ffffff"
|
||||
text: "Webcamoid"
|
||||
font.weight: Font.Bold
|
||||
font.pixelSize: 40
|
||||
}
|
||||
|
||||
Text {
|
||||
color: "#ffffff"
|
||||
text: "The ultimate webcam suite!"
|
||||
leftPadding: 24
|
||||
font.weight: Font.Bold
|
||||
font.pixelSize: 0.5 * programName.font.pixelSize
|
||||
}
|
||||
}
|
||||
|
||||
// Color pattern
|
||||
GridLayout {
|
||||
columns: 8
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
Layout.columnSpan: 2
|
||||
|
||||
Text {
|
||||
text: "R"
|
||||
color: "#ffffff"
|
||||
font.pixelSize: 0.3 * programName.font.pixelSize
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
}
|
||||
Text {
|
||||
text: "G"
|
||||
color: "#ffffff"
|
||||
font.pixelSize: 0.3 * programName.font.pixelSize
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
}
|
||||
Text {
|
||||
text: "B"
|
||||
color: "#ffffff"
|
||||
font.pixelSize: 0.3 * programName.font.pixelSize
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "C"
|
||||
color: "#ffffff"
|
||||
font.pixelSize: 0.3 * programName.font.pixelSize
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
}
|
||||
Text {
|
||||
text: "M"
|
||||
color: "#ffffff"
|
||||
font.pixelSize: 0.3 * programName.font.pixelSize
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
}
|
||||
Text {
|
||||
text: "Y"
|
||||
color: "#ffffff"
|
||||
font.pixelSize: 0.3 * programName.font.pixelSize
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "K"
|
||||
color: "#ffffff"
|
||||
font.pixelSize: 0.3 * programName.font.pixelSize
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
}
|
||||
Text {
|
||||
text: "W"
|
||||
color: "#ffffff"
|
||||
font.pixelSize: 0.3 * programName.font.pixelSize
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
}
|
||||
|
||||
// RGB
|
||||
Rectangle {
|
||||
color: "#ff0000"
|
||||
width: patternSize
|
||||
height: patternSize
|
||||
}
|
||||
Rectangle {
|
||||
color: "#00ff00"
|
||||
width: patternSize
|
||||
height: patternSize
|
||||
}
|
||||
Rectangle {
|
||||
color: "#0000ff"
|
||||
width: patternSize
|
||||
height: patternSize
|
||||
}
|
||||
|
||||
// CMY
|
||||
Rectangle {
|
||||
color: "#00ffff"
|
||||
width: patternSize
|
||||
height: patternSize
|
||||
}
|
||||
Rectangle {
|
||||
color: "#ff00ff"
|
||||
width: patternSize
|
||||
height: patternSize
|
||||
}
|
||||
Rectangle {
|
||||
color: "#ffff00"
|
||||
width: patternSize
|
||||
height: patternSize
|
||||
}
|
||||
|
||||
// BW
|
||||
Rectangle {
|
||||
color: "#000000"
|
||||
width: patternSize
|
||||
height: patternSize
|
||||
}
|
||||
Rectangle {
|
||||
color: "#ffffff"
|
||||
width: patternSize
|
||||
height: patternSize
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Usage
|
||||
Rectangle {
|
||||
width: 500
|
||||
height: 125
|
||||
color: "#00000000"
|
||||
|
||||
Text {
|
||||
id: usage
|
||||
color: "#ffffff"
|
||||
text: "This is a Webcamoid's virtual webcam device.\n"
|
||||
+ "Go to Webcamoid, enable virtual webcam output, select "
|
||||
+ "this device and play some webcam, desktop or video."
|
||||
wrapMode: Text.WordWrap
|
||||
anchors.fill: parent
|
||||
topPadding: 8
|
||||
Layout.columnSpan: 2
|
||||
font.pixelSize: 0.45 * programName.font.pixelSize
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Loading…
Reference in a new issue