Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
c129cc37
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,发现更多精彩内容 >>
提交
c129cc37
编写于
12月 30, 2013
作者:
J
jp9000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update API and implement preliminary ability to add sources to scenes
上级
146912d5
变更
13
显示空白变更内容
内联
并排
Showing
13 changed file
with
149 addition
and
35 deletion
+149
-35
build/data/obs-studio/locale/en.txt
build/data/obs-studio/locale/en.txt
+3
-0
libobs/obs-module.c
libobs/obs-module.c
+4
-4
libobs/obs-output.c
libobs/obs-output.c
+1
-1
libobs/obs-output.h
libobs/obs-output.h
+1
-1
libobs/obs-scene.c
libobs/obs-scene.c
+18
-4
libobs/obs-source.c
libobs/obs-source.c
+27
-14
libobs/obs-source.h
libobs/obs-source.h
+1
-1
libobs/obs.h
libobs/obs.h
+9
-3
obs/obs-app.cpp
obs/obs-app.cpp
+2
-0
obs/obs-app.hpp
obs/obs-app.hpp
+11
-3
obs/window-basic-main.cpp
obs/window-basic-main.cpp
+68
-3
obs/window-basic-main.hpp
obs/window-basic-main.hpp
+3
-0
test/test-input/test-random.c
test/test-input/test-random.c
+1
-1
未找到文件。
build/data/obs-studio/locale/en.txt
浏览文件 @
c129cc37
...
...
@@ -12,6 +12,9 @@ MainMenu.FIle.Save="Save"
MainWindow.AddSceneDlg.Title="Add Scene"
MainWindow.AddSceneDlg.Text="Please enter the name of the scene"
MainWindow.AddSourceDlg.Title="Add Source"
MainWindow.AddSourceDlg.Text="Please enter the name of the source"
MainWindow.NameExists.Title="Name already exists"
MainWindow.NameExists.Text="The name is already in use by another source."
...
...
libobs/obs-module.c
浏览文件 @
c129cc37
...
...
@@ -147,13 +147,13 @@ int obs_load_module(const char *path)
mod
.
name
=
bstrdup
(
path
);
module_load_exports
(
&
mod
,
&
obs
->
input_types
.
da
,
"inputs"
,
sizeof
(
struct
source_info
),
get
_source_info
);
sizeof
(
struct
source_info
),
load
_source_info
);
module_load_exports
(
&
mod
,
&
obs
->
filter_types
.
da
,
"filters"
,
sizeof
(
struct
source_info
),
get
_source_info
);
sizeof
(
struct
source_info
),
load
_source_info
);
module_load_exports
(
&
mod
,
&
obs
->
transition_types
.
da
,
"transitions"
,
sizeof
(
struct
source_info
),
get
_source_info
);
sizeof
(
struct
source_info
),
load
_source_info
);
module_load_exports
(
&
mod
,
&
obs
->
output_types
.
da
,
"outputs"
,
sizeof
(
struct
output_info
),
get
_output_info
);
sizeof
(
struct
output_info
),
load
_output_info
);
da_push_back
(
obs
->
modules
,
&
mod
);
return
MODULE_SUCCESS
;
...
...
libobs/obs-output.c
浏览文件 @
c129cc37
...
...
@@ -18,7 +18,7 @@
#include "obs.h"
#include "obs-data.h"
bool
get
_output_info
(
void
*
module
,
const
char
*
module_name
,
bool
load
_output_info
(
void
*
module
,
const
char
*
module_name
,
const
char
*
output_id
,
struct
output_info
*
info
)
{
info
->
getname
=
load_module_subfunc
(
module
,
module_name
,
...
...
libobs/obs-output.h
浏览文件 @
c129cc37
...
...
@@ -119,5 +119,5 @@ struct obs_output {
struct
dstr
settings
;
};
extern
bool
get
_output_info
(
void
*
module
,
const
char
*
module_name
,
extern
bool
load
_output_info
(
void
*
module
,
const
char
*
module_name
,
const
char
*
output_name
,
struct
output_info
*
info
);
libobs/obs-scene.c
浏览文件 @
c129cc37
...
...
@@ -119,10 +119,16 @@ obs_scene_t obs_scene_create(const char *name)
return
scene
;
}
void
obs_scene_release
(
obs_scene_t
scene
)
int
obs_scene_addref
(
obs_scene_t
scene
)
{
return
obs_source_addref
(
scene
->
source
);
}
int
obs_scene_release
(
obs_scene_t
scene
)
{
if
(
scene
)
obs_source_release
(
scene
->
source
);
return
obs_source_release
(
scene
->
source
);
return
0
;
}
obs_source_t
obs_scene_getsource
(
obs_scene_t
scene
)
...
...
@@ -154,15 +160,23 @@ obs_sceneitem_t obs_scene_add(obs_scene_t scene, obs_source_t source)
return
item
;
}
void
obs_sceneitem_destroy
(
obs_sceneitem_t
item
)
int
obs_sceneitem_destroy
(
obs_sceneitem_t
item
)
{
int
ref
=
0
;
if
(
item
)
{
if
(
item
->
source
)
obs_source_release
(
item
->
source
);
ref
=
obs_source_release
(
item
->
source
);
da_erase_item
(
item
->
parent
->
items
,
item
);
bfree
(
item
);
}
return
ref
;
}
obs_source_t
obs_sceneitem_getsource
(
obs_sceneitem_t
item
)
{
return
item
->
source
;
}
void
obs_sceneitem_setpos
(
obs_sceneitem_t
item
,
const
struct
vec2
*
pos
)
...
...
libobs/obs-source.c
浏览文件 @
c129cc37
...
...
@@ -25,7 +25,7 @@
static
void
obs_source_destroy
(
obs_source_t
source
);
bool
get
_source_info
(
void
*
module
,
const
char
*
module_name
,
bool
load
_source_info
(
void
*
module
,
const
char
*
module_name
,
const
char
*
source_id
,
struct
source_info
*
info
)
{
info
->
getname
=
load_module_subfunc
(
module
,
module_name
,
...
...
@@ -85,6 +85,24 @@ static inline const struct source_info *find_source(struct darray *list,
return
NULL
;
}
static
const
struct
source_info
*
get_source_info
(
enum
source_type
type
,
const
char
*
id
)
{
struct
darray
*
list
=
NULL
;
switch
(
type
)
{
case
SOURCE_INPUT
:
list
=
&
obs
->
input_types
.
da
;
break
;
case
SOURCE_FILTER
:
list
=
&
obs
->
filter_types
.
da
;
break
;
case
SOURCE_TRANSITION
:
list
=
&
obs
->
transition_types
.
da
;
break
;
case
SOURCE_SCENE
:
default:
blog
(
LOG_WARNING
,
"get_source_info: invalid source type"
);
return
NULL
;
}
return
find_source
(
list
,
id
);
}
static
inline
bool
obs_source_init_handlers
(
struct
obs_source
*
source
)
{
source
->
signals
=
signal_handler_create
();
...
...
@@ -95,6 +113,13 @@ static inline bool obs_source_init_handlers(struct obs_source *source)
return
(
source
->
procs
!=
NULL
);
}
const
char
*
obs_source_getdisplayname
(
enum
obs_source_type
type
,
const
char
*
id
,
const
char
*
locale
)
{
const
struct
source_info
*
info
=
get_source_info
(
type
,
id
);
return
(
info
!=
NULL
)
?
info
->
getname
(
locale
)
:
NULL
;
}
/* internal initialization */
bool
obs_source_init
(
struct
obs_source
*
source
,
const
char
*
settings
,
const
struct
source_info
*
info
)
...
...
@@ -141,21 +166,9 @@ static inline void obs_source_dosignal(struct obs_source *source,
obs_source_t
obs_source_create
(
enum
obs_source_type
type
,
const
char
*
id
,
const
char
*
name
,
const
char
*
settings
)
{
const
struct
source_info
*
info
=
NULL
;
struct
darray
*
list
=
NULL
;
struct
obs_source
*
source
;
switch
(
type
)
{
case
SOURCE_INPUT
:
list
=
&
obs
->
input_types
.
da
;
break
;
case
SOURCE_FILTER
:
list
=
&
obs
->
filter_types
.
da
;
break
;
case
SOURCE_TRANSITION
:
list
=
&
obs
->
transition_types
.
da
;
break
;
case
SOURCE_SCENE
:
default:
blog
(
LOG_WARNING
,
"Tried to create invalid source type"
);
return
NULL
;
}
info
=
find_source
(
list
,
id
);
const
struct
source_info
*
info
=
get_source_info
(
type
,
id
);
if
(
!
info
)
{
blog
(
LOG_WARNING
,
"Source '%s' not found"
,
id
);
return
NULL
;
...
...
libobs/obs-source.h
浏览文件 @
c129cc37
...
...
@@ -249,7 +249,7 @@ struct obs_source {
bool
rendering_filter
;
};
extern
bool
get
_source_info
(
void
*
module
,
const
char
*
module_name
,
extern
bool
load
_source_info
(
void
*
module
,
const
char
*
module_name
,
const
char
*
source_name
,
struct
source_info
*
info
);
extern
bool
obs_source_init
(
struct
obs_source
*
source
,
const
char
*
settings
,
...
...
libobs/obs.h
浏览文件 @
c129cc37
...
...
@@ -445,7 +445,9 @@ EXPORT void obs_source_process_filter(obs_source_t filter,
* display oriantations. Scenes can also be used like any other source.
*/
EXPORT
obs_scene_t
obs_scene_create
(
const
char
*
name
);
EXPORT
void
obs_scene_release
(
obs_scene_t
scene
);
EXPORT
int
obs_scene_addref
(
obs_scene_t
scene
);
EXPORT
int
obs_scene_release
(
obs_scene_t
scene
);
/** Gets the scene's source context */
EXPORT
obs_source_t
obs_scene_getsource
(
obs_scene_t
scene
);
...
...
@@ -456,8 +458,12 @@ EXPORT obs_scene_t obs_scene_fromsource(obs_source_t source);
/** Adds/creates a new scene item for a source */
EXPORT
obs_sceneitem_t
obs_scene_add
(
obs_scene_t
scene
,
obs_source_t
source
);
/** Removes/destroys a scene item */
EXPORT
void
obs_sceneitem_destroy
(
obs_sceneitem_t
item
);
/** Removes/destroys a scene item. Returns the source reference counter
* (if any) */
EXPORT
int
obs_sceneitem_destroy
(
obs_sceneitem_t
item
);
/** Gets the source of a scene item */
EXPORT
obs_source_t
obs_sceneitem_getsource
(
obs_sceneitem_t
item
);
/* Functions for gettings/setting specific oriantation of a scene item */
EXPORT
void
obs_sceneitem_setpos
(
obs_sceneitem_t
item
,
const
struct
vec2
*
pos
);
...
...
obs/obs-app.cpp
浏览文件 @
c129cc37
...
...
@@ -136,6 +136,8 @@ bool OBSApp::InitLocale()
const
char
*
lang
=
config_get_string
(
globalConfig
,
"General"
,
"Language"
);
locale
=
lang
;
stringstream
file
;
file
<<
"locale/"
<<
lang
<<
".txt"
;
...
...
obs/obs-app.hpp
浏览文件 @
c129cc37
...
...
@@ -22,12 +22,15 @@
#include <util/util.hpp>
#include <string>
class
OBSAppBase
:
public
wxApp
{
public:
virtual
~
OBSAppBase
();
};
class
OBSApp
:
public
OBSAppBase
{
std
::
string
locale
;
ConfigFile
globalConfig
;
TextLookup
textLookup
;
wxWindow
*
mainWindow
;
...
...
@@ -51,6 +54,11 @@ public:
inline
config_t
GlobalConfig
()
const
{
return
globalConfig
;}
inline
const
char
*
GetLocale
()
const
{
return
locale
.
c_str
();
}
inline
const
char
*
GetString
(
const
char
*
lookupVal
)
const
{
return
textLookup
.
GetString
(
lookupVal
);
...
...
obs/window-basic-main.cpp
浏览文件 @
c129cc37
...
...
@@ -91,7 +91,8 @@ bool OBSBasic::Init()
//obs_scene_t scene = obs_scene_create("test scene");
//obs_add_source(obs_scene_getsource(scene));
//obs_load_module("test-input");
/* TODO: this is a test */
obs_load_module
(
"test-input"
);
return
true
;
}
...
...
@@ -259,13 +260,77 @@ void OBSBasic::sourcesRDown(wxMouseEvent &event)
{
}
void
OBSBasic
::
sourceAddClicked
(
wxCommandEvent
&
event
)
void
OBSBasic
::
AddSource
(
obs_scene_t
scene
,
const
char
*
id
)
{
string
name
;
bool
success
=
false
;
while
(
!
success
)
{
int
ret
=
NameDialog
::
AskForName
(
this
,
Str
(
"MainWindow.AddSourceDlg.Title"
),
Str
(
"MainWindow.AddSourceDlg.Text"
),
name
);
if
(
ret
==
wxID_CANCEL
)
break
;
obs_source_t
source
=
obs_get_source_by_name
(
name
.
c_str
());
if
(
!
source
)
{
success
=
true
;
}
else
{
wxMessageBox
(
WXStr
(
"MainWindow.NameExists.Text"
),
WXStr
(
"MainWindow.NameExists.Title"
),
wxOK
|
wxCENTRE
,
this
);
obs_source_release
(
source
);
}
}
if
(
success
)
{
obs_source_t
source
=
obs_source_create
(
SOURCE_INPUT
,
id
,
name
.
c_str
(),
NULL
);
obs_add_source
(
source
);
obs_sceneitem_t
item
=
obs_scene_add
(
scene
,
source
);
obs_source_release
(
source
);
}
}
void
OBSBasic
::
AddSourcePopup
()
{
int
sceneSel
=
scenes
->
GetSelection
();
size_t
idx
=
0
;
const
char
*
type
;
vector
<
const
char
*>
types
;
if
(
sceneSel
==
wxNOT_FOUND
)
return
;
obs_scene_t
scene
=
(
obs_scene_t
)
scenes
->
GetClientData
(
sceneSel
);
obs_scene_addref
(
scene
);
unique_ptr
<
wxMenu
>
popup
(
new
wxMenu
());
while
(
obs_enum_input_types
(
idx
,
&
type
))
{
const
char
*
name
=
obs_source_getdisplayname
(
SOURCE_INPUT
,
type
,
wxGetApp
().
GetLocale
());
types
.
push_back
(
type
);
popup
->
Append
((
int
)
idx
,
wxString
(
name
,
wxConvUTF8
));
idx
++
;
}
if
(
idx
)
{
int
id
=
WXDoPopupMenu
(
this
,
popup
.
get
());
if
(
id
!=
-
1
)
AddSource
(
scene
,
types
[
id
]);
}
obs_scene_release
(
scene
);
}
void
OBSBasic
::
sourceAddClicked
(
wxCommandEvent
&
event
)
{
AddSourcePopup
();
}
void
OBSBasic
::
sourceRemoveClicked
(
wxCommandEvent
&
event
)
...
...
obs/window-basic-main.hpp
浏览文件 @
c129cc37
...
...
@@ -28,6 +28,9 @@ class OBSBasic : public OBSBasicBase {
static
void
SourceAdded
(
void
*
data
,
calldata_t
params
);
static
void
SourceDestroyed
(
void
*
data
,
calldata_t
params
);
void
AddSource
(
obs_scene_t
scene
,
const
char
*
id
);
void
AddSourcePopup
();
bool
InitGraphics
();
void
NewProject
();
...
...
test/test-input/test-random.c
浏览文件 @
c129cc37
...
...
@@ -3,7 +3,7 @@
const
char
*
random_getname
(
const
char
*
locale
)
{
return
"Random
;
"
;
return
"Random
Source
"
;
}
struct
random_tex
*
random_create
(
const
char
*
settings
,
obs_source_t
source
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录