Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
399b0c8d
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,发现更多精彩内容 >>
提交
399b0c8d
编写于
12月 22, 2013
作者:
J
jp9000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
apply configure video settings on startup
上级
991b5739
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
197 addition
and
59 deletion
+197
-59
build/data/obs-studio/locale/en.txt
build/data/obs-studio/locale/en.txt
+1
-2
libobs/obs.c
libobs/obs.c
+2
-2
libobs/util/util.hpp
libobs/util/util.hpp
+3
-3
obs/obs-app.cpp
obs/obs-app.cpp
+78
-32
obs/obs-app.hpp
obs/obs-app.hpp
+15
-3
obs/settings-basic-general.cpp
obs/settings-basic-general.cpp
+1
-1
obs/settings-basic-video.cpp
obs/settings-basic-video.cpp
+39
-16
obs/window-main-basic.cpp
obs/window-main-basic.cpp
+46
-0
obs/window-main-basic.hpp
obs/window-main-basic.hpp
+12
-0
未找到文件。
build/data/obs-studio/locale/en.txt
浏览文件 @
399b0c8d
...
...
@@ -23,13 +23,12 @@ MainWindow.Volume="Volume:"
Settings="Settings"
Settings.
StreamRestart="All streaming/recording must be stopped in order for these changes to take effect
"
Settings.
ProgramRestart="The program must be restarted for these settings to take effect.
"
Settings.ConfirmTitle="Confirm Changes"
Settings.Confirm="You have unsaved changes. Save changes?"
Settings.General="General"
Settings.General.Language="Language:"
Settings.General.LanguageChanged="The program must be restarted in order to change the language"
Settings.Outputs="Outputs"
...
...
libobs/obs.c
浏览文件 @
399b0c8d
...
...
@@ -343,7 +343,7 @@ bool obs_get_video_info(struct obs_video_info *ovi)
struct
obs_video
*
video
=
&
obs
->
video
;
const
struct
video_info
*
info
;
if
(
!
video
->
graphics
)
if
(
!
obs
||
!
video
->
graphics
)
return
false
;
info
=
video_output_getinfo
(
video
->
video
);
...
...
@@ -365,7 +365,7 @@ bool obs_get_audio_info(struct audio_info *ai)
struct
obs_audio
*
audio
=
&
obs
->
audio
;
const
struct
audio_info
*
info
;
if
(
!
audio
->
audio
)
if
(
!
obs
||
!
audio
->
audio
)
return
false
;
info
=
audio_output_getinfo
(
audio
->
audio
);
...
...
libobs/util/util.hpp
浏览文件 @
399b0c8d
...
...
@@ -89,7 +89,7 @@ public:
config
=
NULL
;
}
inline
operator
config_t
()
{
return
config
;}
inline
operator
config_t
()
const
{
return
config
;}
};
class
TextLookup
{
...
...
@@ -114,9 +114,9 @@ public:
return
*
this
;
}
inline
operator
lookup_t
()
{
return
lookup
;}
inline
operator
lookup_t
()
const
{
return
lookup
;}
inline
const
char
*
GetString
(
const
char
*
lookupVal
)
inline
const
char
*
GetString
(
const
char
*
lookupVal
)
const
{
const
char
*
out
;
if
(
!
text_lookup_getstr
(
lookup
,
lookupVal
,
&
out
))
...
...
obs/obs-app.cpp
浏览文件 @
399b0c8d
...
...
@@ -183,61 +183,107 @@ bool OBSApp::InitLocale()
return
true
;
}
bool
OBSApp
::
InitOBSBasic
()
{
OBSBasic
*
obsBasic
=
new
OBSBasic
();
obsBasic
->
Show
();
mainWindow
=
obsBasic
;
return
obsBasic
->
Init
();
}
bool
OBSApp
::
OnInit
()
{
base_set_log_handler
(
do_log
);
if
(
!
wxApp
::
OnInit
())
return
false
;
wxInitAllImageHandlers
();
if
(
!
MakeUserDirs
())
return
false
;
if
(
!
InitGlobalConfig
())
return
false
;
if
(
!
InitLocale
())
return
false
;
if
(
!
obs_startup
())
if
(
!
InitOBSBasic
())
return
false
;
wxInitAllImageHandlers
();
OBSBasic
*
mainWindow
=
new
OBSBasic
();
wxSize
size
=
mainWindow
->
GetPreviewPanel
()
->
GetClientSize
();
mainWindow
->
Show
();
return
true
;
}
/* this is a test */
struct
obs_video_info
ovi
;
ovi
.
graphics_module
=
"libobs-opengl"
;
ovi
.
fps_num
=
30000
;
ovi
.
fps_den
=
1001
;
ovi
.
window_width
=
size
.
x
;
ovi
.
window_height
=
size
.
y
;
ovi
.
base_width
=
1920
;
ovi
.
base_height
=
1080
;
ovi
.
output_width
=
1280
;
ovi
.
output_height
=
720
;
ovi
.
output_format
=
VIDEO_FORMAT_RGBA
;
ovi
.
adapter
=
0
;
ovi
.
window
=
WxToGSWindow
(
mainWindow
->
GetPreviewPanel
());
int
OBSApp
::
OnExit
()
{
return
wxApp
::
OnExit
();
}
if
(
!
obs_reset_video
(
&
ovi
))
return
false
;
void
OBSApp
::
GetFPSCommon
(
uint32_t
&
num
,
uint32_t
&
den
)
const
{
const
char
*
val
=
config_get_string
(
globalConfig
,
"Video"
,
"FPSCommon"
);
if
(
strcmp
(
val
,
"10"
)
==
0
)
{
num
=
30
;
den
=
1
;
}
else
if
(
strcmp
(
val
,
"20"
)
==
0
)
{
num
=
20
;
den
=
1
;
}
else
if
(
strcmp
(
val
,
"29.97"
)
==
0
)
{
num
=
30000
;
den
=
1001
;
}
else
if
(
strcmp
(
val
,
"48"
)
==
0
)
{
num
=
48
;
den
=
1
;
}
else
if
(
strcmp
(
val
,
"59.94"
)
==
0
)
{
num
=
60000
;
den
=
1001
;
}
else
if
(
strcmp
(
val
,
"60"
)
==
0
)
{
num
=
60
;
den
=
1
;
}
else
{
num
=
30
;
den
=
1
;
}
}
//required to make opengl display stuff on osx(?)
mainWindow
->
SendSizeEvent
();
void
OBSApp
::
GetFPSInteger
(
uint32_t
&
num
,
uint32_t
&
den
)
const
{
num
=
(
uint32_t
)
config_get_uint
(
globalConfig
,
"Video"
,
"FPSInt"
);
den
=
1
;
}
return
true
;
void
OBSApp
::
GetFPSFraction
(
uint32_t
&
num
,
uint32_t
&
den
)
const
{
num
=
(
uint32_t
)
config_get_uint
(
globalConfig
,
"Video"
,
"FPSNum"
);
den
=
(
uint32_t
)
config_get_uint
(
globalConfig
,
"Video"
,
"FPSDen"
);
}
int
OBSApp
::
OnExit
()
void
OBSApp
::
GetFPSNanoseconds
(
uint32_t
&
num
,
uint32_t
&
den
)
const
{
obs_shutdown
();
num
=
1000000000
;
den
=
(
uint32_t
)
config_get_uint
(
globalConfig
,
"Video"
,
"FPSNS"
);
}
return
wxApp
::
OnExit
();
void
OBSApp
::
GetConfigFPS
(
uint32_t
&
num
,
uint32_t
&
den
)
const
{
const
char
*
type
=
config_get_string
(
globalConfig
,
"Video"
,
"FPSType"
);
if
(
astrcmpi
(
type
,
"Integer"
)
==
0
)
GetFPSInteger
(
num
,
den
);
else
if
(
astrcmpi
(
type
,
"Fraction"
)
==
0
)
GetFPSFraction
(
num
,
den
);
else
if
(
astrcmpi
(
type
,
"Nanoseconds"
)
==
0
)
GetFPSNanoseconds
(
num
,
den
);
else
GetFPSCommon
(
num
,
den
);
}
void
OBSApp
::
CleanUp
()
const
char
*
OBSApp
::
GetRenderModule
()
const
{
wxApp
::
CleanUp
();
const
char
*
renderer
=
config_get_string
(
globalConfig
,
"Video"
,
"Renderer"
);
if
(
astrcmpi
(
renderer
,
"Direct3D 11"
)
==
0
)
return
"libobs-d3d11"
;
else
return
"libobs-opengl"
;
}
obs/obs-app.hpp
浏览文件 @
399b0c8d
...
...
@@ -18,6 +18,7 @@
#pragma once
#include <wx/app.h>
#include <wx/window.h>
#include <util/util.hpp>
...
...
@@ -29,23 +30,34 @@ public:
class
OBSApp
:
public
OBSAppBase
{
ConfigFile
globalConfig
;
TextLookup
textLookup
;
wxWindow
*
mainWindow
;
bool
InitGlobalConfig
();
bool
InitGlobalConfigDefaults
();
bool
InitConfigDefaults
();
bool
InitLocale
();
bool
InitOBSBasic
();
void
GetFPSCommon
(
uint32_t
&
num
,
uint32_t
&
den
)
const
;
void
GetFPSInteger
(
uint32_t
&
num
,
uint32_t
&
den
)
const
;
void
GetFPSFraction
(
uint32_t
&
num
,
uint32_t
&
den
)
const
;
void
GetFPSNanoseconds
(
uint32_t
&
num
,
uint32_t
&
den
)
const
;
public:
virtual
bool
OnInit
();
virtual
int
OnExit
();
virtual
void
CleanUp
();
inline
config_t
GlobalConfig
()
{
return
globalConfig
;}
inline
wxWindow
*
GetMainWindow
()
const
{
return
mainWindow
;}
inline
config_t
GlobalConfig
()
const
{
return
globalConfig
;}
inline
const
char
*
GetString
(
const
char
*
lookupVal
)
inline
const
char
*
GetString
(
const
char
*
lookupVal
)
const
{
return
textLookup
.
GetString
(
lookupVal
);
}
void
GetConfigFPS
(
uint32_t
&
num
,
uint32_t
&
den
)
const
;
const
char
*
GetRenderModule
()
const
;
};
wxDECLARE_APP
(
OBSApp
);
...
...
obs/settings-basic-general.cpp
浏览文件 @
399b0c8d
...
...
@@ -103,7 +103,7 @@ void BasicGenData::LanguageChanged(wxCommandEvent &event)
{
SetChanged
();
window
->
generalChangedText
->
SetLabel
(
WXStr
(
"Settings.General.
LanguageChanged
"
));
WXStr
(
"Settings.General.
ProgramRestart
"
));
window
->
generalChangedText
->
Show
();
}
...
...
obs/settings-basic-video.cpp
浏览文件 @
399b0c8d
...
...
@@ -40,8 +40,10 @@ class BasicVideoData : public BasicSettingsData {
void
LoadFPSNanoseconds
();
void
ResetScaleList
(
uint32_t
cx
,
uint32_t
cy
);
void
BaseResListChanged
(
wxCommandEvent
&
event
);
void
OutputResListChanged
(
wxCommandEvent
&
event
);
void
RendererChanged
(
wxCommandEvent
&
event
);
void
BaseResChanged
(
wxCommandEvent
&
event
);
void
OutputResChanged
(
wxCommandEvent
&
event
);
void
FPSChanged
(
wxCommandEvent
&
event
);
void
SaveOther
();
void
SaveFPSData
();
...
...
@@ -280,6 +282,11 @@ void BasicVideoData::ResetScaleList(uint32_t cx, uint32_t cy)
}
}
#define ADD_CONNECT(control, event, func) \
connections.Add(window->control, event, \
wxCommandEventHandler(BasicVideoData::func), \
NULL, this)
BasicVideoData
::
BasicVideoData
(
OBSBasicSettings
*
window
)
:
BasicSettingsData
(
window
)
{
...
...
@@ -288,19 +295,37 @@ BasicVideoData::BasicVideoData(OBSBasicSettings *window)
LoadOther
();
/* load connectors after loading data to prevent them from triggering */
connections
.
Add
(
window
->
baseResList
,
wxEVT_TEXT
,
wxCommandEventHandler
(
BasicVideoData
::
BaseResListChanged
),
NULL
,
this
);
connections
.
Add
(
window
->
outputResList
,
wxEVT_TEXT
,
wxCommandEventHandler
(
BasicVideoData
::
OutputResListChanged
),
NULL
,
this
);
ADD_CONNECT
(
baseResList
,
wxEVT_TEXT
,
BaseResChanged
);
ADD_CONNECT
(
outputResList
,
wxEVT_TEXT
,
OutputResChanged
);
ADD_CONNECT
(
rendererList
,
wxEVT_COMBOBOX
,
RendererChanged
);
ADD_CONNECT
(
fpsCommonList
,
wxEVT_COMBOBOX
,
FPSChanged
);
ADD_CONNECT
(
fpsIntegerScroller
,
wxEVT_SPINCTRL
,
FPSChanged
);
ADD_CONNECT
(
fpsNumeratorScroller
,
wxEVT_SPINCTRL
,
FPSChanged
);
ADD_CONNECT
(
fpsDenominatorScroller
,
wxEVT_SPINCTRL
,
FPSChanged
);
ADD_CONNECT
(
fpsNanosecondsScroller
,
wxEVT_SPINCTRL
,
FPSChanged
);
ADD_CONNECT
(
fpsIntegerScroller
,
wxEVT_TEXT
,
FPSChanged
);
ADD_CONNECT
(
fpsNumeratorScroller
,
wxEVT_TEXT
,
FPSChanged
);
ADD_CONNECT
(
fpsDenominatorScroller
,
wxEVT_TEXT
,
FPSChanged
);
ADD_CONNECT
(
fpsNanosecondsScroller
,
wxEVT_TEXT
,
FPSChanged
);
ADD_CONNECT
(
fpsTypeList
,
wxEVT_CHOICEBOOK_PAGE_CHANGED
,
FPSChanged
);
window
->
videoChangedText
->
Hide
();
}
void
BasicVideoData
::
BaseResListChanged
(
wxCommandEvent
&
event
)
void
BasicVideoData
::
RendererChanged
(
wxCommandEvent
&
event
)
{
SetChanged
();
window
->
videoChangedText
->
SetLabel
(
WXStr
(
"Settings.ProgramRestart"
));
window
->
videoChangedText
->
Show
();
}
void
BasicVideoData
::
FPSChanged
(
wxCommandEvent
&
event
)
{
SetChanged
();
}
void
BasicVideoData
::
BaseResChanged
(
wxCommandEvent
&
event
)
{
uint32_t
cx
,
cy
;
if
(
!
ConvertTextRes
(
window
->
baseResList
,
cx
,
cy
))
{
...
...
@@ -311,13 +336,11 @@ void BasicVideoData::BaseResListChanged(wxCommandEvent &event)
}
SetChanged
();
window
->
videoChangedText
->
SetLabel
(
WXStr
(
"Settings.StreamRestart"
));
window
->
videoChangedText
->
Show
();
ResetScaleList
(
cx
,
cy
);
}
void
BasicVideoData
::
OutputRes
List
Changed
(
wxCommandEvent
&
event
)
void
BasicVideoData
::
OutputResChanged
(
wxCommandEvent
&
event
)
{
uint32_t
cx
,
cy
;
if
(
!
ConvertTextRes
(
window
->
outputResList
,
cx
,
cy
))
{
...
...
@@ -328,8 +351,6 @@ void BasicVideoData::OutputResListChanged(wxCommandEvent &event)
}
SetChanged
();
window
->
videoChangedText
->
SetLabel
(
WXStr
(
"Settings.StreamRestart"
));
window
->
videoChangedText
->
Show
();
}
void
BasicVideoData
::
SaveOther
()
...
...
@@ -412,6 +433,8 @@ void BasicVideoData::Apply()
config_save
(
GetGlobalConfig
());
/* TODO: If resolutiosn/fps were chaned, reset video */
SetSaved
();
}
...
...
obs/window-main-basic.cpp
浏览文件 @
399b0c8d
...
...
@@ -18,9 +18,55 @@
#include <obs.hpp>
#include "obs-app.hpp"
#include "wx-wrappers.hpp"
#include "window-settings-basic.hpp"
#include "window-main-basic.hpp"
bool
OBSBasic
::
Init
()
{
if
(
!
obs_startup
())
return
false
;
if
(
!
InitGraphics
())
return
false
;
return
true
;
}
OBSBasic
::~
OBSBasic
()
{
obs_shutdown
();
}
bool
OBSBasic
::
InitGraphics
()
{
wxSize
size
=
previewPanel
->
GetClientSize
();
struct
obs_video_info
ovi
;
wxGetApp
().
GetConfigFPS
(
ovi
.
fps_num
,
ovi
.
fps_den
);
ovi
.
graphics_module
=
wxGetApp
().
GetRenderModule
();
ovi
.
window_width
=
size
.
x
;
ovi
.
window_height
=
size
.
y
;
ovi
.
base_width
=
(
uint32_t
)
config_get_uint
(
GetGlobalConfig
(),
"Video"
,
"BaseCX"
);
ovi
.
base_height
=
(
uint32_t
)
config_get_uint
(
GetGlobalConfig
(),
"Video"
,
"BaseCY"
);
ovi
.
output_width
=
(
uint32_t
)
config_get_uint
(
GetGlobalConfig
(),
"Video"
,
"OutputCX"
);
ovi
.
output_height
=
(
uint32_t
)
config_get_uint
(
GetGlobalConfig
(),
"Video"
,
"OutputCY"
);
ovi
.
output_format
=
VIDEO_FORMAT_RGBA
;
ovi
.
adapter
=
0
;
ovi
.
window
=
WxToGSWindow
(
previewPanel
);
if
(
!
obs_reset_video
(
&
ovi
))
return
false
;
//required to make opengl display stuff on osx(?)
SendSizeEvent
();
return
true
;
}
void
OBSBasic
::
OnClose
(
wxCloseEvent
&
event
)
{
wxGetApp
().
ExitMainLoop
();
...
...
obs/window-main-basic.hpp
浏览文件 @
399b0c8d
...
...
@@ -19,7 +19,16 @@
#include "forms/OBSWindows.h"
#include <obs.hpp>
#include <vector>
using
namespace
std
;
class
OBSBasic
:
public
OBSBasicBase
{
vector
<
OBSSource
>
scenes
;
bool
InitGraphics
();
void
NewProject
();
void
SaveProject
();
void
LoadProject
();
...
...
@@ -49,6 +58,9 @@ protected:
public:
inline
OBSBasic
()
:
OBSBasicBase
(
NULL
)
{}
virtual
~
OBSBasic
();
bool
Init
();
inline
wxPanel
*
GetPreviewPanel
()
{
return
previewPanel
;}
inline
wxSizer
*
GetPreviewContainer
()
{
return
previewContainer
;}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录