Revert "win-capture, libobs: Show names of displays in Display Capture"

This reverts commit 9931f22ff4.
master
jp9000 2020-03-19 06:43:57 -07:00
parent 06377bec46
commit 8ecfb405ce
4 changed files with 6 additions and 79 deletions

View File

@ -16,8 +16,6 @@
******************************************************************************/
#include "d3d11-subsystem.hpp"
#include "util/platform.h"
#include <map>
#include <unordered_map>
static inline bool get_monitor(gs_device_t *device, int monitor_idx,
@ -36,16 +34,6 @@ static inline bool get_monitor(gs_device_t *device, int monitor_idx,
return true;
}
static inline void get_display_device(DXGI_OUTPUT_DESC *desc,
MONITORINFOEX *moninfo,
DISPLAY_DEVICE *ddev)
{
moninfo->cbSize = sizeof(MONITORINFOEX);
GetMonitorInfoW(desc->Monitor, moninfo);
ddev->cb = sizeof(*ddev);
EnumDisplayDevices(moninfo->szDevice, 0, ddev, 1);
}
void gs_duplicator::Start()
{
ComPtr<IDXGIOutput1> output1;
@ -107,10 +95,6 @@ EXPORT bool device_get_duplicator_monitor_info(gs_device_t *device,
return false;
}
DISPLAY_DEVICE ddev;
MONITORINFOEX monitorinf;
get_display_device(&desc, &monitorinf, &ddev);
switch (desc.Rotation) {
case DXGI_MODE_ROTATION_UNSPECIFIED:
case DXGI_MODE_ROTATION_IDENTITY:
@ -135,17 +119,6 @@ EXPORT bool device_get_duplicator_monitor_info(gs_device_t *device,
info->cx = desc.DesktopCoordinates.right - info->x;
info->cy = desc.DesktopCoordinates.bottom - info->y;
char *devname = NULL;
#ifdef UNICODE
os_wcs_to_utf8_ptr(ddev.DeviceString, 128, &devname);
#else
devname = (char *)bstrdup(ddev.DeviceString);
#endif
info->monitor_name = devname;
bfree(devname);
info->flags = monitorinf.dwFlags;
return true;
}

View File

@ -181,8 +181,6 @@ struct gs_monitor_info {
long y;
long cx;
long cy;
char *monitor_name;
uint32_t flags;
};
struct gs_tvertarray {

View File

@ -273,32 +273,13 @@ static bool get_monitor_props(obs_property_t *monitor_list, int monitor_idx)
if (!gs_get_duplicator_monitor_info(monitor_idx, &info))
return false;
struct dstr format_str = {0};
dstr_copy(&format_str, "%s: %ldx%ld @ %ld,%ld");
struct dstr m = {0};
dstr_copy(&m, info.monitor_name);
if (dstr_is_empty(&m)) {
// Fallback
struct dstr d = {0};
dstr_catf(&d, "%s %d", TEXT_MONITOR, monitor_idx + 1);
dstr_free(&m);
dstr_copy_dstr(&m, &d);
dstr_free(&d);
}
if (info.flags & MONITORINFOF_PRIMARY)
dstr_catf(&format_str, " (%s)", TEXT_PRIMARY_MONITOR);
dstr_catf(&monitor_desc, format_str.array, m.array, info.cx, info.cy,
info.x, info.y);
dstr_catf(&monitor_desc, "%s %d: %ldx%ld @ %ld,%ld", TEXT_MONITOR,
monitor_idx + 1, info.cx, info.cy, info.x, info.y);
obs_property_list_add_int(monitor_list, monitor_desc.array,
monitor_idx);
dstr_free(&monitor_desc);
dstr_free(&format_str);
dstr_free(&m);
return true;
}

View File

@ -1,5 +1,4 @@
#include <util/dstr.h>
#include <util/platform.h>
#include "dc-capture.h"
/* clang-format off */
@ -177,7 +176,7 @@ static BOOL CALLBACK enum_monitor_props(HMONITOR handle, HDC hdc, LPRECT rect,
UNUSED_PARAMETER(rect);
obs_property_t *monitor_list = (obs_property_t *)param;
MONITORINFOEX mi;
MONITORINFO mi;
size_t monitor_id = 0;
struct dstr monitor_desc = {0};
struct dstr resolution = {0};
@ -188,40 +187,18 @@ static BOOL CALLBACK enum_monitor_props(HMONITOR handle, HDC hdc, LPRECT rect,
mi.cbSize = sizeof(mi);
GetMonitorInfo(handle, &mi);
DISPLAY_DEVICE ddev;
ddev.cb = sizeof(ddev);
EnumDisplayDevices(mi.szDevice, 0, &ddev, 1);
char *devname = NULL;
#ifdef UNICODE
os_wcs_to_utf8_ptr(ddev.DeviceString, 128, &devname);
#else
devname = (char *)bstrdup(ddev.DeviceString);
#endif
dstr_catf(&resolution, "%dx%d @ %d,%d",
mi.rcMonitor.right - mi.rcMonitor.left,
mi.rcMonitor.bottom - mi.rcMonitor.top, mi.rcMonitor.left,
mi.rcMonitor.top);
dstr_copy(&format_string, "%s: %s");
dstr_copy(&format_string, "%s %d: %s");
if (mi.dwFlags == MONITORINFOF_PRIMARY) {
dstr_catf(&format_string, " (%s)", TEXT_PRIMARY_MONITOR);
}
struct dstr m = {0};
dstr_copy(&m, devname);
dstr_replace(&m, "(", " (");
if (dstr_is_empty(&m)) {
struct dstr d = {0};
dstr_catf(&d, "%s %d", TEXT_MONITOR, monitor_id + 1);
dstr_free(&m);
dstr_copy_dstr(&m, &d);
dstr_free(&d);
}
dstr_catf(&monitor_desc, format_string.array, m.array,
resolution.array);
dstr_catf(&monitor_desc, format_string.array, TEXT_MONITOR,
monitor_id + 1, resolution.array);
obs_property_list_add_int(monitor_list, monitor_desc.array,
(int)monitor_id);
@ -229,8 +206,6 @@ static BOOL CALLBACK enum_monitor_props(HMONITOR handle, HDC hdc, LPRECT rect,
dstr_free(&monitor_desc);
dstr_free(&resolution);
dstr_free(&format_string);
dstr_free(&m);
bfree(devname);
return TRUE;
}