New upstream version 25.0.3+dfsg1

This commit is contained in:
Sebastian Ramacher 2020-03-25 09:07:22 +01:00
parent 04fe0efc67
commit 8b2e5f2130
569 changed files with 62491 additions and 5875 deletions

View file

@ -19,8 +19,8 @@
#include <sstream>
#include "obs-config.h"
#include "obs-app.hpp"
#include "qt-wrappers.hpp"
#include "platform.hpp"
using namespace std;
#include <util/windows/win-version.h>
#include <util/platform.h>
@ -37,6 +37,8 @@ using namespace std;
#include <util/windows/HRError.hpp>
#include <util/windows/ComPtr.hpp>
using namespace std;
static inline bool check_path(const char *data, const char *path,
string &output)
{
@ -299,10 +301,13 @@ RunOnceMutex GetRunOnceMutex(bool &already_running)
name = "OBSStudioCore";
} else {
char path[500];
char absPath[512];
*path = 0;
*absPath = 0;
GetConfigPath(path, sizeof(path), "");
os_get_abs_path(path, absPath, sizeof(absPath));
name = "OBSStudioPortable";
name += path;
name += absPath;
}
BPtr<wchar_t> wname;
@ -326,3 +331,86 @@ RunOnceMutex GetRunOnceMutex(bool &already_running)
RunOnceMutex rom(h ? new RunOnceMutexData(h) : nullptr);
return rom;
}
struct MonitorData {
const wchar_t *id;
MONITORINFOEX info;
bool found;
};
static BOOL CALLBACK GetMonitorCallback(HMONITOR monitor, HDC, LPRECT,
LPARAM param)
{
MonitorData *data = (MonitorData *)param;
if (GetMonitorInfoW(monitor, &data->info)) {
if (wcscmp(data->info.szDevice, data->id) == 0) {
data->found = true;
return false;
}
}
return true;
}
#define GENERIC_MONITOR_NAME QStringLiteral("Generic PnP Monitor")
QString GetMonitorName(const QString &id)
{
MonitorData data = {};
data.id = (const wchar_t *)id.utf16();
data.info.cbSize = sizeof(data.info);
EnumDisplayMonitors(nullptr, nullptr, GetMonitorCallback,
(LPARAM)&data);
if (!data.found) {
return GENERIC_MONITOR_NAME;
}
UINT32 numPath, numMode;
if (!GetDisplayConfigBufferSizes(QDC_ONLY_ACTIVE_PATHS, &numPath,
&numMode) == ERROR_SUCCESS) {
return GENERIC_MONITOR_NAME;
}
std::vector<DISPLAYCONFIG_PATH_INFO> paths(numPath);
std::vector<DISPLAYCONFIG_MODE_INFO> modes(numMode);
if (!QueryDisplayConfig(QDC_ONLY_ACTIVE_PATHS, &numPath, paths.data(),
&numMode, modes.data(),
nullptr) == ERROR_SUCCESS) {
return GENERIC_MONITOR_NAME;
}
DISPLAYCONFIG_TARGET_DEVICE_NAME target;
bool found = false;
paths.resize(numPath);
for (size_t i = 0; i < numPath; ++i) {
const DISPLAYCONFIG_PATH_INFO &path = paths[i];
DISPLAYCONFIG_SOURCE_DEVICE_NAME s;
s.header.type = DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME;
s.header.size = sizeof(s);
s.header.adapterId = path.sourceInfo.adapterId;
s.header.id = path.sourceInfo.id;
if (DisplayConfigGetDeviceInfo(&s.header) == ERROR_SUCCESS &&
wcscmp(data.info.szDevice, s.viewGdiDeviceName) == 0) {
target.header.type =
DISPLAYCONFIG_DEVICE_INFO_GET_TARGET_NAME;
target.header.size = sizeof(target);
target.header.adapterId = path.sourceInfo.adapterId;
target.header.id = path.targetInfo.id;
found = DisplayConfigGetDeviceInfo(&target.header) ==
ERROR_SUCCESS;
break;
}
}
if (!found) {
return GENERIC_MONITOR_NAME;
}
return QString::fromWCharArray(target.monitorFriendlyDeviceName);
}