Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
f1decd08
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,发现更多精彩内容 >>
提交
f1decd08
编写于
11月 20, 2013
作者:
J
jp9000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
adjusted the way source removal is handled to make it a bit more safe
上级
5fa2f285
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
47 addition
and
31 deletion
+47
-31
libobs/obs-data.h
libobs/obs-data.h
+1
-1
libobs/obs-defs.h
libobs/obs-defs.h
+6
-3
libobs/obs-source.c
libobs/obs-source.c
+29
-6
libobs/obs.c
libobs/obs.c
+0
-17
libobs/obs.h
libobs/obs.h
+11
-4
未找到文件。
libobs/obs-data.h
浏览文件 @
f1decd08
...
...
@@ -33,7 +33,6 @@
/*#include "obs-service.h"*/
#define NUM_TEXTURES 2
#define MAX_CHANNELS 32
struct
obs_display
{
swapchain_t
swap
;
/* can be NULL if just sound */
...
...
@@ -65,6 +64,7 @@ struct obs_audio {
audio_t
audio
;
};
/* user sources, output channels, and displays */
struct
obs_data
{
DARRAY
(
struct
obs_display
*
)
displays
;
DARRAY
(
struct
obs_source
*
)
sources
;
...
...
libobs/obs-defs.h
浏览文件 @
f1decd08
...
...
@@ -17,12 +17,15 @@
#pragma once
/* Maximum number of source channels for output and per display */
#define MAX_CHANNELS 32
#define MODULE_SUCCESS 0
#define MODULE_ERROR -1
#define MODULE_FILENOTFOUND -2
#define MODULE_FUNCTIONNOTFOUND -3
#define MODULE_INCOMPATIBLE_VER -4
#define SOURCE_VIDEO (1<<0)
#define SOURCE_AUDIO (1<<1)
#define SOURCE_ASYNC_VIDEO (1<<2)
#define SOURCE_VIDEO (1<<0)
/* Source has video */
#define SOURCE_AUDIO (1<<1)
/* Source has audio */
#define SOURCE_ASYNC_VIDEO (1<<2)
/* Async video (use with SOURCE_VIDEO) */
libobs/obs-source.c
浏览文件 @
f1decd08
...
...
@@ -192,23 +192,46 @@ static void obs_source_destroy(obs_source_t source)
bfree
(
source
);
}
void
obs_source_addref
(
obs_source_t
source
)
int
obs_source_addref
(
obs_source_t
source
)
{
assert
(
source
!=
NULL
);
if
(
!
source
)
return
;
return
0
;
++
source
->
refs
;
return
++
source
->
refs
;
}
void
obs_source_release
(
obs_source_t
source
)
int
obs_source_release
(
obs_source_t
source
)
{
int
refs
;
assert
(
source
!=
NULL
);
if
(
!
source
)
return
;
return
0
;
if
(
--
source
->
refs
==
0
)
refs
=
--
source
->
refs
;
if
(
refs
==
0
)
obs_source_destroy
(
source
);
return
refs
;
}
void
obs_source_remove
(
obs_source_t
source
)
{
struct
obs_data
*
data
=
&
obs
->
data
;
size_t
id
;
source
->
removed
=
true
;
pthread_mutex_lock
(
&
data
->
sources_mutex
);
id
=
da_find
(
data
->
sources
,
&
source
,
0
);
if
(
id
!=
DARRAY_INVALID
)
{
da_erase_item
(
data
->
sources
,
&
source
);
obs_source_release
(
source
);
}
pthread_mutex_unlock
(
&
data
->
sources_mutex
);
}
bool
obs_source_removed
(
obs_source_t
source
)
...
...
libobs/obs.c
浏览文件 @
f1decd08
...
...
@@ -343,23 +343,6 @@ bool obs_add_source(obs_source_t source)
return
true
;
}
void
obs_delete_source
(
obs_source_t
source
)
{
struct
obs_data
*
data
=
&
obs
->
data
;
size_t
id
;
pthread_mutex_lock
(
&
data
->
sources_mutex
);
id
=
da_find
(
data
->
sources
,
&
source
,
0
);
if
(
id
!=
DARRAY_INVALID
)
{
source
->
removed
=
true
;
da_erase_item
(
data
->
sources
,
&
source
);
obs_source_release
(
source
);
}
pthread_mutex_unlock
(
&
data
->
sources_mutex
);
}
obs_source_t
obs_get_output_source
(
uint32_t
channel
)
{
assert
(
channel
<
MAX_CHANNELS
);
...
...
libobs/obs.h
浏览文件 @
f1decd08
...
...
@@ -200,14 +200,13 @@ EXPORT graphics_t obs_graphics(void);
EXPORT
media_t
obs_media
(
void
);
/**
* Adds
/removes a source to/from
the user source list.
* Adds
a source to
the user source list.
*
* The user source list is the list of sources that are accessible by a user.
* Typically when a transition is active, it is not meant to be accessible by
* users, so there's no reason for a user to see such a source.
*/
EXPORT
bool
obs_add_source
(
obs_source_t
source
);
EXPORT
void
obs_delete_source
(
obs_source_t
source
);
/** Sets/gets the primary output source for a channel. */
EXPORT
void
obs_set_output_source
(
uint32_t
channel
,
obs_source_t
source
);
...
...
@@ -259,8 +258,16 @@ EXPORT const char *obs_source_getdisplayname(enum obs_source_type type,
*/
EXPORT
obs_source_t
obs_source_create
(
enum
obs_source_type
type
,
const
char
*
name
,
const
char
*
settings
);
EXPORT
void
obs_source_addref
(
obs_source_t
source
);
EXPORT
void
obs_source_release
(
obs_source_t
source
);
/**
* Adds/releases a reference to a source. When the last reference is
* released, the source is destroyed.
*/
EXPORT
int
obs_source_addref
(
obs_source_t
source
);
EXPORT
int
obs_source_release
(
obs_source_t
source
);
/** Nofifies all references that the source should be released */
EXPORT
void
obs_source_remove
(
obs_source_t
source
);
/** Returns true if the source should be released */
EXPORT
bool
obs_source_removed
(
obs_source_t
source
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录