Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Obs Studio
提交
0b2fd116
O
Obs Studio
项目概览
小白菜888
/
Obs Studio
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Obs Studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0b2fd116
编写于
7月 01, 2016
作者:
J
jp9000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
UI: Add process priority option for windows
上级
44a523f8
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
125 addition
and
4 deletion
+125
-4
obs/data/locale/en-US.ini
obs/data/locale/en-US.ini
+5
-0
obs/forms/OBSBasicSettings.ui
obs/forms/OBSBasicSettings.ui
+24
-2
obs/obs-app.cpp
obs/obs-app.cpp
+2
-0
obs/platform-windows.cpp
obs/platform-windows.cpp
+15
-0
obs/platform.hpp
obs/platform.hpp
+1
-0
obs/window-basic-main.cpp
obs/window-basic-main.cpp
+37
-1
obs/window-basic-main.hpp
obs/window-basic-main.hpp
+2
-1
obs/window-basic-settings.cpp
obs/window-basic-settings.cpp
+39
-0
未找到文件。
obs/data/locale/en-US.ini
浏览文件 @
0b2fd116
...
...
@@ -509,6 +509,11 @@ Basic.Settings.Audio.UnknownAudioDevice="[Device not connected or not available]
# basic mode 'advanced' settings
Basic.Settings.Advanced
=
"Advanced"
Basic.Settings.Advanced.General.ProcessPriority
=
"Process Priority"
Basic.Settings.Advanced.General.ProcessPriority.High
=
"High"
Basic.Settings.Advanced.General.ProcessPriority.AboveNormal
=
"Above Normal"
Basic.Settings.Advanced.General.ProcessPriority.Normal
=
"Normal"
Basic.Settings.Advanced.General.ProcessPriority.Idle
=
"Idle"
Basic.Settings.Advanced.FormatWarning
=
"Warning: Color formats other than NV12 are primarily intended for recording, and are not recommended when streaming. Streaming may incur increased CPU usage due to color format conversion."
Basic.Settings.Advanced.Audio.BufferingTime
=
"Audio Buffering Time"
Basic.Settings.Advanced.Video.ColorFormat
=
"Color Format"
...
...
obs/forms/OBSBasicSettings.ui
浏览文件 @
0b2fd116
...
...
@@ -2887,8 +2887,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
559
</width>
<height>
563
</height>
<width>
718
</width>
<height>
622
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_16"
>
...
...
@@ -2907,6 +2907,28 @@
<item
alignment=
"Qt::AlignTop"
>
<widget
class=
"QWidget"
name=
"widget_11"
native=
"true"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_17"
>
<item>
<widget
class=
"QGroupBox"
name=
"advancedGeneralGroupBox"
>
<property
name=
"title"
>
<string>
Basic.Settings.General
</string>
</property>
<layout
class=
"QFormLayout"
name=
"formLayout_22"
>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QLabel"
name=
"processPriorityLabel"
>
<property
name=
"text"
>
<string>
Basic.Settings.Advanced.General.ProcessPriority
</string>
</property>
<property
name=
"buddy"
>
<cstring>
processPriority
</cstring>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"processPriority"
/>
</item>
</layout>
</widget>
</item>
<item>
<widget
class=
"QGroupBox"
name=
"advancedVideoContainer"
>
<property
name=
"title"
>
...
...
obs/obs-app.cpp
浏览文件 @
0b2fd116
...
...
@@ -328,6 +328,8 @@ bool OBSApp::InitGlobalConfigDefaults()
config_set_default_string
(
globalConfig
,
"General"
,
"Language"
,
DEFAULT_LANG
);
config_set_default_uint
(
globalConfig
,
"General"
,
"MaxLogs"
,
10
);
config_set_default_string
(
globalConfig
,
"General"
,
"ProcessPriority"
,
"Normal"
);
#if _WIN32
config_set_default_string
(
globalConfig
,
"Video"
,
"Renderer"
,
...
...
obs/platform-windows.cpp
浏览文件 @
0b2fd116
...
...
@@ -215,3 +215,18 @@ void SetAlwaysOnTop(QMainWindow *window, bool enable)
SetWindowPos
(
hwnd
,
enable
?
HWND_TOPMOST
:
HWND_NOTOPMOST
,
0
,
0
,
0
,
0
,
SWP_NOMOVE
|
SWP_NOSIZE
|
SWP_NOACTIVATE
);
}
void
SetProcessPriority
(
const
char
*
priority
)
{
if
(
!
priority
)
return
;
if
(
strcmp
(
priority
,
"High"
)
==
0
)
SetPriorityClass
(
GetCurrentProcess
(),
HIGH_PRIORITY_CLASS
);
else
if
(
strcmp
(
priority
,
"AboveNormal"
)
==
0
)
SetPriorityClass
(
GetCurrentProcess
(),
ABOVE_NORMAL_PRIORITY_CLASS
);
else
if
(
strcmp
(
priority
,
"Normal"
)
==
0
)
SetPriorityClass
(
GetCurrentProcess
(),
NORMAL_PRIORITY_CLASS
);
else
if
(
strcmp
(
priority
,
"Idle"
)
==
0
)
SetPriorityClass
(
GetCurrentProcess
(),
IDLE_PRIORITY_CLASS
);
}
obs/platform.hpp
浏览文件 @
0b2fd116
...
...
@@ -51,6 +51,7 @@ void SetAlwaysOnTop(QMainWindow *window, bool enable);
#ifdef _WIN32
uint32_t
GetWindowsVersion
();
void
SetAeroEnabled
(
bool
enable
);
void
SetProcessPriority
(
const
char
*
priority
);
#endif
#ifdef __APPLE__
...
...
obs/window-basic-main.cpp
浏览文件 @
0b2fd116
...
...
@@ -2267,13 +2267,20 @@ void OBSBasic::SetService(obs_service_t *newService)
service
=
newService
;
}
bool
OBSBasic
::
StreamingActive
()
bool
OBSBasic
::
StreamingActive
()
const
{
if
(
!
outputHandler
)
return
false
;
return
outputHandler
->
StreamingActive
();
}
bool
OBSBasic
::
Active
()
const
{
if
(
!
outputHandler
)
return
false
;
return
outputHandler
->
Active
();
}
#ifdef _WIN32
#define IS_WIN32 1
#else
...
...
@@ -3397,6 +3404,27 @@ void OBSBasic::StartStreaming()
StartRecording
();
}
#ifdef _WIN32
static
inline
void
UpdateProcessPriority
()
{
const
char
*
priority
=
config_get_string
(
App
()
->
GlobalConfig
(),
"General"
,
"ProcessPriority"
);
if
(
priority
&&
strcmp
(
priority
,
"Normal"
)
!=
0
)
SetProcessPriority
(
priority
);
}
static
inline
void
ClearProcessPriority
()
{
const
char
*
priority
=
config_get_string
(
App
()
->
GlobalConfig
(),
"General"
,
"ProcessPriority"
);
if
(
priority
&&
strcmp
(
priority
,
"Normal"
)
!=
0
)
SetProcessPriority
(
"Normal"
);
}
#else
#define UpdateProcessPriority() do {} while(false)
#define ClearProcessPriority() do {} while(false)
#endif
void
OBSBasic
::
StopStreaming
()
{
SaveProject
();
...
...
@@ -3407,6 +3435,7 @@ void OBSBasic::StopStreaming()
if
(
!
outputHandler
->
Active
()
&&
!
ui
->
profileMenu
->
isEnabled
())
{
ui
->
profileMenu
->
setEnabled
(
true
);
App
()
->
DecrementSleepInhibition
();
ClearProcessPriority
();
}
bool
recordWhenStreaming
=
config_get_bool
(
GetGlobalConfig
(),
...
...
@@ -3427,6 +3456,7 @@ void OBSBasic::ForceStopStreaming()
if
(
!
outputHandler
->
Active
()
&&
!
ui
->
profileMenu
->
isEnabled
())
{
ui
->
profileMenu
->
setEnabled
(
true
);
App
()
->
DecrementSleepInhibition
();
ClearProcessPriority
();
}
bool
recordWhenStreaming
=
config_get_bool
(
GetGlobalConfig
(),
...
...
@@ -3457,6 +3487,7 @@ void OBSBasic::StreamDelayStarting(int sec)
if
(
ui
->
profileMenu
->
isEnabled
())
{
ui
->
profileMenu
->
setEnabled
(
false
);
App
()
->
IncrementSleepInhibition
();
UpdateProcessPriority
();
}
}
...
...
@@ -3487,6 +3518,7 @@ void OBSBasic::StreamingStart()
if
(
ui
->
profileMenu
->
isEnabled
())
{
ui
->
profileMenu
->
setEnabled
(
false
);
App
()
->
IncrementSleepInhibition
();
UpdateProcessPriority
();
}
blog
(
LOG_INFO
,
STREAMING_START
);
...
...
@@ -3533,6 +3565,7 @@ void OBSBasic::StreamingStop(int code)
if
(
!
outputHandler
->
Active
()
&&
!
ui
->
profileMenu
->
isEnabled
())
{
ui
->
profileMenu
->
setEnabled
(
true
);
App
()
->
DecrementSleepInhibition
();
ClearProcessPriority
();
}
blog
(
LOG_INFO
,
STREAMING_STOP
);
...
...
@@ -3573,6 +3606,7 @@ void OBSBasic::StopRecording()
if
(
!
outputHandler
->
Active
()
&&
!
ui
->
profileMenu
->
isEnabled
())
{
ui
->
profileMenu
->
setEnabled
(
true
);
App
()
->
DecrementSleepInhibition
();
ClearProcessPriority
();
}
}
...
...
@@ -3584,6 +3618,7 @@ void OBSBasic::RecordingStart()
if
(
ui
->
profileMenu
->
isEnabled
())
{
ui
->
profileMenu
->
setEnabled
(
false
);
App
()
->
IncrementSleepInhibition
();
UpdateProcessPriority
();
}
blog
(
LOG_INFO
,
RECORDING_START
);
...
...
@@ -3614,6 +3649,7 @@ void OBSBasic::RecordingStop(int code)
if
(
!
outputHandler
->
Active
()
&&
!
ui
->
profileMenu
->
isEnabled
())
{
ui
->
profileMenu
->
setEnabled
(
true
);
App
()
->
DecrementSleepInhibition
();
ClearProcessPriority
();
}
}
...
...
obs/window-basic-main.hpp
浏览文件 @
0b2fd116
...
...
@@ -370,7 +370,8 @@ public:
obs_service_t
*
GetService
();
void
SetService
(
obs_service_t
*
service
);
bool
StreamingActive
();
bool
StreamingActive
()
const
;
bool
Active
()
const
;
int
ResetVideo
();
bool
ResetAudio
();
...
...
obs/window-basic-settings.cpp
浏览文件 @
0b2fd116
...
...
@@ -371,6 +371,7 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget
(
ui
->
reconnectEnable
,
CHECK_CHANGED
,
ADV_CHANGED
);
HookWidget
(
ui
->
reconnectRetryDelay
,
SCROLL_CHANGED
,
ADV_CHANGED
);
HookWidget
(
ui
->
reconnectMaxRetries
,
SCROLL_CHANGED
,
ADV_CHANGED
);
HookWidget
(
ui
->
processPriority
,
COMBO_CHANGED
,
ADV_CHANGED
);
#ifdef _WIN32
uint32_t
winVer
=
GetWindowsVersion
();
...
...
@@ -386,15 +387,39 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
connect
(
toggleAero
,
&
QAbstractButton
::
toggled
,
this
,
&
OBSBasicSettings
::
ToggleDisableAero
);
}
#define PROCESS_PRIORITY(val) \
{"Basic.Settings.Advanced.General.ProcessPriority." ## val , val}
static
struct
ProcessPriority
{
const
char
*
name
;
const
char
*
val
;
}
processPriorities
[]
=
{
PROCESS_PRIORITY
(
"High"
),
PROCESS_PRIORITY
(
"AboveNormal"
),
PROCESS_PRIORITY
(
"Normal"
),
PROCESS_PRIORITY
(
"Idle"
)
};
#undef PROCESS_PRIORITY
for
(
ProcessPriority
pri
:
processPriorities
)
ui
->
processPriority
->
addItem
(
QTStr
(
pri
.
name
),
pri
.
val
);
#else
delete
ui
->
rendererLabel
;
delete
ui
->
renderer
;
delete
ui
->
adapterLabel
;
delete
ui
->
adapter
;
delete
ui
->
processPriorityLabel
;
delete
ui
->
processPriority
;
delete
ui
->
advancedGeneralGroupBox
;
ui
->
rendererLabel
=
nullptr
;
ui
->
renderer
=
nullptr
;
ui
->
adapterLabel
=
nullptr
;
ui
->
adapter
=
nullptr
;
ui
->
processPriorityLabel
=
nullptr
;
ui
->
processPriority
=
nullptr
;
ui
->
advancedGeneralGroupBox
=
nullptr
;
#endif
#ifndef __APPLE__
...
...
@@ -1817,6 +1842,13 @@ void OBSBasicSettings::LoadAdvancedSettings()
ui
->
disableOSXVSync
->
setChecked
(
disableOSXVSync
);
ui
->
resetOSXVSync
->
setChecked
(
resetOSXVSync
);
ui
->
resetOSXVSync
->
setEnabled
(
disableOSXVSync
);
#elif _WIN32
const
char
*
processPriority
=
config_get_string
(
App
()
->
GlobalConfig
(),
"General"
,
"ProcessPriority"
);
int
idx
=
ui
->
processPriority
->
findData
(
processPriority
);
if
(
idx
==
-
1
)
idx
=
ui
->
processPriority
->
findData
(
"Normal"
);
ui
->
processPriority
->
setCurrentIndex
(
idx
);
#endif
loading
=
false
;
...
...
@@ -2250,6 +2282,13 @@ void OBSBasicSettings::SaveAdvancedSettings()
if
(
WidgetChanged
(
ui
->
renderer
))
config_set_string
(
App
()
->
GlobalConfig
(),
"Video"
,
"Renderer"
,
QT_TO_UTF8
(
ui
->
renderer
->
currentText
()));
std
::
string
priority
=
QT_TO_UTF8
(
ui
->
processPriority
->
currentData
().
toString
());
config_set_string
(
App
()
->
GlobalConfig
(),
"General"
,
"ProcessPriority"
,
priority
.
c_str
());
if
(
main
->
Active
())
SetProcessPriority
(
priority
.
c_str
());
#endif
#ifdef __APPLE__
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录