Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
e31fea66
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,发现更多精彩内容 >>
提交
e31fea66
编写于
3月 22, 2015
作者:
J
jp9000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
libobs: Add API to mute/unmute sources
上级
f04ef236
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
1 deletion
+33
-1
libobs/obs-internal.h
libobs/obs-internal.h
+1
-0
libobs/obs-source.c
libobs/obs-source.c
+24
-1
libobs/obs.c
libobs/obs.c
+5
-0
libobs/obs.h
libobs/obs.h
+3
-0
未找到文件。
libobs/obs-internal.h
浏览文件 @
e31fea66
...
...
@@ -322,6 +322,7 @@ struct obs_source {
/* audio */
bool
audio_failed
;
bool
muted
;
struct
resample_info
sample_info
;
audio_resampler_t
*
resampler
;
audio_line_t
*
audio_line
;
...
...
libobs/obs-source.c
浏览文件 @
e31fea66
...
...
@@ -78,6 +78,7 @@ static const char *source_signals[] = {
"void deactivate(ptr source)"
,
"void show(ptr source)"
,
"void hide(ptr source)"
,
"void mute(ptr source, bool muted)"
,
"void enable(ptr source, bool enabled)"
,
"void rename(ptr source, string new_name, string prev_name)"
,
"void volume(ptr source, in out float volume)"
,
...
...
@@ -729,7 +730,7 @@ static void source_output_audio_line(obs_source_t *source,
source
->
present_volume
*
obs
->
audio
.
user_volume
*
obs
->
audio
.
present_volume
;
if
(
!
source
->
enabled
)
if
(
!
source
->
enabled
||
source
->
muted
)
in
.
volume
=
0
.
0
f
;
audio_line_output
(
source
->
audio_line
,
&
in
);
...
...
@@ -2627,3 +2628,25 @@ void obs_source_set_enabled(obs_source_t *source, bool enabled)
calldata_free
(
&
data
);
}
bool
obs_source_muted
(
const
obs_source_t
*
source
)
{
return
source
?
source
->
muted
:
false
;
}
void
obs_source_set_muted
(
obs_source_t
*
source
,
bool
muted
)
{
struct
calldata
data
=
{
0
};
if
(
!
source
)
return
;
source
->
muted
=
muted
;
calldata_set_ptr
(
&
data
,
"source"
,
source
);
calldata_set_bool
(
&
data
,
"muted"
,
muted
);
signal_handler_signal
(
source
->
context
.
signals
,
"mute"
,
&
data
);
calldata_free
(
&
data
);
}
libobs/obs.c
浏览文件 @
e31fea66
...
...
@@ -1291,6 +1291,9 @@ static obs_source_t *obs_load_source_type(obs_data_t *source_data,
obs_source_set_enabled
(
source
,
obs_data_get_bool
(
source_data
,
"enabled"
));
obs_data_set_default_bool
(
source_data
,
"muted"
,
false
);
obs_source_set_muted
(
source
,
obs_data_get_bool
(
source_data
,
"muted"
));
if
(
filters
)
{
size_t
count
=
obs_data_array_count
(
filters
);
...
...
@@ -1361,6 +1364,7 @@ obs_data_t *obs_save_source(obs_source_t *source)
const
char
*
name
=
obs_source_get_name
(
source
);
const
char
*
id
=
obs_source_get_id
(
source
);
bool
enabled
=
obs_source_enabled
(
source
);
bool
muted
=
obs_source_muted
(
source
);
obs_source_save
(
source
);
...
...
@@ -1372,6 +1376,7 @@ obs_data_t *obs_save_source(obs_source_t *source)
obs_data_set_int
(
source_data
,
"flags"
,
flags
);
obs_data_set_double
(
source_data
,
"volume"
,
volume
);
obs_data_set_bool
(
source_data
,
"enabled"
,
enabled
);
obs_data_set_bool
(
source_data
,
"muted"
,
muted
);
pthread_mutex_lock
(
&
source
->
filter_mutex
);
...
...
libobs/obs.h
浏览文件 @
e31fea66
...
...
@@ -828,6 +828,9 @@ EXPORT obs_source_t *obs_source_get_filter_by_name(obs_source_t *source,
EXPORT
bool
obs_source_enabled
(
const
obs_source_t
*
source
);
EXPORT
void
obs_source_set_enabled
(
obs_source_t
*
source
,
bool
enabled
);
EXPORT
bool
obs_source_muted
(
const
obs_source_t
*
source
);
EXPORT
void
obs_source_set_muted
(
obs_source_t
*
source
,
bool
muted
);
/* ------------------------------------------------------------------------- */
/* Functions used by sources */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录