Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
19bc92d2
O
obs-studio
项目概览
尘离序散
/
obs-studio
与 Fork 源项目一致
从无法访问的项目Fork
通知
30
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
obs-studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
19bc92d2
编写于
6月 23, 2018
作者:
C
Colin Edwards
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Decklink: Keyer support
上级
f1b9f6b3
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
94 addition
and
9 deletion
+94
-9
libobs/obs-video.c
libobs/obs-video.c
+9
-2
plugins/decklink/DecklinkOutput.hpp
plugins/decklink/DecklinkOutput.hpp
+1
-0
plugins/decklink/const.h
plugins/decklink/const.h
+2
-0
plugins/decklink/decklink-device-instance.cpp
plugins/decklink/decklink-device-instance.cpp
+16
-4
plugins/decklink/decklink-device.cpp
plugins/decklink/decklink-device.cpp
+36
-1
plugins/decklink/decklink-device.hpp
plugins/decklink/decklink-device.hpp
+11
-1
plugins/decklink/decklink-output.cpp
plugins/decklink/decklink-output.cpp
+19
-1
未找到文件。
libobs/obs-video.c
浏览文件 @
19bc92d2
...
...
@@ -117,7 +117,7 @@ static inline void render_main_texture(struct obs_core_video *video,
profile_start
(
render_main_texture_name
);
struct
vec4
clear_color
;
vec4_set
(
&
clear_color
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
1
.
0
f
);
vec4_set
(
&
clear_color
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
,
0
.
0
f
);
gs_set_render_target
(
video
->
render_textures
[
cur_texture
],
NULL
);
gs_clear
(
GS_CLEAR_COLOR
,
&
clear_color
,
1
.
0
f
,
0
);
...
...
@@ -207,7 +207,14 @@ static inline void render_output_texture(struct obs_core_video *video,
1
.
0
f
/
(
float
)
video
->
base_height
);
gs_effect_t
*
effect
=
get_scale_effect
(
video
,
width
,
height
);
gs_technique_t
*
tech
=
gs_effect_get_technique
(
effect
,
"DrawMatrix"
);
gs_technique_t
*
tech
;
if
(
video
->
ovi
.
output_format
==
VIDEO_FORMAT_RGBA
)
{
tech
=
gs_effect_get_technique
(
effect
,
"Draw"
);
}
else
{
tech
=
gs_effect_get_technique
(
effect
,
"DrawMatrix"
);
}
gs_eparam_t
*
image
=
gs_effect_get_param_by_name
(
effect
,
"image"
);
gs_eparam_t
*
matrix
=
gs_effect_get_param_by_name
(
effect
,
"color_matrix"
);
...
...
plugins/decklink/DecklinkOutput.hpp
浏览文件 @
19bc92d2
...
...
@@ -19,6 +19,7 @@ public:
uint32_t
audio_samplerate
;
size_t
audio_planes
;
size_t
audio_size
;
int
keyerMode
;
DeckLinkOutput
(
obs_output_t
*
output
,
DeckLinkDeviceDiscovery
*
discovery
);
virtual
~
DeckLinkOutput
(
void
);
...
...
plugins/decklink/const.h
浏览文件 @
19bc92d2
...
...
@@ -9,6 +9,7 @@
#define BUFFERING "buffering"
#define DEACTIVATE_WNS "deactivate_when_not_showing"
#define AUTO_START "auto_start"
#define KEYER "keyer"
#define TEXT_DEVICE obs_module_text("Device")
#define TEXT_MODE obs_module_text("Mode")
...
...
@@ -30,3 +31,4 @@
#define TEXT_BUFFERING obs_module_text("Buffering")
#define TEXT_DWNS obs_module_text("DeactivateWhenNotShowing")
#define TEXT_AUTO_START obs_module_text("AutoStart")
#define TEXT_ENABLE_KEYER obs_module_text("Keyer")
plugins/decklink/decklink-device-instance.cpp
浏览文件 @
19bc92d2
#include "decklink-device-instance.hpp"
#
include
"decklink-device-instance.hpp"
#include "audio-repack.hpp"
#include "DecklinkInput.hpp"
...
...
@@ -312,6 +312,18 @@ bool DeckLinkDeviceInstance::StartOutput(DeckLinkDeviceMode *mode_)
mode
=
mode_
;
IDeckLinkKeyer
*
deckLinkKeyer
=
nullptr
;
if
(
device
->
GetKeyer
(
&
deckLinkKeyer
))
{
int
keyerMode
=
device
->
GetKeyerMode
();
if
(
keyerMode
)
{
deckLinkKeyer
->
Enable
(
keyerMode
==
1
);
deckLinkKeyer
->
SetLevel
(
255
);
}
else
{
deckLinkKeyer
->
Disable
();
}
}
auto
decklinkOutput
=
dynamic_cast
<
DeckLinkOutput
*>
(
decklink
);
if
(
decklinkOutput
==
nullptr
)
return
false
;
...
...
@@ -319,8 +331,8 @@ bool DeckLinkDeviceInstance::StartOutput(DeckLinkDeviceMode *mode_)
HRESULT
result
;
result
=
output
->
CreateVideoFrame
(
decklinkOutput
->
GetWidth
(),
decklinkOutput
->
GetHeight
(),
decklinkOutput
->
GetWidth
()
*
2
,
bmdFormat8Bit
YUV
,
decklinkOutput
->
GetWidth
()
*
4
,
bmdFormat8Bit
BGRA
,
bmdFrameFlagDefault
,
&
decklinkOutputFrame
);
if
(
result
!=
S_OK
)
{
...
...
@@ -362,7 +374,7 @@ void DeckLinkDeviceInstance::DisplayVideoFrame(video_data *frame)
uint8_t
*
outData
=
frame
->
data
[
0
];
std
::
copy
(
outData
,
outData
+
(
decklinkOutput
->
GetWidth
()
*
decklinkOutput
->
GetHeight
()
*
2
),
destData
);
decklinkOutput
->
GetHeight
()
*
4
),
destData
);
output
->
DisplayVideoFrameSync
(
decklinkOutputFrame
);
}
...
...
plugins/decklink/decklink-device.cpp
浏览文件 @
19bc92d2
#include <sstream>
#
include
<
sstream
>
#include "decklink-device.hpp"
...
...
@@ -97,6 +97,10 @@ bool DeckLinkDevice::Init()
}
}
// get keyer support
attributes
->
GetFlag
(
BMDDeckLinkSupportsExternalKeying
,
&
supportsExternalKeyer
);
attributes
->
GetFlag
(
BMDDeckLinkSupportsInternalKeying
,
&
supportsInternalKeyer
);
decklink_string_t
decklinkModelName
;
decklink_string_t
decklinkDisplayName
;
...
...
@@ -152,6 +156,27 @@ bool DeckLinkDevice::GetOutput(IDeckLinkOutput **output)
return
true
;
}
bool
DeckLinkDevice
::
GetKeyer
(
IDeckLinkKeyer
**
deckLinkKeyer
)
{
if
(
device
->
QueryInterface
(
IID_IDeckLinkKeyer
,
(
void
**
)
deckLinkKeyer
)
!=
S_OK
)
{
fprintf
(
stderr
,
"Could not obtain the IDeckLinkKeyer interface
\n
"
);
return
false
;
}
return
true
;
}
void
DeckLinkDevice
::
SetKeyerMode
(
int
newKeyerMode
)
{
keyerMode
=
newKeyerMode
;
}
int
DeckLinkDevice
::
GetKeyerMode
(
void
)
{
return
keyerMode
;
}
DeckLinkDeviceMode
*
DeckLinkDevice
::
FindInputMode
(
long
long
id
)
{
return
inputModeIdMap
[
id
];
...
...
@@ -182,6 +207,16 @@ const std::vector<DeckLinkDeviceMode *>& DeckLinkDevice::GetOutputModes(void) co
return
outputModes
;
}
const
bool
DeckLinkDevice
::
GetSupportsExternalKeyer
(
void
)
const
{
return
supportsExternalKeyer
;
}
const
bool
DeckLinkDevice
::
GetSupportsInternalKeyer
(
void
)
const
{
return
supportsInternalKeyer
;
}
const
std
::
string
&
DeckLinkDevice
::
GetName
(
void
)
const
{
return
name
;
...
...
plugins/decklink/decklink-device.hpp
浏览文件 @
19bc92d2
#pragma once
#
pragma
once
#include "decklink-device-mode.hpp"
...
...
@@ -7,6 +7,8 @@
#include <vector>
#include <stdint.h>
class
DeckLinkDevice
{
ComPtr
<
IDeckLink
>
device
;
std
::
map
<
long
long
,
DeckLinkDeviceMode
*>
inputModeIdMap
;
...
...
@@ -17,6 +19,9 @@ class DeckLinkDevice {
std
::
string
displayName
;
std
::
string
hash
;
int32_t
maxChannel
;
decklink_bool_t
supportsExternalKeyer
;
decklink_bool_t
supportsInternalKeyer
;
int
keyerMode
;
volatile
long
refCount
=
1
;
public:
...
...
@@ -34,11 +39,16 @@ public:
const
std
::
string
&
GetHash
(
void
)
const
;
const
std
::
vector
<
DeckLinkDeviceMode
*>&
GetInputModes
(
void
)
const
;
const
std
::
vector
<
DeckLinkDeviceMode
*>&
GetOutputModes
(
void
)
const
;
const
bool
GetSupportsExternalKeyer
(
void
)
const
;
const
bool
GetSupportsInternalKeyer
(
void
)
const
;
int
GetKeyerMode
(
void
);
void
SetKeyerMode
(
int
newKeyerMode
);
const
std
::
string
&
GetName
(
void
)
const
;
int32_t
GetMaxChannel
(
void
)
const
;
bool
GetInput
(
IDeckLinkInput
**
input
);
bool
GetOutput
(
IDeckLinkOutput
**
output
);
bool
GetKeyer
(
IDeckLinkKeyer
**
keyer
);
inline
bool
IsDevice
(
IDeckLink
*
device_
)
{
...
...
plugins/decklink/decklink-output.cpp
浏览文件 @
19bc92d2
...
...
@@ -22,6 +22,7 @@ static void *decklink_output_create(obs_data_t *settings, obs_output_t *output)
decklinkOutput
->
deviceHash
=
obs_data_get_string
(
settings
,
DEVICE_HASH
);
decklinkOutput
->
modeID
=
obs_data_get_int
(
settings
,
MODE_ID
);
decklinkOutput
->
keyerMode
=
obs_data_get_int
(
settings
,
KEYER
);
return
decklinkOutput
;
}
...
...
@@ -32,6 +33,7 @@ static void decklink_output_update(void *data, obs_data_t *settings)
decklink
->
deviceHash
=
obs_data_get_string
(
settings
,
DEVICE_HASH
);
decklink
->
modeID
=
obs_data_get_int
(
settings
,
MODE_ID
);
decklink
->
keyerMode
=
obs_data_get_int
(
settings
,
KEYER
);
}
static
bool
decklink_output_start
(
void
*
data
)
...
...
@@ -59,12 +61,13 @@ static bool decklink_output_start(void *data)
decklink
->
SetSize
(
mode
->
GetWidth
(),
mode
->
GetHeight
());
struct
video_scale_info
to
=
{};
to
.
format
=
VIDEO_FORMAT_
UYVY
;
to
.
format
=
VIDEO_FORMAT_
BGRA
;
to
.
width
=
mode
->
GetWidth
();
to
.
height
=
mode
->
GetHeight
();
obs_output_set_video_conversion
(
decklink
->
GetOutput
(),
&
to
);
device
->
SetKeyerMode
(
decklink
->
keyerMode
);
decklink
->
Activate
(
device
,
decklink
->
modeID
);
struct
audio_convert_info
conversion
=
{};
...
...
@@ -172,8 +175,10 @@ static bool decklink_output_device_changed(obs_properties_t *props,
}
obs_property_t
*
modeList
=
obs_properties_get
(
props
,
MODE_ID
);
obs_property_t
*
keyerList
=
obs_properties_get
(
props
,
KEYER
);
obs_property_list_clear
(
modeList
);
obs_property_list_clear
(
keyerList
);
ComPtr
<
DeckLinkDevice
>
device
;
device
.
Set
(
deviceEnum
->
FindByHash
(
hash
));
...
...
@@ -181,6 +186,7 @@ static bool decklink_output_device_changed(obs_properties_t *props,
if
(
!
device
)
{
obs_property_list_add_int
(
modeList
,
mode
,
modeId
);
obs_property_list_item_disable
(
modeList
,
0
,
true
);
obs_property_list_item_disable
(
keyerList
,
0
,
true
);
}
else
{
const
std
::
vector
<
DeckLinkDeviceMode
*>
&
modes
=
device
->
GetOutputModes
();
...
...
@@ -190,6 +196,16 @@ static bool decklink_output_device_changed(obs_properties_t *props,
mode
->
GetName
().
c_str
(),
mode
->
GetId
());
}
obs_property_list_add_int
(
keyerList
,
"Disabled"
,
0
);
if
(
device
->
GetSupportsExternalKeyer
())
{
obs_property_list_add_int
(
keyerList
,
"External"
,
1
);
}
if
(
device
->
GetSupportsInternalKeyer
())
{
obs_property_list_add_int
(
keyerList
,
"Internal"
,
2
);
}
}
return
true
;
...
...
@@ -211,6 +227,8 @@ static obs_properties_t *decklink_output_properties(void *unused)
obs_properties_add_bool
(
props
,
AUTO_START
,
TEXT_AUTO_START
);
obs_properties_add_list
(
props
,
KEYER
,
TEXT_ENABLE_KEYER
,
OBS_COMBO_TYPE_LIST
,
OBS_COMBO_FORMAT_INT
);
return
props
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录