Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
922eb7b8
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,发现更多精彩内容 >>
提交
922eb7b8
编写于
12月 22, 2013
作者:
J
jp9000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make direct filter rendering optional (can be useful for certain cases)
上级
bd47d9fe
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
17 addition
and
5 deletion
+17
-5
libobs/obs-source.c
libobs/obs-source.c
+9
-3
libobs/obs.h
libobs/obs.h
+7
-1
test/test-input/test-filter.c
test/test-input/test-filter.c
+1
-1
未找到文件。
libobs/obs-source.c
浏览文件 @
922eb7b8
...
@@ -968,7 +968,8 @@ static inline void render_filter_tex(texture_t tex, effect_t effect,
...
@@ -968,7 +968,8 @@ static inline void render_filter_tex(texture_t tex, effect_t effect,
}
}
void
obs_source_process_filter
(
obs_source_t
filter
,
texrender_t
texrender
,
void
obs_source_process_filter
(
obs_source_t
filter
,
texrender_t
texrender
,
effect_t
effect
,
uint32_t
width
,
uint32_t
height
)
effect_t
effect
,
uint32_t
width
,
uint32_t
height
,
enum
allow_direct_render
allow_direct
)
{
{
obs_source_t
target
=
obs_filter_gettarget
(
filter
);
obs_source_t
target
=
obs_filter_gettarget
(
filter
);
obs_source_t
parent
=
obs_filter_getparent
(
filter
);
obs_source_t
parent
=
obs_filter_getparent
(
filter
);
...
@@ -977,18 +978,23 @@ void obs_source_process_filter(obs_source_t filter, texrender_t texrender,
...
@@ -977,18 +978,23 @@ void obs_source_process_filter(obs_source_t filter, texrender_t texrender,
int
cx
=
obs_source_getwidth
(
target
);
int
cx
=
obs_source_getwidth
(
target
);
int
cy
=
obs_source_getheight
(
target
);
int
cy
=
obs_source_getheight
(
target
);
bool
yuv
=
(
target_flags
&
SOURCE_YUV
)
!=
0
;
bool
yuv
=
(
target_flags
&
SOURCE_YUV
)
!=
0
;
bool
expects_def
=
(
parent_flags
&
SOURCE_DEFAULT_EFFECT
)
!=
0
;
bool
can_directly
=
allow_direct
==
ALLOW_DIRECT_RENDERING
;
/* if the parent does not use any custom effects, and this is the last
/* if the parent does not use any custom effects, and this is the last
* filter in the chain for the parent, then render the parent directly
* filter in the chain for the parent, then render the parent directly
* using the filter effect instead of rendering to texture to reduce
* using the filter effect instead of rendering to texture to reduce
* the total number of passes */
* the total number of passes */
if
(
(
parent_flags
&
SOURCE_DEFAULT_EFFECT
)
!=
0
&&
target
==
parent
)
{
if
(
can_directly
&&
expects_def
&&
target
==
parent
)
{
render_filter_bypass
(
target
,
effect
,
width
,
height
,
yuv
);
render_filter_bypass
(
target
,
effect
,
width
,
height
,
yuv
);
return
;
return
;
}
}
if
(
texrender_begin
(
texrender
,
cx
,
cy
))
{
if
(
texrender_begin
(
texrender
,
cx
,
cy
))
{
gs_ortho
(
0
.
0
f
,
(
float
)
cx
,
0
.
0
f
,
(
float
)
cy
,
-
100
.
0
f
,
100
.
0
f
);
gs_ortho
(
0
.
0
f
,
(
float
)
cx
,
0
.
0
f
,
(
float
)
cy
,
-
100
.
0
f
,
100
.
0
f
);
if
(
expects_def
&&
parent
==
target
)
obs_source_default_render
(
parent
,
yuv
);
else
obs_source_video_render
(
target
);
obs_source_video_render
(
target
);
texrender_end
(
texrender
);
texrender_end
(
texrender
);
}
}
...
...
libobs/obs.h
浏览文件 @
922eb7b8
...
@@ -60,6 +60,11 @@ enum order_movement {
...
@@ -60,6 +60,11 @@ enum order_movement {
ORDER_MOVE_BOTTOM
ORDER_MOVE_BOTTOM
};
};
enum
allow_direct_render
{
NO_DIRECT_RENDERING
,
ALLOW_DIRECT_RENDERING
,
};
struct
obs_video_info
{
struct
obs_video_info
{
/* graphics module to use (usually "libobs-opengl" or "libobs-d3d11") */
/* graphics module to use (usually "libobs-opengl" or "libobs-d3d11") */
const
char
*
graphics_module
;
const
char
*
graphics_module
;
...
@@ -412,7 +417,8 @@ EXPORT void obs_source_releaseframe(obs_source_t source,
...
@@ -412,7 +417,8 @@ EXPORT void obs_source_releaseframe(obs_source_t source,
/** Default RGB filter handler for generic effect filters */
/** Default RGB filter handler for generic effect filters */
EXPORT
void
obs_source_process_filter
(
obs_source_t
filter
,
EXPORT
void
obs_source_process_filter
(
obs_source_t
filter
,
texrender_t
texrender
,
effect_t
effect
,
texrender_t
texrender
,
effect_t
effect
,
uint32_t
width
,
uint32_t
height
);
uint32_t
width
,
uint32_t
height
,
enum
allow_direct_render
allow_direct
);
/* ------------------------------------------------------------------------- */
/* ------------------------------------------------------------------------- */
...
...
test/test-input/test-filter.c
浏览文件 @
922eb7b8
...
@@ -56,5 +56,5 @@ void test_video_tick(struct test_filter *tf, float seconds)
...
@@ -56,5 +56,5 @@ void test_video_tick(struct test_filter *tf, float seconds)
void
test_video_render
(
struct
test_filter
*
tf
)
void
test_video_render
(
struct
test_filter
*
tf
)
{
{
obs_source_process_filter
(
tf
->
source
,
tf
->
texrender
,
tf
->
whatever
,
obs_source_process_filter
(
tf
->
source
,
tf
->
texrender
,
tf
->
whatever
,
0
,
0
);
0
,
0
,
ALLOW_DIRECT_RENDERING
);
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录