Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Obs Studio
提交
9931f22f
O
Obs Studio
项目概览
小白菜888
/
Obs Studio
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Obs Studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9931f22f
编写于
2月 24, 2019
作者:
M
Matt Gajownik
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
win-capture, libobs: Show names of displays in Display Capture
上级
6b5636ad
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
79 addition
and
6 deletion
+79
-6
libobs-d3d11/d3d11-duplicator.cpp
libobs-d3d11/d3d11-duplicator.cpp
+27
-0
libobs/graphics/graphics.h
libobs/graphics/graphics.h
+2
-0
plugins/win-capture/duplicator-monitor-capture.c
plugins/win-capture/duplicator-monitor-capture.c
+21
-2
plugins/win-capture/monitor-capture.c
plugins/win-capture/monitor-capture.c
+29
-4
未找到文件。
libobs-d3d11/d3d11-duplicator.cpp
浏览文件 @
9931f22f
...
...
@@ -16,6 +16,8 @@
******************************************************************************/
#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
,
...
...
@@ -34,6 +36,16 @@ 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
;
...
...
@@ -95,6 +107,10 @@ 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
:
...
...
@@ -119,6 +135,17 @@ 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
;
}
...
...
libobs/graphics/graphics.h
浏览文件 @
9931f22f
...
...
@@ -181,6 +181,8 @@ struct gs_monitor_info {
long
y
;
long
cx
;
long
cy
;
char
*
monitor_name
;
uint32_t
flags
;
};
struct
gs_tvertarray
{
...
...
plugins/win-capture/duplicator-monitor-capture.c
浏览文件 @
9931f22f
...
...
@@ -273,13 +273,32 @@ static bool get_monitor_props(obs_property_t *monitor_list, int monitor_idx)
if
(
!
gs_get_duplicator_monitor_info
(
monitor_idx
,
&
info
))
return
false
;
dstr_catf
(
&
monitor_desc
,
"%s %d: %ldx%ld @ %ld,%ld"
,
TEXT_MONITOR
,
monitor_idx
+
1
,
info
.
cx
,
info
.
cy
,
info
.
x
,
info
.
y
);
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
);
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
;
}
...
...
plugins/win-capture/monitor-capture.c
浏览文件 @
9931f22f
#include <util/dstr.h>
#include <util/platform.h>
#include "dc-capture.h"
/* clang-format off */
...
...
@@ -176,7 +177,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
;
MONITORINFO
mi
;
MONITORINFO
EX
mi
;
size_t
monitor_id
=
0
;
struct
dstr
monitor_desc
=
{
0
};
struct
dstr
resolution
=
{
0
};
...
...
@@ -187,18 +188,40 @@ 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
%d
: %s"
);
dstr_copy
(
&
format_string
,
"%s: %s"
);
if
(
mi
.
dwFlags
==
MONITORINFOF_PRIMARY
)
{
dstr_catf
(
&
format_string
,
" (%s)"
,
TEXT_PRIMARY_MONITOR
);
}
dstr_catf
(
&
monitor_desc
,
format_string
.
array
,
TEXT_MONITOR
,
monitor_id
+
1
,
resolution
.
array
);
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
);
obs_property_list_add_int
(
monitor_list
,
monitor_desc
.
array
,
(
int
)
monitor_id
);
...
...
@@ -206,6 +229,8 @@ 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
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录