Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
b9d6675e
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,发现更多精彩内容 >>
提交
b9d6675e
编写于
3月 01, 2020
作者:
J
jp9000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
libobs: Add ability to rotate async sources
上级
88e8ffc1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
63 addition
and
3 deletion
+63
-3
docs/sphinx/reference-sources.rst
docs/sphinx/reference-sources.rst
+8
-0
libobs/obs-internal.h
libobs/obs-internal.h
+1
-0
libobs/obs-source.c
libobs/obs-source.c
+52
-3
libobs/obs.h
libobs/obs.h
+2
-0
未找到文件。
docs/sphinx/reference-sources.rst
浏览文件 @
b9d6675e
...
...
@@ -1186,6 +1186,14 @@ Functions used by sources
---------------------
.. function:: void obs_source_set_async_rotation(obs_source_t *source, long rotation)
Allows the ability to set rotation (0, 90, 180, -90, 270) for an
async video source. The rotation will be automatically applied to
the source.
---------------------
.. function:: void obs_source_preload_video(obs_source_t *source, const struct obs_source_frame *frame)
Preloads a video frame to ensure a frame is ready for playback as
...
...
libobs/obs-internal.h
浏览文件 @
b9d6675e
...
...
@@ -641,6 +641,7 @@ struct obs_source {
bool
async_cache_full_range
;
enum
gs_color_format
async_texture_formats
[
MAX_AV_PLANES
];
int
async_channel_count
;
long
async_rotation
;
bool
async_flip
;
bool
async_active
;
bool
async_update_texture
;
...
...
libobs/obs-source.c
浏览文件 @
b9d6675e
...
...
@@ -2038,10 +2038,41 @@ static void obs_source_update_async_video(obs_source_t *source)
}
}
static
void
rotate_async_video
(
obs_source_t
*
source
,
long
rotation
)
{
float
x
=
0
;
float
y
=
0
;
switch
(
rotation
)
{
case
90
:
y
=
(
float
)
source
->
async_width
;
break
;
case
270
:
case
-
90
:
x
=
(
float
)
source
->
async_height
;
break
;
case
180
:
x
=
(
float
)
source
->
async_width
;
y
=
(
float
)
source
->
async_height
;
}
gs_matrix_translate3f
(
x
,
y
,
0
);
gs_matrix_rotaa4f
(
0
.
0
f
,
0
.
0
f
,
-
1
.
0
f
,
RAD
((
float
)
rotation
));
}
static
inline
void
obs_source_render_async_video
(
obs_source_t
*
source
)
{
if
(
source
->
async_textures
[
0
]
&&
source
->
async_active
)
if
(
source
->
async_textures
[
0
]
&&
source
->
async_active
)
{
long
rotation
=
source
->
async_rotation
;
if
(
rotation
)
{
gs_matrix_push
();
rotate_async_video
(
source
,
rotation
);
}
obs_source_draw_async_texture
(
source
);
if
(
rotation
)
{
gs_matrix_pop
();
}
}
}
static
inline
void
obs_source_render_filters
(
obs_source_t
*
source
)
...
...
@@ -2165,6 +2196,18 @@ void obs_source_video_render(obs_source_t *source)
obs_source_release
(
source
);
}
static
inline
uint32_t
get_async_width
(
const
obs_source_t
*
source
)
{
return
((
source
->
async_rotation
%
180
)
==
0
)
?
source
->
async_width
:
source
->
async_height
;
}
static
inline
uint32_t
get_async_height
(
const
obs_source_t
*
source
)
{
return
((
source
->
async_rotation
%
180
)
==
0
)
?
source
->
async_height
:
source
->
async_width
;
}
static
uint32_t
get_base_width
(
const
obs_source_t
*
source
)
{
bool
is_filter
=
!!
source
->
filter_parent
;
...
...
@@ -2180,7 +2223,7 @@ static uint32_t get_base_width(const obs_source_t *source)
return
get_base_width
(
source
->
filter_target
);
}
return
source
->
async_active
?
source
->
async_width
:
0
;
return
source
->
async_active
?
get_async_width
(
source
)
:
0
;
}
static
uint32_t
get_base_height
(
const
obs_source_t
*
source
)
...
...
@@ -2198,7 +2241,7 @@ static uint32_t get_base_height(const obs_source_t *source)
return
get_base_height
(
source
->
filter_target
);
}
return
source
->
async_active
?
source
->
async_height
:
0
;
return
source
->
async_active
?
get_async_height
(
source
)
:
0
;
}
static
uint32_t
get_recurse_width
(
obs_source_t
*
source
)
...
...
@@ -2800,6 +2843,12 @@ void obs_source_output_video2(obs_source_t *source,
obs_source_output_video_internal
(
source
,
&
new_frame
);
}
void
obs_source_set_async_rotation
(
obs_source_t
*
source
,
long
rotation
)
{
if
(
source
)
source
->
async_rotation
=
rotation
;
}
static
inline
bool
preload_frame_changed
(
obs_source_t
*
source
,
const
struct
obs_source_frame
*
in
)
{
...
...
libobs/obs.h
浏览文件 @
b9d6675e
...
...
@@ -1175,6 +1175,8 @@ EXPORT void obs_source_output_video(obs_source_t *source,
EXPORT
void
obs_source_output_video2
(
obs_source_t
*
source
,
const
struct
obs_source_frame2
*
frame
);
EXPORT
void
obs_source_set_async_rotation
(
obs_source_t
*
source
,
long
rotation
);
/**
* Preloads asynchronous video data to allow instantaneous playback
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录