2013-12-11 21:50:10 -07:00
|
|
|
/******************************************************************************
|
2014-03-07 12:56:31 -07:00
|
|
|
Copyright (C) 2013-2014 by Hugh Bailey <obs.jim@gmail.com>
|
2015-02-17 02:45:34 -05:00
|
|
|
Philippe Groarke <philippe.groarke@gmail.com>
|
2013-12-11 21:50:10 -07:00
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
******************************************************************************/
|
|
|
|
|
2014-02-22 20:14:19 -07:00
|
|
|
#include <obs.hpp>
|
2014-01-26 15:36:15 -07:00
|
|
|
#include <util/util.hpp>
|
|
|
|
#include <util/lexer.h>
|
2015-08-16 14:38:56 -07:00
|
|
|
#include <graphics/math-defs.h>
|
2015-07-02 10:01:09 +02:00
|
|
|
#include <initializer_list>
|
2014-01-26 15:36:15 -07:00
|
|
|
#include <sstream>
|
2016-03-25 02:43:38 -07:00
|
|
|
#include <QCompleter>
|
2016-10-03 23:50:13 -07:00
|
|
|
#include <QGuiApplication>
|
2014-01-26 15:36:15 -07:00
|
|
|
#include <QLineEdit>
|
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QCloseEvent>
|
2015-02-17 02:45:34 -05:00
|
|
|
#include <QDirIterator>
|
2015-03-28 02:21:16 -05:00
|
|
|
#include <QVariant>
|
|
|
|
#include <QTreeView>
|
2016-10-03 23:50:13 -07:00
|
|
|
#include <QScreen>
|
2015-03-28 02:21:16 -05:00
|
|
|
#include <QStandardItemModel>
|
2014-11-01 21:50:36 +01:00
|
|
|
#include <QSpacerItem>
|
2014-01-26 15:36:15 -07:00
|
|
|
|
2015-07-02 10:01:09 +02:00
|
|
|
#include "audio-encoders.hpp"
|
2014-11-01 21:50:36 +01:00
|
|
|
#include "hotkey-edit.hpp"
|
|
|
|
#include "source-label.hpp"
|
2014-01-25 09:08:56 -07:00
|
|
|
#include "obs-app.hpp"
|
2014-01-26 15:36:15 -07:00
|
|
|
#include "platform.hpp"
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
#include "properties-view.hpp"
|
2014-01-26 15:36:15 -07:00
|
|
|
#include "qt-wrappers.hpp"
|
2014-02-22 20:14:19 -07:00
|
|
|
#include "window-basic-main.hpp"
|
2013-12-28 21:51:18 -07:00
|
|
|
#include "window-basic-settings.hpp"
|
2016-12-07 05:21:44 -08:00
|
|
|
#include "window-basic-main-outputs.hpp"
|
2017-12-13 19:42:19 -02:00
|
|
|
#include "window-projector.hpp"
|
2013-12-10 21:14:20 -07:00
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
#include <util/platform.h>
|
2021-09-09 00:21:00 -03:00
|
|
|
#include <util/dstr.hpp>
|
2019-03-29 04:16:12 -05:00
|
|
|
#include "ui-config.h"
|
2014-01-26 15:36:15 -07:00
|
|
|
|
2020-02-18 21:34:39 -08:00
|
|
|
#define ENCODER_HIDE_FLAGS \
|
|
|
|
(OBS_ENCODER_CAP_DEPRECATED | OBS_ENCODER_CAP_INTERNAL)
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
using namespace std;
|
|
|
|
|
2020-05-12 00:08:08 +02:00
|
|
|
class SettingsEventFilter : public QObject {
|
|
|
|
QScopedPointer<OBSEventFilter> shortcutFilter;
|
|
|
|
|
|
|
|
public:
|
|
|
|
inline SettingsEventFilter()
|
|
|
|
: shortcutFilter((OBSEventFilter *)CreateShortcutFilter())
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *obj, QEvent *event) override
|
|
|
|
{
|
|
|
|
int key;
|
|
|
|
|
|
|
|
switch (event->type()) {
|
|
|
|
case QEvent::KeyPress:
|
|
|
|
case QEvent::KeyRelease:
|
|
|
|
key = static_cast<QKeyEvent *>(event)->key();
|
|
|
|
if (key == Qt::Key_Escape) {
|
|
|
|
return false;
|
|
|
|
}
|
2020-07-16 23:15:13 -05:00
|
|
|
default:
|
|
|
|
break;
|
2020-05-12 00:08:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return shortcutFilter->filter(obj, event);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-03-28 02:21:16 -05:00
|
|
|
// Used for QVariant in codec comboboxes
|
|
|
|
namespace {
|
2015-06-09 19:04:44 -05:00
|
|
|
static bool StringEquals(QString left, QString right)
|
|
|
|
{
|
|
|
|
return left == right;
|
|
|
|
}
|
2015-03-28 02:21:16 -05:00
|
|
|
struct FormatDesc {
|
|
|
|
const char *name = nullptr;
|
|
|
|
const char *mimeType = nullptr;
|
|
|
|
const ff_format_desc *desc = nullptr;
|
|
|
|
|
|
|
|
inline FormatDesc() = default;
|
|
|
|
inline FormatDesc(const char *name, const char *mimeType,
|
|
|
|
const ff_format_desc *desc = nullptr)
|
|
|
|
: name(name), mimeType(mimeType), desc(desc)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const FormatDesc &f) const
|
|
|
|
{
|
2015-06-09 19:04:44 -05:00
|
|
|
if (!StringEquals(name, f.name))
|
2015-03-28 02:21:16 -05:00
|
|
|
return false;
|
2015-06-09 19:04:44 -05:00
|
|
|
return StringEquals(mimeType, f.mimeType);
|
2015-03-28 02:21:16 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
struct CodecDesc {
|
|
|
|
const char *name = nullptr;
|
|
|
|
int id = 0;
|
|
|
|
|
|
|
|
inline CodecDesc() = default;
|
|
|
|
inline CodecDesc(const char *name, int id) : name(name), id(id) {}
|
|
|
|
|
|
|
|
bool operator==(const CodecDesc &codecDesc) const
|
|
|
|
{
|
|
|
|
if (id != codecDesc.id)
|
|
|
|
return false;
|
2015-06-09 19:04:44 -05:00
|
|
|
return StringEquals(name, codecDesc.name);
|
2015-03-28 02:21:16 -05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
Q_DECLARE_METATYPE(FormatDesc)
|
|
|
|
Q_DECLARE_METATYPE(CodecDesc)
|
|
|
|
|
2020-01-22 15:14:05 -06:00
|
|
|
static inline bool ResTooHigh(uint32_t cx, uint32_t cy)
|
|
|
|
{
|
|
|
|
return cx > 16384 || cy > 16384;
|
|
|
|
}
|
|
|
|
|
2020-05-24 00:36:50 +02:00
|
|
|
static inline bool ResTooLow(uint32_t cx, uint32_t cy)
|
|
|
|
{
|
|
|
|
return cx < 8 || cy < 8;
|
|
|
|
}
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
/* parses "[width]x[height]", string, i.e. 1024x768 */
|
|
|
|
static bool ConvertResText(const char *res, uint32_t &cx, uint32_t &cy)
|
|
|
|
{
|
|
|
|
BaseLexer lex;
|
|
|
|
base_token token;
|
|
|
|
|
|
|
|
lexer_start(lex, res);
|
|
|
|
|
|
|
|
/* parse width */
|
|
|
|
if (!lexer_getbasetoken(lex, &token, IGNORE_WHITESPACE))
|
|
|
|
return false;
|
|
|
|
if (token.type != BASETOKEN_DIGIT)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
cx = std::stoul(token.text.array);
|
|
|
|
|
|
|
|
/* parse 'x' */
|
|
|
|
if (!lexer_getbasetoken(lex, &token, IGNORE_WHITESPACE))
|
|
|
|
return false;
|
|
|
|
if (strref_cmpi(&token.text, "x") != 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
/* parse height */
|
|
|
|
if (!lexer_getbasetoken(lex, &token, IGNORE_WHITESPACE))
|
|
|
|
return false;
|
|
|
|
if (token.type != BASETOKEN_DIGIT)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
cy = std::stoul(token.text.array);
|
|
|
|
|
|
|
|
/* shouldn't be any more tokens after this */
|
|
|
|
if (lexer_getbasetoken(lex, &token, IGNORE_WHITESPACE))
|
|
|
|
return false;
|
|
|
|
|
2020-05-24 00:36:50 +02:00
|
|
|
if (ResTooHigh(cx, cy) || ResTooLow(cx, cy)) {
|
2020-01-22 15:14:05 -06:00
|
|
|
cx = cy = 0;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-06-23 19:54:20 -07:00
|
|
|
static inline bool WidgetChanged(QWidget *widget)
|
|
|
|
{
|
|
|
|
return widget->property("changed").toBool();
|
|
|
|
}
|
|
|
|
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
static inline void SetComboByName(QComboBox *combo, const char *name)
|
|
|
|
{
|
|
|
|
int idx = combo->findText(QT_UTF8(name));
|
|
|
|
if (idx != -1)
|
|
|
|
combo->setCurrentIndex(idx);
|
|
|
|
}
|
|
|
|
|
2016-04-11 05:03:30 -07:00
|
|
|
static inline bool SetComboByValue(QComboBox *combo, const char *name)
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
{
|
|
|
|
int idx = combo->findData(QT_UTF8(name));
|
2016-04-11 05:03:30 -07:00
|
|
|
if (idx != -1) {
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
combo->setCurrentIndex(idx);
|
2016-04-11 05:03:30 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
}
|
|
|
|
|
2017-05-10 21:41:34 +02:00
|
|
|
static inline bool SetInvalidValue(QComboBox *combo, const char *name,
|
|
|
|
const char *data = nullptr)
|
|
|
|
{
|
|
|
|
combo->insertItem(0, name, data);
|
|
|
|
|
|
|
|
QStandardItemModel *model =
|
|
|
|
dynamic_cast<QStandardItemModel *>(combo->model());
|
|
|
|
if (!model)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
QStandardItem *item = model->item(0);
|
|
|
|
item->setFlags(Qt::NoItemFlags);
|
|
|
|
|
|
|
|
combo->setCurrentIndex(0);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-06-23 19:54:20 -07:00
|
|
|
static inline QString GetComboData(QComboBox *combo)
|
|
|
|
{
|
|
|
|
int idx = combo->currentIndex();
|
|
|
|
if (idx == -1)
|
|
|
|
return QString();
|
|
|
|
|
|
|
|
return combo->itemData(idx).toString();
|
|
|
|
}
|
|
|
|
|
2015-03-28 02:21:16 -05:00
|
|
|
static int FindEncoder(QComboBox *combo, const char *name, int id)
|
|
|
|
{
|
|
|
|
CodecDesc codecDesc(name, id);
|
|
|
|
for (int i = 0; i < combo->count(); i++) {
|
|
|
|
QVariant v = combo->itemData(i);
|
|
|
|
if (!v.isNull()) {
|
|
|
|
if (codecDesc == v.value<CodecDesc>()) {
|
|
|
|
return i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static CodecDesc GetDefaultCodecDesc(const ff_format_desc *formatDesc,
|
|
|
|
ff_codec_type codecType)
|
|
|
|
{
|
|
|
|
int id = 0;
|
|
|
|
switch (codecType) {
|
|
|
|
case FF_CODEC_AUDIO:
|
|
|
|
id = ff_format_desc_audio(formatDesc);
|
|
|
|
break;
|
|
|
|
case FF_CODEC_VIDEO:
|
|
|
|
id = ff_format_desc_video(formatDesc);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return CodecDesc();
|
|
|
|
}
|
|
|
|
|
|
|
|
return CodecDesc(ff_format_desc_get_default_name(formatDesc, codecType),
|
|
|
|
id);
|
|
|
|
}
|
|
|
|
|
2015-05-25 01:37:13 -07:00
|
|
|
#ifdef _WIN32
|
|
|
|
void OBSBasicSettings::ToggleDisableAero(bool checked)
|
|
|
|
{
|
|
|
|
SetAeroEnabled(!checked);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-07-02 10:01:09 +02:00
|
|
|
static void PopulateAACBitrates(initializer_list<QComboBox *> boxes)
|
|
|
|
{
|
|
|
|
auto &bitrateMap = GetAACEncoderBitrateMap();
|
|
|
|
if (bitrateMap.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
vector<pair<QString, QString>> pairs;
|
|
|
|
for (auto &entry : bitrateMap)
|
2022-03-13 07:04:11 -07:00
|
|
|
pairs.emplace_back(
|
|
|
|
QString::number(entry.first),
|
|
|
|
obs_encoder_get_display_name(entry.second.c_str()));
|
2015-07-02 10:01:09 +02:00
|
|
|
|
|
|
|
for (auto box : boxes) {
|
|
|
|
QString currentText = box->currentText();
|
|
|
|
box->clear();
|
|
|
|
|
|
|
|
for (auto &pair : pairs) {
|
|
|
|
box->addItem(pair.first);
|
|
|
|
box->setItemData(box->count() - 1, pair.second,
|
|
|
|
Qt::ToolTipRole);
|
|
|
|
}
|
|
|
|
|
|
|
|
box->setCurrentText(currentText);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-22 12:25:05 -06:00
|
|
|
static std::tuple<int, int> aspect_ratio(int cx, int cy)
|
|
|
|
{
|
2021-11-19 04:38:53 -06:00
|
|
|
int common = std::gcd(cx, cy);
|
2020-01-22 12:25:05 -06:00
|
|
|
int newCX = cx / common;
|
|
|
|
int newCY = cy / common;
|
|
|
|
|
|
|
|
if (newCX == 8 && newCY == 5) {
|
|
|
|
newCX = 16;
|
|
|
|
newCY = 10;
|
|
|
|
}
|
|
|
|
|
|
|
|
return std::make_tuple(newCX, newCY);
|
|
|
|
}
|
|
|
|
|
2020-04-14 13:33:36 -05:00
|
|
|
static inline void HighlightGroupBoxLabel(QGroupBox *gb, QWidget *widget,
|
|
|
|
QString objectName)
|
|
|
|
{
|
|
|
|
QFormLayout *layout = qobject_cast<QFormLayout *>(gb->layout());
|
|
|
|
|
|
|
|
if (!layout)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QLabel *label = qobject_cast<QLabel *>(layout->labelForField(widget));
|
|
|
|
|
|
|
|
if (label) {
|
|
|
|
label->setObjectName(objectName);
|
|
|
|
|
|
|
|
label->style()->unpolish(label);
|
|
|
|
label->style()->polish(label);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)
Adds surround sound audio support to the core, core plugins, and user
interface.
Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
(due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST: stereo plugins keep in general only the first two channels.
surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
(not implemented due to lack of usefulness)
Closes jp9000/obs-studio#968
2017-05-27 02:15:54 +02:00
|
|
|
void RestrictResetBitrates(initializer_list<QComboBox *> boxes, int maxbitrate);
|
|
|
|
|
2014-03-07 12:56:31 -07:00
|
|
|
void OBSBasicSettings::HookWidget(QWidget *widget, const char *signal,
|
|
|
|
const char *slot)
|
|
|
|
{
|
|
|
|
QObject::connect(widget, signal, this, slot);
|
2014-06-23 19:54:20 -07:00
|
|
|
widget->setProperty("changed", QVariant(false));
|
2014-03-07 12:56:31 -07:00
|
|
|
}
|
|
|
|
|
2016-05-05 00:19:38 -07:00
|
|
|
/* clang-format off */
|
2014-03-07 12:56:31 -07:00
|
|
|
#define COMBO_CHANGED SIGNAL(currentIndexChanged(int))
|
2014-03-10 13:10:35 -07:00
|
|
|
#define EDIT_CHANGED SIGNAL(textChanged(const QString &))
|
2014-03-07 12:56:31 -07:00
|
|
|
#define CBEDIT_CHANGED SIGNAL(editTextChanged(const QString &))
|
2019-09-12 13:55:31 -07:00
|
|
|
#define CHECK_CHANGED SIGNAL(clicked(bool))
|
2014-03-07 12:56:31 -07:00
|
|
|
#define SCROLL_CHANGED SIGNAL(valueChanged(int))
|
2016-04-10 02:11:43 -07:00
|
|
|
#define DSCROLL_CHANGED SIGNAL(valueChanged(double))
|
2019-09-12 13:55:31 -07:00
|
|
|
#define TOGGLE_CHANGED SIGNAL(toggled(bool))
|
2014-03-07 12:56:31 -07:00
|
|
|
|
|
|
|
#define GENERAL_CHANGED SLOT(GeneralChanged())
|
2015-02-07 08:09:57 -08:00
|
|
|
#define STREAM1_CHANGED SLOT(Stream1Changed())
|
2014-03-10 13:10:35 -07:00
|
|
|
#define OUTPUTS_CHANGED SLOT(OutputsChanged())
|
2014-03-07 22:34:49 -07:00
|
|
|
#define AUDIO_RESTART SLOT(AudioChangedRestart())
|
|
|
|
#define AUDIO_CHANGED SLOT(AudioChanged())
|
2014-03-07 12:56:31 -07:00
|
|
|
#define VIDEO_RESTART SLOT(VideoChangedRestart())
|
|
|
|
#define VIDEO_RES SLOT(VideoChangedResolution())
|
|
|
|
#define VIDEO_CHANGED SLOT(VideoChanged())
|
2015-02-11 12:55:06 -08:00
|
|
|
#define ADV_CHANGED SLOT(AdvancedChanged())
|
|
|
|
#define ADV_RESTART SLOT(AdvancedChangedRestart())
|
2015-06-17 12:07:55 -07:00
|
|
|
/* clang-format on */
|
2014-03-07 12:56:31 -07:00
|
|
|
|
2014-01-24 21:19:50 -07:00
|
|
|
OBSBasicSettings::OBSBasicSettings(QWidget *parent)
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
: QDialog(parent),
|
|
|
|
main(qobject_cast<OBSBasic *>(parent)),
|
2015-02-03 20:19:48 -08:00
|
|
|
ui(new Ui::OBSBasicSettings)
|
2013-12-11 21:50:10 -07:00
|
|
|
{
|
2014-01-26 15:36:15 -07:00
|
|
|
string path;
|
|
|
|
|
2019-02-20 17:33:29 -08:00
|
|
|
EnableThreadedMessageBoxes(true);
|
|
|
|
|
2019-02-12 12:55:31 +01:00
|
|
|
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
|
|
|
|
2020-03-04 23:17:03 +01:00
|
|
|
ui->setupUi(this);
|
|
|
|
|
2017-05-15 14:26:05 -07:00
|
|
|
main->EnableOutputs(false);
|
|
|
|
|
2015-07-02 10:01:09 +02:00
|
|
|
PopulateAACBitrates({ui->simpleOutputABitrate, ui->advOutTrack1Bitrate,
|
|
|
|
ui->advOutTrack2Bitrate, ui->advOutTrack3Bitrate,
|
2016-12-21 17:14:24 -08:00
|
|
|
ui->advOutTrack4Bitrate, ui->advOutTrack5Bitrate,
|
|
|
|
ui->advOutTrack6Bitrate});
|
2015-07-02 10:01:09 +02:00
|
|
|
|
2014-10-29 17:18:00 +01:00
|
|
|
ui->listWidget->setAttribute(Qt::WA_MacShowFocusRect, false);
|
|
|
|
|
2016-05-05 00:19:38 -07:00
|
|
|
/* clang-format off */
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
HookWidget(ui->language, COMBO_CHANGED, GENERAL_CHANGED);
|
2015-02-17 02:45:34 -05:00
|
|
|
HookWidget(ui->theme, COMBO_CHANGED, GENERAL_CHANGED);
|
2017-02-20 04:46:29 -08:00
|
|
|
HookWidget(ui->enableAutoUpdates, CHECK_CHANGED, GENERAL_CHANGED);
|
2017-05-13 20:47:47 -07:00
|
|
|
HookWidget(ui->openStatsOnStartup, CHECK_CHANGED, GENERAL_CHANGED);
|
2020-06-27 02:31:08 +02:00
|
|
|
HookWidget(ui->hideOBSFromCapture, CHECK_CHANGED, GENERAL_CHANGED);
|
2016-01-22 08:09:04 -08:00
|
|
|
HookWidget(ui->warnBeforeStreamStart,CHECK_CHANGED, GENERAL_CHANGED);
|
|
|
|
HookWidget(ui->warnBeforeStreamStop, CHECK_CHANGED, GENERAL_CHANGED);
|
2019-06-17 15:14:14 +01:00
|
|
|
HookWidget(ui->warnBeforeRecordStop, CHECK_CHANGED, GENERAL_CHANGED);
|
2016-06-27 14:47:42 -07:00
|
|
|
HookWidget(ui->hideProjectorCursor, CHECK_CHANGED, GENERAL_CHANGED);
|
2016-08-21 16:11:32 -07:00
|
|
|
HookWidget(ui->projectorAlwaysOnTop, CHECK_CHANGED, GENERAL_CHANGED);
|
2016-06-16 12:59:36 -05:00
|
|
|
HookWidget(ui->recordWhenStreaming, CHECK_CHANGED, GENERAL_CHANGED);
|
|
|
|
HookWidget(ui->keepRecordStreamStops,CHECK_CHANGED, GENERAL_CHANGED);
|
2017-01-04 16:11:52 -05:00
|
|
|
HookWidget(ui->replayWhileStreaming, CHECK_CHANGED, GENERAL_CHANGED);
|
|
|
|
HookWidget(ui->keepReplayStreamStops,CHECK_CHANGED, GENERAL_CHANGED);
|
2016-08-13 09:36:17 -05:00
|
|
|
HookWidget(ui->systemTrayEnabled, CHECK_CHANGED, GENERAL_CHANGED);
|
|
|
|
HookWidget(ui->systemTrayWhenStarted,CHECK_CHANGED, GENERAL_CHANGED);
|
2017-01-24 23:01:24 -08:00
|
|
|
HookWidget(ui->systemTrayAlways, CHECK_CHANGED, GENERAL_CHANGED);
|
2016-12-29 09:21:53 -06:00
|
|
|
HookWidget(ui->saveProjectors, CHECK_CHANGED, GENERAL_CHANGED);
|
2021-08-06 01:42:29 -05:00
|
|
|
HookWidget(ui->closeProjectors, CHECK_CHANGED, GENERAL_CHANGED);
|
2016-04-06 18:03:29 -07:00
|
|
|
HookWidget(ui->snappingEnabled, CHECK_CHANGED, GENERAL_CHANGED);
|
|
|
|
HookWidget(ui->screenSnapping, CHECK_CHANGED, GENERAL_CHANGED);
|
2016-04-06 18:10:39 -07:00
|
|
|
HookWidget(ui->centerSnapping, CHECK_CHANGED, GENERAL_CHANGED);
|
2016-04-06 18:13:56 -07:00
|
|
|
HookWidget(ui->sourceSnapping, CHECK_CHANGED, GENERAL_CHANGED);
|
2016-04-10 02:11:43 -07:00
|
|
|
HookWidget(ui->snapDistance, DSCROLL_CHANGED,GENERAL_CHANGED);
|
2019-01-15 14:58:20 +13:00
|
|
|
HookWidget(ui->overflowHide, CHECK_CHANGED, GENERAL_CHANGED);
|
|
|
|
HookWidget(ui->overflowAlwaysVisible,CHECK_CHANGED, GENERAL_CHANGED);
|
|
|
|
HookWidget(ui->overflowSelectionHide,CHECK_CHANGED, GENERAL_CHANGED);
|
2021-08-19 23:56:49 -05:00
|
|
|
HookWidget(ui->previewSafeAreas, CHECK_CHANGED, GENERAL_CHANGED);
|
2020-02-02 20:44:07 +13:00
|
|
|
HookWidget(ui->automaticSearch, CHECK_CHANGED, GENERAL_CHANGED);
|
2017-09-21 15:37:01 -05:00
|
|
|
HookWidget(ui->doubleClickSwitch, CHECK_CHANGED, GENERAL_CHANGED);
|
2017-11-08 23:44:22 -05:00
|
|
|
HookWidget(ui->studioPortraitLayout, CHECK_CHANGED, GENERAL_CHANGED);
|
2019-02-28 15:29:41 -06:00
|
|
|
HookWidget(ui->prevProgLabelToggle, CHECK_CHANGED, GENERAL_CHANGED);
|
2018-03-16 18:55:56 -03:00
|
|
|
HookWidget(ui->multiviewMouseSwitch, CHECK_CHANGED, GENERAL_CHANGED);
|
2018-03-16 23:00:32 -03:00
|
|
|
HookWidget(ui->multiviewDrawNames, CHECK_CHANGED, GENERAL_CHANGED);
|
2018-03-18 23:02:27 -03:00
|
|
|
HookWidget(ui->multiviewDrawAreas, CHECK_CHANGED, GENERAL_CHANGED);
|
2017-12-13 19:42:19 -02:00
|
|
|
HookWidget(ui->multiviewLayout, COMBO_CHANGED, GENERAL_CHANGED);
|
2019-02-06 19:19:17 -08:00
|
|
|
HookWidget(ui->service, COMBO_CHANGED, STREAM1_CHANGED);
|
|
|
|
HookWidget(ui->server, COMBO_CHANGED, STREAM1_CHANGED);
|
|
|
|
HookWidget(ui->customServer, EDIT_CHANGED, STREAM1_CHANGED);
|
|
|
|
HookWidget(ui->key, EDIT_CHANGED, STREAM1_CHANGED);
|
2019-03-09 02:54:41 +01:00
|
|
|
HookWidget(ui->bandwidthTestEnable, CHECK_CHANGED, STREAM1_CHANGED);
|
2019-10-10 03:29:09 +02:00
|
|
|
HookWidget(ui->twitchAddonDropdown, COMBO_CHANGED, STREAM1_CHANGED);
|
2019-02-14 23:09:43 -08:00
|
|
|
HookWidget(ui->useAuth, CHECK_CHANGED, STREAM1_CHANGED);
|
|
|
|
HookWidget(ui->authUsername, EDIT_CHANGED, STREAM1_CHANGED);
|
|
|
|
HookWidget(ui->authPw, EDIT_CHANGED, STREAM1_CHANGED);
|
2020-11-11 09:48:39 -08:00
|
|
|
HookWidget(ui->ignoreRecommended, CHECK_CHANGED, STREAM1_CHANGED);
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
HookWidget(ui->outputMode, COMBO_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->simpleOutputPath, EDIT_CHANGED, OUTPUTS_CHANGED);
|
2015-11-27 12:14:18 +01:00
|
|
|
HookWidget(ui->simpleNoSpace, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2015-05-29 09:45:54 -07:00
|
|
|
HookWidget(ui->simpleOutRecFormat, COMBO_CHANGED, OUTPUTS_CHANGED);
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
HookWidget(ui->simpleOutputVBitrate, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
2016-04-18 00:56:51 -07:00
|
|
|
HookWidget(ui->simpleOutStrEncoder, COMBO_CHANGED, OUTPUTS_CHANGED);
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
HookWidget(ui->simpleOutputABitrate, COMBO_CHANGED, OUTPUTS_CHANGED);
|
2014-08-25 07:48:51 -07:00
|
|
|
HookWidget(ui->simpleOutAdvanced, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->simpleOutPreset, COMBO_CHANGED, OUTPUTS_CHANGED);
|
2015-02-10 19:38:59 -08:00
|
|
|
HookWidget(ui->simpleOutCustom, EDIT_CHANGED, OUTPUTS_CHANGED);
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
HookWidget(ui->simpleOutRecQuality, COMBO_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->simpleOutRecEncoder, COMBO_CHANGED, OUTPUTS_CHANGED);
|
2015-11-23 15:36:06 +01:00
|
|
|
HookWidget(ui->simpleOutMuxCustom, EDIT_CHANGED, OUTPUTS_CHANGED);
|
2016-12-07 05:21:44 -08:00
|
|
|
HookWidget(ui->simpleReplayBuf, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->simpleRBSecMax, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->simpleRBMegsMax, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
2015-01-26 13:41:22 -08:00
|
|
|
HookWidget(ui->advOutEncoder, COMBO_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutUseRescale, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutRescale, CBEDIT_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack1, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack2, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack3, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack4, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2016-12-21 17:14:24 -08:00
|
|
|
HookWidget(ui->advOutTrack5, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack6, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2015-01-26 13:41:22 -08:00
|
|
|
HookWidget(ui->advOutRecType, COMBO_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutRecPath, EDIT_CHANGED, OUTPUTS_CHANGED);
|
2015-11-27 12:14:18 +01:00
|
|
|
HookWidget(ui->advOutNoSpace, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2015-05-29 09:45:54 -07:00
|
|
|
HookWidget(ui->advOutRecFormat, COMBO_CHANGED, OUTPUTS_CHANGED);
|
2015-01-26 13:41:22 -08:00
|
|
|
HookWidget(ui->advOutRecEncoder, COMBO_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutRecUseRescale, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutRecRescale, CBEDIT_CHANGED, OUTPUTS_CHANGED);
|
2015-11-23 15:36:06 +01:00
|
|
|
HookWidget(ui->advOutMuxCustom, EDIT_CHANGED, OUTPUTS_CHANGED);
|
2021-10-03 19:06:46 +09:00
|
|
|
HookWidget(ui->advOutSplitFile, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutSplitFileType, COMBO_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutSplitFileTime, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutSplitFileSize, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
2021-12-24 15:59:26 +09:00
|
|
|
HookWidget(ui->advOutSplitFileRstTS, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2015-01-26 13:41:22 -08:00
|
|
|
HookWidget(ui->advOutRecTrack1, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutRecTrack2, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutRecTrack3, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutRecTrack4, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2016-12-21 17:14:24 -08:00
|
|
|
HookWidget(ui->advOutRecTrack5, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutRecTrack6, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2019-07-23 07:20:13 -05:00
|
|
|
HookWidget(ui->flvTrack1, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->flvTrack2, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->flvTrack3, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->flvTrack4, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->flvTrack5, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->flvTrack6, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2015-08-18 20:58:24 -07:00
|
|
|
HookWidget(ui->advOutFFType, COMBO_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutFFRecPath, EDIT_CHANGED, OUTPUTS_CHANGED);
|
2015-11-27 12:14:18 +01:00
|
|
|
HookWidget(ui->advOutFFNoSpace, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2015-01-26 13:41:22 -08:00
|
|
|
HookWidget(ui->advOutFFURL, EDIT_CHANGED, OUTPUTS_CHANGED);
|
2015-03-28 02:21:16 -05:00
|
|
|
HookWidget(ui->advOutFFFormat, COMBO_CHANGED, OUTPUTS_CHANGED);
|
2015-09-16 10:26:48 +02:00
|
|
|
HookWidget(ui->advOutFFMCfg, EDIT_CHANGED, OUTPUTS_CHANGED);
|
2015-01-26 13:41:22 -08:00
|
|
|
HookWidget(ui->advOutFFVBitrate, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
2017-02-17 17:25:21 +01:00
|
|
|
HookWidget(ui->advOutFFVGOPSize, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
2015-01-26 13:41:22 -08:00
|
|
|
HookWidget(ui->advOutFFUseRescale, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2017-02-17 18:07:32 +01:00
|
|
|
HookWidget(ui->advOutFFIgnoreCompat, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2015-01-26 13:41:22 -08:00
|
|
|
HookWidget(ui->advOutFFRescale, CBEDIT_CHANGED, OUTPUTS_CHANGED);
|
2015-03-28 02:21:16 -05:00
|
|
|
HookWidget(ui->advOutFFVEncoder, COMBO_CHANGED, OUTPUTS_CHANGED);
|
2015-01-26 13:41:22 -08:00
|
|
|
HookWidget(ui->advOutFFVCfg, EDIT_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutFFABitrate, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutFFTrack1, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutFFTrack2, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutFFTrack3, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutFFTrack4, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2016-12-21 17:14:24 -08:00
|
|
|
HookWidget(ui->advOutFFTrack5, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutFFTrack6, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2017-02-17 18:07:32 +01:00
|
|
|
HookWidget(ui->advOutFFAEncoder, COMBO_CHANGED, OUTPUTS_CHANGED);
|
2015-01-26 13:41:22 -08:00
|
|
|
HookWidget(ui->advOutFFACfg, EDIT_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack1Bitrate, COMBO_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack1Name, EDIT_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack2Bitrate, COMBO_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack2Name, EDIT_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack3Bitrate, COMBO_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack3Name, EDIT_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack4Bitrate, COMBO_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack4Name, EDIT_CHANGED, OUTPUTS_CHANGED);
|
2016-12-21 17:14:24 -08:00
|
|
|
HookWidget(ui->advOutTrack5Bitrate, COMBO_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack5Name, EDIT_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack6Bitrate, COMBO_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advOutTrack6Name, EDIT_CHANGED, OUTPUTS_CHANGED);
|
2017-09-05 20:01:49 -04:00
|
|
|
HookWidget(ui->advReplayBuf, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advRBSecMax, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
HookWidget(ui->advRBMegsMax, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
HookWidget(ui->channelSetup, COMBO_CHANGED, AUDIO_RESTART);
|
|
|
|
HookWidget(ui->sampleRate, COMBO_CHANGED, AUDIO_RESTART);
|
2018-01-09 18:45:20 -02:00
|
|
|
HookWidget(ui->meterDecayRate, COMBO_CHANGED, AUDIO_CHANGED);
|
2018-01-19 22:57:36 +01:00
|
|
|
HookWidget(ui->peakMeterType, COMBO_CHANGED, AUDIO_CHANGED);
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
HookWidget(ui->desktopAudioDevice1, COMBO_CHANGED, AUDIO_CHANGED);
|
|
|
|
HookWidget(ui->desktopAudioDevice2, COMBO_CHANGED, AUDIO_CHANGED);
|
|
|
|
HookWidget(ui->auxAudioDevice1, COMBO_CHANGED, AUDIO_CHANGED);
|
|
|
|
HookWidget(ui->auxAudioDevice2, COMBO_CHANGED, AUDIO_CHANGED);
|
|
|
|
HookWidget(ui->auxAudioDevice3, COMBO_CHANGED, AUDIO_CHANGED);
|
2018-06-26 20:41:32 +02:00
|
|
|
HookWidget(ui->auxAudioDevice4, COMBO_CHANGED, AUDIO_CHANGED);
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
HookWidget(ui->baseResolution, CBEDIT_CHANGED, VIDEO_RES);
|
|
|
|
HookWidget(ui->outputResolution, CBEDIT_CHANGED, VIDEO_RES);
|
|
|
|
HookWidget(ui->downscaleFilter, COMBO_CHANGED, VIDEO_CHANGED);
|
|
|
|
HookWidget(ui->fpsType, COMBO_CHANGED, VIDEO_CHANGED);
|
|
|
|
HookWidget(ui->fpsCommon, COMBO_CHANGED, VIDEO_CHANGED);
|
|
|
|
HookWidget(ui->fpsInteger, SCROLL_CHANGED, VIDEO_CHANGED);
|
|
|
|
HookWidget(ui->fpsNumerator, SCROLL_CHANGED, VIDEO_CHANGED);
|
|
|
|
HookWidget(ui->fpsDenominator, SCROLL_CHANGED, VIDEO_CHANGED);
|
2016-01-25 05:55:01 -08:00
|
|
|
HookWidget(ui->renderer, COMBO_CHANGED, ADV_RESTART);
|
|
|
|
HookWidget(ui->adapter, COMBO_CHANGED, ADV_RESTART);
|
2015-02-11 12:55:06 -08:00
|
|
|
HookWidget(ui->colorFormat, COMBO_CHANGED, ADV_CHANGED);
|
|
|
|
HookWidget(ui->colorSpace, COMBO_CHANGED, ADV_CHANGED);
|
|
|
|
HookWidget(ui->colorRange, COMBO_CHANGED, ADV_CHANGED);
|
2022-02-20 20:31:30 -08:00
|
|
|
HookWidget(ui->sdrWhiteLevel, SCROLL_CHANGED, ADV_CHANGED);
|
2022-04-10 12:31:08 -07:00
|
|
|
HookWidget(ui->hdrNominalPeakLevel, SCROLL_CHANGED, ADV_CHANGED);
|
2016-01-25 17:09:59 -08:00
|
|
|
HookWidget(ui->disableOSXVSync, CHECK_CHANGED, ADV_CHANGED);
|
|
|
|
HookWidget(ui->resetOSXVSync, CHECK_CHANGED, ADV_CHANGED);
|
2021-12-21 19:08:14 -08:00
|
|
|
if (obs_audio_monitoring_available())
|
2021-08-31 04:53:02 -07:00
|
|
|
HookWidget(ui->monitoringDevice, COMBO_CHANGED, ADV_CHANGED);
|
2017-04-17 22:38:16 +09:00
|
|
|
#ifdef _WIN32
|
|
|
|
HookWidget(ui->disableAudioDucking, CHECK_CHANGED, ADV_CHANGED);
|
2020-12-11 19:09:57 +01:00
|
|
|
#endif
|
|
|
|
#if defined(_WIN32) || defined(__APPLE__)
|
2018-08-10 06:12:16 -07:00
|
|
|
HookWidget(ui->browserHWAccel, CHECK_CHANGED, ADV_RESTART);
|
2017-02-05 21:51:50 -08:00
|
|
|
#endif
|
2016-03-25 02:43:38 -07:00
|
|
|
HookWidget(ui->filenameFormatting, EDIT_CHANGED, ADV_CHANGED);
|
|
|
|
HookWidget(ui->overwriteIfExists, CHECK_CHANGED, ADV_CHANGED);
|
2016-12-09 14:42:14 -08:00
|
|
|
HookWidget(ui->simpleRBPrefix, EDIT_CHANGED, ADV_CHANGED);
|
|
|
|
HookWidget(ui->simpleRBSuffix, EDIT_CHANGED, ADV_CHANGED);
|
2015-09-06 16:12:03 -07:00
|
|
|
HookWidget(ui->streamDelayEnable, CHECK_CHANGED, ADV_CHANGED);
|
|
|
|
HookWidget(ui->streamDelaySec, SCROLL_CHANGED, ADV_CHANGED);
|
|
|
|
HookWidget(ui->streamDelayPreserve, CHECK_CHANGED, ADV_CHANGED);
|
2015-09-10 19:10:40 -07:00
|
|
|
HookWidget(ui->reconnectEnable, CHECK_CHANGED, ADV_CHANGED);
|
|
|
|
HookWidget(ui->reconnectRetryDelay, SCROLL_CHANGED, ADV_CHANGED);
|
|
|
|
HookWidget(ui->reconnectMaxRetries, SCROLL_CHANGED, ADV_CHANGED);
|
2016-07-01 10:27:27 -07:00
|
|
|
HookWidget(ui->processPriority, COMBO_CHANGED, ADV_CHANGED);
|
2020-11-20 12:04:26 +01:00
|
|
|
HookWidget(ui->confirmOnExit, CHECK_CHANGED, ADV_CHANGED);
|
2016-07-29 08:30:54 -07:00
|
|
|
HookWidget(ui->bindToIP, COMBO_CHANGED, ADV_CHANGED);
|
2017-02-22 02:05:45 +01:00
|
|
|
HookWidget(ui->enableNewSocketLoop, CHECK_CHANGED, ADV_CHANGED);
|
|
|
|
HookWidget(ui->enableLowLatencyMode, CHECK_CHANGED, ADV_CHANGED);
|
2019-07-22 01:20:12 -07:00
|
|
|
HookWidget(ui->hotkeyFocusType, COMBO_CHANGED, ADV_CHANGED);
|
2017-05-08 06:53:35 -05:00
|
|
|
HookWidget(ui->autoRemux, CHECK_CHANGED, ADV_CHANGED);
|
2019-08-15 08:50:09 -07:00
|
|
|
HookWidget(ui->dynBitrate, CHECK_CHANGED, ADV_CHANGED);
|
2015-06-17 12:07:55 -07:00
|
|
|
/* clang-format on */
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
|
2019-07-22 01:20:12 -07:00
|
|
|
#define ADD_HOTKEY_FOCUS_TYPE(s) \
|
|
|
|
ui->hotkeyFocusType->addItem( \
|
|
|
|
QTStr("Basic.Settings.Advanced.Hotkeys." s), s)
|
|
|
|
|
|
|
|
ADD_HOTKEY_FOCUS_TYPE("NeverDisableHotkeys");
|
|
|
|
ADD_HOTKEY_FOCUS_TYPE("DisableHotkeysInFocus");
|
|
|
|
ADD_HOTKEY_FOCUS_TYPE("DisableHotkeysOutOfFocus");
|
|
|
|
|
|
|
|
#undef ADD_HOTKEY_FOCUS_TYPE
|
|
|
|
|
2019-04-30 06:54:02 -05:00
|
|
|
ui->simpleOutputVBitrate->setSingleStep(50);
|
2019-04-30 09:31:30 -05:00
|
|
|
ui->simpleOutputVBitrate->setSuffix(" Kbps");
|
2019-04-30 06:54:02 -05:00
|
|
|
ui->advOutFFVBitrate->setSingleStep(50);
|
2019-04-30 09:31:30 -05:00
|
|
|
ui->advOutFFVBitrate->setSuffix(" Kbps");
|
|
|
|
ui->advOutFFABitrate->setSuffix(" Kbps");
|
2019-04-30 06:54:02 -05:00
|
|
|
|
2018-03-12 19:56:07 -05:00
|
|
|
#if !defined(_WIN32) && !defined(__APPLE__)
|
2017-02-27 08:00:13 -08:00
|
|
|
delete ui->enableAutoUpdates;
|
|
|
|
ui->enableAutoUpdates = nullptr;
|
2018-03-12 19:56:07 -05:00
|
|
|
#endif
|
|
|
|
|
2021-08-31 04:53:02 -07:00
|
|
|
// Remove the Advanced Audio section if monitoring is not supported, as the monitoring device selection is the only item in the group box.
|
2021-12-21 19:08:14 -08:00
|
|
|
if (!obs_audio_monitoring_available()) {
|
2021-08-31 04:53:02 -07:00
|
|
|
delete ui->audioAdvGroupBox;
|
|
|
|
ui->audioAdvGroupBox = nullptr;
|
|
|
|
}
|
2017-02-05 21:51:50 -08:00
|
|
|
|
2015-05-25 01:37:13 -07:00
|
|
|
#ifdef _WIN32
|
|
|
|
uint32_t winVer = GetWindowsVersion();
|
|
|
|
if (winVer > 0 && winVer < 0x602) {
|
2020-06-27 02:31:08 +02:00
|
|
|
// Older than Windows 8
|
2015-05-25 01:37:13 -07:00
|
|
|
toggleAero = new QCheckBox(
|
|
|
|
QTStr("Basic.Settings.Video.DisableAero"), this);
|
|
|
|
QFormLayout *videoLayout = reinterpret_cast<QFormLayout *>(
|
|
|
|
ui->videoPage->layout());
|
|
|
|
videoLayout->addRow(nullptr, toggleAero);
|
|
|
|
|
|
|
|
HookWidget(toggleAero, CHECK_CHANGED, VIDEO_CHANGED);
|
|
|
|
connect(toggleAero, &QAbstractButton::toggled, this,
|
|
|
|
&OBSBasicSettings::ToggleDisableAero);
|
|
|
|
}
|
2016-07-01 10:27:27 -07:00
|
|
|
|
2020-06-27 02:31:08 +02:00
|
|
|
if (!SetDisplayAffinitySupported()) {
|
|
|
|
delete ui->hideOBSFromCapture;
|
|
|
|
ui->hideOBSFromCapture = nullptr;
|
|
|
|
}
|
|
|
|
|
2016-07-01 10:27:27 -07:00
|
|
|
#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"),
|
2017-07-26 23:44:58 +02:00
|
|
|
PROCESS_PRIORITY("BelowNormal"),
|
2016-07-01 10:27:27 -07:00
|
|
|
PROCESS_PRIORITY("Idle")};
|
|
|
|
#undef PROCESS_PRIORITY
|
|
|
|
|
|
|
|
for (ProcessPriority pri : processPriorities)
|
|
|
|
ui->processPriority->addItem(QTStr(pri.name), pri.val);
|
|
|
|
|
2016-01-25 06:22:00 -08:00
|
|
|
#else
|
|
|
|
delete ui->rendererLabel;
|
|
|
|
delete ui->renderer;
|
|
|
|
delete ui->adapterLabel;
|
|
|
|
delete ui->adapter;
|
2016-07-01 10:27:27 -07:00
|
|
|
delete ui->processPriorityLabel;
|
|
|
|
delete ui->processPriority;
|
2017-02-22 02:05:45 +01:00
|
|
|
delete ui->enableNewSocketLoop;
|
|
|
|
delete ui->enableLowLatencyMode;
|
2020-06-27 02:31:08 +02:00
|
|
|
delete ui->hideOBSFromCapture;
|
2020-12-11 19:09:57 +01:00
|
|
|
#ifdef __linux__
|
2018-08-10 06:12:16 -07:00
|
|
|
delete ui->browserHWAccel;
|
|
|
|
delete ui->sourcesGroup;
|
2020-12-11 19:09:57 +01:00
|
|
|
#endif
|
2022-03-16 23:11:58 +01:00
|
|
|
#if defined(__APPLE__) || defined(PULSEAUDIO_FOUND)
|
2017-04-17 22:38:16 +09:00
|
|
|
delete ui->disableAudioDucking;
|
2017-05-06 15:59:41 +02:00
|
|
|
#endif
|
2016-01-25 06:22:00 -08:00
|
|
|
ui->rendererLabel = nullptr;
|
|
|
|
ui->renderer = nullptr;
|
|
|
|
ui->adapterLabel = nullptr;
|
|
|
|
ui->adapter = nullptr;
|
2016-07-01 10:27:27 -07:00
|
|
|
ui->processPriorityLabel = nullptr;
|
|
|
|
ui->processPriority = nullptr;
|
2017-02-22 02:05:45 +01:00
|
|
|
ui->enableNewSocketLoop = nullptr;
|
|
|
|
ui->enableLowLatencyMode = nullptr;
|
2020-06-27 02:31:08 +02:00
|
|
|
ui->hideOBSFromCapture = nullptr;
|
2020-12-11 19:09:57 +01:00
|
|
|
#ifdef __linux__
|
2018-08-10 06:12:16 -07:00
|
|
|
ui->browserHWAccel = nullptr;
|
|
|
|
ui->sourcesGroup = nullptr;
|
2020-12-11 19:09:57 +01:00
|
|
|
#endif
|
2022-03-16 23:11:58 +01:00
|
|
|
#if defined(__APPLE__) || defined(PULSEAUDIO_FOUND)
|
2017-04-17 22:38:16 +09:00
|
|
|
ui->disableAudioDucking = nullptr;
|
2015-05-25 01:37:13 -07:00
|
|
|
#endif
|
2017-05-06 15:59:41 +02:00
|
|
|
#endif
|
2015-05-25 01:37:13 -07:00
|
|
|
|
2016-01-25 17:09:59 -08:00
|
|
|
#ifndef __APPLE__
|
|
|
|
delete ui->disableOSXVSync;
|
|
|
|
delete ui->resetOSXVSync;
|
|
|
|
ui->disableOSXVSync = nullptr;
|
|
|
|
ui->resetOSXVSync = nullptr;
|
|
|
|
#endif
|
|
|
|
|
2015-09-06 16:12:03 -07:00
|
|
|
connect(ui->streamDelaySec, SIGNAL(valueChanged(int)), this,
|
|
|
|
SLOT(UpdateStreamDelayEstimate()));
|
|
|
|
connect(ui->outputMode, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(UpdateStreamDelayEstimate()));
|
|
|
|
connect(ui->simpleOutputVBitrate, SIGNAL(valueChanged(int)), this,
|
|
|
|
SLOT(UpdateStreamDelayEstimate()));
|
|
|
|
connect(ui->simpleOutputABitrate, SIGNAL(currentIndexChanged(int)),
|
|
|
|
this, SLOT(UpdateStreamDelayEstimate()));
|
|
|
|
connect(ui->advOutTrack1Bitrate, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(UpdateStreamDelayEstimate()));
|
|
|
|
connect(ui->advOutTrack2Bitrate, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(UpdateStreamDelayEstimate()));
|
|
|
|
connect(ui->advOutTrack3Bitrate, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(UpdateStreamDelayEstimate()));
|
|
|
|
connect(ui->advOutTrack4Bitrate, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(UpdateStreamDelayEstimate()));
|
2016-12-21 17:14:24 -08:00
|
|
|
connect(ui->advOutTrack5Bitrate, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(UpdateStreamDelayEstimate()));
|
|
|
|
connect(ui->advOutTrack6Bitrate, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(UpdateStreamDelayEstimate()));
|
2015-09-06 16:12:03 -07:00
|
|
|
|
2014-05-09 18:04:39 -04:00
|
|
|
//Apply button disabled until change.
|
|
|
|
EnableApplyButton(false);
|
|
|
|
|
2015-03-28 02:21:16 -05:00
|
|
|
// Initialize libff library
|
|
|
|
ff_init();
|
|
|
|
|
2020-05-12 00:08:08 +02:00
|
|
|
installEventFilter(new SettingsEventFilter());
|
2014-11-01 21:48:58 +01:00
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
LoadEncoderTypes();
|
2015-02-11 12:55:06 -08:00
|
|
|
LoadColorRanges();
|
2022-01-19 00:51:25 -08:00
|
|
|
LoadColorSpaces();
|
2022-07-12 12:08:26 +02:00
|
|
|
LoadColorFormats();
|
2015-03-28 02:21:16 -05:00
|
|
|
LoadFormats();
|
2014-11-01 21:50:36 +01:00
|
|
|
|
2015-05-01 07:07:42 +02:00
|
|
|
auto ReloadAudioSources = [](void *data, calldata_t *param) {
|
|
|
|
auto settings = static_cast<OBSBasicSettings *>(data);
|
|
|
|
auto source = static_cast<obs_source_t *>(
|
|
|
|
calldata_ptr(param, "source"));
|
|
|
|
|
2015-10-17 02:51:59 -07:00
|
|
|
if (!source)
|
|
|
|
return;
|
|
|
|
|
2015-05-01 07:07:42 +02:00
|
|
|
if (!(obs_source_get_output_flags(source) & OBS_SOURCE_AUDIO))
|
|
|
|
return;
|
|
|
|
|
|
|
|
QMetaObject::invokeMethod(settings, "ReloadAudioSources",
|
|
|
|
Qt::QueuedConnection);
|
|
|
|
};
|
|
|
|
sourceCreated.Connect(obs_get_signal_handler(), "source_create",
|
|
|
|
ReloadAudioSources, this);
|
|
|
|
channelChanged.Connect(obs_get_signal_handler(), "channel_change",
|
|
|
|
ReloadAudioSources, this);
|
|
|
|
|
2021-09-09 00:21:00 -03:00
|
|
|
hotkeyConflictIcon =
|
|
|
|
QIcon::fromTheme("obs", QIcon(":/res/images/warning.svg"));
|
|
|
|
|
2014-11-01 21:50:36 +01:00
|
|
|
auto ReloadHotkeys = [](void *data, calldata_t *) {
|
|
|
|
auto settings = static_cast<OBSBasicSettings *>(data);
|
|
|
|
QMetaObject::invokeMethod(settings, "ReloadHotkeys");
|
|
|
|
};
|
|
|
|
hotkeyRegistered.Connect(obs_get_signal_handler(), "hotkey_register",
|
|
|
|
ReloadHotkeys, this);
|
|
|
|
|
|
|
|
auto ReloadHotkeysIgnore = [](void *data, calldata_t *param) {
|
|
|
|
auto settings = static_cast<OBSBasicSettings *>(data);
|
|
|
|
auto key =
|
|
|
|
static_cast<obs_hotkey_t *>(calldata_ptr(param, "key"));
|
|
|
|
QMetaObject::invokeMethod(settings, "ReloadHotkeys",
|
|
|
|
Q_ARG(obs_hotkey_id,
|
|
|
|
obs_hotkey_get_id(key)));
|
|
|
|
};
|
|
|
|
hotkeyUnregistered.Connect(obs_get_signal_handler(),
|
|
|
|
"hotkey_unregister", ReloadHotkeysIgnore,
|
|
|
|
this);
|
|
|
|
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
FillSimpleRecordingValues();
|
2016-04-18 00:56:51 -07:00
|
|
|
FillSimpleStreamingValues();
|
2021-12-21 19:08:14 -08:00
|
|
|
if (obs_audio_monitoring_available())
|
2021-08-31 04:53:02 -07:00
|
|
|
FillAudioMonitoringDevices();
|
2016-04-18 00:56:51 -07:00
|
|
|
|
libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)
Adds surround sound audio support to the core, core plugins, and user
interface.
Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
(due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST: stereo plugins keep in general only the first two channels.
surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
(not implemented due to lack of usefulness)
Closes jp9000/obs-studio#968
2017-05-27 02:15:54 +02:00
|
|
|
connect(ui->channelSetup, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(SurroundWarning(int)));
|
|
|
|
connect(ui->channelSetup, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(SpeakerLayoutChanged(int)));
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
connect(ui->simpleOutRecQuality, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(SimpleRecordingQualityChanged()));
|
|
|
|
connect(ui->simpleOutRecQuality, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(SimpleRecordingQualityLosslessWarning(int)));
|
2017-02-04 18:47:44 +01:00
|
|
|
connect(ui->simpleOutRecFormat, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(SimpleRecordingEncoderChanged()));
|
2016-04-18 00:56:51 -07:00
|
|
|
connect(ui->simpleOutStrEncoder, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(SimpleStreamingEncoderChanged()));
|
2016-04-23 16:02:58 -07:00
|
|
|
connect(ui->simpleOutStrEncoder, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(SimpleRecordingEncoderChanged()));
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
connect(ui->simpleOutRecEncoder, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(SimpleRecordingEncoderChanged()));
|
2016-04-10 03:12:25 -07:00
|
|
|
connect(ui->simpleOutputVBitrate, SIGNAL(valueChanged(int)), this,
|
|
|
|
SLOT(SimpleRecordingEncoderChanged()));
|
|
|
|
connect(ui->simpleOutputABitrate, SIGNAL(currentIndexChanged(int)),
|
|
|
|
this, SLOT(SimpleRecordingEncoderChanged()));
|
|
|
|
connect(ui->simpleOutAdvanced, SIGNAL(toggled(bool)), this,
|
|
|
|
SLOT(SimpleRecordingEncoderChanged()));
|
2020-11-11 09:48:39 -08:00
|
|
|
connect(ui->ignoreRecommended, SIGNAL(toggled(bool)), this,
|
2016-04-10 03:12:25 -07:00
|
|
|
SLOT(SimpleRecordingEncoderChanged()));
|
2016-12-07 05:21:44 -08:00
|
|
|
connect(ui->simpleReplayBuf, SIGNAL(toggled(bool)), this,
|
|
|
|
SLOT(SimpleReplayBufferChanged()));
|
|
|
|
connect(ui->simpleOutputVBitrate, SIGNAL(valueChanged(int)), this,
|
|
|
|
SLOT(SimpleReplayBufferChanged()));
|
|
|
|
connect(ui->simpleOutputABitrate, SIGNAL(currentIndexChanged(int)),
|
|
|
|
this, SLOT(SimpleReplayBufferChanged()));
|
|
|
|
connect(ui->simpleRBSecMax, SIGNAL(valueChanged(int)), this,
|
|
|
|
SLOT(SimpleReplayBufferChanged()));
|
2021-10-03 19:06:46 +09:00
|
|
|
connect(ui->advOutSplitFile, SIGNAL(stateChanged(int)), this,
|
|
|
|
SLOT(AdvOutSplitFileChanged()));
|
|
|
|
connect(ui->advOutSplitFileType, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(AdvOutSplitFileChanged()));
|
2017-09-05 20:01:49 -04:00
|
|
|
connect(ui->advReplayBuf, SIGNAL(toggled(bool)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
|
|
|
connect(ui->advOutRecTrack1, SIGNAL(toggled(bool)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
|
|
|
connect(ui->advOutRecTrack2, SIGNAL(toggled(bool)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
|
|
|
connect(ui->advOutRecTrack3, SIGNAL(toggled(bool)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
|
|
|
connect(ui->advOutRecTrack4, SIGNAL(toggled(bool)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
|
|
|
connect(ui->advOutRecTrack5, SIGNAL(toggled(bool)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
|
|
|
connect(ui->advOutRecTrack6, SIGNAL(toggled(bool)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
|
|
|
connect(ui->advOutTrack1Bitrate, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
|
|
|
connect(ui->advOutTrack2Bitrate, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
|
|
|
connect(ui->advOutTrack3Bitrate, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
|
|
|
connect(ui->advOutTrack4Bitrate, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
|
|
|
connect(ui->advOutTrack5Bitrate, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
|
|
|
connect(ui->advOutTrack6Bitrate, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
|
|
|
connect(ui->advOutRecType, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
|
|
|
connect(ui->advOutRecEncoder, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
|
|
|
connect(ui->advRBSecMax, SIGNAL(valueChanged(int)), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
2016-04-10 22:55:23 -07:00
|
|
|
connect(ui->listWidget, SIGNAL(currentRowChanged(int)), this,
|
|
|
|
SLOT(SimpleRecordingEncoderChanged()));
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
|
2016-07-29 08:30:54 -07:00
|
|
|
// Get Bind to IP Addresses
|
|
|
|
obs_properties_t *ppts = obs_get_output_properties("rtmp_output");
|
|
|
|
obs_property_t *p = obs_properties_get(ppts, "bind_ip");
|
|
|
|
|
|
|
|
size_t count = obs_property_list_item_count(p);
|
|
|
|
for (size_t i = 0; i < count; i++) {
|
|
|
|
const char *name = obs_property_list_item_name(p, i);
|
|
|
|
const char *val = obs_property_list_item_string(p, i);
|
|
|
|
|
|
|
|
ui->bindToIP->addItem(QT_UTF8(name), val);
|
|
|
|
}
|
|
|
|
|
|
|
|
obs_properties_destroy(ppts);
|
|
|
|
|
2019-02-06 19:19:17 -08:00
|
|
|
InitStreamPage();
|
2014-01-26 15:36:15 -07:00
|
|
|
LoadSettings(false);
|
2015-06-17 12:07:55 -07:00
|
|
|
|
2020-11-25 22:45:28 +13:00
|
|
|
ui->advOutTrack1->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track1"));
|
|
|
|
ui->advOutTrack2->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track2"));
|
|
|
|
ui->advOutTrack3->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track3"));
|
|
|
|
ui->advOutTrack4->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track4"));
|
|
|
|
ui->advOutTrack5->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track5"));
|
|
|
|
ui->advOutTrack6->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track6"));
|
|
|
|
|
|
|
|
ui->advOutRecTrack1->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track1"));
|
|
|
|
ui->advOutRecTrack2->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track2"));
|
|
|
|
ui->advOutRecTrack3->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track3"));
|
|
|
|
ui->advOutRecTrack4->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track4"));
|
|
|
|
ui->advOutRecTrack5->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track5"));
|
|
|
|
ui->advOutRecTrack6->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track6"));
|
|
|
|
|
|
|
|
ui->advOutFFTrack1->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track1"));
|
|
|
|
ui->advOutFFTrack2->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track2"));
|
|
|
|
ui->advOutFFTrack3->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track3"));
|
|
|
|
ui->advOutFFTrack4->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track4"));
|
|
|
|
ui->advOutFFTrack5->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track5"));
|
|
|
|
ui->advOutFFTrack6->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Audio.Track6"));
|
|
|
|
|
|
|
|
ui->snappingEnabled->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.General.Snapping"));
|
|
|
|
ui->systemTrayEnabled->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.General.SysTray"));
|
|
|
|
ui->label_31->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Recording.RecType"));
|
|
|
|
ui->streamDelayEnable->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Advanced.StreamDelay"));
|
|
|
|
ui->reconnectEnable->setAccessibleName(
|
|
|
|
QTStr("Basic.Settings.Output.Reconnect"));
|
|
|
|
|
2015-06-17 12:07:55 -07:00
|
|
|
// Add warning checks to advanced output recording section controls
|
2019-09-12 13:55:31 -07:00
|
|
|
connect(ui->advOutRecTrack1, SIGNAL(clicked()), this,
|
2015-06-17 12:07:55 -07:00
|
|
|
SLOT(AdvOutRecCheckWarnings()));
|
2019-09-12 13:55:31 -07:00
|
|
|
connect(ui->advOutRecTrack2, SIGNAL(clicked()), this,
|
2015-06-17 12:07:55 -07:00
|
|
|
SLOT(AdvOutRecCheckWarnings()));
|
2019-09-12 13:55:31 -07:00
|
|
|
connect(ui->advOutRecTrack3, SIGNAL(clicked()), this,
|
2015-06-17 12:07:55 -07:00
|
|
|
SLOT(AdvOutRecCheckWarnings()));
|
2019-09-12 13:55:31 -07:00
|
|
|
connect(ui->advOutRecTrack4, SIGNAL(clicked()), this,
|
2015-06-17 12:07:55 -07:00
|
|
|
SLOT(AdvOutRecCheckWarnings()));
|
2019-09-12 13:55:31 -07:00
|
|
|
connect(ui->advOutRecTrack5, SIGNAL(clicked()), this,
|
2016-12-21 17:14:24 -08:00
|
|
|
SLOT(AdvOutRecCheckWarnings()));
|
2019-09-12 13:55:31 -07:00
|
|
|
connect(ui->advOutRecTrack6, SIGNAL(clicked()), this,
|
2016-12-21 17:14:24 -08:00
|
|
|
SLOT(AdvOutRecCheckWarnings()));
|
2017-02-04 18:47:44 +01:00
|
|
|
connect(ui->advOutRecFormat, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(AdvOutRecCheckWarnings()));
|
2019-07-07 15:47:29 -07:00
|
|
|
connect(ui->advOutRecEncoder, SIGNAL(currentIndexChanged(int)), this,
|
|
|
|
SLOT(AdvOutRecCheckWarnings()));
|
2015-06-17 12:07:55 -07:00
|
|
|
AdvOutRecCheckWarnings();
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
|
2019-04-29 16:34:10 -05:00
|
|
|
ui->buttonBox->button(QDialogButtonBox::Apply)->setIcon(QIcon());
|
|
|
|
ui->buttonBox->button(QDialogButtonBox::Ok)->setIcon(QIcon());
|
|
|
|
ui->buttonBox->button(QDialogButtonBox::Cancel)->setIcon(QIcon());
|
|
|
|
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
SimpleRecordingQualityChanged();
|
2021-10-03 19:06:46 +09:00
|
|
|
AdvOutSplitFileChanged();
|
2017-01-04 16:11:52 -05:00
|
|
|
|
|
|
|
UpdateAutomaticReplayBufferCheckboxes();
|
2018-05-06 16:48:27 -07:00
|
|
|
|
2019-07-22 01:20:12 -07:00
|
|
|
App()->DisableHotkeys();
|
2020-01-12 13:30:06 -06:00
|
|
|
|
|
|
|
channelIndex = ui->channelSetup->currentIndex();
|
|
|
|
sampleRateIndex = ui->sampleRate->currentIndex();
|
2020-01-27 23:45:49 -06:00
|
|
|
|
2021-03-04 21:30:03 -08:00
|
|
|
QRegularExpression rx("\\d{1,5}x\\d{1,5}");
|
|
|
|
QValidator *validator = new QRegularExpressionValidator(rx, this);
|
2020-01-27 23:45:49 -06:00
|
|
|
ui->baseResolution->lineEdit()->setValidator(validator);
|
|
|
|
ui->outputResolution->lineEdit()->setValidator(validator);
|
2021-06-27 15:30:00 -07:00
|
|
|
|
|
|
|
connect(ui->useStreamKeyAdv, SIGNAL(clicked()), this,
|
|
|
|
SLOT(UseStreamKeyAdvClicked()));
|
2014-01-26 15:36:15 -07:00
|
|
|
}
|
|
|
|
|
2017-05-15 14:26:05 -07:00
|
|
|
OBSBasicSettings::~OBSBasicSettings()
|
|
|
|
{
|
2018-05-13 03:03:41 +02:00
|
|
|
delete ui->filenameFormatting->completer();
|
2017-05-15 14:26:05 -07:00
|
|
|
main->EnableOutputs(true);
|
2019-07-22 01:20:12 -07:00
|
|
|
|
|
|
|
App()->UpdateHotkeyFocusSetting();
|
2019-02-20 17:33:29 -08:00
|
|
|
|
|
|
|
EnableThreadedMessageBoxes(false);
|
2017-05-15 14:26:05 -07:00
|
|
|
}
|
|
|
|
|
2014-06-23 19:54:20 -07:00
|
|
|
void OBSBasicSettings::SaveCombo(QComboBox *widget, const char *section,
|
|
|
|
const char *value)
|
|
|
|
{
|
|
|
|
if (WidgetChanged(widget))
|
|
|
|
config_set_string(main->Config(), section, value,
|
|
|
|
QT_TO_UTF8(widget->currentText()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SaveComboData(QComboBox *widget, const char *section,
|
|
|
|
const char *value)
|
|
|
|
{
|
|
|
|
if (WidgetChanged(widget)) {
|
|
|
|
QString str = GetComboData(widget);
|
|
|
|
config_set_string(main->Config(), section, value,
|
|
|
|
QT_TO_UTF8(str));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
void OBSBasicSettings::SaveCheckBox(QAbstractButton *widget,
|
|
|
|
const char *section, const char *value,
|
|
|
|
bool invert)
|
2014-07-03 18:07:33 -07:00
|
|
|
{
|
2015-01-26 13:41:22 -08:00
|
|
|
if (WidgetChanged(widget)) {
|
|
|
|
bool checked = widget->isChecked();
|
|
|
|
if (invert)
|
|
|
|
checked = !checked;
|
|
|
|
|
|
|
|
config_set_bool(main->Config(), section, value, checked);
|
|
|
|
}
|
2014-07-03 18:07:33 -07:00
|
|
|
}
|
|
|
|
|
2014-06-23 19:54:20 -07:00
|
|
|
void OBSBasicSettings::SaveEdit(QLineEdit *widget, const char *section,
|
|
|
|
const char *value)
|
|
|
|
{
|
|
|
|
if (WidgetChanged(widget))
|
|
|
|
config_set_string(main->Config(), section, value,
|
|
|
|
QT_TO_UTF8(widget->text()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SaveSpinBox(QSpinBox *widget, const char *section,
|
|
|
|
const char *value)
|
|
|
|
{
|
|
|
|
if (WidgetChanged(widget))
|
|
|
|
config_set_int(main->Config(), section, value, widget->value());
|
|
|
|
}
|
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
#define TEXT_USE_STREAM_ENC \
|
|
|
|
QTStr("Basic.Settings.Output.Adv.Recording.UseStreamEncoder")
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadEncoderTypes()
|
|
|
|
{
|
|
|
|
const char *type;
|
|
|
|
size_t idx = 0;
|
|
|
|
|
|
|
|
ui->advOutRecEncoder->addItem(TEXT_USE_STREAM_ENC, "none");
|
|
|
|
|
|
|
|
while (obs_enum_encoder_types(idx++, &type)) {
|
|
|
|
const char *name = obs_encoder_get_display_name(type);
|
|
|
|
const char *codec = obs_get_encoder_codec(type);
|
2016-04-11 05:03:30 -07:00
|
|
|
uint32_t caps = obs_get_encoder_caps(type);
|
2015-01-26 13:41:22 -08:00
|
|
|
|
2017-02-09 02:54:19 +01:00
|
|
|
if (obs_get_encoder_type(type) != OBS_ENCODER_VIDEO)
|
2015-01-26 13:41:22 -08:00
|
|
|
continue;
|
2017-02-09 02:54:19 +01:00
|
|
|
|
|
|
|
const char *streaming_codecs[] = {
|
|
|
|
"h264",
|
2022-03-06 11:29:31 -08:00
|
|
|
#ifdef ENABLE_HEVC
|
|
|
|
"hevc",
|
|
|
|
#endif
|
2017-02-09 02:54:19 +01:00
|
|
|
};
|
|
|
|
bool is_streaming_codec = false;
|
|
|
|
for (const char *test_codec : streaming_codecs) {
|
|
|
|
if (strcmp(codec, test_codec) == 0) {
|
|
|
|
is_streaming_codec = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2020-02-18 21:34:39 -08:00
|
|
|
if ((caps & ENCODER_HIDE_FLAGS) != 0)
|
2016-04-11 05:03:30 -07:00
|
|
|
continue;
|
2015-01-26 13:41:22 -08:00
|
|
|
|
|
|
|
QString qName = QT_UTF8(name);
|
|
|
|
QString qType = QT_UTF8(type);
|
|
|
|
|
2017-02-09 02:54:19 +01:00
|
|
|
if (is_streaming_codec)
|
|
|
|
ui->advOutEncoder->addItem(qName, qType);
|
2015-01-26 13:41:22 -08:00
|
|
|
ui->advOutRecEncoder->addItem(qName, qType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-11 12:55:06 -08:00
|
|
|
#define CS_PARTIAL_STR QTStr("Basic.Settings.Advanced.Video.ColorRange.Partial")
|
|
|
|
#define CS_FULL_STR QTStr("Basic.Settings.Advanced.Video.ColorRange.Full")
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadColorRanges()
|
|
|
|
{
|
|
|
|
ui->colorRange->addItem(CS_PARTIAL_STR, "Partial");
|
|
|
|
ui->colorRange->addItem(CS_FULL_STR, "Full");
|
|
|
|
}
|
|
|
|
|
2022-01-19 00:51:25 -08:00
|
|
|
#define CS_SRGB_STR QTStr("Basic.Settings.Advanced.Video.ColorSpace.sRGB")
|
|
|
|
#define CS_709_STR QTStr("Basic.Settings.Advanced.Video.ColorSpace.709")
|
|
|
|
#define CS_601_STR QTStr("Basic.Settings.Advanced.Video.ColorSpace.601")
|
2022-04-09 20:54:28 -07:00
|
|
|
#define CS_2100PQ_STR QTStr("Basic.Settings.Advanced.Video.ColorSpace.2100PQ")
|
|
|
|
#define CS_2100HLG_STR QTStr("Basic.Settings.Advanced.Video.ColorSpace.2100HLG")
|
2022-01-19 00:51:25 -08:00
|
|
|
|
|
|
|
void OBSBasicSettings::LoadColorSpaces()
|
|
|
|
{
|
|
|
|
ui->colorSpace->addItem(CS_SRGB_STR, "sRGB");
|
|
|
|
ui->colorSpace->addItem(CS_709_STR, "709");
|
|
|
|
ui->colorSpace->addItem(CS_601_STR, "601");
|
2022-04-09 20:54:28 -07:00
|
|
|
ui->colorSpace->addItem(CS_2100PQ_STR, "2100PQ");
|
|
|
|
ui->colorSpace->addItem(CS_2100HLG_STR, "2100HLG");
|
2022-01-19 00:51:25 -08:00
|
|
|
}
|
|
|
|
|
2022-07-12 12:08:26 +02:00
|
|
|
#define CF_NV12_STR QTStr("Basic.Settings.Advanced.Video.ColorFormat.NV12")
|
|
|
|
#define CF_I420_STR QTStr("Basic.Settings.Advanced.Video.ColorFormat.I420")
|
|
|
|
#define CF_I444_STR QTStr("Basic.Settings.Advanced.Video.ColorFormat.I444")
|
|
|
|
#define CF_P010_STR QTStr("Basic.Settings.Advanced.Video.ColorFormat.P010")
|
|
|
|
#define CF_I010_STR QTStr("Basic.Settings.Advanced.Video.ColorFormat.I010")
|
|
|
|
#define CF_RGB_STR QTStr("Basic.Settings.Advanced.Video.ColorFormat.RGB")
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadColorFormats()
|
|
|
|
{
|
|
|
|
ui->colorFormat->addItem(CF_NV12_STR, "NV12");
|
|
|
|
ui->colorFormat->addItem(CF_I420_STR, "I420");
|
|
|
|
ui->colorFormat->addItem(CF_I444_STR, "I444");
|
|
|
|
ui->colorFormat->addItem(CF_P010_STR, "P010");
|
|
|
|
ui->colorFormat->addItem(CF_I010_STR, "I010");
|
|
|
|
ui->colorFormat->addItem(CF_RGB_STR, "RGB");
|
|
|
|
}
|
|
|
|
|
2015-03-28 02:21:16 -05:00
|
|
|
#define AV_FORMAT_DEFAULT_STR \
|
|
|
|
QTStr("Basic.Settings.Output.Adv.FFmpeg.FormatDefault")
|
|
|
|
#define AUDIO_STR QTStr("Basic.Settings.Output.Adv.FFmpeg.FormatAudio")
|
|
|
|
#define VIDEO_STR QTStr("Basic.Settings.Output.Adv.FFmpeg.FormatVideo")
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadFormats()
|
|
|
|
{
|
2015-04-26 22:34:55 -05:00
|
|
|
ui->advOutFFFormat->blockSignals(true);
|
|
|
|
|
2015-03-28 02:21:16 -05:00
|
|
|
formats.reset(ff_format_supported());
|
|
|
|
const ff_format_desc *format = formats.get();
|
|
|
|
|
|
|
|
while (format != nullptr) {
|
|
|
|
bool audio = ff_format_desc_has_audio(format);
|
|
|
|
bool video = ff_format_desc_has_video(format);
|
|
|
|
FormatDesc formatDesc(ff_format_desc_name(format),
|
|
|
|
ff_format_desc_mime_type(format), format);
|
|
|
|
if (audio || video) {
|
|
|
|
QString itemText(ff_format_desc_name(format));
|
|
|
|
if (audio ^ video)
|
|
|
|
itemText += QString(" (%1)").arg(
|
|
|
|
audio ? AUDIO_STR : VIDEO_STR);
|
|
|
|
|
|
|
|
ui->advOutFFFormat->addItem(
|
2020-01-20 22:13:16 -08:00
|
|
|
itemText, QVariant::fromValue(formatDesc));
|
2015-03-28 02:21:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
format = ff_format_desc_next(format);
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->advOutFFFormat->model()->sort(0);
|
|
|
|
|
|
|
|
ui->advOutFFFormat->insertItem(0, AV_FORMAT_DEFAULT_STR);
|
2015-04-26 22:34:55 -05:00
|
|
|
|
|
|
|
ui->advOutFFFormat->blockSignals(false);
|
2015-03-28 02:21:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void AddCodec(QComboBox *combo, const ff_codec_desc *codec_desc)
|
|
|
|
{
|
|
|
|
QString itemText(ff_codec_desc_name(codec_desc));
|
|
|
|
if (ff_codec_desc_is_alias(codec_desc))
|
|
|
|
itemText += QString(" (%1)").arg(
|
|
|
|
ff_codec_desc_base_name(codec_desc));
|
|
|
|
|
|
|
|
CodecDesc cd(ff_codec_desc_name(codec_desc),
|
|
|
|
ff_codec_desc_id(codec_desc));
|
|
|
|
|
2020-01-20 22:13:16 -08:00
|
|
|
combo->addItem(itemText, QVariant::fromValue(cd));
|
2015-03-28 02:21:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#define AV_ENCODER_DEFAULT_STR \
|
|
|
|
QTStr("Basic.Settings.Output.Adv.FFmpeg.AVEncoderDefault")
|
|
|
|
|
|
|
|
static void AddDefaultCodec(QComboBox *combo, const ff_format_desc *formatDesc,
|
|
|
|
ff_codec_type codecType)
|
|
|
|
{
|
|
|
|
CodecDesc cd = GetDefaultCodecDesc(formatDesc, codecType);
|
|
|
|
|
|
|
|
int existingIdx = FindEncoder(combo, cd.name, cd.id);
|
|
|
|
if (existingIdx >= 0)
|
|
|
|
combo->removeItem(existingIdx);
|
|
|
|
|
|
|
|
combo->addItem(QString("%1 (%2)").arg(cd.name, AV_ENCODER_DEFAULT_STR),
|
2020-01-20 22:13:16 -08:00
|
|
|
QVariant::fromValue(cd));
|
2015-03-28 02:21:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#define AV_ENCODER_DISABLE_STR \
|
|
|
|
QTStr("Basic.Settings.Output.Adv.FFmpeg.AVEncoderDisable")
|
|
|
|
|
|
|
|
void OBSBasicSettings::ReloadCodecs(const ff_format_desc *formatDesc)
|
|
|
|
{
|
|
|
|
ui->advOutFFAEncoder->blockSignals(true);
|
|
|
|
ui->advOutFFVEncoder->blockSignals(true);
|
|
|
|
ui->advOutFFAEncoder->clear();
|
|
|
|
ui->advOutFFVEncoder->clear();
|
|
|
|
|
|
|
|
if (formatDesc == nullptr)
|
|
|
|
return;
|
|
|
|
|
2017-02-17 18:07:32 +01:00
|
|
|
bool ignore_compatability = ui->advOutFFIgnoreCompat->isChecked();
|
|
|
|
OBSFFCodecDesc codecDescs(
|
|
|
|
ff_codec_supported(formatDesc, ignore_compatability));
|
2015-03-28 02:21:16 -05:00
|
|
|
|
|
|
|
const ff_codec_desc *codec = codecDescs.get();
|
|
|
|
|
|
|
|
while (codec != nullptr) {
|
|
|
|
switch (ff_codec_desc_type(codec)) {
|
|
|
|
case FF_CODEC_AUDIO:
|
|
|
|
AddCodec(ui->advOutFFAEncoder, codec);
|
|
|
|
break;
|
|
|
|
case FF_CODEC_VIDEO:
|
|
|
|
AddCodec(ui->advOutFFVEncoder, codec);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
codec = ff_codec_desc_next(codec);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ff_format_desc_has_audio(formatDesc))
|
|
|
|
AddDefaultCodec(ui->advOutFFAEncoder, formatDesc,
|
|
|
|
FF_CODEC_AUDIO);
|
|
|
|
if (ff_format_desc_has_video(formatDesc))
|
|
|
|
AddDefaultCodec(ui->advOutFFVEncoder, formatDesc,
|
|
|
|
FF_CODEC_VIDEO);
|
|
|
|
|
|
|
|
ui->advOutFFAEncoder->model()->sort(0);
|
|
|
|
ui->advOutFFVEncoder->model()->sort(0);
|
|
|
|
|
2020-01-20 22:13:16 -08:00
|
|
|
QVariant disable = QVariant::fromValue(CodecDesc());
|
2015-03-28 02:21:16 -05:00
|
|
|
|
|
|
|
ui->advOutFFAEncoder->insertItem(0, AV_ENCODER_DISABLE_STR, disable);
|
|
|
|
ui->advOutFFVEncoder->insertItem(0, AV_ENCODER_DISABLE_STR, disable);
|
|
|
|
|
|
|
|
ui->advOutFFAEncoder->blockSignals(false);
|
|
|
|
ui->advOutFFVEncoder->blockSignals(false);
|
|
|
|
}
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
void OBSBasicSettings::LoadLanguageList()
|
|
|
|
{
|
2014-07-11 20:35:04 +02:00
|
|
|
const char *currentLang = App()->GetLocale();
|
2014-01-26 15:36:15 -07:00
|
|
|
|
|
|
|
ui->language->clear();
|
|
|
|
|
2014-07-11 20:12:32 +02:00
|
|
|
for (const auto &locale : GetLocaleNames()) {
|
2014-01-26 15:36:15 -07:00
|
|
|
int idx = ui->language->count();
|
|
|
|
|
2014-07-11 20:12:32 +02:00
|
|
|
ui->language->addItem(QT_UTF8(locale.second.c_str()),
|
|
|
|
QT_UTF8(locale.first.c_str()));
|
2014-01-26 15:36:15 -07:00
|
|
|
|
2014-07-11 20:12:32 +02:00
|
|
|
if (locale.first == currentLang)
|
2014-01-26 15:36:15 -07:00
|
|
|
ui->language->setCurrentIndex(idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
ui->language->model()->sort(0);
|
|
|
|
}
|
|
|
|
|
2015-02-17 02:45:34 -05:00
|
|
|
void OBSBasicSettings::LoadThemeList()
|
|
|
|
{
|
|
|
|
/* Save theme if user presses Cancel */
|
|
|
|
savedTheme = string(App()->GetTheme());
|
|
|
|
|
|
|
|
ui->theme->clear();
|
|
|
|
QSet<QString> uniqueSet;
|
|
|
|
string themeDir;
|
|
|
|
char userThemeDir[512];
|
2015-06-01 16:11:57 -07:00
|
|
|
int ret = GetConfigPath(userThemeDir, sizeof(userThemeDir),
|
2015-02-17 02:45:34 -05:00
|
|
|
"obs-studio/themes/");
|
|
|
|
GetDataFilePath("themes/", themeDir);
|
|
|
|
|
|
|
|
/* Check user dir first. */
|
|
|
|
if (ret > 0) {
|
|
|
|
QDirIterator it(QString(userThemeDir), QStringList() << "*.qss",
|
|
|
|
QDir::Files);
|
|
|
|
while (it.hasNext()) {
|
|
|
|
it.next();
|
2022-06-07 16:59:50 -05:00
|
|
|
QString name = it.fileInfo().completeBaseName();
|
2015-02-17 02:45:34 -05:00
|
|
|
ui->theme->addItem(name);
|
|
|
|
uniqueSet.insert(name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-29 04:16:12 -05:00
|
|
|
QString defaultTheme;
|
|
|
|
defaultTheme += DEFAULT_THEME;
|
|
|
|
defaultTheme += " ";
|
|
|
|
defaultTheme += QTStr("Default");
|
|
|
|
|
2015-02-17 02:45:34 -05:00
|
|
|
/* Check shipped themes. */
|
|
|
|
QDirIterator uIt(QString(themeDir.c_str()), QStringList() << "*.qss",
|
|
|
|
QDir::Files);
|
|
|
|
while (uIt.hasNext()) {
|
|
|
|
uIt.next();
|
2022-06-07 16:59:50 -05:00
|
|
|
QString name = uIt.fileInfo().completeBaseName();
|
2019-03-29 04:16:12 -05:00
|
|
|
|
|
|
|
if (name == DEFAULT_THEME)
|
|
|
|
name = defaultTheme;
|
|
|
|
|
|
|
|
if (!uniqueSet.contains(name) && name != "Default")
|
2015-02-17 02:45:34 -05:00
|
|
|
ui->theme->addItem(name);
|
|
|
|
}
|
|
|
|
|
2019-05-02 15:47:35 -07:00
|
|
|
std::string themeName = App()->GetTheme();
|
2019-03-29 04:16:12 -05:00
|
|
|
|
2019-05-02 15:47:35 -07:00
|
|
|
if (themeName == DEFAULT_THEME)
|
2019-03-29 04:16:12 -05:00
|
|
|
themeName = QT_TO_UTF8(defaultTheme);
|
|
|
|
|
2019-05-02 15:47:35 -07:00
|
|
|
int idx = ui->theme->findText(themeName.c_str());
|
2015-02-17 02:45:34 -05:00
|
|
|
if (idx != -1)
|
|
|
|
ui->theme->setCurrentIndex(idx);
|
|
|
|
}
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
void OBSBasicSettings::LoadGeneralSettings()
|
|
|
|
{
|
|
|
|
loading = true;
|
|
|
|
|
|
|
|
LoadLanguageList();
|
2015-02-17 02:45:34 -05:00
|
|
|
LoadThemeList();
|
2014-01-26 15:36:15 -07:00
|
|
|
|
2017-02-27 08:00:13 -08:00
|
|
|
#if defined(_WIN32) || defined(__APPLE__)
|
2017-02-20 04:46:29 -08:00
|
|
|
bool enableAutoUpdates = config_get_bool(GetGlobalConfig(), "General",
|
|
|
|
"EnableAutoUpdates");
|
|
|
|
ui->enableAutoUpdates->setChecked(enableAutoUpdates);
|
2017-02-27 08:00:13 -08:00
|
|
|
#endif
|
2017-05-13 20:47:47 -07:00
|
|
|
bool openStatsOnStartup = config_get_bool(main->Config(), "General",
|
|
|
|
"OpenStatsOnStartup");
|
|
|
|
ui->openStatsOnStartup->setChecked(openStatsOnStartup);
|
2017-02-20 04:46:29 -08:00
|
|
|
|
2020-06-27 02:31:08 +02:00
|
|
|
#if defined(_WIN32)
|
|
|
|
if (ui->hideOBSFromCapture) {
|
|
|
|
bool hideWindowFromCapture =
|
|
|
|
config_get_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"HideOBSWindowsFromCapture");
|
|
|
|
ui->hideOBSFromCapture->setChecked(hideWindowFromCapture);
|
2022-01-23 12:27:18 +11:00
|
|
|
|
|
|
|
connect(ui->hideOBSFromCapture, SIGNAL(stateChanged(int)), this,
|
|
|
|
SLOT(HideOBSWindowWarning(int)));
|
2020-06-27 02:31:08 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-06-16 12:59:36 -05:00
|
|
|
bool recordWhenStreaming = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "RecordWhenStreaming");
|
|
|
|
ui->recordWhenStreaming->setChecked(recordWhenStreaming);
|
|
|
|
|
|
|
|
bool keepRecordStreamStops =
|
|
|
|
config_get_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"KeepRecordingWhenStreamStops");
|
|
|
|
ui->keepRecordStreamStops->setChecked(keepRecordStreamStops);
|
|
|
|
|
2017-01-04 16:11:52 -05:00
|
|
|
bool replayWhileStreaming = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "ReplayBufferWhileStreaming");
|
|
|
|
ui->replayWhileStreaming->setChecked(replayWhileStreaming);
|
|
|
|
|
|
|
|
bool keepReplayStreamStops =
|
|
|
|
config_get_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"KeepReplayBufferStreamStops");
|
|
|
|
ui->keepReplayStreamStops->setChecked(keepReplayStreamStops);
|
|
|
|
|
2016-08-13 09:36:17 -05:00
|
|
|
bool systemTrayEnabled = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "SysTrayEnabled");
|
|
|
|
ui->systemTrayEnabled->setChecked(systemTrayEnabled);
|
|
|
|
|
|
|
|
bool systemTrayWhenStarted = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "SysTrayWhenStarted");
|
|
|
|
ui->systemTrayWhenStarted->setChecked(systemTrayWhenStarted);
|
|
|
|
|
2017-01-24 23:01:24 -08:00
|
|
|
bool systemTrayAlways = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "SysTrayMinimizeToTray");
|
|
|
|
ui->systemTrayAlways->setChecked(systemTrayAlways);
|
2020-07-11 06:05:35 -07:00
|
|
|
|
2016-12-29 09:21:53 -06:00
|
|
|
bool saveProjectors = config_get_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"SaveProjectors");
|
|
|
|
ui->saveProjectors->setChecked(saveProjectors);
|
|
|
|
|
2021-08-06 01:42:29 -05:00
|
|
|
bool closeProjectors = config_get_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"CloseExistingProjectors");
|
|
|
|
ui->closeProjectors->setChecked(closeProjectors);
|
|
|
|
|
2016-04-06 18:03:29 -07:00
|
|
|
bool snappingEnabled = config_get_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"SnappingEnabled");
|
|
|
|
ui->snappingEnabled->setChecked(snappingEnabled);
|
|
|
|
|
|
|
|
bool screenSnapping = config_get_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"ScreenSnapping");
|
|
|
|
ui->screenSnapping->setChecked(screenSnapping);
|
|
|
|
|
2016-04-06 18:10:39 -07:00
|
|
|
bool centerSnapping = config_get_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"CenterSnapping");
|
|
|
|
ui->centerSnapping->setChecked(centerSnapping);
|
|
|
|
|
2016-04-06 18:13:56 -07:00
|
|
|
bool sourceSnapping = config_get_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"SourceSnapping");
|
|
|
|
ui->sourceSnapping->setChecked(sourceSnapping);
|
|
|
|
|
2016-04-06 18:03:29 -07:00
|
|
|
double snapDistance = config_get_double(GetGlobalConfig(),
|
|
|
|
"BasicWindow", "SnapDistance");
|
|
|
|
ui->snapDistance->setValue(snapDistance);
|
|
|
|
|
2016-01-22 08:09:04 -08:00
|
|
|
bool warnBeforeStreamStart = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "WarnBeforeStartingStream");
|
|
|
|
ui->warnBeforeStreamStart->setChecked(warnBeforeStreamStart);
|
|
|
|
|
|
|
|
bool warnBeforeStreamStop = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "WarnBeforeStoppingStream");
|
|
|
|
ui->warnBeforeStreamStop->setChecked(warnBeforeStreamStop);
|
|
|
|
|
2019-06-17 15:14:14 +01:00
|
|
|
bool warnBeforeRecordStop = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "WarnBeforeStoppingRecord");
|
|
|
|
ui->warnBeforeRecordStop->setChecked(warnBeforeRecordStop);
|
|
|
|
|
2016-06-27 14:47:42 -07:00
|
|
|
bool hideProjectorCursor = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "HideProjectorCursor");
|
|
|
|
ui->hideProjectorCursor->setChecked(hideProjectorCursor);
|
|
|
|
|
2016-08-21 16:11:32 -07:00
|
|
|
bool projectorAlwaysOnTop = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "ProjectorAlwaysOnTop");
|
|
|
|
ui->projectorAlwaysOnTop->setChecked(projectorAlwaysOnTop);
|
|
|
|
|
2019-01-15 14:58:20 +13:00
|
|
|
bool overflowHide = config_get_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"OverflowHidden");
|
|
|
|
ui->overflowHide->setChecked(overflowHide);
|
|
|
|
|
|
|
|
bool overflowAlwaysVisible = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "OverflowAlwaysVisible");
|
|
|
|
ui->overflowAlwaysVisible->setChecked(overflowAlwaysVisible);
|
|
|
|
|
|
|
|
bool overflowSelectionHide = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "OverflowSelectionHidden");
|
|
|
|
ui->overflowSelectionHide->setChecked(overflowSelectionHide);
|
|
|
|
|
2021-08-19 23:56:49 -05:00
|
|
|
bool safeAreas = config_get_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"ShowSafeAreas");
|
|
|
|
ui->previewSafeAreas->setChecked(safeAreas);
|
|
|
|
|
2020-02-02 20:44:07 +13:00
|
|
|
bool automaticSearch = config_get_bool(GetGlobalConfig(), "General",
|
|
|
|
"AutomaticCollectionSearch");
|
|
|
|
ui->automaticSearch->setChecked(automaticSearch);
|
|
|
|
|
2017-09-21 15:37:01 -05:00
|
|
|
bool doubleClickSwitch = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "TransitionOnDoubleClick");
|
|
|
|
ui->doubleClickSwitch->setChecked(doubleClickSwitch);
|
|
|
|
|
2017-11-08 23:44:22 -05:00
|
|
|
bool studioPortraitLayout = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "StudioPortraitLayout");
|
|
|
|
ui->studioPortraitLayout->setChecked(studioPortraitLayout);
|
|
|
|
|
2019-02-28 15:29:41 -06:00
|
|
|
bool prevProgLabels = config_get_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"StudioModeLabels");
|
|
|
|
ui->prevProgLabelToggle->setChecked(prevProgLabels);
|
|
|
|
|
2018-03-16 18:55:56 -03:00
|
|
|
bool multiviewMouseSwitch = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "MultiviewMouseSwitch");
|
|
|
|
ui->multiviewMouseSwitch->setChecked(multiviewMouseSwitch);
|
|
|
|
|
2018-03-16 23:00:32 -03:00
|
|
|
bool multiviewDrawNames = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "MultiviewDrawNames");
|
|
|
|
ui->multiviewDrawNames->setChecked(multiviewDrawNames);
|
|
|
|
|
2018-03-18 23:02:27 -03:00
|
|
|
bool multiviewDrawAreas = config_get_bool(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "MultiviewDrawAreas");
|
|
|
|
ui->multiviewDrawAreas->setChecked(multiviewDrawAreas);
|
|
|
|
|
2017-12-13 19:42:19 -02:00
|
|
|
ui->multiviewLayout->addItem(
|
|
|
|
QTStr("Basic.Settings.General.MultiviewLayout.Horizontal.Top"),
|
2018-03-20 21:41:39 -03:00
|
|
|
static_cast<int>(MultiviewLayout::HORIZONTAL_TOP_8_SCENES));
|
2017-12-13 19:42:19 -02:00
|
|
|
ui->multiviewLayout->addItem(
|
|
|
|
QTStr("Basic.Settings.General.MultiviewLayout.Horizontal.Bottom"),
|
2018-03-20 21:41:39 -03:00
|
|
|
static_cast<int>(MultiviewLayout::HORIZONTAL_BOTTOM_8_SCENES));
|
2017-12-13 19:42:19 -02:00
|
|
|
ui->multiviewLayout->addItem(
|
|
|
|
QTStr("Basic.Settings.General.MultiviewLayout.Vertical.Left"),
|
2018-03-20 21:41:39 -03:00
|
|
|
static_cast<int>(MultiviewLayout::VERTICAL_LEFT_8_SCENES));
|
2017-12-13 19:42:19 -02:00
|
|
|
ui->multiviewLayout->addItem(
|
|
|
|
QTStr("Basic.Settings.General.MultiviewLayout.Vertical.Right"),
|
2018-03-20 21:41:39 -03:00
|
|
|
static_cast<int>(MultiviewLayout::VERTICAL_RIGHT_8_SCENES));
|
2021-07-19 22:16:44 -07:00
|
|
|
ui->multiviewLayout->addItem(
|
|
|
|
QTStr("Basic.Settings.General.MultiviewLayout.Horizontal.18Scene.Top"),
|
|
|
|
static_cast<int>(MultiviewLayout::HORIZONTAL_TOP_18_SCENES));
|
2018-03-23 00:57:15 -03:00
|
|
|
ui->multiviewLayout->addItem(
|
|
|
|
QTStr("Basic.Settings.General.MultiviewLayout.Horizontal.Extended.Top"),
|
|
|
|
static_cast<int>(MultiviewLayout::HORIZONTAL_TOP_24_SCENES));
|
2021-12-15 10:45:10 +01:00
|
|
|
ui->multiviewLayout->addItem(
|
|
|
|
QTStr("Basic.Settings.General.MultiviewLayout.4Scene"),
|
|
|
|
static_cast<int>(MultiviewLayout::SCENES_ONLY_4_SCENES));
|
|
|
|
ui->multiviewLayout->addItem(
|
|
|
|
QTStr("Basic.Settings.General.MultiviewLayout.9Scene"),
|
|
|
|
static_cast<int>(MultiviewLayout::SCENES_ONLY_9_SCENES));
|
|
|
|
ui->multiviewLayout->addItem(
|
|
|
|
QTStr("Basic.Settings.General.MultiviewLayout.16Scene"),
|
|
|
|
static_cast<int>(MultiviewLayout::SCENES_ONLY_16_SCENES));
|
|
|
|
ui->multiviewLayout->addItem(
|
|
|
|
QTStr("Basic.Settings.General.MultiviewLayout.25Scene"),
|
|
|
|
static_cast<int>(MultiviewLayout::SCENES_ONLY_25_SCENES));
|
2019-06-22 22:13:45 -07:00
|
|
|
|
2021-07-20 17:22:44 +12:00
|
|
|
ui->multiviewLayout->setCurrentIndex(ui->multiviewLayout->findData(
|
2021-07-20 17:34:42 +12:00
|
|
|
QVariant::fromValue(config_get_int(
|
|
|
|
GetGlobalConfig(), "BasicWindow", "MultiviewLayout"))));
|
2017-12-13 19:42:19 -02:00
|
|
|
|
2020-02-16 15:15:33 -06:00
|
|
|
prevLangIndex = ui->language->currentIndex();
|
|
|
|
|
|
|
|
if (obs_video_active())
|
|
|
|
ui->language->setEnabled(false);
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
loading = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadRendererList()
|
|
|
|
{
|
2016-01-25 06:22:00 -08:00
|
|
|
#ifdef _WIN32
|
2014-01-26 15:36:15 -07:00
|
|
|
const char *renderer =
|
|
|
|
config_get_string(GetGlobalConfig(), "Video", "Renderer");
|
|
|
|
|
|
|
|
ui->renderer->addItem(QT_UTF8("Direct3D 11"));
|
2017-04-10 16:53:28 +02:00
|
|
|
if (opt_allow_opengl || strcmp(renderer, "OpenGL") == 0)
|
2017-04-10 15:52:53 +02:00
|
|
|
ui->renderer->addItem(QT_UTF8("OpenGL"));
|
2014-01-26 15:36:15 -07:00
|
|
|
|
|
|
|
int idx = ui->renderer->findText(QT_UTF8(renderer));
|
|
|
|
if (idx == -1)
|
|
|
|
idx = 0;
|
|
|
|
|
2017-04-10 15:52:53 +02:00
|
|
|
// the video adapter selection is not currently implemented, hide for now
|
|
|
|
// to avoid user confusion. was previously protected by
|
|
|
|
// if (strcmp(renderer, "OpenGL") == 0)
|
|
|
|
delete ui->adapter;
|
|
|
|
delete ui->adapterLabel;
|
|
|
|
ui->adapter = nullptr;
|
|
|
|
ui->adapterLabel = nullptr;
|
2016-01-25 06:22:00 -08:00
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
ui->renderer->setCurrentIndex(idx);
|
2016-01-25 06:22:00 -08:00
|
|
|
#endif
|
2014-01-26 15:36:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static string ResString(uint32_t cx, uint32_t cy)
|
|
|
|
{
|
|
|
|
stringstream res;
|
|
|
|
res << cx << "x" << cy;
|
|
|
|
return res.str();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* some nice default output resolution vals */
|
|
|
|
static const double vals[] = {1.0, 1.25, (1.0 / 0.75), 1.5, (1.0 / 0.6), 1.75,
|
|
|
|
2.0, 2.25, 2.5, 2.75, 3.0};
|
|
|
|
|
|
|
|
static const size_t numVals = sizeof(vals) / sizeof(double);
|
|
|
|
|
2020-11-13 17:35:27 -08:00
|
|
|
void OBSBasicSettings::ResetDownscales(uint32_t cx, uint32_t cy,
|
|
|
|
bool ignoreAllSignals)
|
2014-01-26 15:36:15 -07:00
|
|
|
{
|
2015-01-26 13:41:22 -08:00
|
|
|
QString advRescale;
|
|
|
|
QString advRecRescale;
|
|
|
|
QString advFFRescale;
|
2015-08-16 14:38:56 -07:00
|
|
|
QString oldOutputRes;
|
|
|
|
string bestScale;
|
|
|
|
int bestPixelDiff = 0x7FFFFFFF;
|
2016-01-25 05:25:16 -08:00
|
|
|
uint32_t out_cx = outputCX;
|
|
|
|
uint32_t out_cy = outputCY;
|
2015-01-26 13:41:22 -08:00
|
|
|
|
|
|
|
advRescale = ui->advOutRescale->lineEdit()->text();
|
|
|
|
advRecRescale = ui->advOutRecRescale->lineEdit()->text();
|
|
|
|
advFFRescale = ui->advOutFFRescale->lineEdit()->text();
|
2016-01-25 05:25:16 -08:00
|
|
|
|
2020-11-13 09:21:24 -08:00
|
|
|
bool lockedOutputRes = !ui->outputResolution->isEditable();
|
2015-01-26 13:41:22 -08:00
|
|
|
|
2020-11-13 09:21:24 -08:00
|
|
|
if (!lockedOutputRes) {
|
|
|
|
ui->outputResolution->blockSignals(true);
|
|
|
|
ui->outputResolution->clear();
|
|
|
|
}
|
2020-11-13 17:35:27 -08:00
|
|
|
if (ignoreAllSignals) {
|
|
|
|
ui->advOutRescale->blockSignals(true);
|
|
|
|
ui->advOutRecRescale->blockSignals(true);
|
|
|
|
ui->advOutFFRescale->blockSignals(true);
|
|
|
|
}
|
2015-01-26 13:41:22 -08:00
|
|
|
ui->advOutRescale->clear();
|
|
|
|
ui->advOutRecRescale->clear();
|
|
|
|
ui->advOutFFRescale->clear();
|
2014-02-23 16:27:19 -07:00
|
|
|
|
2015-08-16 14:38:56 -07:00
|
|
|
if (!out_cx || !out_cy) {
|
|
|
|
out_cx = cx;
|
|
|
|
out_cy = cy;
|
2016-01-25 05:25:16 -08:00
|
|
|
oldOutputRes = ui->baseResolution->lineEdit()->text();
|
|
|
|
} else {
|
|
|
|
oldOutputRes =
|
|
|
|
QString::number(out_cx) + "x" + QString::number(out_cy);
|
2015-08-16 14:38:56 -07:00
|
|
|
}
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
for (size_t idx = 0; idx < numVals; idx++) {
|
|
|
|
uint32_t downscaleCX = uint32_t(double(cx) / vals[idx]);
|
|
|
|
uint32_t downscaleCY = uint32_t(double(cy) / vals[idx]);
|
2015-02-08 01:29:15 -08:00
|
|
|
uint32_t outDownscaleCX = uint32_t(double(out_cx) / vals[idx]);
|
|
|
|
uint32_t outDownscaleCY = uint32_t(double(out_cy) / vals[idx]);
|
2014-01-26 15:36:15 -07:00
|
|
|
|
2015-02-08 01:31:02 -08:00
|
|
|
downscaleCX &= 0xFFFFFFFC;
|
|
|
|
downscaleCY &= 0xFFFFFFFE;
|
|
|
|
outDownscaleCX &= 0xFFFFFFFE;
|
|
|
|
outDownscaleCY &= 0xFFFFFFFE;
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
string res = ResString(downscaleCX, downscaleCY);
|
2015-02-08 01:29:15 -08:00
|
|
|
string outRes = ResString(outDownscaleCX, outDownscaleCY);
|
2020-11-13 09:21:24 -08:00
|
|
|
if (!lockedOutputRes)
|
|
|
|
ui->outputResolution->addItem(res.c_str());
|
2015-02-08 01:29:15 -08:00
|
|
|
ui->advOutRescale->addItem(outRes.c_str());
|
|
|
|
ui->advOutRecRescale->addItem(outRes.c_str());
|
|
|
|
ui->advOutFFRescale->addItem(outRes.c_str());
|
2015-08-16 14:38:56 -07:00
|
|
|
|
|
|
|
/* always try to find the closest output resolution to the
|
|
|
|
* previously set output resolution */
|
|
|
|
int newPixelCount = int(downscaleCX * downscaleCY);
|
|
|
|
int oldPixelCount = int(out_cx * out_cy);
|
|
|
|
int diff = abs(newPixelCount - oldPixelCount);
|
|
|
|
|
|
|
|
if (diff < bestPixelDiff) {
|
|
|
|
bestScale = res;
|
|
|
|
bestPixelDiff = diff;
|
|
|
|
}
|
2014-01-26 15:36:15 -07:00
|
|
|
}
|
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
string res = ResString(cx, cy);
|
|
|
|
|
2020-11-13 09:21:24 -08:00
|
|
|
if (!lockedOutputRes) {
|
|
|
|
float baseAspect = float(cx) / float(cy);
|
|
|
|
float outputAspect = float(out_cx) / float(out_cy);
|
|
|
|
bool closeAspect = close_float(baseAspect, outputAspect, 0.01f);
|
2015-08-16 14:38:56 -07:00
|
|
|
|
2020-11-13 09:21:24 -08:00
|
|
|
if (closeAspect) {
|
|
|
|
ui->outputResolution->lineEdit()->setText(oldOutputRes);
|
|
|
|
on_outputResolution_editTextChanged(oldOutputRes);
|
|
|
|
} else {
|
|
|
|
ui->outputResolution->lineEdit()->setText(
|
|
|
|
bestScale.c_str());
|
|
|
|
on_outputResolution_editTextChanged(bestScale.c_str());
|
|
|
|
}
|
2015-01-26 13:41:22 -08:00
|
|
|
|
2020-11-13 09:21:24 -08:00
|
|
|
ui->outputResolution->blockSignals(false);
|
2016-01-31 15:32:43 -08:00
|
|
|
|
2020-11-13 09:21:24 -08:00
|
|
|
if (!closeAspect) {
|
|
|
|
ui->outputResolution->setProperty("changed",
|
|
|
|
QVariant(true));
|
|
|
|
videoChanged = true;
|
|
|
|
}
|
2016-01-31 15:32:43 -08:00
|
|
|
}
|
2016-01-25 05:25:16 -08:00
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
if (advRescale.isEmpty())
|
|
|
|
advRescale = res.c_str();
|
|
|
|
if (advRecRescale.isEmpty())
|
|
|
|
advRecRescale = res.c_str();
|
|
|
|
if (advFFRescale.isEmpty())
|
|
|
|
advFFRescale = res.c_str();
|
|
|
|
|
|
|
|
ui->advOutRescale->lineEdit()->setText(advRescale);
|
|
|
|
ui->advOutRecRescale->lineEdit()->setText(advRecRescale);
|
|
|
|
ui->advOutFFRescale->lineEdit()->setText(advFFRescale);
|
2020-11-13 17:35:27 -08:00
|
|
|
|
|
|
|
if (ignoreAllSignals) {
|
|
|
|
ui->advOutRescale->blockSignals(false);
|
|
|
|
ui->advOutRecRescale->blockSignals(false);
|
|
|
|
ui->advOutFFRescale->blockSignals(false);
|
|
|
|
}
|
2014-01-26 15:36:15 -07:00
|
|
|
}
|
|
|
|
|
2014-12-15 01:08:46 -08:00
|
|
|
void OBSBasicSettings::LoadDownscaleFilters()
|
|
|
|
{
|
2021-10-12 01:22:04 +02:00
|
|
|
QString downscaleFilter = ui->downscaleFilter->currentData().toString();
|
|
|
|
if (downscaleFilter.isEmpty())
|
|
|
|
downscaleFilter =
|
|
|
|
config_get_string(main->Config(), "Video", "ScaleType");
|
|
|
|
|
|
|
|
ui->downscaleFilter->clear();
|
|
|
|
if (ui->baseResolution->currentText() ==
|
|
|
|
ui->outputResolution->currentText()) {
|
|
|
|
ui->downscaleFilter->setEnabled(false);
|
|
|
|
ui->downscaleFilter->addItem(
|
|
|
|
QTStr("Basic.Settings.Video.DownscaleFilter.Unavailable"),
|
|
|
|
downscaleFilter);
|
|
|
|
} else {
|
|
|
|
ui->downscaleFilter->setEnabled(true);
|
|
|
|
ui->downscaleFilter->addItem(
|
|
|
|
QTStr("Basic.Settings.Video.DownscaleFilter.Bilinear"),
|
|
|
|
QT_UTF8("bilinear"));
|
|
|
|
ui->downscaleFilter->addItem(
|
|
|
|
QTStr("Basic.Settings.Video.DownscaleFilter.Area"),
|
|
|
|
QT_UTF8("area"));
|
|
|
|
ui->downscaleFilter->addItem(
|
|
|
|
QTStr("Basic.Settings.Video.DownscaleFilter.Bicubic"),
|
|
|
|
QT_UTF8("bicubic"));
|
|
|
|
ui->downscaleFilter->addItem(
|
|
|
|
QTStr("Basic.Settings.Video.DownscaleFilter.Lanczos"),
|
|
|
|
QT_UTF8("lanczos"));
|
|
|
|
|
|
|
|
if (downscaleFilter == "bilinear")
|
|
|
|
ui->downscaleFilter->setCurrentIndex(0);
|
|
|
|
else if (downscaleFilter == "lanczos")
|
|
|
|
ui->downscaleFilter->setCurrentIndex(3);
|
|
|
|
else if (downscaleFilter == "area")
|
|
|
|
ui->downscaleFilter->setCurrentIndex(1);
|
|
|
|
else
|
|
|
|
ui->downscaleFilter->setCurrentIndex(2);
|
|
|
|
}
|
2014-12-15 01:08:46 -08:00
|
|
|
}
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
void OBSBasicSettings::LoadResolutionLists()
|
|
|
|
{
|
2014-03-06 21:08:12 -07:00
|
|
|
uint32_t cx = config_get_uint(main->Config(), "Video", "BaseCX");
|
|
|
|
uint32_t cy = config_get_uint(main->Config(), "Video", "BaseCY");
|
2015-02-08 01:29:15 -08:00
|
|
|
uint32_t out_cx = config_get_uint(main->Config(), "Video", "OutputCX");
|
|
|
|
uint32_t out_cy = config_get_uint(main->Config(), "Video", "OutputCY");
|
2014-01-26 15:36:15 -07:00
|
|
|
|
|
|
|
ui->baseResolution->clear();
|
|
|
|
|
2017-04-28 18:12:53 -07:00
|
|
|
auto addRes = [this](int cx, int cy) {
|
|
|
|
QString res = ResString(cx, cy).c_str();
|
|
|
|
if (ui->baseResolution->findText(res) == -1)
|
|
|
|
ui->baseResolution->addItem(res);
|
|
|
|
};
|
|
|
|
|
2016-10-03 23:50:13 -07:00
|
|
|
for (QScreen *screen : QGuiApplication::screens()) {
|
2016-10-20 15:29:43 +02:00
|
|
|
QSize as = screen->size();
|
2021-02-12 21:50:40 +01:00
|
|
|
uint32_t as_width = as.width();
|
|
|
|
uint32_t as_height = as.height();
|
|
|
|
|
|
|
|
// Calculate physical screen resolution based on the virtual screen resolution
|
|
|
|
// They might differ if scaling is enabled, e.g. for HiDPI screens
|
|
|
|
as_width = round(as_width * screen->devicePixelRatio());
|
|
|
|
as_height = round(as_height * screen->devicePixelRatio());
|
|
|
|
|
|
|
|
addRes(as_width, as_height);
|
2014-01-26 15:36:15 -07:00
|
|
|
}
|
|
|
|
|
2017-04-28 18:12:53 -07:00
|
|
|
addRes(1920, 1080);
|
|
|
|
addRes(1280, 720);
|
|
|
|
|
2016-01-25 05:25:16 -08:00
|
|
|
string outputResString = ResString(out_cx, out_cy);
|
2014-01-26 15:36:15 -07:00
|
|
|
|
2014-02-22 20:14:19 -07:00
|
|
|
ui->baseResolution->lineEdit()->setText(ResString(cx, cy).c_str());
|
2016-01-25 05:25:16 -08:00
|
|
|
|
|
|
|
RecalcOutputResPixels(outputResString.c_str());
|
|
|
|
ResetDownscales(cx, cy);
|
|
|
|
|
|
|
|
ui->outputResolution->lineEdit()->setText(outputResString.c_str());
|
2020-01-22 12:25:05 -06:00
|
|
|
|
|
|
|
std::tuple<int, int> aspect = aspect_ratio(cx, cy);
|
|
|
|
|
|
|
|
ui->baseAspect->setText(
|
|
|
|
QTStr("AspectRatio")
|
|
|
|
.arg(QString::number(std::get<0>(aspect)),
|
|
|
|
QString::number(std::get<1>(aspect))));
|
2014-01-26 15:36:15 -07:00
|
|
|
}
|
|
|
|
|
2014-03-06 21:08:12 -07:00
|
|
|
static inline void LoadFPSCommon(OBSBasic *main, Ui::OBSBasicSettings *ui)
|
2014-01-26 15:36:15 -07:00
|
|
|
{
|
2014-03-06 21:08:12 -07:00
|
|
|
const char *val =
|
|
|
|
config_get_string(main->Config(), "Video", "FPSCommon");
|
2014-01-26 15:36:15 -07:00
|
|
|
|
|
|
|
int idx = ui->fpsCommon->findText(val);
|
2017-02-06 14:55:14 -08:00
|
|
|
if (idx == -1)
|
|
|
|
idx = 4;
|
2014-01-26 15:36:15 -07:00
|
|
|
ui->fpsCommon->setCurrentIndex(idx);
|
|
|
|
}
|
|
|
|
|
2014-03-06 21:08:12 -07:00
|
|
|
static inline void LoadFPSInteger(OBSBasic *main, Ui::OBSBasicSettings *ui)
|
2014-01-26 15:36:15 -07:00
|
|
|
{
|
2014-03-06 21:08:12 -07:00
|
|
|
uint32_t val = config_get_uint(main->Config(), "Video", "FPSInt");
|
2014-01-26 15:36:15 -07:00
|
|
|
ui->fpsInteger->setValue(val);
|
|
|
|
}
|
|
|
|
|
2014-03-06 21:08:12 -07:00
|
|
|
static inline void LoadFPSFraction(OBSBasic *main, Ui::OBSBasicSettings *ui)
|
2014-01-26 15:36:15 -07:00
|
|
|
{
|
2014-03-06 21:08:12 -07:00
|
|
|
uint32_t num = config_get_uint(main->Config(), "Video", "FPSNum");
|
|
|
|
uint32_t den = config_get_uint(main->Config(), "Video", "FPSDen");
|
2014-01-26 15:36:15 -07:00
|
|
|
|
|
|
|
ui->fpsNumerator->setValue(num);
|
|
|
|
ui->fpsDenominator->setValue(den);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadFPSData()
|
|
|
|
{
|
2014-03-06 21:08:12 -07:00
|
|
|
LoadFPSCommon(main, ui.get());
|
|
|
|
LoadFPSInteger(main, ui.get());
|
|
|
|
LoadFPSFraction(main, ui.get());
|
2014-01-26 15:36:15 -07:00
|
|
|
|
2014-03-06 21:08:12 -07:00
|
|
|
uint32_t fpsType = config_get_uint(main->Config(), "Video", "FPSType");
|
2014-01-29 08:40:04 +01:00
|
|
|
if (fpsType > 2)
|
|
|
|
fpsType = 0;
|
2014-01-26 15:36:15 -07:00
|
|
|
|
|
|
|
ui->fpsType->setCurrentIndex(fpsType);
|
|
|
|
ui->fpsTypes->setCurrentIndex(fpsType);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadVideoSettings()
|
|
|
|
{
|
|
|
|
loading = true;
|
|
|
|
|
2018-10-05 19:36:51 -07:00
|
|
|
if (obs_video_active()) {
|
2014-02-22 20:14:19 -07:00
|
|
|
ui->videoPage->setEnabled(false);
|
2014-05-10 18:47:48 -07:00
|
|
|
ui->videoMsg->setText(
|
|
|
|
QTStr("Basic.Settings.Video.CurrentlyActive"));
|
2014-02-22 20:14:19 -07:00
|
|
|
}
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
LoadResolutionLists();
|
|
|
|
LoadFPSData();
|
2014-12-15 01:08:46 -08:00
|
|
|
LoadDownscaleFilters();
|
2014-01-26 15:36:15 -07:00
|
|
|
|
2015-05-25 01:37:13 -07:00
|
|
|
#ifdef _WIN32
|
|
|
|
if (toggleAero) {
|
|
|
|
bool disableAero =
|
|
|
|
config_get_bool(main->Config(), "Video", "DisableAero");
|
|
|
|
toggleAero->setChecked(disableAero);
|
|
|
|
|
|
|
|
aeroWasDisabled = disableAero;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
loading = false;
|
|
|
|
}
|
|
|
|
|
libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)
Adds surround sound audio support to the core, core plugins, and user
interface.
Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
(due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST: stereo plugins keep in general only the first two channels.
surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
(not implemented due to lack of usefulness)
Closes jp9000/obs-studio#968
2017-05-27 02:15:54 +02:00
|
|
|
static inline bool IsSurround(const char *speakers)
|
|
|
|
{
|
|
|
|
static const char *surroundLayouts[] = {"2.1", "4.0", "4.1",
|
|
|
|
"5.1", "7.1", nullptr};
|
|
|
|
|
|
|
|
if (!speakers || !*speakers)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
const char **curLayout = surroundLayouts;
|
|
|
|
for (; *curLayout; ++curLayout) {
|
|
|
|
if (strcmp(*curLayout, speakers) == 0) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
void OBSBasicSettings::LoadSimpleOutputSettings()
|
2014-03-10 13:10:35 -07:00
|
|
|
{
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
const char *path =
|
|
|
|
config_get_string(main->Config(), "SimpleOutput", "FilePath");
|
2015-11-27 12:14:18 +01:00
|
|
|
bool noSpace = config_get_bool(main->Config(), "SimpleOutput",
|
|
|
|
"FileNameWithoutSpace");
|
2015-05-29 09:45:54 -07:00
|
|
|
const char *format =
|
|
|
|
config_get_string(main->Config(), "SimpleOutput", "RecFormat");
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
int videoBitrate =
|
|
|
|
config_get_uint(main->Config(), "SimpleOutput", "VBitrate");
|
2016-04-18 00:56:51 -07:00
|
|
|
const char *streamEnc = config_get_string(
|
|
|
|
main->Config(), "SimpleOutput", "StreamEncoder");
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
int audioBitrate =
|
|
|
|
config_get_uint(main->Config(), "SimpleOutput", "ABitrate");
|
2014-08-25 07:48:51 -07:00
|
|
|
bool advanced =
|
|
|
|
config_get_bool(main->Config(), "SimpleOutput", "UseAdvanced");
|
|
|
|
const char *preset =
|
|
|
|
config_get_string(main->Config(), "SimpleOutput", "Preset");
|
2016-04-18 00:56:51 -07:00
|
|
|
const char *qsvPreset =
|
|
|
|
config_get_string(main->Config(), "SimpleOutput", "QSVPreset");
|
2016-04-18 16:12:59 -07:00
|
|
|
const char *nvPreset = config_get_string(main->Config(), "SimpleOutput",
|
|
|
|
"NVENCPreset");
|
2016-11-17 04:40:49 +01:00
|
|
|
const char *amdPreset =
|
|
|
|
config_get_string(main->Config(), "SimpleOutput", "AMDPreset");
|
2014-08-25 07:48:51 -07:00
|
|
|
const char *custom = config_get_string(main->Config(), "SimpleOutput",
|
|
|
|
"x264Settings");
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
const char *recQual =
|
|
|
|
config_get_string(main->Config(), "SimpleOutput", "RecQuality");
|
|
|
|
const char *recEnc =
|
|
|
|
config_get_string(main->Config(), "SimpleOutput", "RecEncoder");
|
2015-11-23 15:36:06 +01:00
|
|
|
const char *muxCustom = config_get_string(
|
|
|
|
main->Config(), "SimpleOutput", "MuxerCustom");
|
2016-12-07 05:21:44 -08:00
|
|
|
bool replayBuf =
|
|
|
|
config_get_bool(main->Config(), "SimpleOutput", "RecRB");
|
|
|
|
int rbTime =
|
|
|
|
config_get_int(main->Config(), "SimpleOutput", "RecRBTime");
|
|
|
|
int rbSize =
|
|
|
|
config_get_int(main->Config(), "SimpleOutput", "RecRBSize");
|
2014-03-10 13:10:35 -07:00
|
|
|
|
2016-04-18 00:56:51 -07:00
|
|
|
curPreset = preset;
|
|
|
|
curQSVPreset = qsvPreset;
|
2016-04-18 16:12:59 -07:00
|
|
|
curNVENCPreset = nvPreset;
|
2016-11-17 04:40:49 +01:00
|
|
|
curAMDPreset = amdPreset;
|
2016-04-18 00:56:51 -07:00
|
|
|
|
2015-09-21 18:36:26 -07:00
|
|
|
audioBitrate = FindClosestAvailableAACBitrate(audioBitrate);
|
|
|
|
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
ui->simpleOutputPath->setText(path);
|
2015-11-27 12:14:18 +01:00
|
|
|
ui->simpleNoSpace->setChecked(noSpace);
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
ui->simpleOutputVBitrate->setValue(videoBitrate);
|
|
|
|
|
2015-05-29 09:45:54 -07:00
|
|
|
int idx = ui->simpleOutRecFormat->findText(format);
|
|
|
|
ui->simpleOutRecFormat->setCurrentIndex(idx);
|
|
|
|
|
libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)
Adds surround sound audio support to the core, core plugins, and user
interface.
Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
(due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST: stereo plugins keep in general only the first two channels.
surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
(not implemented due to lack of usefulness)
Closes jp9000/obs-studio#968
2017-05-27 02:15:54 +02:00
|
|
|
const char *speakers =
|
|
|
|
config_get_string(main->Config(), "Audio", "ChannelSetup");
|
|
|
|
|
|
|
|
// restrict list of bitrates when multichannel is OFF
|
|
|
|
if (!IsSurround(speakers))
|
|
|
|
RestrictResetBitrates({ui->simpleOutputABitrate}, 320);
|
|
|
|
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
SetComboByName(ui->simpleOutputABitrate,
|
|
|
|
std::to_string(audioBitrate).c_str());
|
2014-07-03 18:07:33 -07:00
|
|
|
|
2014-08-25 07:48:51 -07:00
|
|
|
ui->simpleOutAdvanced->setChecked(advanced);
|
2015-01-18 06:29:24 -08:00
|
|
|
ui->simpleOutCustom->setText(custom);
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
|
|
|
|
idx = ui->simpleOutRecQuality->findData(QString(recQual));
|
|
|
|
if (idx == -1)
|
|
|
|
idx = 0;
|
|
|
|
ui->simpleOutRecQuality->setCurrentIndex(idx);
|
|
|
|
|
2016-04-18 00:56:51 -07:00
|
|
|
idx = ui->simpleOutStrEncoder->findData(QString(streamEnc));
|
|
|
|
if (idx == -1)
|
|
|
|
idx = 0;
|
|
|
|
ui->simpleOutStrEncoder->setCurrentIndex(idx);
|
|
|
|
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
idx = ui->simpleOutRecEncoder->findData(QString(recEnc));
|
|
|
|
if (idx == -1)
|
|
|
|
idx = 0;
|
|
|
|
ui->simpleOutRecEncoder->setCurrentIndex(idx);
|
2015-11-23 15:36:06 +01:00
|
|
|
|
|
|
|
ui->simpleOutMuxCustom->setText(muxCustom);
|
2016-04-18 00:56:51 -07:00
|
|
|
|
2016-12-07 05:21:44 -08:00
|
|
|
ui->simpleReplayBuf->setChecked(replayBuf);
|
|
|
|
ui->simpleRBSecMax->setValue(rbTime);
|
|
|
|
ui->simpleRBMegsMax->setValue(rbSize);
|
|
|
|
|
2016-04-18 00:56:51 -07:00
|
|
|
SimpleStreamingEncoderChanged();
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
}
|
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
void OBSBasicSettings::LoadAdvOutputStreamingSettings()
|
|
|
|
{
|
|
|
|
bool rescale = config_get_bool(main->Config(), "AdvOut", "Rescale");
|
|
|
|
const char *rescaleRes =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "RescaleRes");
|
|
|
|
int trackIndex = config_get_int(main->Config(), "AdvOut", "TrackIndex");
|
|
|
|
|
|
|
|
ui->advOutUseRescale->setChecked(rescale);
|
2015-03-28 01:01:55 -05:00
|
|
|
ui->advOutRescale->setEnabled(rescale);
|
2015-01-26 13:41:22 -08:00
|
|
|
ui->advOutRescale->setCurrentText(rescaleRes);
|
|
|
|
|
2016-03-25 02:43:38 -07:00
|
|
|
QStringList specList = QTStr("FilenameFormatting.completer")
|
|
|
|
.split(QRegularExpression("\n"));
|
|
|
|
QCompleter *specCompleter = new QCompleter(specList);
|
|
|
|
specCompleter->setCaseSensitivity(Qt::CaseSensitive);
|
|
|
|
specCompleter->setFilterMode(Qt::MatchContains);
|
|
|
|
ui->filenameFormatting->setCompleter(specCompleter);
|
|
|
|
ui->filenameFormatting->setToolTip(QTStr("FilenameFormatting.TT"));
|
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
switch (trackIndex) {
|
|
|
|
case 1:
|
|
|
|
ui->advOutTrack1->setChecked(true);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
ui->advOutTrack2->setChecked(true);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
ui->advOutTrack3->setChecked(true);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
ui->advOutTrack4->setChecked(true);
|
|
|
|
break;
|
2016-12-21 17:14:24 -08:00
|
|
|
case 5:
|
|
|
|
ui->advOutTrack5->setChecked(true);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
ui->advOutTrack6->setChecked(true);
|
|
|
|
break;
|
2015-01-26 13:41:22 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
OBSPropertiesView *
|
|
|
|
OBSBasicSettings::CreateEncoderPropertyView(const char *encoder,
|
|
|
|
const char *path, bool changed)
|
|
|
|
{
|
2021-11-26 22:25:39 +13:00
|
|
|
OBSDataAutoRelease settings = obs_encoder_defaults(encoder);
|
2015-01-26 13:41:22 -08:00
|
|
|
OBSPropertiesView *view;
|
|
|
|
|
2016-11-02 18:31:50 -07:00
|
|
|
if (path) {
|
|
|
|
char encoderJsonPath[512];
|
|
|
|
int ret = GetProfilePath(encoderJsonPath,
|
|
|
|
sizeof(encoderJsonPath), path);
|
|
|
|
if (ret > 0) {
|
|
|
|
obs_data_t *data = obs_data_create_from_json_file_safe(
|
|
|
|
encoderJsonPath, "bak");
|
|
|
|
obs_data_apply(settings, data);
|
|
|
|
obs_data_release(data);
|
|
|
|
}
|
2015-01-26 13:41:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
view = new OBSPropertiesView(
|
2021-11-26 22:25:39 +13:00
|
|
|
settings.Get(), encoder,
|
2015-01-26 13:41:22 -08:00
|
|
|
(PropertiesReloadCallback)obs_get_encoder_properties, 170);
|
|
|
|
view->setFrameShape(QFrame::StyledPanel);
|
|
|
|
view->setProperty("changed", QVariant(changed));
|
|
|
|
QObject::connect(view, SIGNAL(Changed()), this, SLOT(OutputsChanged()));
|
|
|
|
|
|
|
|
return view;
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadAdvOutputStreamingEncoderProperties()
|
|
|
|
{
|
2016-04-11 05:03:30 -07:00
|
|
|
const char *type =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "Encoder");
|
2015-01-26 13:41:22 -08:00
|
|
|
|
|
|
|
delete streamEncoderProps;
|
2016-04-11 05:03:30 -07:00
|
|
|
streamEncoderProps =
|
|
|
|
CreateEncoderPropertyView(type, "streamEncoder.json");
|
2015-01-26 13:41:22 -08:00
|
|
|
ui->advOutputStreamTab->layout()->addWidget(streamEncoderProps);
|
|
|
|
|
2015-09-06 16:12:03 -07:00
|
|
|
connect(streamEncoderProps, SIGNAL(Changed()), this,
|
|
|
|
SLOT(UpdateStreamDelayEstimate()));
|
2017-09-05 20:01:49 -04:00
|
|
|
connect(streamEncoderProps, SIGNAL(Changed()), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
2015-09-06 16:12:03 -07:00
|
|
|
|
2016-05-09 05:36:28 -07:00
|
|
|
curAdvStreamEncoder = type;
|
|
|
|
|
2016-04-11 05:03:30 -07:00
|
|
|
if (!SetComboByValue(ui->advOutEncoder, type)) {
|
|
|
|
uint32_t caps = obs_get_encoder_caps(type);
|
2020-02-18 21:34:39 -08:00
|
|
|
if ((caps & ENCODER_HIDE_FLAGS) != 0) {
|
2016-04-11 05:03:30 -07:00
|
|
|
const char *name = obs_encoder_get_display_name(type);
|
|
|
|
|
|
|
|
ui->advOutEncoder->insertItem(0, QT_UTF8(name),
|
|
|
|
QT_UTF8(type));
|
|
|
|
SetComboByValue(ui->advOutEncoder, type);
|
|
|
|
}
|
|
|
|
}
|
2015-09-06 16:12:03 -07:00
|
|
|
|
|
|
|
UpdateStreamDelayEstimate();
|
2015-01-26 13:41:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadAdvOutputRecordingSettings()
|
|
|
|
{
|
|
|
|
const char *type =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "RecType");
|
2015-05-29 09:45:54 -07:00
|
|
|
const char *format =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "RecFormat");
|
2016-03-19 10:33:22 -07:00
|
|
|
const char *path =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "RecFilePath");
|
2015-11-27 12:14:18 +01:00
|
|
|
bool noSpace = config_get_bool(main->Config(), "AdvOut",
|
|
|
|
"RecFileNameWithoutSpace");
|
2015-01-26 13:41:22 -08:00
|
|
|
bool rescale = config_get_bool(main->Config(), "AdvOut", "RecRescale");
|
|
|
|
const char *rescaleRes =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "RecRescaleRes");
|
2015-11-23 15:36:06 +01:00
|
|
|
const char *muxCustom =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "RecMuxerCustom");
|
2015-05-30 21:45:14 -07:00
|
|
|
int tracks = config_get_int(main->Config(), "AdvOut", "RecTracks");
|
2019-07-23 07:20:13 -05:00
|
|
|
int flvTrack = config_get_int(main->Config(), "AdvOut", "FLVTrack");
|
2021-10-03 19:06:46 +09:00
|
|
|
bool splitFile =
|
|
|
|
config_get_bool(main->Config(), "AdvOut", "RecSplitFile");
|
|
|
|
const char *splitFileType =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "RecSplitFileType");
|
|
|
|
int splitFileTime =
|
|
|
|
config_get_int(main->Config(), "AdvOut", "RecSplitFileTime");
|
|
|
|
int splitFileSize =
|
|
|
|
config_get_int(main->Config(), "AdvOut", "RecSplitFileSize");
|
2021-12-24 15:59:26 +09:00
|
|
|
bool splitFileResetTimestamps = config_get_bool(
|
|
|
|
main->Config(), "AdvOut", "RecSplitFileResetTimestamps");
|
2015-01-26 13:41:22 -08:00
|
|
|
|
|
|
|
int typeIndex = (astrcmpi(type, "FFmpeg") == 0) ? 1 : 0;
|
|
|
|
ui->advOutRecType->setCurrentIndex(typeIndex);
|
|
|
|
ui->advOutRecPath->setText(path);
|
2015-11-27 12:14:18 +01:00
|
|
|
ui->advOutNoSpace->setChecked(noSpace);
|
2015-01-26 13:41:22 -08:00
|
|
|
ui->advOutRecUseRescale->setChecked(rescale);
|
|
|
|
ui->advOutRecRescale->setCurrentText(rescaleRes);
|
2015-11-23 15:36:06 +01:00
|
|
|
ui->advOutMuxCustom->setText(muxCustom);
|
2015-01-26 13:41:22 -08:00
|
|
|
|
2015-05-29 09:45:54 -07:00
|
|
|
int idx = ui->advOutRecFormat->findText(format);
|
|
|
|
ui->advOutRecFormat->setCurrentIndex(idx);
|
|
|
|
|
2015-05-30 21:45:14 -07:00
|
|
|
ui->advOutRecTrack1->setChecked(tracks & (1 << 0));
|
|
|
|
ui->advOutRecTrack2->setChecked(tracks & (1 << 1));
|
|
|
|
ui->advOutRecTrack3->setChecked(tracks & (1 << 2));
|
|
|
|
ui->advOutRecTrack4->setChecked(tracks & (1 << 3));
|
2016-12-21 17:14:24 -08:00
|
|
|
ui->advOutRecTrack5->setChecked(tracks & (1 << 4));
|
|
|
|
ui->advOutRecTrack6->setChecked(tracks & (1 << 5));
|
2019-07-23 07:20:13 -05:00
|
|
|
|
2021-10-03 19:06:46 +09:00
|
|
|
idx = (astrcmpi(splitFileType, "Size") == 0) ? 1 : 0;
|
|
|
|
ui->advOutSplitFile->setChecked(splitFile);
|
|
|
|
ui->advOutSplitFileType->setCurrentIndex(idx);
|
|
|
|
ui->advOutSplitFileTime->setValue(splitFileTime);
|
|
|
|
ui->advOutSplitFileSize->setValue(splitFileSize);
|
2021-12-24 15:59:26 +09:00
|
|
|
ui->advOutSplitFileRstTS->setChecked(splitFileResetTimestamps);
|
2021-10-03 19:06:46 +09:00
|
|
|
|
2019-07-23 07:20:13 -05:00
|
|
|
switch (flvTrack) {
|
|
|
|
case 1:
|
|
|
|
ui->flvTrack1->setChecked(true);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
ui->flvTrack2->setChecked(true);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
ui->flvTrack3->setChecked(true);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
ui->flvTrack4->setChecked(true);
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
ui->flvTrack5->setChecked(true);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
ui->flvTrack6->setChecked(true);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ui->flvTrack1->setChecked(true);
|
|
|
|
break;
|
|
|
|
}
|
2015-01-26 13:41:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadAdvOutputRecordingEncoderProperties()
|
|
|
|
{
|
2016-04-11 05:03:30 -07:00
|
|
|
const char *type =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "RecEncoder");
|
2015-01-26 13:41:22 -08:00
|
|
|
|
|
|
|
delete recordEncoderProps;
|
|
|
|
recordEncoderProps = nullptr;
|
|
|
|
|
2016-04-11 05:03:30 -07:00
|
|
|
if (astrcmpi(type, "none") != 0) {
|
|
|
|
recordEncoderProps =
|
|
|
|
CreateEncoderPropertyView(type, "recordEncoder.json");
|
2015-01-26 13:41:22 -08:00
|
|
|
ui->advOutRecStandard->layout()->addWidget(recordEncoderProps);
|
2017-09-05 20:01:49 -04:00
|
|
|
connect(recordEncoderProps, SIGNAL(Changed()), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
2015-01-26 13:41:22 -08:00
|
|
|
}
|
|
|
|
|
2016-05-09 05:36:28 -07:00
|
|
|
curAdvRecordEncoder = type;
|
|
|
|
|
2016-04-11 05:03:30 -07:00
|
|
|
if (!SetComboByValue(ui->advOutRecEncoder, type)) {
|
|
|
|
uint32_t caps = obs_get_encoder_caps(type);
|
2020-02-18 21:34:39 -08:00
|
|
|
if ((caps & ENCODER_HIDE_FLAGS) != 0) {
|
2016-04-11 05:03:30 -07:00
|
|
|
const char *name = obs_encoder_get_display_name(type);
|
|
|
|
|
|
|
|
ui->advOutRecEncoder->insertItem(1, QT_UTF8(name),
|
|
|
|
QT_UTF8(type));
|
|
|
|
SetComboByValue(ui->advOutRecEncoder, type);
|
|
|
|
}
|
|
|
|
}
|
2015-01-26 13:41:22 -08:00
|
|
|
}
|
|
|
|
|
2015-03-28 02:21:16 -05:00
|
|
|
static void SelectFormat(QComboBox *combo, const char *name,
|
|
|
|
const char *mimeType)
|
|
|
|
{
|
|
|
|
FormatDesc formatDesc(name, mimeType);
|
|
|
|
|
|
|
|
for (int i = 0; i < combo->count(); i++) {
|
|
|
|
QVariant v = combo->itemData(i);
|
|
|
|
if (!v.isNull()) {
|
|
|
|
if (formatDesc == v.value<FormatDesc>()) {
|
|
|
|
combo->setCurrentIndex(i);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
combo->setCurrentIndex(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void SelectEncoder(QComboBox *combo, const char *name, int id)
|
|
|
|
{
|
|
|
|
int idx = FindEncoder(combo, name, id);
|
|
|
|
if (idx >= 0)
|
|
|
|
combo->setCurrentIndex(idx);
|
|
|
|
}
|
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
void OBSBasicSettings::LoadAdvOutputFFmpegSettings()
|
|
|
|
{
|
2015-08-18 20:58:24 -07:00
|
|
|
bool saveFile =
|
|
|
|
config_get_bool(main->Config(), "AdvOut", "FFOutputToFile");
|
2016-03-19 10:33:22 -07:00
|
|
|
const char *path =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "FFFilePath");
|
2015-11-27 12:14:18 +01:00
|
|
|
bool noSpace = config_get_bool(main->Config(), "AdvOut",
|
|
|
|
"FFFileNameWithoutSpace");
|
2015-01-26 13:41:22 -08:00
|
|
|
const char *url = config_get_string(main->Config(), "AdvOut", "FFURL");
|
2015-03-28 02:21:16 -05:00
|
|
|
const char *format =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "FFFormat");
|
|
|
|
const char *mimeType =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "FFFormatMimeType");
|
2015-09-16 10:26:48 +02:00
|
|
|
const char *muxCustom =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "FFMCustom");
|
2015-01-26 13:41:22 -08:00
|
|
|
int videoBitrate =
|
|
|
|
config_get_int(main->Config(), "AdvOut", "FFVBitrate");
|
2017-02-17 17:25:21 +01:00
|
|
|
int gopSize = config_get_int(main->Config(), "AdvOut", "FFVGOPSize");
|
2015-01-26 13:41:22 -08:00
|
|
|
bool rescale = config_get_bool(main->Config(), "AdvOut", "FFRescale");
|
2017-02-17 18:07:32 +01:00
|
|
|
bool codecCompat =
|
|
|
|
config_get_bool(main->Config(), "AdvOut", "FFIgnoreCompat");
|
2015-01-26 13:41:22 -08:00
|
|
|
const char *rescaleRes =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "FFRescaleRes");
|
|
|
|
const char *vEncoder =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "FFVEncoder");
|
2015-03-28 02:21:16 -05:00
|
|
|
int vEncoderId =
|
|
|
|
config_get_int(main->Config(), "AdvOut", "FFVEncoderId");
|
2015-01-26 13:41:22 -08:00
|
|
|
const char *vEncCustom =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "FFVCustom");
|
|
|
|
int audioBitrate =
|
|
|
|
config_get_int(main->Config(), "AdvOut", "FFABitrate");
|
2018-10-04 20:06:54 -07:00
|
|
|
int audioMixes =
|
|
|
|
config_get_int(main->Config(), "AdvOut", "FFAudioMixes");
|
2015-01-26 13:41:22 -08:00
|
|
|
const char *aEncoder =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "FFAEncoder");
|
2015-03-28 02:21:16 -05:00
|
|
|
int aEncoderId =
|
|
|
|
config_get_int(main->Config(), "AdvOut", "FFAEncoderId");
|
2015-01-26 13:41:22 -08:00
|
|
|
const char *aEncCustom =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "FFACustom");
|
|
|
|
|
2015-08-18 20:58:24 -07:00
|
|
|
ui->advOutFFType->setCurrentIndex(saveFile ? 0 : 1);
|
|
|
|
ui->advOutFFRecPath->setText(QT_UTF8(path));
|
2015-11-27 12:14:18 +01:00
|
|
|
ui->advOutFFNoSpace->setChecked(noSpace);
|
2015-08-18 20:58:24 -07:00
|
|
|
ui->advOutFFURL->setText(QT_UTF8(url));
|
2015-03-28 02:21:16 -05:00
|
|
|
SelectFormat(ui->advOutFFFormat, format, mimeType);
|
2015-09-16 10:26:48 +02:00
|
|
|
ui->advOutFFMCfg->setText(muxCustom);
|
2015-01-26 13:41:22 -08:00
|
|
|
ui->advOutFFVBitrate->setValue(videoBitrate);
|
2017-02-17 17:25:21 +01:00
|
|
|
ui->advOutFFVGOPSize->setValue(gopSize);
|
2015-01-26 13:41:22 -08:00
|
|
|
ui->advOutFFUseRescale->setChecked(rescale);
|
2017-02-17 18:07:32 +01:00
|
|
|
ui->advOutFFIgnoreCompat->setChecked(codecCompat);
|
2015-03-28 01:01:55 -05:00
|
|
|
ui->advOutFFRescale->setEnabled(rescale);
|
2015-01-26 13:41:22 -08:00
|
|
|
ui->advOutFFRescale->setCurrentText(rescaleRes);
|
2015-03-28 02:21:16 -05:00
|
|
|
SelectEncoder(ui->advOutFFVEncoder, vEncoder, vEncoderId);
|
2015-01-26 13:41:22 -08:00
|
|
|
ui->advOutFFVCfg->setText(vEncCustom);
|
|
|
|
ui->advOutFFABitrate->setValue(audioBitrate);
|
2015-03-28 02:21:16 -05:00
|
|
|
SelectEncoder(ui->advOutFFAEncoder, aEncoder, aEncoderId);
|
2015-01-26 13:41:22 -08:00
|
|
|
ui->advOutFFACfg->setText(aEncCustom);
|
|
|
|
|
2018-10-04 20:06:54 -07:00
|
|
|
ui->advOutFFTrack1->setChecked(audioMixes & (1 << 0));
|
|
|
|
ui->advOutFFTrack2->setChecked(audioMixes & (1 << 1));
|
|
|
|
ui->advOutFFTrack3->setChecked(audioMixes & (1 << 2));
|
|
|
|
ui->advOutFFTrack4->setChecked(audioMixes & (1 << 3));
|
|
|
|
ui->advOutFFTrack5->setChecked(audioMixes & (1 << 4));
|
|
|
|
ui->advOutFFTrack6->setChecked(audioMixes & (1 << 5));
|
2015-01-26 13:41:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadAdvOutputAudioSettings()
|
|
|
|
{
|
|
|
|
int track1Bitrate =
|
|
|
|
config_get_uint(main->Config(), "AdvOut", "Track1Bitrate");
|
|
|
|
int track2Bitrate =
|
|
|
|
config_get_uint(main->Config(), "AdvOut", "Track2Bitrate");
|
|
|
|
int track3Bitrate =
|
|
|
|
config_get_uint(main->Config(), "AdvOut", "Track3Bitrate");
|
|
|
|
int track4Bitrate =
|
|
|
|
config_get_uint(main->Config(), "AdvOut", "Track4Bitrate");
|
|
|
|
int track5Bitrate =
|
2016-12-21 17:14:24 -08:00
|
|
|
config_get_uint(main->Config(), "AdvOut", "Track5Bitrate");
|
|
|
|
int track6Bitrate =
|
|
|
|
config_get_uint(main->Config(), "AdvOut", "Track6Bitrate");
|
2015-01-26 13:41:22 -08:00
|
|
|
const char *name1 =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "Track1Name");
|
|
|
|
const char *name2 =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "Track2Name");
|
|
|
|
const char *name3 =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "Track3Name");
|
|
|
|
const char *name4 =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "Track4Name");
|
2016-12-21 17:14:24 -08:00
|
|
|
const char *name5 =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "Track5Name");
|
|
|
|
const char *name6 =
|
|
|
|
config_get_string(main->Config(), "AdvOut", "Track6Name");
|
2015-01-26 13:41:22 -08:00
|
|
|
|
2015-09-21 18:36:26 -07:00
|
|
|
track1Bitrate = FindClosestAvailableAACBitrate(track1Bitrate);
|
|
|
|
track2Bitrate = FindClosestAvailableAACBitrate(track2Bitrate);
|
|
|
|
track3Bitrate = FindClosestAvailableAACBitrate(track3Bitrate);
|
|
|
|
track4Bitrate = FindClosestAvailableAACBitrate(track4Bitrate);
|
2016-12-21 17:14:24 -08:00
|
|
|
track5Bitrate = FindClosestAvailableAACBitrate(track5Bitrate);
|
|
|
|
track6Bitrate = FindClosestAvailableAACBitrate(track6Bitrate);
|
2015-09-21 18:36:26 -07:00
|
|
|
|
libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)
Adds surround sound audio support to the core, core plugins, and user
interface.
Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
(due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST: stereo plugins keep in general only the first two channels.
surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
(not implemented due to lack of usefulness)
Closes jp9000/obs-studio#968
2017-05-27 02:15:54 +02:00
|
|
|
// restrict list of bitrates when multichannel is OFF
|
|
|
|
const char *speakers =
|
|
|
|
config_get_string(main->Config(), "Audio", "ChannelSetup");
|
|
|
|
|
|
|
|
// restrict list of bitrates when multichannel is OFF
|
|
|
|
if (!IsSurround(speakers)) {
|
|
|
|
RestrictResetBitrates(
|
|
|
|
{ui->advOutTrack1Bitrate, ui->advOutTrack2Bitrate,
|
|
|
|
ui->advOutTrack3Bitrate, ui->advOutTrack4Bitrate,
|
|
|
|
ui->advOutTrack5Bitrate, ui->advOutTrack6Bitrate},
|
|
|
|
320);
|
|
|
|
}
|
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
SetComboByName(ui->advOutTrack1Bitrate,
|
|
|
|
std::to_string(track1Bitrate).c_str());
|
|
|
|
SetComboByName(ui->advOutTrack2Bitrate,
|
|
|
|
std::to_string(track2Bitrate).c_str());
|
|
|
|
SetComboByName(ui->advOutTrack3Bitrate,
|
|
|
|
std::to_string(track3Bitrate).c_str());
|
|
|
|
SetComboByName(ui->advOutTrack4Bitrate,
|
|
|
|
std::to_string(track4Bitrate).c_str());
|
2016-12-21 17:14:24 -08:00
|
|
|
SetComboByName(ui->advOutTrack5Bitrate,
|
|
|
|
std::to_string(track5Bitrate).c_str());
|
|
|
|
SetComboByName(ui->advOutTrack6Bitrate,
|
|
|
|
std::to_string(track6Bitrate).c_str());
|
2015-01-26 13:41:22 -08:00
|
|
|
|
|
|
|
ui->advOutTrack1Name->setText(name1);
|
|
|
|
ui->advOutTrack2Name->setText(name2);
|
|
|
|
ui->advOutTrack3Name->setText(name3);
|
|
|
|
ui->advOutTrack4Name->setText(name4);
|
2016-12-21 17:14:24 -08:00
|
|
|
ui->advOutTrack5Name->setText(name5);
|
|
|
|
ui->advOutTrack6Name->setText(name6);
|
2015-01-26 13:41:22 -08:00
|
|
|
}
|
|
|
|
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
void OBSBasicSettings::LoadOutputSettings()
|
|
|
|
{
|
|
|
|
loading = true;
|
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
const char *mode = config_get_string(main->Config(), "Output", "Mode");
|
|
|
|
|
|
|
|
int modeIdx = astrcmpi(mode, "Advanced") == 0 ? 1 : 0;
|
|
|
|
ui->outputMode->setCurrentIndex(modeIdx);
|
|
|
|
|
obs-studio UI: Implement stream settings UI
- Updated the services API so that it links up with an output and
the output gets data from that service rather than via settings.
This allows the service context to have control over how an output is
used, and makes it so that the URL/key/etc isn't necessarily some
static setting.
Also, if the service is attached to an output, it will stick around
until the output is destroyed.
- The settings interface has been updated so that it can allow the
usage of service plugins. What this means is that now you can create
a service plugin that can control aspects of the stream, and it
allows each service to create their own user interface if they create
a service plugin module.
- Testing out saving of current service information. Saves/loads from
JSON in to obs_data_t, seems to be working quite nicely, and the
service object information is saved/preserved on exit, and loaded
again on startup.
- I agonized over the settings user interface for days, and eventually
I just decided that the only way that users weren't going to be
fumbling over options was to split up the settings in to simple/basic
output, pre-configured, and then advanced for advanced use (such as
multiple outputs or services, which I'll implement later).
This was particularly painful to really design right, I wanted more
features and wanted to include everything in one interface but
ultimately just realized from experience that users are just not
technically knowledgable about it and will end up fumbling with the
settings rather than getting things done.
Basically, what this means is that casual users only have to enter in
about 3 things to configure their stream: Stream key, audio bitrate,
and video bitrate. I am really happy with this interface for those
types of users, but it definitely won't be sufficient for advanced
usage or for custom outputs, so that stuff will have to be separated.
- Improved the JSON usage for the 'common streaming services' context,
I realized that JSON arrays are there to ensure sorting, while
forgetting that general items are optimized for hashing. So
basically I'm just using arrays now to sort items in it.
2014-04-24 01:49:07 -07:00
|
|
|
LoadSimpleOutputSettings();
|
2015-01-26 13:41:22 -08:00
|
|
|
LoadAdvOutputStreamingSettings();
|
|
|
|
LoadAdvOutputStreamingEncoderProperties();
|
|
|
|
LoadAdvOutputRecordingSettings();
|
|
|
|
LoadAdvOutputRecordingEncoderProperties();
|
|
|
|
LoadAdvOutputFFmpegSettings();
|
|
|
|
LoadAdvOutputAudioSettings();
|
|
|
|
|
2018-10-05 19:36:51 -07:00
|
|
|
if (obs_video_active()) {
|
2015-01-26 13:41:22 -08:00
|
|
|
ui->outputMode->setEnabled(false);
|
2015-03-12 08:49:07 -07:00
|
|
|
ui->outputModeLabel->setEnabled(false);
|
2020-10-31 02:57:38 -04:00
|
|
|
ui->simpleOutStrEncoderLabel->setEnabled(false);
|
|
|
|
ui->simpleOutStrEncoder->setEnabled(false);
|
2016-12-07 05:18:32 -08:00
|
|
|
ui->simpleRecordingGroupBox->setEnabled(false);
|
2016-12-07 05:21:44 -08:00
|
|
|
ui->replayBufferGroupBox->setEnabled(false);
|
2015-01-26 13:41:22 -08:00
|
|
|
ui->advOutTopContainer->setEnabled(false);
|
|
|
|
ui->advOutRecTopContainer->setEnabled(false);
|
|
|
|
ui->advOutRecTypeContainer->setEnabled(false);
|
|
|
|
ui->advOutputAudioTracksTab->setEnabled(false);
|
2017-03-05 14:24:29 -08:00
|
|
|
ui->advNetworkGroupBox->setEnabled(false);
|
2015-01-26 13:41:22 -08:00
|
|
|
}
|
2014-03-10 13:10:35 -07:00
|
|
|
|
|
|
|
loading = false;
|
|
|
|
}
|
|
|
|
|
2015-03-28 02:21:16 -05:00
|
|
|
void OBSBasicSettings::SetAdvOutputFFmpegEnablement(ff_codec_type encoderType,
|
|
|
|
bool enabled,
|
|
|
|
bool enableEncoder)
|
|
|
|
{
|
|
|
|
bool rescale = config_get_bool(main->Config(), "AdvOut", "FFRescale");
|
|
|
|
|
|
|
|
switch (encoderType) {
|
|
|
|
case FF_CODEC_VIDEO:
|
|
|
|
ui->advOutFFVBitrate->setEnabled(enabled);
|
2017-02-17 17:25:21 +01:00
|
|
|
ui->advOutFFVGOPSize->setEnabled(enabled);
|
2015-03-28 02:21:16 -05:00
|
|
|
ui->advOutFFUseRescale->setEnabled(enabled);
|
|
|
|
ui->advOutFFRescale->setEnabled(enabled && rescale);
|
|
|
|
ui->advOutFFVEncoder->setEnabled(enabled || enableEncoder);
|
|
|
|
ui->advOutFFVCfg->setEnabled(enabled);
|
|
|
|
break;
|
|
|
|
case FF_CODEC_AUDIO:
|
|
|
|
ui->advOutFFABitrate->setEnabled(enabled);
|
|
|
|
ui->advOutFFAEncoder->setEnabled(enabled || enableEncoder);
|
|
|
|
ui->advOutFFACfg->setEnabled(enabled);
|
|
|
|
ui->advOutFFTrack1->setEnabled(enabled);
|
|
|
|
ui->advOutFFTrack2->setEnabled(enabled);
|
|
|
|
ui->advOutFFTrack3->setEnabled(enabled);
|
|
|
|
ui->advOutFFTrack4->setEnabled(enabled);
|
2016-12-21 17:14:24 -08:00
|
|
|
ui->advOutFFTrack5->setEnabled(enabled);
|
|
|
|
ui->advOutFFTrack6->setEnabled(enabled);
|
2015-03-28 02:21:16 -05:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-06 07:02:25 -07:00
|
|
|
static inline void LoadListValue(QComboBox *widget, const char *text,
|
|
|
|
const char *val)
|
|
|
|
{
|
|
|
|
widget->addItem(QT_UTF8(text), QT_UTF8(val));
|
|
|
|
}
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void OBSBasicSettings::LoadListValues(QComboBox *widget, obs_property_t *prop,
|
2015-06-23 18:47:22 -07:00
|
|
|
int index)
|
2014-03-06 07:02:25 -07:00
|
|
|
{
|
|
|
|
size_t count = obs_property_list_item_count(prop);
|
2015-06-23 18:47:22 -07:00
|
|
|
|
2021-11-26 22:25:39 +13:00
|
|
|
OBSSourceAutoRelease source = obs_get_output_source(index);
|
2015-10-17 02:51:59 -07:00
|
|
|
const char *deviceId = nullptr;
|
2021-11-26 22:25:39 +13:00
|
|
|
OBSDataAutoRelease settings = nullptr;
|
2015-06-23 18:47:22 -07:00
|
|
|
|
2015-10-17 02:51:59 -07:00
|
|
|
if (source) {
|
|
|
|
settings = obs_source_get_settings(source);
|
|
|
|
if (settings)
|
|
|
|
deviceId = obs_data_get_string(settings, "device_id");
|
|
|
|
}
|
2014-03-06 07:02:25 -07:00
|
|
|
|
2019-02-25 23:06:10 +01:00
|
|
|
widget->addItem(QTStr("Basic.Settings.Audio.Disabled"), "disabled");
|
2014-03-06 07:02:25 -07:00
|
|
|
|
|
|
|
for (size_t i = 0; i < count; i++) {
|
|
|
|
const char *name = obs_property_list_item_name(prop, i);
|
2014-04-04 00:30:37 -07:00
|
|
|
const char *val = obs_property_list_item_string(prop, i);
|
2014-03-06 07:02:25 -07:00
|
|
|
LoadListValue(widget, name, val);
|
|
|
|
}
|
2014-03-07 12:56:31 -07:00
|
|
|
|
2015-10-17 02:51:59 -07:00
|
|
|
if (deviceId) {
|
2016-01-23 01:20:57 -08:00
|
|
|
QVariant var(QT_UTF8(deviceId));
|
|
|
|
int idx = widget->findData(var);
|
|
|
|
if (idx != -1) {
|
2015-10-17 02:51:59 -07:00
|
|
|
widget->setCurrentIndex(idx);
|
2016-01-23 01:20:57 -08:00
|
|
|
} else {
|
|
|
|
widget->insertItem(0,
|
|
|
|
QTStr("Basic.Settings.Audio."
|
|
|
|
"UnknownAudioDevice"),
|
|
|
|
var);
|
|
|
|
widget->setCurrentIndex(0);
|
2020-04-14 13:33:36 -05:00
|
|
|
HighlightGroupBoxLabel(ui->audioDevicesGroupBox, widget,
|
|
|
|
"errorLabel");
|
2016-01-23 01:20:57 -08:00
|
|
|
}
|
2015-10-17 02:51:59 -07:00
|
|
|
}
|
2014-03-06 07:02:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadAudioDevices()
|
|
|
|
{
|
2014-03-10 13:59:15 -07:00
|
|
|
const char *input_id = App()->InputAudioSource();
|
|
|
|
const char *output_id = App()->OutputAudioSource();
|
2014-03-06 07:02:25 -07:00
|
|
|
|
2015-12-29 15:25:45 -08:00
|
|
|
obs_properties_t *input_props = obs_get_source_properties(input_id);
|
|
|
|
obs_properties_t *output_props = obs_get_source_properties(output_id);
|
2014-03-06 07:02:25 -07:00
|
|
|
|
2014-03-10 13:59:15 -07:00
|
|
|
if (input_props) {
|
2014-09-25 17:44:05 -07:00
|
|
|
obs_property_t *inputs =
|
|
|
|
obs_properties_get(input_props, "device_id");
|
2015-06-23 18:47:22 -07:00
|
|
|
LoadListValues(ui->auxAudioDevice1, inputs, 3);
|
|
|
|
LoadListValues(ui->auxAudioDevice2, inputs, 4);
|
|
|
|
LoadListValues(ui->auxAudioDevice3, inputs, 5);
|
2018-06-26 20:41:32 +02:00
|
|
|
LoadListValues(ui->auxAudioDevice4, inputs, 6);
|
2014-03-10 13:59:15 -07:00
|
|
|
obs_properties_destroy(input_props);
|
|
|
|
}
|
2014-03-06 07:02:25 -07:00
|
|
|
|
2014-03-10 13:59:15 -07:00
|
|
|
if (output_props) {
|
2014-09-25 17:44:05 -07:00
|
|
|
obs_property_t *outputs =
|
|
|
|
obs_properties_get(output_props, "device_id");
|
2015-06-23 18:47:22 -07:00
|
|
|
LoadListValues(ui->desktopAudioDevice1, outputs, 1);
|
|
|
|
LoadListValues(ui->desktopAudioDevice2, outputs, 2);
|
2014-03-10 13:59:15 -07:00
|
|
|
obs_properties_destroy(output_props);
|
|
|
|
}
|
2020-02-16 15:15:33 -06:00
|
|
|
|
|
|
|
if (obs_video_active()) {
|
|
|
|
ui->sampleRate->setEnabled(false);
|
|
|
|
ui->channelSetup->setEnabled(false);
|
|
|
|
}
|
2014-03-06 07:02:25 -07:00
|
|
|
}
|
|
|
|
|
2015-10-15 01:27:21 -07:00
|
|
|
#define NBSP "\xC2\xA0"
|
|
|
|
|
2015-05-01 07:07:42 +02:00
|
|
|
void OBSBasicSettings::LoadAudioSources()
|
|
|
|
{
|
2019-02-02 22:09:47 +11:00
|
|
|
if (ui->audioSourceLayout->rowCount() > 0) {
|
|
|
|
QLayoutItem *forDeletion = ui->audioSourceLayout->takeAt(0);
|
2020-02-24 15:29:12 -08:00
|
|
|
forDeletion->widget()->deleteLater();
|
2019-02-02 22:09:47 +11:00
|
|
|
delete forDeletion;
|
|
|
|
}
|
2015-05-01 07:07:42 +02:00
|
|
|
auto layout = new QFormLayout();
|
|
|
|
layout->setVerticalSpacing(15);
|
|
|
|
layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
|
|
|
|
|
|
|
audioSourceSignals.clear();
|
|
|
|
audioSources.clear();
|
|
|
|
|
|
|
|
auto widget = new QWidget();
|
|
|
|
widget->setLayout(layout);
|
2019-02-02 22:09:47 +11:00
|
|
|
ui->audioSourceLayout->addRow(widget);
|
2015-05-01 07:07:42 +02:00
|
|
|
|
|
|
|
const char *enablePtm = Str("Basic.Settings.Audio.EnablePushToMute");
|
|
|
|
const char *ptmDelay = Str("Basic.Settings.Audio.PushToMuteDelay");
|
|
|
|
const char *enablePtt = Str("Basic.Settings.Audio.EnablePushToTalk");
|
|
|
|
const char *pttDelay = Str("Basic.Settings.Audio.PushToTalkDelay");
|
|
|
|
auto AddSource = [&](obs_source_t *source) {
|
|
|
|
if (!(obs_source_get_output_flags(source) & OBS_SOURCE_AUDIO))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
auto form = new QFormLayout();
|
|
|
|
form->setVerticalSpacing(0);
|
|
|
|
form->setHorizontalSpacing(5);
|
|
|
|
form->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
|
|
|
|
|
|
|
auto ptmCB = new SilentUpdateCheckBox();
|
|
|
|
ptmCB->setText(enablePtm);
|
|
|
|
ptmCB->setChecked(obs_source_push_to_mute_enabled(source));
|
|
|
|
form->addRow(ptmCB);
|
|
|
|
|
|
|
|
auto ptmSB = new SilentUpdateSpinBox();
|
2015-10-15 01:27:21 -07:00
|
|
|
ptmSB->setSuffix(NBSP "ms");
|
2015-05-01 07:07:42 +02:00
|
|
|
ptmSB->setRange(0, INT_MAX);
|
|
|
|
ptmSB->setValue(obs_source_get_push_to_mute_delay(source));
|
|
|
|
form->addRow(ptmDelay, ptmSB);
|
|
|
|
|
|
|
|
auto pttCB = new SilentUpdateCheckBox();
|
|
|
|
pttCB->setText(enablePtt);
|
|
|
|
pttCB->setChecked(obs_source_push_to_talk_enabled(source));
|
|
|
|
form->addRow(pttCB);
|
|
|
|
|
|
|
|
auto pttSB = new SilentUpdateSpinBox();
|
2015-10-15 01:27:21 -07:00
|
|
|
pttSB->setSuffix(NBSP "ms");
|
2015-05-01 07:07:42 +02:00
|
|
|
pttSB->setRange(0, INT_MAX);
|
|
|
|
pttSB->setValue(obs_source_get_push_to_talk_delay(source));
|
|
|
|
form->addRow(pttDelay, pttSB);
|
|
|
|
|
|
|
|
HookWidget(ptmCB, CHECK_CHANGED, AUDIO_CHANGED);
|
|
|
|
HookWidget(ptmSB, SCROLL_CHANGED, AUDIO_CHANGED);
|
|
|
|
HookWidget(pttCB, CHECK_CHANGED, AUDIO_CHANGED);
|
|
|
|
HookWidget(pttSB, SCROLL_CHANGED, AUDIO_CHANGED);
|
|
|
|
|
|
|
|
audioSourceSignals.reserve(audioSourceSignals.size() + 4);
|
|
|
|
|
|
|
|
auto handler = obs_source_get_signal_handler(source);
|
|
|
|
audioSourceSignals.emplace_back(
|
|
|
|
handler, "push_to_mute_changed",
|
|
|
|
[](void *data, calldata_t *param) {
|
|
|
|
QMetaObject::invokeMethod(
|
|
|
|
static_cast<QObject *>(data),
|
|
|
|
"setCheckedSilently",
|
|
|
|
Q_ARG(bool,
|
|
|
|
calldata_bool(param, "enabled")));
|
|
|
|
},
|
|
|
|
ptmCB);
|
|
|
|
audioSourceSignals.emplace_back(
|
|
|
|
handler, "push_to_mute_delay",
|
|
|
|
[](void *data, calldata_t *param) {
|
|
|
|
QMetaObject::invokeMethod(
|
|
|
|
static_cast<QObject *>(data),
|
|
|
|
"setValueSilently",
|
|
|
|
Q_ARG(int,
|
|
|
|
calldata_int(param, "delay")));
|
|
|
|
},
|
|
|
|
ptmSB);
|
|
|
|
audioSourceSignals.emplace_back(
|
|
|
|
handler, "push_to_talk_changed",
|
|
|
|
[](void *data, calldata_t *param) {
|
|
|
|
QMetaObject::invokeMethod(
|
|
|
|
static_cast<QObject *>(data),
|
|
|
|
"setCheckedSilently",
|
|
|
|
Q_ARG(bool,
|
|
|
|
calldata_bool(param, "enabled")));
|
|
|
|
},
|
|
|
|
pttCB);
|
|
|
|
audioSourceSignals.emplace_back(
|
|
|
|
handler, "push_to_talk_delay",
|
|
|
|
[](void *data, calldata_t *param) {
|
|
|
|
QMetaObject::invokeMethod(
|
|
|
|
static_cast<QObject *>(data),
|
|
|
|
"setValueSilently",
|
|
|
|
Q_ARG(int,
|
|
|
|
calldata_int(param, "delay")));
|
|
|
|
},
|
|
|
|
pttSB);
|
2019-06-22 22:13:45 -07:00
|
|
|
|
2022-01-07 23:12:31 -06:00
|
|
|
audioSources.emplace_back(OBSGetWeakRef(source), ptmCB, ptmSB,
|
2015-05-01 07:07:42 +02:00
|
|
|
pttCB, pttSB);
|
|
|
|
|
|
|
|
auto label = new OBSSourceLabel(source);
|
2022-05-31 04:30:03 -05:00
|
|
|
TruncateLabel(label, label->text());
|
2019-02-02 22:09:47 +11:00
|
|
|
label->setMinimumSize(QSize(170, 0));
|
|
|
|
label->setAlignment(Qt::AlignRight | Qt::AlignTrailing |
|
|
|
|
Qt::AlignVCenter);
|
2020-03-02 22:21:02 +01:00
|
|
|
connect(label, &OBSSourceLabel::Removed, [=]() {
|
|
|
|
QMetaObject::invokeMethod(this, "ReloadAudioSources");
|
|
|
|
});
|
|
|
|
connect(label, &OBSSourceLabel::Destroyed, [=]() {
|
|
|
|
QMetaObject::invokeMethod(this, "ReloadAudioSources");
|
|
|
|
});
|
2015-05-01 07:07:42 +02:00
|
|
|
|
|
|
|
layout->addRow(label, form);
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
|
|
|
using AddSource_t = decltype(AddSource);
|
|
|
|
obs_enum_sources(
|
|
|
|
[](void *data, obs_source_t *source) {
|
|
|
|
auto &AddSource = *static_cast<AddSource_t *>(data);
|
2020-03-02 22:23:13 +01:00
|
|
|
if (!obs_source_removed(source))
|
|
|
|
AddSource(source);
|
2015-05-01 07:07:42 +02:00
|
|
|
return true;
|
|
|
|
},
|
|
|
|
static_cast<void *>(&AddSource));
|
|
|
|
|
|
|
|
if (layout->rowCount() == 0)
|
2019-02-02 22:09:47 +11:00
|
|
|
ui->audioHotkeysGroupBox->hide();
|
2015-05-01 07:07:42 +02:00
|
|
|
else
|
2019-02-02 22:09:47 +11:00
|
|
|
ui->audioHotkeysGroupBox->show();
|
2015-05-01 07:07:42 +02:00
|
|
|
}
|
|
|
|
|
2014-02-23 16:27:19 -07:00
|
|
|
void OBSBasicSettings::LoadAudioSettings()
|
|
|
|
{
|
2014-03-06 21:08:12 -07:00
|
|
|
uint32_t sampleRate =
|
|
|
|
config_get_uint(main->Config(), "Audio", "SampleRate");
|
|
|
|
const char *speakers =
|
|
|
|
config_get_string(main->Config(), "Audio", "ChannelSetup");
|
2018-01-09 18:45:20 -02:00
|
|
|
double meterDecayRate =
|
|
|
|
config_get_double(main->Config(), "Audio", "MeterDecayRate");
|
2018-01-19 22:57:36 +01:00
|
|
|
uint32_t peakMeterTypeIdx =
|
|
|
|
config_get_uint(main->Config(), "Audio", "PeakMeterType");
|
2014-02-23 16:27:19 -07:00
|
|
|
|
|
|
|
loading = true;
|
|
|
|
|
|
|
|
const char *str;
|
2015-09-21 19:31:08 -07:00
|
|
|
if (sampleRate == 48000)
|
2019-10-19 19:05:00 +11:00
|
|
|
str = "48 kHz";
|
2014-02-23 16:27:19 -07:00
|
|
|
else
|
2019-10-19 19:05:00 +11:00
|
|
|
str = "44.1 kHz";
|
2014-02-23 16:27:19 -07:00
|
|
|
|
|
|
|
int sampleRateIdx = ui->sampleRate->findText(str);
|
|
|
|
if (sampleRateIdx != -1)
|
|
|
|
ui->sampleRate->setCurrentIndex(sampleRateIdx);
|
|
|
|
|
|
|
|
if (strcmp(speakers, "Mono") == 0)
|
|
|
|
ui->channelSetup->setCurrentIndex(0);
|
libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)
Adds surround sound audio support to the core, core plugins, and user
interface.
Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
(due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST: stereo plugins keep in general only the first two channels.
surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
(not implemented due to lack of usefulness)
Closes jp9000/obs-studio#968
2017-05-27 02:15:54 +02:00
|
|
|
else if (strcmp(speakers, "2.1") == 0)
|
|
|
|
ui->channelSetup->setCurrentIndex(2);
|
2017-12-01 17:10:05 +01:00
|
|
|
else if (strcmp(speakers, "4.0") == 0)
|
libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)
Adds surround sound audio support to the core, core plugins, and user
interface.
Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
(due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST: stereo plugins keep in general only the first two channels.
surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
(not implemented due to lack of usefulness)
Closes jp9000/obs-studio#968
2017-05-27 02:15:54 +02:00
|
|
|
ui->channelSetup->setCurrentIndex(3);
|
|
|
|
else if (strcmp(speakers, "4.1") == 0)
|
|
|
|
ui->channelSetup->setCurrentIndex(4);
|
|
|
|
else if (strcmp(speakers, "5.1") == 0)
|
|
|
|
ui->channelSetup->setCurrentIndex(5);
|
|
|
|
else if (strcmp(speakers, "7.1") == 0)
|
|
|
|
ui->channelSetup->setCurrentIndex(6);
|
2014-02-23 16:27:19 -07:00
|
|
|
else
|
|
|
|
ui->channelSetup->setCurrentIndex(1);
|
|
|
|
|
2018-01-09 18:45:20 -02:00
|
|
|
if (meterDecayRate == VOLUME_METER_DECAY_MEDIUM)
|
|
|
|
ui->meterDecayRate->setCurrentIndex(1);
|
|
|
|
else if (meterDecayRate == VOLUME_METER_DECAY_SLOW)
|
|
|
|
ui->meterDecayRate->setCurrentIndex(2);
|
|
|
|
else
|
|
|
|
ui->meterDecayRate->setCurrentIndex(0);
|
|
|
|
|
2018-01-19 22:57:36 +01:00
|
|
|
ui->peakMeterType->setCurrentIndex(peakMeterTypeIdx);
|
|
|
|
|
2014-03-06 07:02:25 -07:00
|
|
|
LoadAudioDevices();
|
2015-05-01 07:07:42 +02:00
|
|
|
LoadAudioSources();
|
2014-03-06 07:02:25 -07:00
|
|
|
|
2014-02-23 16:27:19 -07:00
|
|
|
loading = false;
|
|
|
|
}
|
|
|
|
|
2022-01-19 00:51:25 -08:00
|
|
|
void OBSBasicSettings::UpdateColorFormatSpaceWarning()
|
|
|
|
{
|
2022-07-13 17:49:27 +02:00
|
|
|
const QString format = ui->colorFormat->currentData().toString();
|
2022-04-04 00:13:24 -07:00
|
|
|
switch (ui->colorSpace->currentIndex()) {
|
2022-04-09 20:54:28 -07:00
|
|
|
case 3: /* Rec.2100 (PQ) */
|
|
|
|
case 4: /* Rec.2100 (HLG) */
|
2022-07-13 17:49:27 +02:00
|
|
|
if (format == "P010") {
|
2022-01-19 00:51:25 -08:00
|
|
|
ui->advancedMsg2->clear();
|
2022-07-13 17:49:27 +02:00
|
|
|
} else if (format == "I010") {
|
2022-01-19 00:51:25 -08:00
|
|
|
ui->advancedMsg2->setText(
|
|
|
|
QTStr("Basic.Settings.Advanced.FormatWarning"));
|
|
|
|
} else {
|
|
|
|
ui->advancedMsg2->setText(QTStr(
|
2022-04-09 20:54:28 -07:00
|
|
|
"Basic.Settings.Advanced.FormatWarning2100"));
|
2022-01-19 00:51:25 -08:00
|
|
|
}
|
2022-04-04 00:13:24 -07:00
|
|
|
break;
|
|
|
|
default:
|
2022-07-13 17:49:27 +02:00
|
|
|
if (format == "NV12") {
|
2022-01-19 00:51:25 -08:00
|
|
|
ui->advancedMsg2->clear();
|
2022-07-13 17:49:27 +02:00
|
|
|
} else if ((format == "I010") || (format == "P010")) {
|
2022-01-19 00:51:25 -08:00
|
|
|
ui->advancedMsg2->setText(QTStr(
|
2022-04-04 00:13:24 -07:00
|
|
|
"Basic.Settings.Advanced.FormatWarning10BitSdr"));
|
2022-01-19 00:51:25 -08:00
|
|
|
} else {
|
|
|
|
ui->advancedMsg2->setText(
|
|
|
|
QTStr("Basic.Settings.Advanced.FormatWarning"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-11 12:55:06 -08:00
|
|
|
void OBSBasicSettings::LoadAdvancedSettings()
|
|
|
|
{
|
|
|
|
const char *videoColorFormat =
|
|
|
|
config_get_string(main->Config(), "Video", "ColorFormat");
|
|
|
|
const char *videoColorSpace =
|
|
|
|
config_get_string(main->Config(), "Video", "ColorSpace");
|
|
|
|
const char *videoColorRange =
|
|
|
|
config_get_string(main->Config(), "Video", "ColorRange");
|
2022-02-20 20:31:30 -08:00
|
|
|
uint32_t sdrWhiteLevel = (uint32_t)config_get_uint(
|
|
|
|
main->Config(), "Video", "SdrWhiteLevel");
|
2022-04-10 12:31:08 -07:00
|
|
|
uint32_t hdrNominalPeakLevel = (uint32_t)config_get_uint(
|
|
|
|
main->Config(), "Video", "HdrNominalPeakLevel");
|
2021-08-31 04:53:02 -07:00
|
|
|
|
|
|
|
QString monDevName;
|
|
|
|
QString monDevId;
|
2021-12-21 19:08:14 -08:00
|
|
|
if (obs_audio_monitoring_available()) {
|
2021-08-31 04:53:02 -07:00
|
|
|
monDevName = config_get_string(main->Config(), "Audio",
|
|
|
|
"MonitoringDeviceName");
|
|
|
|
monDevId = config_get_string(main->Config(), "Audio",
|
|
|
|
"MonitoringDeviceId");
|
|
|
|
}
|
2015-09-06 16:12:03 -07:00
|
|
|
bool enableDelay =
|
|
|
|
config_get_bool(main->Config(), "Output", "DelayEnable");
|
|
|
|
int delaySec = config_get_int(main->Config(), "Output", "DelaySec");
|
|
|
|
bool preserveDelay =
|
|
|
|
config_get_bool(main->Config(), "Output", "DelayPreserve");
|
2015-09-10 19:10:40 -07:00
|
|
|
bool reconnect = config_get_bool(main->Config(), "Output", "Reconnect");
|
|
|
|
int retryDelay = config_get_int(main->Config(), "Output", "RetryDelay");
|
|
|
|
int maxRetries = config_get_int(main->Config(), "Output", "MaxRetries");
|
2016-03-25 02:43:38 -07:00
|
|
|
const char *filename = config_get_string(main->Config(), "Output",
|
|
|
|
"FilenameFormatting");
|
|
|
|
bool overwriteIfExists =
|
|
|
|
config_get_bool(main->Config(), "Output", "OverwriteIfExists");
|
2016-07-29 08:30:54 -07:00
|
|
|
const char *bindIP =
|
|
|
|
config_get_string(main->Config(), "Output", "BindIP");
|
2016-12-09 14:42:14 -08:00
|
|
|
const char *rbPrefix = config_get_string(main->Config(), "SimpleOutput",
|
|
|
|
"RecRBPrefix");
|
|
|
|
const char *rbSuffix = config_get_string(main->Config(), "SimpleOutput",
|
|
|
|
"RecRBSuffix");
|
2017-09-05 20:01:49 -04:00
|
|
|
bool replayBuf = config_get_bool(main->Config(), "AdvOut", "RecRB");
|
|
|
|
int rbTime = config_get_int(main->Config(), "AdvOut", "RecRBTime");
|
|
|
|
int rbSize = config_get_int(main->Config(), "AdvOut", "RecRBSize");
|
2017-05-08 06:53:35 -05:00
|
|
|
bool autoRemux = config_get_bool(main->Config(), "Video", "AutoRemux");
|
2019-07-22 01:20:12 -07:00
|
|
|
const char *hotkeyFocusType = config_get_string(
|
|
|
|
App()->GlobalConfig(), "General", "HotkeyFocusType");
|
2019-08-15 08:50:09 -07:00
|
|
|
bool dynBitrate =
|
|
|
|
config_get_bool(main->Config(), "Output", "DynamicBitrate");
|
2017-09-05 20:01:49 -04:00
|
|
|
|
2020-11-20 12:04:26 +01:00
|
|
|
bool confirmOnExit =
|
|
|
|
config_get_bool(GetGlobalConfig(), "General", "ConfirmOnExit");
|
|
|
|
ui->confirmOnExit->setChecked(confirmOnExit);
|
|
|
|
|
2015-02-11 12:55:06 -08:00
|
|
|
loading = true;
|
|
|
|
|
2016-01-25 05:55:01 -08:00
|
|
|
LoadRendererList();
|
|
|
|
|
2021-12-21 19:08:14 -08:00
|
|
|
if (obs_audio_monitoring_available() &&
|
2021-08-31 04:53:02 -07:00
|
|
|
!SetComboByValue(ui->monitoringDevice, monDevId.toUtf8()))
|
|
|
|
SetInvalidValue(ui->monitoringDevice, monDevName.toUtf8(),
|
|
|
|
monDevId.toUtf8());
|
2017-02-05 21:51:50 -08:00
|
|
|
|
2016-03-25 02:43:38 -07:00
|
|
|
ui->filenameFormatting->setText(filename);
|
|
|
|
ui->overwriteIfExists->setChecked(overwriteIfExists);
|
2016-12-09 14:42:14 -08:00
|
|
|
ui->simpleRBPrefix->setText(rbPrefix);
|
|
|
|
ui->simpleRBSuffix->setText(rbSuffix);
|
2016-03-25 02:43:38 -07:00
|
|
|
|
2017-09-05 20:01:49 -04:00
|
|
|
ui->advReplayBuf->setChecked(replayBuf);
|
|
|
|
ui->advRBSecMax->setValue(rbTime);
|
|
|
|
ui->advRBMegsMax->setValue(rbSize);
|
|
|
|
|
2015-09-10 19:10:40 -07:00
|
|
|
ui->reconnectEnable->setChecked(reconnect);
|
|
|
|
ui->reconnectRetryDelay->setValue(retryDelay);
|
|
|
|
ui->reconnectMaxRetries->setValue(maxRetries);
|
|
|
|
|
2015-09-06 16:12:03 -07:00
|
|
|
ui->streamDelaySec->setValue(delaySec);
|
|
|
|
ui->streamDelayPreserve->setChecked(preserveDelay);
|
|
|
|
ui->streamDelayEnable->setChecked(enableDelay);
|
2017-05-08 06:53:35 -05:00
|
|
|
ui->autoRemux->setChecked(autoRemux);
|
2019-08-15 08:50:09 -07:00
|
|
|
ui->dynBitrate->setChecked(dynBitrate);
|
2015-09-06 16:12:03 -07:00
|
|
|
|
2022-01-19 00:51:25 -08:00
|
|
|
UpdateColorFormatSpaceWarning();
|
|
|
|
|
2022-07-12 12:08:26 +02:00
|
|
|
SetComboByValue(ui->colorFormat, videoColorFormat);
|
2022-01-19 00:51:25 -08:00
|
|
|
SetComboByValue(ui->colorSpace, videoColorSpace);
|
2015-02-11 12:55:06 -08:00
|
|
|
SetComboByValue(ui->colorRange, videoColorRange);
|
2022-02-20 20:31:30 -08:00
|
|
|
ui->sdrWhiteLevel->setValue(sdrWhiteLevel);
|
2022-04-10 12:31:08 -07:00
|
|
|
ui->hdrNominalPeakLevel->setValue(hdrNominalPeakLevel);
|
2015-02-11 12:55:06 -08:00
|
|
|
|
2017-05-10 21:41:34 +02:00
|
|
|
if (!SetComboByValue(ui->bindToIP, bindIP))
|
|
|
|
SetInvalidValue(ui->bindToIP, bindIP, bindIP);
|
2016-07-29 08:30:54 -07:00
|
|
|
|
2018-10-05 19:36:51 -07:00
|
|
|
if (obs_video_active()) {
|
2015-02-11 12:55:06 -08:00
|
|
|
ui->advancedVideoContainer->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
2016-01-25 17:09:59 -08:00
|
|
|
#ifdef __APPLE__
|
|
|
|
bool disableOSXVSync = config_get_bool(App()->GlobalConfig(), "Video",
|
|
|
|
"DisableOSXVSync");
|
|
|
|
bool resetOSXVSync = config_get_bool(App()->GlobalConfig(), "Video",
|
|
|
|
"ResetOSXVSyncOnExit");
|
|
|
|
ui->disableOSXVSync->setChecked(disableOSXVSync);
|
|
|
|
ui->resetOSXVSync->setChecked(resetOSXVSync);
|
|
|
|
ui->resetOSXVSync->setEnabled(disableOSXVSync);
|
2016-07-01 10:27:27 -07:00
|
|
|
#elif _WIN32
|
2017-04-17 22:38:16 +09:00
|
|
|
bool disableAudioDucking = config_get_bool(
|
|
|
|
App()->GlobalConfig(), "Audio", "DisableAudioDucking");
|
|
|
|
ui->disableAudioDucking->setChecked(disableAudioDucking);
|
|
|
|
|
2016-07-01 10:27:27 -07:00
|
|
|
const char *processPriority = config_get_string(
|
|
|
|
App()->GlobalConfig(), "General", "ProcessPriority");
|
2017-02-22 02:05:45 +01:00
|
|
|
bool enableNewSocketLoop = config_get_bool(main->Config(), "Output",
|
|
|
|
"NewSocketLoopEnable");
|
|
|
|
bool enableLowLatencyMode =
|
|
|
|
config_get_bool(main->Config(), "Output", "LowLatencyEnable");
|
|
|
|
|
2017-06-01 03:58:42 -03:00
|
|
|
int idx = ui->processPriority->findData(processPriority);
|
2016-07-01 10:27:27 -07:00
|
|
|
if (idx == -1)
|
|
|
|
idx = ui->processPriority->findData("Normal");
|
|
|
|
ui->processPriority->setCurrentIndex(idx);
|
2017-02-22 02:05:45 +01:00
|
|
|
|
|
|
|
ui->enableNewSocketLoop->setChecked(enableNewSocketLoop);
|
|
|
|
ui->enableLowLatencyMode->setChecked(enableLowLatencyMode);
|
2019-10-08 04:21:19 -05:00
|
|
|
ui->enableLowLatencyMode->setToolTip(
|
|
|
|
QTStr("Basic.Settings.Advanced.Network.TCPPacing.Tooltip"));
|
2020-12-11 19:09:57 +01:00
|
|
|
#endif
|
|
|
|
#if defined(_WIN32) || defined(__APPLE__)
|
2018-08-10 06:12:16 -07:00
|
|
|
bool browserHWAccel = config_get_bool(App()->GlobalConfig(), "General",
|
|
|
|
"BrowserHWAccel");
|
|
|
|
ui->browserHWAccel->setChecked(browserHWAccel);
|
2020-03-18 21:47:23 +11:00
|
|
|
prevBrowserAccel = ui->browserHWAccel->isChecked();
|
2016-01-25 17:09:59 -08:00
|
|
|
#endif
|
|
|
|
|
2019-07-22 01:20:12 -07:00
|
|
|
SetComboByValue(ui->hotkeyFocusType, hotkeyFocusType);
|
2018-05-06 16:48:27 -07:00
|
|
|
|
2015-02-11 12:55:06 -08:00
|
|
|
loading = false;
|
|
|
|
}
|
|
|
|
|
2014-11-01 21:50:36 +01:00
|
|
|
template<typename Func>
|
|
|
|
static inline void
|
2021-09-09 00:21:00 -03:00
|
|
|
LayoutHotkey(OBSBasicSettings *settings, obs_hotkey_id id, obs_hotkey_t *key,
|
|
|
|
Func &&fun,
|
2014-11-01 21:50:36 +01:00
|
|
|
const map<obs_hotkey_id, vector<obs_key_combination_t>> &keys)
|
|
|
|
{
|
|
|
|
auto *label = new OBSHotkeyLabel;
|
2019-04-23 01:20:10 -05:00
|
|
|
QString text = QT_UTF8(obs_hotkey_get_description(key));
|
|
|
|
|
2021-01-20 19:12:38 +03:00
|
|
|
label->setProperty("fullName", text);
|
2022-05-31 04:25:48 -05:00
|
|
|
TruncateLabel(label, text);
|
2014-11-01 21:50:36 +01:00
|
|
|
|
|
|
|
OBSHotkeyWidget *hw = nullptr;
|
|
|
|
|
|
|
|
auto combos = keys.find(id);
|
|
|
|
if (combos == std::end(keys))
|
2022-01-03 17:41:28 +11:00
|
|
|
hw = new OBSHotkeyWidget(settings, id, obs_hotkey_get_name(key),
|
2021-09-09 00:21:00 -03:00
|
|
|
settings);
|
|
|
|
else
|
2022-01-03 17:41:28 +11:00
|
|
|
hw = new OBSHotkeyWidget(settings, id, obs_hotkey_get_name(key),
|
|
|
|
settings, combos->second);
|
2014-11-01 21:50:36 +01:00
|
|
|
|
|
|
|
hw->label = label;
|
|
|
|
label->widget = hw;
|
|
|
|
|
|
|
|
fun(key, label, hw);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename Func, typename T>
|
|
|
|
static QLabel *makeLabel(T &t, Func &&getName)
|
|
|
|
{
|
2021-08-07 03:51:52 +02:00
|
|
|
QLabel *label = new QLabel(getName(t));
|
|
|
|
label->setStyleSheet("font-weight: bold;");
|
|
|
|
return label;
|
2014-11-01 21:50:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename Func>
|
|
|
|
static QLabel *makeLabel(const OBSSource &source, Func &&)
|
|
|
|
{
|
2019-04-29 13:34:16 -05:00
|
|
|
OBSSourceLabel *label = new OBSSourceLabel(source);
|
|
|
|
label->setStyleSheet("font-weight: bold;");
|
2019-04-23 01:20:10 -05:00
|
|
|
QString name = QT_UTF8(obs_source_get_name(source));
|
2022-05-31 04:25:48 -05:00
|
|
|
TruncateLabel(label, name);
|
2019-04-29 13:34:16 -05:00
|
|
|
|
|
|
|
return label;
|
2014-11-01 21:50:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename Func, typename T>
|
|
|
|
static inline void AddHotkeys(
|
|
|
|
QFormLayout &layout, Func &&getName,
|
|
|
|
std::vector<std::tuple<T, QPointer<QLabel>, QPointer<QWidget>>> &hotkeys)
|
|
|
|
{
|
|
|
|
if (hotkeys.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
layout.setItem(layout.rowCount(), QFormLayout::SpanningRole,
|
|
|
|
new QSpacerItem(0, 10));
|
|
|
|
|
|
|
|
using tuple_type = std::tuple<T, QPointer<QLabel>, QPointer<QWidget>>;
|
|
|
|
|
|
|
|
stable_sort(begin(hotkeys), end(hotkeys),
|
|
|
|
[&](const tuple_type &a, const tuple_type &b) {
|
|
|
|
const auto &o_a = get<0>(a);
|
|
|
|
const auto &o_b = get<0>(b);
|
|
|
|
return o_a != o_b &&
|
|
|
|
string(getName(o_a)) < getName(o_b);
|
|
|
|
});
|
|
|
|
|
|
|
|
string prevName;
|
|
|
|
for (const auto &hotkey : hotkeys) {
|
|
|
|
const auto &o = get<0>(hotkey);
|
|
|
|
const char *name = getName(o);
|
|
|
|
if (prevName != name) {
|
|
|
|
prevName = name;
|
|
|
|
layout.setItem(layout.rowCount(),
|
|
|
|
QFormLayout::SpanningRole,
|
|
|
|
new QSpacerItem(0, 10));
|
|
|
|
layout.addRow(makeLabel(o, getName));
|
|
|
|
}
|
|
|
|
|
|
|
|
auto hlabel = get<1>(hotkey);
|
|
|
|
auto widget = get<2>(hotkey);
|
|
|
|
layout.addRow(hlabel, widget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadHotkeySettings(obs_hotkey_id ignoreKey)
|
|
|
|
{
|
|
|
|
hotkeys.clear();
|
2022-01-03 17:41:28 +11:00
|
|
|
if (ui->hotkeyFormLayout->rowCount() > 0) {
|
|
|
|
QLayoutItem *forDeletion = ui->hotkeyFormLayout->takeAt(0);
|
|
|
|
forDeletion->widget()->deleteLater();
|
|
|
|
delete forDeletion;
|
|
|
|
}
|
|
|
|
ui->hotkeyFilterSearch->blockSignals(true);
|
|
|
|
ui->hotkeyFilterInput->blockSignals(true);
|
|
|
|
ui->hotkeyFilterSearch->setText("");
|
|
|
|
ui->hotkeyFilterInput->ResetKey();
|
|
|
|
ui->hotkeyFilterSearch->blockSignals(false);
|
|
|
|
ui->hotkeyFilterInput->blockSignals(false);
|
2014-11-01 21:50:36 +01:00
|
|
|
|
|
|
|
using keys_t = map<obs_hotkey_id, vector<obs_key_combination_t>>;
|
|
|
|
keys_t keys;
|
|
|
|
obs_enum_hotkey_bindings(
|
|
|
|
[](void *data, size_t, obs_hotkey_binding_t *binding) {
|
|
|
|
auto &keys = *static_cast<keys_t *>(data);
|
|
|
|
|
|
|
|
keys[obs_hotkey_binding_get_hotkey_id(binding)]
|
|
|
|
.emplace_back(
|
|
|
|
obs_hotkey_binding_get_key_combination(
|
|
|
|
binding));
|
|
|
|
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
&keys);
|
|
|
|
|
2022-01-03 17:41:28 +11:00
|
|
|
QFormLayout *hotkeysLayout = new QFormLayout();
|
2021-09-09 00:21:00 -03:00
|
|
|
hotkeysLayout->setVerticalSpacing(0);
|
|
|
|
hotkeysLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
|
|
|
hotkeysLayout->setLabelAlignment(Qt::AlignRight | Qt::AlignTrailing |
|
|
|
|
Qt::AlignVCenter);
|
2022-01-03 17:41:28 +11:00
|
|
|
auto hotkeyChildWidget = new QWidget();
|
|
|
|
hotkeyChildWidget->setLayout(hotkeysLayout);
|
|
|
|
ui->hotkeyFormLayout->addRow(hotkeyChildWidget);
|
2018-09-10 09:31:04 +12:00
|
|
|
|
2014-11-01 21:50:36 +01:00
|
|
|
using namespace std;
|
|
|
|
using encoders_elem_t =
|
|
|
|
tuple<OBSEncoder, QPointer<QLabel>, QPointer<QWidget>>;
|
|
|
|
using outputs_elem_t =
|
|
|
|
tuple<OBSOutput, QPointer<QLabel>, QPointer<QWidget>>;
|
|
|
|
using services_elem_t =
|
|
|
|
tuple<OBSService, QPointer<QLabel>, QPointer<QWidget>>;
|
|
|
|
using sources_elem_t =
|
|
|
|
tuple<OBSSource, QPointer<QLabel>, QPointer<QWidget>>;
|
|
|
|
vector<encoders_elem_t> encoders;
|
|
|
|
vector<outputs_elem_t> outputs;
|
|
|
|
vector<services_elem_t> services;
|
|
|
|
vector<sources_elem_t> scenes;
|
|
|
|
vector<sources_elem_t> sources;
|
|
|
|
|
|
|
|
vector<obs_hotkey_id> pairIds;
|
|
|
|
map<obs_hotkey_id, pair<obs_hotkey_id, OBSHotkeyLabel *>> pairLabels;
|
|
|
|
|
|
|
|
using std::move;
|
|
|
|
|
|
|
|
auto HandleEncoder = [&](void *registerer, OBSHotkeyLabel *label,
|
|
|
|
OBSHotkeyWidget *hw) {
|
|
|
|
auto weak_encoder =
|
|
|
|
static_cast<obs_weak_encoder_t *>(registerer);
|
|
|
|
auto encoder = OBSGetStrongRef(weak_encoder);
|
|
|
|
|
|
|
|
if (!encoder)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
encoders.emplace_back(move(encoder), label, hw);
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
auto HandleOutput = [&](void *registerer, OBSHotkeyLabel *label,
|
|
|
|
OBSHotkeyWidget *hw) {
|
|
|
|
auto weak_output = static_cast<obs_weak_output_t *>(registerer);
|
|
|
|
auto output = OBSGetStrongRef(weak_output);
|
|
|
|
|
|
|
|
if (!output)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
outputs.emplace_back(move(output), label, hw);
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
auto HandleService = [&](void *registerer, OBSHotkeyLabel *label,
|
|
|
|
OBSHotkeyWidget *hw) {
|
|
|
|
auto weak_service =
|
|
|
|
static_cast<obs_weak_service_t *>(registerer);
|
|
|
|
auto service = OBSGetStrongRef(weak_service);
|
|
|
|
|
|
|
|
if (!service)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
services.emplace_back(move(service), label, hw);
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
auto HandleSource = [&](void *registerer, OBSHotkeyLabel *label,
|
|
|
|
OBSHotkeyWidget *hw) {
|
|
|
|
auto weak_source = static_cast<obs_weak_source_t *>(registerer);
|
|
|
|
auto source = OBSGetStrongRef(weak_source);
|
|
|
|
|
|
|
|
if (!source)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (obs_scene_from_source(source))
|
|
|
|
scenes.emplace_back(source, label, hw);
|
2020-08-15 21:29:51 +10:00
|
|
|
else if (obs_source_get_name(source) != NULL)
|
2014-11-01 21:50:36 +01:00
|
|
|
sources.emplace_back(source, label, hw);
|
|
|
|
|
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
auto RegisterHotkey = [&](obs_hotkey_t *key, OBSHotkeyLabel *label,
|
|
|
|
OBSHotkeyWidget *hw) {
|
|
|
|
auto registerer_type = obs_hotkey_get_registerer_type(key);
|
|
|
|
void *registerer = obs_hotkey_get_registerer(key);
|
|
|
|
|
|
|
|
obs_hotkey_id partner = obs_hotkey_get_pair_partner_id(key);
|
|
|
|
if (partner != OBS_INVALID_HOTKEY_ID) {
|
|
|
|
pairLabels.emplace(obs_hotkey_get_id(key),
|
|
|
|
make_pair(partner, label));
|
|
|
|
pairIds.push_back(obs_hotkey_get_id(key));
|
|
|
|
}
|
|
|
|
|
|
|
|
using std::move;
|
|
|
|
|
|
|
|
switch (registerer_type) {
|
|
|
|
case OBS_HOTKEY_REGISTERER_FRONTEND:
|
2021-09-09 00:21:00 -03:00
|
|
|
hotkeysLayout->addRow(label, hw);
|
2014-11-01 21:50:36 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case OBS_HOTKEY_REGISTERER_ENCODER:
|
|
|
|
if (HandleEncoder(registerer, label, hw))
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBS_HOTKEY_REGISTERER_OUTPUT:
|
|
|
|
if (HandleOutput(registerer, label, hw))
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBS_HOTKEY_REGISTERER_SERVICE:
|
|
|
|
if (HandleService(registerer, label, hw))
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case OBS_HOTKEY_REGISTERER_SOURCE:
|
|
|
|
if (HandleSource(registerer, label, hw))
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
hotkeys.emplace_back(
|
|
|
|
registerer_type == OBS_HOTKEY_REGISTERER_FRONTEND, hw);
|
2021-09-09 00:21:00 -03:00
|
|
|
connect(hw, &OBSHotkeyWidget::KeyChanged, this, [=]() {
|
|
|
|
HotkeysChanged();
|
|
|
|
ScanDuplicateHotkeys(hotkeysLayout);
|
|
|
|
});
|
|
|
|
connect(hw, &OBSHotkeyWidget::SearchKey,
|
|
|
|
[=](obs_key_combination_t combo) {
|
2022-01-03 17:41:28 +11:00
|
|
|
ui->hotkeyFilterSearch->setText("");
|
|
|
|
ui->hotkeyFilterInput->HandleNewKey(combo);
|
|
|
|
ui->hotkeyFilterInput->KeyChanged(combo);
|
2021-09-09 00:21:00 -03:00
|
|
|
});
|
2014-11-01 21:50:36 +01:00
|
|
|
};
|
|
|
|
|
2021-09-09 00:21:00 -03:00
|
|
|
auto data =
|
|
|
|
make_tuple(RegisterHotkey, std::move(keys), ignoreKey, this);
|
2014-11-01 21:50:36 +01:00
|
|
|
using data_t = decltype(data);
|
|
|
|
obs_enum_hotkeys(
|
|
|
|
[](void *data, obs_hotkey_id id, obs_hotkey_t *key) {
|
|
|
|
data_t &d = *static_cast<data_t *>(data);
|
|
|
|
if (id != get<2>(d))
|
2021-09-09 00:21:00 -03:00
|
|
|
LayoutHotkey(get<3>(d), id, key, get<0>(d),
|
|
|
|
get<1>(d));
|
2014-11-01 21:50:36 +01:00
|
|
|
return true;
|
|
|
|
},
|
|
|
|
&data);
|
|
|
|
|
|
|
|
for (auto keyId : pairIds) {
|
|
|
|
auto data1 = pairLabels.find(keyId);
|
|
|
|
if (data1 == end(pairLabels))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
auto &label1 = data1->second.second;
|
|
|
|
if (label1->pairPartner)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
auto data2 = pairLabels.find(data1->second.first);
|
|
|
|
if (data2 == end(pairLabels))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
auto &label2 = data2->second.second;
|
|
|
|
if (label2->pairPartner)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
QString tt = QTStr("Basic.Settings.Hotkeys.Pair");
|
|
|
|
auto name1 = label1->text();
|
|
|
|
auto name2 = label2->text();
|
|
|
|
|
|
|
|
auto Update = [&](OBSHotkeyLabel *label, const QString &name,
|
|
|
|
OBSHotkeyLabel *other,
|
|
|
|
const QString &otherName) {
|
2019-04-23 01:20:10 -05:00
|
|
|
QString string =
|
|
|
|
other->property("fullName").value<QString>();
|
|
|
|
|
|
|
|
if (string.isEmpty() || string.isNull())
|
|
|
|
string = otherName;
|
|
|
|
|
|
|
|
label->setToolTip(tt.arg(string));
|
2015-10-14 16:05:07 +08:00
|
|
|
label->setText(name + " *");
|
2014-11-01 21:50:36 +01:00
|
|
|
label->pairPartner = other;
|
|
|
|
};
|
|
|
|
Update(label1, name1, label2, name2);
|
|
|
|
Update(label2, name2, label1, name1);
|
|
|
|
}
|
|
|
|
|
2021-09-09 00:21:00 -03:00
|
|
|
AddHotkeys(*hotkeysLayout, obs_output_get_name, outputs);
|
|
|
|
AddHotkeys(*hotkeysLayout, obs_source_get_name, scenes);
|
|
|
|
AddHotkeys(*hotkeysLayout, obs_source_get_name, sources);
|
|
|
|
AddHotkeys(*hotkeysLayout, obs_encoder_get_name, encoders);
|
|
|
|
AddHotkeys(*hotkeysLayout, obs_service_get_name, services);
|
|
|
|
|
|
|
|
ScanDuplicateHotkeys(hotkeysLayout);
|
2014-11-01 21:50:36 +01:00
|
|
|
}
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
void OBSBasicSettings::LoadSettings(bool changedOnly)
|
|
|
|
{
|
|
|
|
if (!changedOnly || generalChanged)
|
|
|
|
LoadGeneralSettings();
|
2015-02-07 08:09:57 -08:00
|
|
|
if (!changedOnly || stream1Changed)
|
|
|
|
LoadStream1Settings();
|
2014-03-10 13:10:35 -07:00
|
|
|
if (!changedOnly || outputsChanged)
|
|
|
|
LoadOutputSettings();
|
2014-02-23 16:27:19 -07:00
|
|
|
if (!changedOnly || audioChanged)
|
|
|
|
LoadAudioSettings();
|
2014-01-26 15:36:15 -07:00
|
|
|
if (!changedOnly || videoChanged)
|
|
|
|
LoadVideoSettings();
|
2014-11-01 21:50:36 +01:00
|
|
|
if (!changedOnly || hotkeysChanged)
|
|
|
|
LoadHotkeySettings();
|
2015-02-11 12:55:06 -08:00
|
|
|
if (!changedOnly || advancedChanged)
|
|
|
|
LoadAdvancedSettings();
|
2014-01-26 15:36:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SaveGeneralSettings()
|
|
|
|
{
|
|
|
|
int languageIndex = ui->language->currentIndex();
|
|
|
|
QVariant langData = ui->language->itemData(languageIndex);
|
|
|
|
string language = langData.toString().toStdString();
|
|
|
|
|
2014-06-23 19:54:20 -07:00
|
|
|
if (WidgetChanged(ui->language))
|
|
|
|
config_set_string(GetGlobalConfig(), "General", "Language",
|
|
|
|
language.c_str());
|
2015-02-17 02:45:34 -05:00
|
|
|
|
|
|
|
int themeIndex = ui->theme->currentIndex();
|
|
|
|
QString themeData = ui->theme->itemText(themeIndex);
|
2019-03-29 04:16:12 -05:00
|
|
|
QString defaultTheme;
|
|
|
|
defaultTheme += DEFAULT_THEME;
|
|
|
|
defaultTheme += " ";
|
|
|
|
defaultTheme += QTStr("Default");
|
|
|
|
|
|
|
|
if (themeData == defaultTheme)
|
|
|
|
themeData = DEFAULT_THEME;
|
2015-02-17 02:45:34 -05:00
|
|
|
|
2022-07-04 23:00:15 +10:00
|
|
|
if (WidgetChanged(ui->theme))
|
2019-12-15 11:24:34 +13:00
|
|
|
config_set_string(GetGlobalConfig(), "General", "CurrentTheme2",
|
2019-03-29 04:16:12 -05:00
|
|
|
QT_TO_UTF8(themeData));
|
2017-07-02 13:25:20 -07:00
|
|
|
|
2017-02-27 08:00:13 -08:00
|
|
|
#if defined(_WIN32) || defined(__APPLE__)
|
2017-02-20 04:46:29 -08:00
|
|
|
if (WidgetChanged(ui->enableAutoUpdates))
|
|
|
|
config_set_bool(GetGlobalConfig(), "General",
|
|
|
|
"EnableAutoUpdates",
|
|
|
|
ui->enableAutoUpdates->isChecked());
|
2020-06-27 02:31:08 +02:00
|
|
|
#endif
|
|
|
|
#ifdef _WIN32
|
2022-01-24 18:30:54 +11:00
|
|
|
if (ui->hideOBSFromCapture && WidgetChanged(ui->hideOBSFromCapture)) {
|
2020-06-27 02:31:08 +02:00
|
|
|
bool hide_window = ui->hideOBSFromCapture->isChecked();
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"HideOBSWindowsFromCapture", hide_window);
|
|
|
|
|
|
|
|
QWindowList windows = QGuiApplication::allWindows();
|
|
|
|
for (auto window : windows) {
|
|
|
|
if (window->isVisible()) {
|
|
|
|
main->SetDisplayAffinity(window);
|
|
|
|
}
|
|
|
|
}
|
2022-02-20 13:38:17 +11:00
|
|
|
|
|
|
|
blog(LOG_INFO, "Hide OBS windows from screen capture: %s",
|
|
|
|
hide_window ? "true" : "false");
|
2020-06-27 02:31:08 +02:00
|
|
|
}
|
2017-02-27 08:00:13 -08:00
|
|
|
#endif
|
2017-05-13 20:47:47 -07:00
|
|
|
if (WidgetChanged(ui->openStatsOnStartup))
|
|
|
|
config_set_bool(main->Config(), "General", "OpenStatsOnStartup",
|
|
|
|
ui->openStatsOnStartup->isChecked());
|
2016-04-06 18:03:29 -07:00
|
|
|
if (WidgetChanged(ui->snappingEnabled))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"SnappingEnabled",
|
|
|
|
ui->snappingEnabled->isChecked());
|
|
|
|
if (WidgetChanged(ui->screenSnapping))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"ScreenSnapping",
|
|
|
|
ui->screenSnapping->isChecked());
|
2016-04-06 18:10:39 -07:00
|
|
|
if (WidgetChanged(ui->centerSnapping))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"CenterSnapping",
|
|
|
|
ui->centerSnapping->isChecked());
|
2016-04-06 18:13:56 -07:00
|
|
|
if (WidgetChanged(ui->sourceSnapping))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"SourceSnapping",
|
|
|
|
ui->sourceSnapping->isChecked());
|
2016-04-06 18:03:29 -07:00
|
|
|
if (WidgetChanged(ui->snapDistance))
|
|
|
|
config_set_double(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"SnapDistance", ui->snapDistance->value());
|
2019-01-15 14:58:20 +13:00
|
|
|
if (WidgetChanged(ui->overflowAlwaysVisible))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"OverflowAlwaysVisible",
|
|
|
|
ui->overflowAlwaysVisible->isChecked());
|
|
|
|
if (WidgetChanged(ui->overflowHide))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"OverflowHidden",
|
|
|
|
ui->overflowHide->isChecked());
|
|
|
|
if (WidgetChanged(ui->overflowSelectionHide))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"OverflowSelectionHidden",
|
|
|
|
ui->overflowSelectionHide->isChecked());
|
2021-08-19 23:56:49 -05:00
|
|
|
if (WidgetChanged(ui->previewSafeAreas)) {
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"ShowSafeAreas",
|
|
|
|
ui->previewSafeAreas->isChecked());
|
|
|
|
main->UpdatePreviewSafeAreas();
|
|
|
|
}
|
2017-09-21 15:37:01 -05:00
|
|
|
if (WidgetChanged(ui->doubleClickSwitch))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"TransitionOnDoubleClick",
|
|
|
|
ui->doubleClickSwitch->isChecked());
|
2020-02-02 20:44:07 +13:00
|
|
|
if (WidgetChanged(ui->automaticSearch))
|
|
|
|
config_set_bool(GetGlobalConfig(), "General",
|
|
|
|
"AutomaticCollectionSearch",
|
|
|
|
ui->automaticSearch->isChecked());
|
2016-04-06 18:03:29 -07:00
|
|
|
|
2016-01-22 08:09:04 -08:00
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"WarnBeforeStartingStream",
|
|
|
|
ui->warnBeforeStreamStart->isChecked());
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"WarnBeforeStoppingStream",
|
|
|
|
ui->warnBeforeStreamStop->isChecked());
|
2019-06-17 15:14:14 +01:00
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"WarnBeforeStoppingRecord",
|
|
|
|
ui->warnBeforeRecordStop->isChecked());
|
2016-06-27 14:47:42 -07:00
|
|
|
|
2020-06-13 21:00:55 -05:00
|
|
|
if (WidgetChanged(ui->hideProjectorCursor)) {
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"HideProjectorCursor",
|
|
|
|
ui->hideProjectorCursor->isChecked());
|
|
|
|
main->UpdateProjectorHideCursor();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (WidgetChanged(ui->projectorAlwaysOnTop)) {
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"ProjectorAlwaysOnTop",
|
|
|
|
ui->projectorAlwaysOnTop->isChecked());
|
2020-08-23 05:12:46 -05:00
|
|
|
#if defined(_WIN32) || defined(__APPLE__)
|
2020-06-13 21:00:55 -05:00
|
|
|
main->UpdateProjectorAlwaysOnTop(
|
2016-08-21 16:11:32 -07:00
|
|
|
ui->projectorAlwaysOnTop->isChecked());
|
2020-08-23 05:12:46 -05:00
|
|
|
#else
|
|
|
|
main->ResetProjectors();
|
|
|
|
#endif
|
2020-06-13 21:00:55 -05:00
|
|
|
}
|
2016-06-16 12:59:36 -05:00
|
|
|
|
|
|
|
if (WidgetChanged(ui->recordWhenStreaming))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"RecordWhenStreaming",
|
|
|
|
ui->recordWhenStreaming->isChecked());
|
|
|
|
if (WidgetChanged(ui->keepRecordStreamStops))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"KeepRecordingWhenStreamStops",
|
|
|
|
ui->keepRecordStreamStops->isChecked());
|
2016-08-13 09:36:17 -05:00
|
|
|
|
2017-01-04 16:11:52 -05:00
|
|
|
if (WidgetChanged(ui->replayWhileStreaming))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"ReplayBufferWhileStreaming",
|
|
|
|
ui->replayWhileStreaming->isChecked());
|
|
|
|
if (WidgetChanged(ui->keepReplayStreamStops))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"KeepReplayBufferStreamStops",
|
|
|
|
ui->keepReplayStreamStops->isChecked());
|
|
|
|
|
2022-01-04 20:45:10 -06:00
|
|
|
if (WidgetChanged(ui->systemTrayEnabled)) {
|
2016-08-13 09:36:17 -05:00
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"SysTrayEnabled",
|
|
|
|
ui->systemTrayEnabled->isChecked());
|
|
|
|
|
2022-01-04 20:45:10 -06:00
|
|
|
main->SystemTray(false);
|
|
|
|
}
|
|
|
|
|
2016-08-13 09:36:17 -05:00
|
|
|
if (WidgetChanged(ui->systemTrayWhenStarted))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"SysTrayWhenStarted",
|
|
|
|
ui->systemTrayWhenStarted->isChecked());
|
2017-01-24 23:01:24 -08:00
|
|
|
|
|
|
|
if (WidgetChanged(ui->systemTrayAlways))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"SysTrayMinimizeToTray",
|
|
|
|
ui->systemTrayAlways->isChecked());
|
2020-07-11 06:05:35 -07:00
|
|
|
|
2016-12-29 09:21:53 -06:00
|
|
|
if (WidgetChanged(ui->saveProjectors))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"SaveProjectors",
|
|
|
|
ui->saveProjectors->isChecked());
|
2017-11-08 23:44:22 -05:00
|
|
|
|
2021-08-06 01:42:29 -05:00
|
|
|
if (WidgetChanged(ui->closeProjectors))
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"CloseExistingProjectors",
|
|
|
|
ui->closeProjectors->isChecked());
|
|
|
|
|
2017-11-08 23:44:22 -05:00
|
|
|
if (WidgetChanged(ui->studioPortraitLayout)) {
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"StudioPortraitLayout",
|
|
|
|
ui->studioPortraitLayout->isChecked());
|
|
|
|
|
|
|
|
main->ResetUI();
|
|
|
|
}
|
2017-12-13 19:42:19 -02:00
|
|
|
|
2019-02-28 15:29:41 -06:00
|
|
|
if (WidgetChanged(ui->prevProgLabelToggle)) {
|
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"StudioModeLabels",
|
|
|
|
ui->prevProgLabelToggle->isChecked());
|
|
|
|
|
|
|
|
main->ResetUI();
|
|
|
|
}
|
|
|
|
|
2018-03-19 23:27:44 -03:00
|
|
|
bool multiviewChanged = false;
|
|
|
|
if (WidgetChanged(ui->multiviewMouseSwitch)) {
|
2018-03-16 18:55:56 -03:00
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"MultiviewMouseSwitch",
|
|
|
|
ui->multiviewMouseSwitch->isChecked());
|
2018-03-19 23:27:44 -03:00
|
|
|
multiviewChanged = true;
|
|
|
|
}
|
2018-03-16 18:55:56 -03:00
|
|
|
|
2018-03-19 23:27:44 -03:00
|
|
|
if (WidgetChanged(ui->multiviewDrawNames)) {
|
2018-03-16 23:00:32 -03:00
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"MultiviewDrawNames",
|
|
|
|
ui->multiviewDrawNames->isChecked());
|
2018-03-19 23:27:44 -03:00
|
|
|
multiviewChanged = true;
|
|
|
|
}
|
2018-03-16 23:00:32 -03:00
|
|
|
|
2018-03-19 23:27:44 -03:00
|
|
|
if (WidgetChanged(ui->multiviewDrawAreas)) {
|
2018-03-18 23:02:27 -03:00
|
|
|
config_set_bool(GetGlobalConfig(), "BasicWindow",
|
|
|
|
"MultiviewDrawAreas",
|
|
|
|
ui->multiviewDrawAreas->isChecked());
|
2018-03-19 23:27:44 -03:00
|
|
|
multiviewChanged = true;
|
|
|
|
}
|
2018-03-18 23:02:27 -03:00
|
|
|
|
2017-12-13 19:42:19 -02:00
|
|
|
if (WidgetChanged(ui->multiviewLayout)) {
|
2018-03-07 06:12:55 -03:00
|
|
|
config_set_int(GetGlobalConfig(), "BasicWindow",
|
2017-12-13 19:42:19 -02:00
|
|
|
"MultiviewLayout",
|
2018-03-07 06:12:55 -03:00
|
|
|
ui->multiviewLayout->currentData().toInt());
|
2018-03-19 23:27:44 -03:00
|
|
|
multiviewChanged = true;
|
|
|
|
}
|
2017-12-13 19:42:19 -02:00
|
|
|
|
2018-03-19 23:27:44 -03:00
|
|
|
if (multiviewChanged)
|
2017-12-13 19:42:19 -02:00
|
|
|
OBSProjector::UpdateMultiviewProjectors();
|
2014-01-26 15:36:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SaveVideoSettings()
|
|
|
|
{
|
|
|
|
QString baseResolution = ui->baseResolution->currentText();
|
|
|
|
QString outputResolution = ui->outputResolution->currentText();
|
|
|
|
int fpsType = ui->fpsType->currentIndex();
|
2014-06-25 02:03:00 -07:00
|
|
|
uint32_t cx = 0, cy = 0;
|
2014-01-26 15:36:15 -07:00
|
|
|
|
|
|
|
/* ------------------- */
|
|
|
|
|
2014-06-23 19:54:20 -07:00
|
|
|
if (WidgetChanged(ui->baseResolution) &&
|
|
|
|
ConvertResText(QT_TO_UTF8(baseResolution), cx, cy)) {
|
2014-03-06 21:08:12 -07:00
|
|
|
config_set_uint(main->Config(), "Video", "BaseCX", cx);
|
|
|
|
config_set_uint(main->Config(), "Video", "BaseCY", cy);
|
2014-01-26 15:36:15 -07:00
|
|
|
}
|
|
|
|
|
2014-06-23 19:54:20 -07:00
|
|
|
if (WidgetChanged(ui->outputResolution) &&
|
|
|
|
ConvertResText(QT_TO_UTF8(outputResolution), cx, cy)) {
|
2014-03-06 21:08:12 -07:00
|
|
|
config_set_uint(main->Config(), "Video", "OutputCX", cx);
|
|
|
|
config_set_uint(main->Config(), "Video", "OutputCY", cy);
|
2014-01-26 15:36:15 -07:00
|
|
|
}
|
|
|
|
|
2014-06-23 19:54:20 -07:00
|
|
|
if (WidgetChanged(ui->fpsType))
|
|
|
|
config_set_uint(main->Config(), "Video", "FPSType", fpsType);
|
|
|
|
|
|
|
|
SaveCombo(ui->fpsCommon, "Video", "FPSCommon");
|
|
|
|
SaveSpinBox(ui->fpsInteger, "Video", "FPSInt");
|
|
|
|
SaveSpinBox(ui->fpsNumerator, "Video", "FPSNum");
|
|
|
|
SaveSpinBox(ui->fpsDenominator, "Video", "FPSDen");
|
2014-12-15 01:08:46 -08:00
|
|
|
SaveComboData(ui->downscaleFilter, "Video", "ScaleType");
|
2015-05-25 01:37:13 -07:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
if (toggleAero) {
|
|
|
|
SaveCheckBox(toggleAero, "Video", "DisableAero");
|
|
|
|
aeroWasDisabled = toggleAero->isChecked();
|
|
|
|
}
|
|
|
|
#endif
|
2015-02-11 12:55:06 -08:00
|
|
|
}
|
2014-02-22 20:14:19 -07:00
|
|
|
|
2015-02-11 12:55:06 -08:00
|
|
|
void OBSBasicSettings::SaveAdvancedSettings()
|
|
|
|
{
|
2017-03-02 12:35:37 -08:00
|
|
|
QString lastMonitoringDevice = config_get_string(
|
|
|
|
main->Config(), "Audio", "MonitoringDeviceId");
|
|
|
|
|
2016-01-25 06:22:00 -08:00
|
|
|
#ifdef _WIN32
|
2016-01-25 05:55:01 -08:00
|
|
|
if (WidgetChanged(ui->renderer))
|
|
|
|
config_set_string(App()->GlobalConfig(), "Video", "Renderer",
|
|
|
|
QT_TO_UTF8(ui->renderer->currentText()));
|
2016-07-01 10:27:27 -07:00
|
|
|
|
|
|
|
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());
|
2017-02-22 02:05:45 +01:00
|
|
|
|
|
|
|
SaveCheckBox(ui->enableNewSocketLoop, "Output", "NewSocketLoopEnable");
|
|
|
|
SaveCheckBox(ui->enableLowLatencyMode, "Output", "LowLatencyEnable");
|
2020-12-11 19:09:57 +01:00
|
|
|
#endif
|
|
|
|
#if defined(_WIN32) || defined(__APPLE__)
|
2018-08-10 06:12:16 -07:00
|
|
|
bool browserHWAccel = ui->browserHWAccel->isChecked();
|
|
|
|
config_set_bool(App()->GlobalConfig(), "General", "BrowserHWAccel",
|
|
|
|
browserHWAccel);
|
2016-01-25 06:22:00 -08:00
|
|
|
#endif
|
2016-01-25 17:09:59 -08:00
|
|
|
|
2019-07-22 01:20:12 -07:00
|
|
|
if (WidgetChanged(ui->hotkeyFocusType)) {
|
|
|
|
QString str = GetComboData(ui->hotkeyFocusType);
|
|
|
|
config_set_string(App()->GlobalConfig(), "General",
|
|
|
|
"HotkeyFocusType", QT_TO_UTF8(str));
|
|
|
|
}
|
2018-05-06 16:48:27 -07:00
|
|
|
|
2016-01-25 17:09:59 -08:00
|
|
|
#ifdef __APPLE__
|
|
|
|
if (WidgetChanged(ui->disableOSXVSync)) {
|
|
|
|
bool disable = ui->disableOSXVSync->isChecked();
|
|
|
|
config_set_bool(App()->GlobalConfig(), "Video",
|
|
|
|
"DisableOSXVSync", disable);
|
|
|
|
EnableOSXVSync(!disable);
|
|
|
|
}
|
|
|
|
if (WidgetChanged(ui->resetOSXVSync))
|
|
|
|
config_set_bool(App()->GlobalConfig(), "Video",
|
|
|
|
"ResetOSXVSyncOnExit",
|
|
|
|
ui->resetOSXVSync->isChecked());
|
|
|
|
#endif
|
|
|
|
|
2022-07-12 12:08:26 +02:00
|
|
|
SaveComboData(ui->colorFormat, "Video", "ColorFormat");
|
2022-01-19 00:51:25 -08:00
|
|
|
SaveComboData(ui->colorSpace, "Video", "ColorSpace");
|
2015-02-11 12:55:06 -08:00
|
|
|
SaveComboData(ui->colorRange, "Video", "ColorRange");
|
2022-02-20 20:31:30 -08:00
|
|
|
SaveSpinBox(ui->sdrWhiteLevel, "Video", "SdrWhiteLevel");
|
2022-04-10 12:31:08 -07:00
|
|
|
SaveSpinBox(ui->hdrNominalPeakLevel, "Video", "HdrNominalPeakLevel");
|
2021-12-21 19:08:14 -08:00
|
|
|
if (obs_audio_monitoring_available()) {
|
2021-08-31 04:53:02 -07:00
|
|
|
SaveCombo(ui->monitoringDevice, "Audio",
|
|
|
|
"MonitoringDeviceName");
|
|
|
|
SaveComboData(ui->monitoringDevice, "Audio",
|
|
|
|
"MonitoringDeviceId");
|
|
|
|
}
|
2017-04-17 22:38:16 +09:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
if (WidgetChanged(ui->disableAudioDucking)) {
|
|
|
|
bool disable = ui->disableAudioDucking->isChecked();
|
|
|
|
config_set_bool(App()->GlobalConfig(), "Audio",
|
|
|
|
"DisableAudioDucking", disable);
|
|
|
|
DisableAudioDucking(disable);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-11-20 12:04:26 +01:00
|
|
|
if (WidgetChanged(ui->confirmOnExit))
|
|
|
|
config_set_bool(GetGlobalConfig(), "General", "ConfirmOnExit",
|
|
|
|
ui->confirmOnExit->isChecked());
|
|
|
|
|
2016-03-25 02:43:38 -07:00
|
|
|
SaveEdit(ui->filenameFormatting, "Output", "FilenameFormatting");
|
2016-12-09 14:42:14 -08:00
|
|
|
SaveEdit(ui->simpleRBPrefix, "SimpleOutput", "RecRBPrefix");
|
|
|
|
SaveEdit(ui->simpleRBSuffix, "SimpleOutput", "RecRBSuffix");
|
2016-03-25 02:43:38 -07:00
|
|
|
SaveCheckBox(ui->overwriteIfExists, "Output", "OverwriteIfExists");
|
2015-09-06 16:12:03 -07:00
|
|
|
SaveCheckBox(ui->streamDelayEnable, "Output", "DelayEnable");
|
|
|
|
SaveSpinBox(ui->streamDelaySec, "Output", "DelaySec");
|
|
|
|
SaveCheckBox(ui->streamDelayPreserve, "Output", "DelayPreserve");
|
2015-09-10 19:10:40 -07:00
|
|
|
SaveCheckBox(ui->reconnectEnable, "Output", "Reconnect");
|
|
|
|
SaveSpinBox(ui->reconnectRetryDelay, "Output", "RetryDelay");
|
|
|
|
SaveSpinBox(ui->reconnectMaxRetries, "Output", "MaxRetries");
|
2016-07-29 08:30:54 -07:00
|
|
|
SaveComboData(ui->bindToIP, "Output", "BindIP");
|
2017-05-08 06:53:35 -05:00
|
|
|
SaveCheckBox(ui->autoRemux, "Video", "AutoRemux");
|
2019-08-15 08:50:09 -07:00
|
|
|
SaveCheckBox(ui->dynBitrate, "Output", "DynamicBitrate");
|
2017-02-05 21:51:50 -08:00
|
|
|
|
2021-12-21 19:08:14 -08:00
|
|
|
if (obs_audio_monitoring_available()) {
|
2021-08-31 04:53:02 -07:00
|
|
|
QString newDevice =
|
|
|
|
ui->monitoringDevice->currentData().toString();
|
2017-03-02 12:35:37 -08:00
|
|
|
|
2021-08-31 04:53:02 -07:00
|
|
|
if (lastMonitoringDevice != newDevice) {
|
|
|
|
obs_set_audio_monitoring_device(
|
|
|
|
QT_TO_UTF8(ui->monitoringDevice->currentText()),
|
|
|
|
QT_TO_UTF8(newDevice));
|
2017-03-02 12:35:37 -08:00
|
|
|
|
2021-08-31 04:53:02 -07:00
|
|
|
blog(LOG_INFO,
|
|
|
|
"Audio monitoring device:\n\tname: %s\n\tid: %s",
|
|
|
|
QT_TO_UTF8(ui->monitoringDevice->currentText()),
|
|
|
|
QT_TO_UTF8(newDevice));
|
|
|
|
}
|
2017-03-02 12:35:37 -08:00
|
|
|
}
|
2014-01-26 15:36:15 -07:00
|
|
|
}
|
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
static inline const char *OutputModeFromIdx(int idx)
|
|
|
|
{
|
|
|
|
if (idx == 1)
|
|
|
|
return "Advanced";
|
|
|
|
else
|
|
|
|
return "Simple";
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline const char *RecTypeFromIdx(int idx)
|
|
|
|
{
|
|
|
|
if (idx == 1)
|
|
|
|
return "FFmpeg";
|
|
|
|
else
|
|
|
|
return "Standard";
|
|
|
|
}
|
|
|
|
|
2021-10-03 19:06:46 +09:00
|
|
|
static inline const char *SplitFileTypeFromIdx(int idx)
|
|
|
|
{
|
|
|
|
if (idx == 1)
|
|
|
|
return "Size";
|
|
|
|
else
|
|
|
|
return "Time";
|
|
|
|
}
|
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
static void WriteJsonData(OBSPropertiesView *view, const char *path)
|
|
|
|
{
|
|
|
|
char full_path[512];
|
|
|
|
|
|
|
|
if (!view || !WidgetChanged(view))
|
|
|
|
return;
|
|
|
|
|
2015-06-23 19:38:01 -07:00
|
|
|
int ret = GetProfilePath(full_path, sizeof(full_path), path);
|
2015-01-26 13:41:22 -08:00
|
|
|
if (ret > 0) {
|
|
|
|
obs_data_t *settings = view->GetSettings();
|
|
|
|
if (settings) {
|
2015-08-21 17:56:37 -07:00
|
|
|
obs_data_save_json_safe(settings, full_path, "tmp",
|
|
|
|
"bak");
|
2015-01-26 13:41:22 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void SaveTrackIndex(config_t *config, const char *section,
|
|
|
|
const char *name, QAbstractButton *check1,
|
|
|
|
QAbstractButton *check2, QAbstractButton *check3,
|
2016-12-21 17:14:24 -08:00
|
|
|
QAbstractButton *check4, QAbstractButton *check5,
|
|
|
|
QAbstractButton *check6)
|
2015-01-26 13:41:22 -08:00
|
|
|
{
|
|
|
|
if (check1->isChecked())
|
|
|
|
config_set_int(config, section, name, 1);
|
|
|
|
else if (check2->isChecked())
|
|
|
|
config_set_int(config, section, name, 2);
|
|
|
|
else if (check3->isChecked())
|
|
|
|
config_set_int(config, section, name, 3);
|
|
|
|
else if (check4->isChecked())
|
|
|
|
config_set_int(config, section, name, 4);
|
2016-12-21 17:14:24 -08:00
|
|
|
else if (check5->isChecked())
|
|
|
|
config_set_int(config, section, name, 5);
|
|
|
|
else if (check6->isChecked())
|
|
|
|
config_set_int(config, section, name, 6);
|
2015-01-26 13:41:22 -08:00
|
|
|
}
|
|
|
|
|
2015-03-28 02:21:16 -05:00
|
|
|
void OBSBasicSettings::SaveFormat(QComboBox *combo)
|
|
|
|
{
|
|
|
|
QVariant v = combo->currentData();
|
|
|
|
if (!v.isNull()) {
|
|
|
|
FormatDesc desc = v.value<FormatDesc>();
|
|
|
|
config_set_string(main->Config(), "AdvOut", "FFFormat",
|
|
|
|
desc.name);
|
|
|
|
config_set_string(main->Config(), "AdvOut", "FFFormatMimeType",
|
|
|
|
desc.mimeType);
|
2015-08-18 20:58:24 -07:00
|
|
|
|
|
|
|
const char *ext = ff_format_desc_extensions(desc.desc);
|
2015-09-16 16:20:17 +02:00
|
|
|
string extStr = ext ? ext : "";
|
2015-08-18 20:58:24 -07:00
|
|
|
|
|
|
|
char *comma = strchr(&extStr[0], ',');
|
|
|
|
if (comma)
|
2017-02-17 20:37:52 +01:00
|
|
|
*comma = 0;
|
2015-08-18 20:58:24 -07:00
|
|
|
|
|
|
|
config_set_string(main->Config(), "AdvOut", "FFExtension",
|
|
|
|
extStr.c_str());
|
2015-03-28 02:21:16 -05:00
|
|
|
} else {
|
|
|
|
config_set_string(main->Config(), "AdvOut", "FFFormat",
|
|
|
|
nullptr);
|
|
|
|
config_set_string(main->Config(), "AdvOut", "FFFormatMimeType",
|
|
|
|
nullptr);
|
2015-08-18 20:58:24 -07:00
|
|
|
|
|
|
|
config_remove_value(main->Config(), "AdvOut", "FFExtension");
|
2015-03-28 02:21:16 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SaveEncoder(QComboBox *combo, const char *section,
|
|
|
|
const char *value)
|
|
|
|
{
|
|
|
|
QVariant v = combo->currentData();
|
|
|
|
CodecDesc cd;
|
|
|
|
if (!v.isNull())
|
|
|
|
cd = v.value<CodecDesc>();
|
|
|
|
config_set_int(main->Config(), section,
|
|
|
|
QT_TO_UTF8(QString("%1Id").arg(value)), cd.id);
|
|
|
|
if (cd.id != 0)
|
|
|
|
config_set_string(main->Config(), section, value, cd.name);
|
|
|
|
else
|
|
|
|
config_set_string(main->Config(), section, value, nullptr);
|
|
|
|
}
|
|
|
|
|
2014-03-10 13:10:35 -07:00
|
|
|
void OBSBasicSettings::SaveOutputSettings()
|
|
|
|
{
|
2015-01-26 13:41:22 -08:00
|
|
|
config_set_string(main->Config(), "Output", "Mode",
|
|
|
|
OutputModeFromIdx(ui->outputMode->currentIndex()));
|
|
|
|
|
2016-04-18 00:56:51 -07:00
|
|
|
QString encoder = ui->simpleOutStrEncoder->currentData().toString();
|
|
|
|
const char *presetType;
|
|
|
|
|
|
|
|
if (encoder == SIMPLE_ENCODER_QSV)
|
|
|
|
presetType = "QSVPreset";
|
2016-04-18 16:12:59 -07:00
|
|
|
else if (encoder == SIMPLE_ENCODER_NVENC)
|
|
|
|
presetType = "NVENCPreset";
|
2022-05-19 07:53:37 +03:00
|
|
|
#ifdef ENABLE_HEVC
|
|
|
|
else if (encoder == SIMPLE_ENCODER_NVENC_HEVC)
|
|
|
|
presetType = "NVENCPreset";
|
|
|
|
#endif
|
2016-09-26 16:29:33 -07:00
|
|
|
else if (encoder == SIMPLE_ENCODER_AMD)
|
|
|
|
presetType = "AMDPreset";
|
2022-06-23 02:46:03 +02:00
|
|
|
else if (encoder == SIMPLE_ENCODER_APPLE_H264)
|
|
|
|
/* The Apple encoders don't have presets like the other encoders
|
|
|
|
do. This only exists to make sure that the x264 preset doesn't
|
|
|
|
get overwritten with empty data. */
|
|
|
|
presetType = "ApplePreset";
|
2016-04-18 00:56:51 -07:00
|
|
|
else
|
|
|
|
presetType = "Preset";
|
|
|
|
|
2014-06-23 19:54:20 -07:00
|
|
|
SaveSpinBox(ui->simpleOutputVBitrate, "SimpleOutput", "VBitrate");
|
2016-04-18 00:56:51 -07:00
|
|
|
SaveComboData(ui->simpleOutStrEncoder, "SimpleOutput", "StreamEncoder");
|
2014-06-23 19:54:20 -07:00
|
|
|
SaveCombo(ui->simpleOutputABitrate, "SimpleOutput", "ABitrate");
|
|
|
|
SaveEdit(ui->simpleOutputPath, "SimpleOutput", "FilePath");
|
2015-11-27 12:14:18 +01:00
|
|
|
SaveCheckBox(ui->simpleNoSpace, "SimpleOutput", "FileNameWithoutSpace");
|
2015-05-29 09:45:54 -07:00
|
|
|
SaveCombo(ui->simpleOutRecFormat, "SimpleOutput", "RecFormat");
|
2014-08-25 07:48:51 -07:00
|
|
|
SaveCheckBox(ui->simpleOutAdvanced, "SimpleOutput", "UseAdvanced");
|
2016-04-18 00:56:51 -07:00
|
|
|
SaveComboData(ui->simpleOutPreset, "SimpleOutput", presetType);
|
2015-01-18 06:29:24 -08:00
|
|
|
SaveEdit(ui->simpleOutCustom, "SimpleOutput", "x264Settings");
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
SaveComboData(ui->simpleOutRecQuality, "SimpleOutput", "RecQuality");
|
|
|
|
SaveComboData(ui->simpleOutRecEncoder, "SimpleOutput", "RecEncoder");
|
2015-11-23 15:36:06 +01:00
|
|
|
SaveEdit(ui->simpleOutMuxCustom, "SimpleOutput", "MuxerCustom");
|
2016-12-07 05:21:44 -08:00
|
|
|
SaveCheckBox(ui->simpleReplayBuf, "SimpleOutput", "RecRB");
|
|
|
|
SaveSpinBox(ui->simpleRBSecMax, "SimpleOutput", "RecRBTime");
|
|
|
|
SaveSpinBox(ui->simpleRBMegsMax, "SimpleOutput", "RecRBSize");
|
2015-02-06 03:56:19 -08:00
|
|
|
|
2016-05-09 05:36:28 -07:00
|
|
|
curAdvStreamEncoder = GetComboData(ui->advOutEncoder);
|
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
SaveComboData(ui->advOutEncoder, "AdvOut", "Encoder");
|
|
|
|
SaveCheckBox(ui->advOutUseRescale, "AdvOut", "Rescale");
|
|
|
|
SaveCombo(ui->advOutRescale, "AdvOut", "RescaleRes");
|
|
|
|
SaveTrackIndex(main->Config(), "AdvOut", "TrackIndex", ui->advOutTrack1,
|
2016-12-21 17:14:24 -08:00
|
|
|
ui->advOutTrack2, ui->advOutTrack3, ui->advOutTrack4,
|
|
|
|
ui->advOutTrack5, ui->advOutTrack6);
|
2015-01-26 13:41:22 -08:00
|
|
|
|
|
|
|
config_set_string(main->Config(), "AdvOut", "RecType",
|
|
|
|
RecTypeFromIdx(ui->advOutRecType->currentIndex()));
|
|
|
|
|
2016-05-09 05:36:28 -07:00
|
|
|
curAdvRecordEncoder = GetComboData(ui->advOutRecEncoder);
|
|
|
|
|
2016-03-19 10:33:22 -07:00
|
|
|
SaveEdit(ui->advOutRecPath, "AdvOut", "RecFilePath");
|
2015-11-27 12:14:18 +01:00
|
|
|
SaveCheckBox(ui->advOutNoSpace, "AdvOut", "RecFileNameWithoutSpace");
|
2015-05-29 09:45:54 -07:00
|
|
|
SaveCombo(ui->advOutRecFormat, "AdvOut", "RecFormat");
|
2015-01-26 13:41:22 -08:00
|
|
|
SaveComboData(ui->advOutRecEncoder, "AdvOut", "RecEncoder");
|
|
|
|
SaveCheckBox(ui->advOutRecUseRescale, "AdvOut", "RecRescale");
|
|
|
|
SaveCombo(ui->advOutRecRescale, "AdvOut", "RecRescaleRes");
|
2015-11-23 15:36:06 +01:00
|
|
|
SaveEdit(ui->advOutMuxCustom, "AdvOut", "RecMuxerCustom");
|
2021-10-03 19:06:46 +09:00
|
|
|
SaveCheckBox(ui->advOutSplitFile, "AdvOut", "RecSplitFile");
|
|
|
|
config_set_string(
|
|
|
|
main->Config(), "AdvOut", "RecSplitFileType",
|
|
|
|
SplitFileTypeFromIdx(ui->advOutSplitFileType->currentIndex()));
|
|
|
|
SaveSpinBox(ui->advOutSplitFileTime, "AdvOut", "RecSplitFileTime");
|
|
|
|
SaveSpinBox(ui->advOutSplitFileSize, "AdvOut", "RecSplitFileSize");
|
2021-12-24 15:59:26 +09:00
|
|
|
SaveCheckBox(ui->advOutSplitFileRstTS, "AdvOut",
|
|
|
|
"RecSplitFileResetTimestamps");
|
2015-05-30 21:45:14 -07:00
|
|
|
|
|
|
|
config_set_int(
|
|
|
|
main->Config(), "AdvOut", "RecTracks",
|
|
|
|
(ui->advOutRecTrack1->isChecked() ? (1 << 0) : 0) |
|
|
|
|
(ui->advOutRecTrack2->isChecked() ? (1 << 1) : 0) |
|
|
|
|
(ui->advOutRecTrack3->isChecked() ? (1 << 2) : 0) |
|
2016-12-21 17:14:24 -08:00
|
|
|
(ui->advOutRecTrack4->isChecked() ? (1 << 3) : 0) |
|
|
|
|
(ui->advOutRecTrack5->isChecked() ? (1 << 4) : 0) |
|
|
|
|
(ui->advOutRecTrack6->isChecked() ? (1 << 5) : 0));
|
2015-01-26 13:41:22 -08:00
|
|
|
|
2019-07-23 07:20:13 -05:00
|
|
|
config_set_int(main->Config(), "AdvOut", "FLVTrack", CurrentFLVTrack());
|
|
|
|
|
2015-08-18 20:58:24 -07:00
|
|
|
config_set_bool(main->Config(), "AdvOut", "FFOutputToFile",
|
|
|
|
ui->advOutFFType->currentIndex() == 0 ? true : false);
|
2016-03-19 10:33:22 -07:00
|
|
|
SaveEdit(ui->advOutFFRecPath, "AdvOut", "FFFilePath");
|
2015-11-27 12:14:18 +01:00
|
|
|
SaveCheckBox(ui->advOutFFNoSpace, "AdvOut", "FFFileNameWithoutSpace");
|
2015-01-26 13:41:22 -08:00
|
|
|
SaveEdit(ui->advOutFFURL, "AdvOut", "FFURL");
|
2015-03-28 02:21:16 -05:00
|
|
|
SaveFormat(ui->advOutFFFormat);
|
2015-09-16 10:26:48 +02:00
|
|
|
SaveEdit(ui->advOutFFMCfg, "AdvOut", "FFMCustom");
|
2015-01-26 13:41:22 -08:00
|
|
|
SaveSpinBox(ui->advOutFFVBitrate, "AdvOut", "FFVBitrate");
|
2017-02-17 17:25:21 +01:00
|
|
|
SaveSpinBox(ui->advOutFFVGOPSize, "AdvOut", "FFVGOPSize");
|
2015-01-26 13:41:22 -08:00
|
|
|
SaveCheckBox(ui->advOutFFUseRescale, "AdvOut", "FFRescale");
|
2017-02-17 18:07:32 +01:00
|
|
|
SaveCheckBox(ui->advOutFFIgnoreCompat, "AdvOut", "FFIgnoreCompat");
|
2015-01-26 13:41:22 -08:00
|
|
|
SaveCombo(ui->advOutFFRescale, "AdvOut", "FFRescaleRes");
|
2015-03-28 02:21:16 -05:00
|
|
|
SaveEncoder(ui->advOutFFVEncoder, "AdvOut", "FFVEncoder");
|
2015-01-26 13:41:22 -08:00
|
|
|
SaveEdit(ui->advOutFFVCfg, "AdvOut", "FFVCustom");
|
|
|
|
SaveSpinBox(ui->advOutFFABitrate, "AdvOut", "FFABitrate");
|
2015-03-28 02:21:16 -05:00
|
|
|
SaveEncoder(ui->advOutFFAEncoder, "AdvOut", "FFAEncoder");
|
2015-01-26 13:41:22 -08:00
|
|
|
SaveEdit(ui->advOutFFACfg, "AdvOut", "FFACustom");
|
2018-10-04 20:06:54 -07:00
|
|
|
config_set_int(
|
|
|
|
main->Config(), "AdvOut", "FFAudioMixes",
|
|
|
|
(ui->advOutFFTrack1->isChecked() ? (1 << 0) : 0) |
|
|
|
|
(ui->advOutFFTrack2->isChecked() ? (1 << 1) : 0) |
|
|
|
|
(ui->advOutFFTrack3->isChecked() ? (1 << 2) : 0) |
|
|
|
|
(ui->advOutFFTrack4->isChecked() ? (1 << 3) : 0) |
|
|
|
|
(ui->advOutFFTrack5->isChecked() ? (1 << 4) : 0) |
|
|
|
|
(ui->advOutFFTrack6->isChecked() ? (1 << 5) : 0));
|
2015-01-26 13:41:22 -08:00
|
|
|
SaveCombo(ui->advOutTrack1Bitrate, "AdvOut", "Track1Bitrate");
|
|
|
|
SaveCombo(ui->advOutTrack2Bitrate, "AdvOut", "Track2Bitrate");
|
|
|
|
SaveCombo(ui->advOutTrack3Bitrate, "AdvOut", "Track3Bitrate");
|
|
|
|
SaveCombo(ui->advOutTrack4Bitrate, "AdvOut", "Track4Bitrate");
|
2016-12-21 17:14:24 -08:00
|
|
|
SaveCombo(ui->advOutTrack5Bitrate, "AdvOut", "Track5Bitrate");
|
|
|
|
SaveCombo(ui->advOutTrack6Bitrate, "AdvOut", "Track6Bitrate");
|
2015-01-26 13:41:22 -08:00
|
|
|
SaveEdit(ui->advOutTrack1Name, "AdvOut", "Track1Name");
|
|
|
|
SaveEdit(ui->advOutTrack2Name, "AdvOut", "Track2Name");
|
|
|
|
SaveEdit(ui->advOutTrack3Name, "AdvOut", "Track3Name");
|
|
|
|
SaveEdit(ui->advOutTrack4Name, "AdvOut", "Track4Name");
|
2016-12-21 17:14:24 -08:00
|
|
|
SaveEdit(ui->advOutTrack5Name, "AdvOut", "Track5Name");
|
|
|
|
SaveEdit(ui->advOutTrack6Name, "AdvOut", "Track6Name");
|
2015-01-26 13:41:22 -08:00
|
|
|
|
2020-11-01 01:54:27 -08:00
|
|
|
if (vodTrackCheckbox) {
|
2020-11-14 08:05:52 -08:00
|
|
|
SaveCheckBox(simpleVodTrack, "SimpleOutput", "VodTrackEnabled");
|
2020-11-01 01:54:27 -08:00
|
|
|
SaveCheckBox(vodTrackCheckbox, "AdvOut", "VodTrackEnabled");
|
|
|
|
SaveTrackIndex(main->Config(), "AdvOut", "VodTrackIndex",
|
|
|
|
vodTrack[0], vodTrack[1], vodTrack[2],
|
|
|
|
vodTrack[3], vodTrack[4], vodTrack[5]);
|
|
|
|
}
|
|
|
|
|
2017-09-05 20:01:49 -04:00
|
|
|
SaveCheckBox(ui->advReplayBuf, "AdvOut", "RecRB");
|
|
|
|
SaveSpinBox(ui->advRBSecMax, "AdvOut", "RecRBTime");
|
|
|
|
SaveSpinBox(ui->advRBMegsMax, "AdvOut", "RecRBSize");
|
|
|
|
|
2015-06-23 19:38:01 -07:00
|
|
|
WriteJsonData(streamEncoderProps, "streamEncoder.json");
|
|
|
|
WriteJsonData(recordEncoderProps, "recordEncoder.json");
|
2015-01-26 13:41:22 -08:00
|
|
|
main->ResetOutputs();
|
2014-03-07 12:56:31 -07:00
|
|
|
}
|
|
|
|
|
2014-02-23 16:27:19 -07:00
|
|
|
void OBSBasicSettings::SaveAudioSettings()
|
|
|
|
{
|
2014-03-07 12:56:31 -07:00
|
|
|
QString sampleRateStr = ui->sampleRate->currentText();
|
|
|
|
int channelSetupIdx = ui->channelSetup->currentIndex();
|
2014-02-23 16:27:19 -07:00
|
|
|
|
libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)
Adds surround sound audio support to the core, core plugins, and user
interface.
Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
(due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST: stereo plugins keep in general only the first two channels.
surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
(not implemented due to lack of usefulness)
Closes jp9000/obs-studio#968
2017-05-27 02:15:54 +02:00
|
|
|
const char *channelSetup;
|
|
|
|
switch (channelSetupIdx) {
|
|
|
|
case 0:
|
|
|
|
channelSetup = "Mono";
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
channelSetup = "Stereo";
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
channelSetup = "2.1";
|
|
|
|
break;
|
|
|
|
case 3:
|
2017-12-01 17:10:05 +01:00
|
|
|
channelSetup = "4.0";
|
libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)
Adds surround sound audio support to the core, core plugins, and user
interface.
Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
(due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST: stereo plugins keep in general only the first two channels.
surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
(not implemented due to lack of usefulness)
Closes jp9000/obs-studio#968
2017-05-27 02:15:54 +02:00
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
channelSetup = "4.1";
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
channelSetup = "5.1";
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
channelSetup = "7.1";
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
channelSetup = "Stereo";
|
|
|
|
break;
|
|
|
|
}
|
2014-02-23 16:27:19 -07:00
|
|
|
|
|
|
|
int sampleRate = 44100;
|
2019-10-19 19:05:00 +11:00
|
|
|
if (sampleRateStr == "48 kHz")
|
2014-02-23 16:27:19 -07:00
|
|
|
sampleRate = 48000;
|
|
|
|
|
2014-06-23 19:54:20 -07:00
|
|
|
if (WidgetChanged(ui->sampleRate))
|
|
|
|
config_set_uint(main->Config(), "Audio", "SampleRate",
|
|
|
|
sampleRate);
|
|
|
|
|
|
|
|
if (WidgetChanged(ui->channelSetup))
|
|
|
|
config_set_string(main->Config(), "Audio", "ChannelSetup",
|
|
|
|
channelSetup);
|
|
|
|
|
2018-01-09 18:45:20 -02:00
|
|
|
if (WidgetChanged(ui->meterDecayRate)) {
|
|
|
|
double meterDecayRate;
|
|
|
|
switch (ui->meterDecayRate->currentIndex()) {
|
|
|
|
case 0:
|
|
|
|
meterDecayRate = VOLUME_METER_DECAY_FAST;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
meterDecayRate = VOLUME_METER_DECAY_MEDIUM;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
meterDecayRate = VOLUME_METER_DECAY_SLOW;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
meterDecayRate = VOLUME_METER_DECAY_FAST;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
config_set_double(main->Config(), "Audio", "MeterDecayRate",
|
|
|
|
meterDecayRate);
|
|
|
|
|
|
|
|
main->UpdateVolumeControlsDecayRate();
|
|
|
|
}
|
|
|
|
|
2018-01-19 22:57:36 +01:00
|
|
|
if (WidgetChanged(ui->peakMeterType)) {
|
|
|
|
uint32_t peakMeterTypeIdx = ui->peakMeterType->currentIndex();
|
|
|
|
config_set_uint(main->Config(), "Audio", "PeakMeterType",
|
|
|
|
peakMeterTypeIdx);
|
|
|
|
|
|
|
|
main->UpdateVolumeControlsPeakMeterType();
|
|
|
|
}
|
|
|
|
|
2015-05-01 07:07:42 +02:00
|
|
|
for (auto &audioSource : audioSources) {
|
|
|
|
auto source = OBSGetStrongRef(get<0>(audioSource));
|
|
|
|
if (!source)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
auto &ptmCB = get<1>(audioSource);
|
|
|
|
auto &ptmSB = get<2>(audioSource);
|
|
|
|
auto &pttCB = get<3>(audioSource);
|
|
|
|
auto &pttSB = get<4>(audioSource);
|
|
|
|
|
|
|
|
obs_source_enable_push_to_mute(source, ptmCB->isChecked());
|
|
|
|
obs_source_set_push_to_mute_delay(source, ptmSB->value());
|
|
|
|
|
|
|
|
obs_source_enable_push_to_talk(source, pttCB->isChecked());
|
|
|
|
obs_source_set_push_to_talk_delay(source, pttSB->value());
|
|
|
|
}
|
|
|
|
|
2015-06-23 18:47:22 -07:00
|
|
|
auto UpdateAudioDevice = [this](bool input, QComboBox *combo,
|
|
|
|
const char *name, int index) {
|
|
|
|
main->ResetAudioDevice(input ? App()->InputAudioSource()
|
|
|
|
: App()->OutputAudioSource(),
|
|
|
|
QT_TO_UTF8(GetComboData(combo)),
|
|
|
|
Str(name), index);
|
|
|
|
};
|
|
|
|
|
|
|
|
UpdateAudioDevice(false, ui->desktopAudioDevice1,
|
|
|
|
"Basic.DesktopDevice1", 1);
|
|
|
|
UpdateAudioDevice(false, ui->desktopAudioDevice2,
|
|
|
|
"Basic.DesktopDevice2", 2);
|
|
|
|
UpdateAudioDevice(true, ui->auxAudioDevice1, "Basic.AuxDevice1", 3);
|
|
|
|
UpdateAudioDevice(true, ui->auxAudioDevice2, "Basic.AuxDevice2", 4);
|
|
|
|
UpdateAudioDevice(true, ui->auxAudioDevice3, "Basic.AuxDevice3", 5);
|
2018-06-26 20:41:32 +02:00
|
|
|
UpdateAudioDevice(true, ui->auxAudioDevice4, "Basic.AuxDevice4", 6);
|
2015-06-23 18:47:22 -07:00
|
|
|
main->SaveProject();
|
2014-02-23 16:27:19 -07:00
|
|
|
}
|
|
|
|
|
2014-11-01 21:50:36 +01:00
|
|
|
void OBSBasicSettings::SaveHotkeySettings()
|
|
|
|
{
|
|
|
|
const auto &config = main->Config();
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
std::vector<obs_key_combination> combinations;
|
|
|
|
for (auto &hotkey : hotkeys) {
|
|
|
|
auto &hw = *hotkey.second;
|
|
|
|
if (!hw.Changed())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
hw.Save(combinations);
|
|
|
|
|
|
|
|
if (!hotkey.first)
|
|
|
|
continue;
|
|
|
|
|
2021-11-26 22:25:39 +13:00
|
|
|
OBSDataArrayAutoRelease array = obs_hotkey_save(hw.id);
|
|
|
|
OBSDataAutoRelease data = obs_data_create();
|
2014-11-01 21:50:36 +01:00
|
|
|
obs_data_set_array(data, "bindings", array);
|
|
|
|
const char *json = obs_data_get_json(data);
|
|
|
|
config_set_string(config, "Hotkeys", hw.name.c_str(), json);
|
|
|
|
}
|
2016-12-07 05:21:44 -08:00
|
|
|
|
2016-12-09 14:40:04 -08:00
|
|
|
if (!main->outputHandler || !main->outputHandler->replayBuffer)
|
|
|
|
return;
|
|
|
|
|
|
|
|
const char *id = obs_obj_get_id(main->outputHandler->replayBuffer);
|
2016-12-07 05:21:44 -08:00
|
|
|
if (strcmp(id, "replay_buffer") == 0) {
|
2021-11-26 22:25:39 +13:00
|
|
|
OBSDataAutoRelease hotkeys = obs_hotkeys_save_output(
|
2016-12-09 14:40:04 -08:00
|
|
|
main->outputHandler->replayBuffer);
|
2016-12-07 05:21:44 -08:00
|
|
|
config_set_string(config, "Hotkeys", "ReplayBuffer",
|
|
|
|
obs_data_get_json(hotkeys));
|
|
|
|
}
|
2014-11-01 21:50:36 +01:00
|
|
|
}
|
|
|
|
|
2015-07-05 23:53:13 -07:00
|
|
|
#define MINOR_SEPARATOR "------------------------------------------------"
|
|
|
|
|
|
|
|
static void AddChangedVal(std::string &changed, const char *str)
|
|
|
|
{
|
|
|
|
if (changed.size())
|
|
|
|
changed += ", ";
|
|
|
|
changed += str;
|
|
|
|
}
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
void OBSBasicSettings::SaveSettings()
|
|
|
|
{
|
|
|
|
if (generalChanged)
|
|
|
|
SaveGeneralSettings();
|
2015-02-07 08:09:57 -08:00
|
|
|
if (stream1Changed)
|
|
|
|
SaveStream1Settings();
|
2014-03-10 13:10:35 -07:00
|
|
|
if (outputsChanged)
|
|
|
|
SaveOutputSettings();
|
2014-02-23 16:27:19 -07:00
|
|
|
if (audioChanged)
|
|
|
|
SaveAudioSettings();
|
2014-01-26 15:36:15 -07:00
|
|
|
if (videoChanged)
|
|
|
|
SaveVideoSettings();
|
2014-11-01 21:50:36 +01:00
|
|
|
if (hotkeysChanged)
|
|
|
|
SaveHotkeySettings();
|
2015-02-11 12:55:06 -08:00
|
|
|
if (advancedChanged)
|
|
|
|
SaveAdvancedSettings();
|
|
|
|
|
|
|
|
if (videoChanged || advancedChanged)
|
|
|
|
main->ResetVideo();
|
2014-01-26 15:36:15 -07:00
|
|
|
|
2015-08-21 17:56:37 -07:00
|
|
|
config_save_safe(main->Config(), "tmp", nullptr);
|
|
|
|
config_save_safe(GetGlobalConfig(), "tmp", nullptr);
|
2015-06-30 05:49:31 -07:00
|
|
|
main->SaveProject();
|
2015-07-05 23:53:13 -07:00
|
|
|
|
|
|
|
if (Changed()) {
|
|
|
|
std::string changed;
|
|
|
|
if (generalChanged)
|
|
|
|
AddChangedVal(changed, "general");
|
|
|
|
if (stream1Changed)
|
|
|
|
AddChangedVal(changed, "stream 1");
|
|
|
|
if (outputsChanged)
|
|
|
|
AddChangedVal(changed, "outputs");
|
|
|
|
if (audioChanged)
|
|
|
|
AddChangedVal(changed, "audio");
|
|
|
|
if (videoChanged)
|
|
|
|
AddChangedVal(changed, "video");
|
|
|
|
if (hotkeysChanged)
|
|
|
|
AddChangedVal(changed, "hotkeys");
|
|
|
|
if (advancedChanged)
|
|
|
|
AddChangedVal(changed, "advanced");
|
|
|
|
|
|
|
|
blog(LOG_INFO, "Settings changed (%s)", changed.c_str());
|
|
|
|
blog(LOG_INFO, MINOR_SEPARATOR);
|
|
|
|
}
|
2020-02-16 15:15:33 -06:00
|
|
|
|
|
|
|
bool langChanged = (ui->language->currentIndex() != prevLangIndex);
|
|
|
|
bool audioRestart = (ui->channelSetup->currentIndex() != channelIndex ||
|
|
|
|
ui->sampleRate->currentIndex() != sampleRateIndex);
|
2020-03-18 21:47:23 +11:00
|
|
|
bool browserHWAccelChanged =
|
2020-03-19 20:36:55 -07:00
|
|
|
(ui->browserHWAccel &&
|
|
|
|
ui->browserHWAccel->isChecked() != prevBrowserAccel);
|
2020-02-16 15:15:33 -06:00
|
|
|
|
2020-03-18 21:47:23 +11:00
|
|
|
if (langChanged || audioRestart || browserHWAccelChanged)
|
2020-02-16 15:15:33 -06:00
|
|
|
restart = true;
|
|
|
|
else
|
|
|
|
restart = false;
|
2014-01-26 15:36:15 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
bool OBSBasicSettings::QueryChanges()
|
|
|
|
{
|
|
|
|
QMessageBox::StandardButton button;
|
|
|
|
|
2017-05-13 14:06:32 -07:00
|
|
|
button = OBSMessageBox::question(
|
2014-05-10 18:47:48 -07:00
|
|
|
this, QTStr("Basic.Settings.ConfirmTitle"),
|
|
|
|
QTStr("Basic.Settings.Confirm"),
|
2014-01-26 15:36:15 -07:00
|
|
|
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
|
|
|
|
|
2015-05-25 01:37:13 -07:00
|
|
|
if (button == QMessageBox::Cancel) {
|
2014-01-26 15:36:15 -07:00
|
|
|
return false;
|
2015-05-25 01:37:13 -07:00
|
|
|
} else if (button == QMessageBox::Yes) {
|
2014-01-26 15:36:15 -07:00
|
|
|
SaveSettings();
|
2015-05-25 01:37:13 -07:00
|
|
|
} else {
|
2020-05-12 10:10:58 -07:00
|
|
|
if (savedTheme != App()->GetTheme())
|
|
|
|
App()->SetTheme(savedTheme);
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
LoadSettings(true);
|
2015-05-25 01:37:13 -07:00
|
|
|
#ifdef _WIN32
|
|
|
|
if (toggleAero)
|
|
|
|
SetAeroEnabled(!aeroWasDisabled);
|
|
|
|
#endif
|
2020-02-16 15:15:33 -06:00
|
|
|
restart = false;
|
2015-05-25 01:37:13 -07:00
|
|
|
}
|
2014-01-26 15:36:15 -07:00
|
|
|
|
|
|
|
ClearChanged();
|
|
|
|
return true;
|
2013-12-11 21:50:10 -07:00
|
|
|
}
|
|
|
|
|
2014-01-24 21:19:50 -07:00
|
|
|
void OBSBasicSettings::closeEvent(QCloseEvent *event)
|
2013-12-11 21:50:10 -07:00
|
|
|
{
|
2020-05-12 00:08:08 +02:00
|
|
|
if (!AskIfCanCloseSettings())
|
2014-01-26 15:36:15 -07:00
|
|
|
event->ignore();
|
2020-05-12 00:08:08 +02:00
|
|
|
}
|
2019-10-10 03:29:09 +02:00
|
|
|
|
2020-05-12 00:08:08 +02:00
|
|
|
void OBSBasicSettings::reject()
|
|
|
|
{
|
|
|
|
if (AskIfCanCloseSettings())
|
|
|
|
close();
|
2013-12-17 13:56:58 -07:00
|
|
|
}
|
|
|
|
|
2015-02-17 02:45:34 -05:00
|
|
|
void OBSBasicSettings::on_theme_activated(int idx)
|
|
|
|
{
|
2019-03-29 04:16:12 -05:00
|
|
|
QString currT = ui->theme->itemText(idx);
|
|
|
|
|
|
|
|
QString defaultTheme;
|
|
|
|
defaultTheme += DEFAULT_THEME;
|
|
|
|
defaultTheme += " ";
|
|
|
|
defaultTheme += QTStr("Default");
|
|
|
|
|
|
|
|
if (currT == defaultTheme)
|
|
|
|
currT = DEFAULT_THEME;
|
|
|
|
|
2019-12-08 14:43:23 -08:00
|
|
|
App()->SetTheme(currT.toUtf8().constData());
|
2015-02-17 02:45:34 -05:00
|
|
|
}
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
void OBSBasicSettings::on_listWidget_itemSelectionChanged()
|
2013-12-17 13:56:58 -07:00
|
|
|
{
|
2014-01-26 15:36:15 -07:00
|
|
|
int row = ui->listWidget->currentRow();
|
|
|
|
|
|
|
|
if (loading || row == pageIndex)
|
|
|
|
return;
|
|
|
|
|
|
|
|
pageIndex = row;
|
2013-12-17 13:56:58 -07:00
|
|
|
}
|
|
|
|
|
2014-01-24 21:19:50 -07:00
|
|
|
void OBSBasicSettings::on_buttonBox_clicked(QAbstractButton *button)
|
2013-12-17 13:56:58 -07:00
|
|
|
{
|
2014-01-26 15:36:15 -07:00
|
|
|
QDialogButtonBox::ButtonRole val = ui->buttonBox->buttonRole(button);
|
|
|
|
|
|
|
|
if (val == QDialogButtonBox::ApplyRole ||
|
|
|
|
val == QDialogButtonBox::AcceptRole) {
|
|
|
|
SaveSettings();
|
|
|
|
ClearChanged();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (val == QDialogButtonBox::AcceptRole ||
|
|
|
|
val == QDialogButtonBox::RejectRole) {
|
2015-07-07 23:51:27 -07:00
|
|
|
if (val == QDialogButtonBox::RejectRole) {
|
2019-12-07 10:20:57 -08:00
|
|
|
if (savedTheme != App()->GetTheme())
|
|
|
|
App()->SetTheme(savedTheme);
|
2015-07-07 23:51:27 -07:00
|
|
|
#ifdef _WIN32
|
|
|
|
if (toggleAero)
|
|
|
|
SetAeroEnabled(!aeroWasDisabled);
|
|
|
|
#endif
|
|
|
|
}
|
2014-01-26 15:36:15 -07:00
|
|
|
ClearChanged();
|
|
|
|
close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-05-20 23:27:27 -07:00
|
|
|
void OBSBasicSettings::on_simpleOutputBrowse_clicked()
|
|
|
|
{
|
2020-07-17 06:32:38 -05:00
|
|
|
QString dir = SelectDirectory(
|
2015-01-26 13:41:22 -08:00
|
|
|
this, QTStr("Basic.Settings.Output.SelectDirectory"),
|
2020-07-17 06:32:38 -05:00
|
|
|
ui->simpleOutputPath->text());
|
2014-05-20 23:27:27 -07:00
|
|
|
if (dir.isEmpty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
ui->simpleOutputPath->setText(dir);
|
|
|
|
}
|
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
void OBSBasicSettings::on_advOutRecPathBrowse_clicked()
|
|
|
|
{
|
2020-07-17 06:32:38 -05:00
|
|
|
QString dir = SelectDirectory(
|
2015-01-26 13:41:22 -08:00
|
|
|
this, QTStr("Basic.Settings.Output.SelectDirectory"),
|
2020-07-17 06:32:38 -05:00
|
|
|
ui->advOutRecPath->text());
|
2015-01-26 13:41:22 -08:00
|
|
|
if (dir.isEmpty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
ui->advOutRecPath->setText(dir);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::on_advOutFFPathBrowse_clicked()
|
|
|
|
{
|
2020-07-17 06:32:38 -05:00
|
|
|
QString dir = SelectDirectory(
|
2015-08-18 20:58:24 -07:00
|
|
|
this, QTStr("Basic.Settings.Output.SelectDirectory"),
|
2020-07-17 06:32:38 -05:00
|
|
|
ui->advOutRecPath->text());
|
2015-08-18 20:58:24 -07:00
|
|
|
if (dir.isEmpty())
|
2015-01-26 13:41:22 -08:00
|
|
|
return;
|
|
|
|
|
2015-08-18 20:58:24 -07:00
|
|
|
ui->advOutFFRecPath->setText(dir);
|
2015-01-26 13:41:22 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::on_advOutEncoder_currentIndexChanged(int idx)
|
|
|
|
{
|
|
|
|
QString encoder = GetComboData(ui->advOutEncoder);
|
2019-02-05 18:09:00 -08:00
|
|
|
if (!loading) {
|
|
|
|
bool loadSettings = encoder == curAdvStreamEncoder;
|
2015-01-26 13:41:22 -08:00
|
|
|
|
2019-02-05 18:09:00 -08:00
|
|
|
delete streamEncoderProps;
|
|
|
|
streamEncoderProps = CreateEncoderPropertyView(
|
|
|
|
QT_TO_UTF8(encoder),
|
|
|
|
loadSettings ? "streamEncoder.json" : nullptr, true);
|
|
|
|
ui->advOutputStreamTab->layout()->addWidget(streamEncoderProps);
|
|
|
|
}
|
|
|
|
|
2020-02-18 21:00:57 -08:00
|
|
|
ui->advOutUseRescale->setVisible(true);
|
|
|
|
ui->advOutRescale->setVisible(true);
|
2015-01-26 13:41:22 -08:00
|
|
|
|
|
|
|
UNUSED_PARAMETER(idx);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::on_advOutRecEncoder_currentIndexChanged(int idx)
|
|
|
|
{
|
2019-02-05 18:09:00 -08:00
|
|
|
if (!loading) {
|
|
|
|
delete recordEncoderProps;
|
|
|
|
recordEncoderProps = nullptr;
|
|
|
|
}
|
2015-01-26 13:41:22 -08:00
|
|
|
|
2019-02-05 18:09:00 -08:00
|
|
|
if (idx <= 0) {
|
2019-02-11 17:10:41 -08:00
|
|
|
ui->advOutRecUseRescale->setChecked(false);
|
2019-02-15 16:19:21 -08:00
|
|
|
ui->advOutRecUseRescale->setVisible(false);
|
|
|
|
ui->advOutRecRescaleContainer->setVisible(false);
|
2019-02-05 18:09:00 -08:00
|
|
|
return;
|
|
|
|
}
|
2015-01-26 13:41:22 -08:00
|
|
|
|
2019-02-05 18:09:00 -08:00
|
|
|
QString encoder = GetComboData(ui->advOutRecEncoder);
|
|
|
|
bool loadSettings = encoder == curAdvRecordEncoder;
|
2015-01-26 13:41:22 -08:00
|
|
|
|
2019-02-05 18:09:00 -08:00
|
|
|
if (!loading) {
|
2015-01-26 13:41:22 -08:00
|
|
|
recordEncoderProps = CreateEncoderPropertyView(
|
|
|
|
QT_TO_UTF8(encoder),
|
2016-05-09 05:36:28 -07:00
|
|
|
loadSettings ? "recordEncoder.json" : nullptr, true);
|
2015-01-26 13:41:22 -08:00
|
|
|
ui->advOutRecStandard->layout()->addWidget(recordEncoderProps);
|
2017-09-05 20:01:49 -04:00
|
|
|
connect(recordEncoderProps, SIGNAL(Changed()), this,
|
|
|
|
SLOT(AdvReplayBufferChanged()));
|
2015-01-26 13:41:22 -08:00
|
|
|
}
|
2019-02-05 18:09:00 -08:00
|
|
|
|
2020-02-18 21:00:57 -08:00
|
|
|
ui->advOutRecUseRescale->setVisible(true);
|
|
|
|
ui->advOutRecRescaleContainer->setVisible(true);
|
2015-01-26 13:41:22 -08:00
|
|
|
}
|
|
|
|
|
2017-02-17 18:07:32 +01:00
|
|
|
void OBSBasicSettings::on_advOutFFIgnoreCompat_stateChanged(int)
|
|
|
|
{
|
|
|
|
/* Little hack to reload codecs when checked */
|
|
|
|
on_advOutFFFormat_currentIndexChanged(
|
|
|
|
ui->advOutFFFormat->currentIndex());
|
|
|
|
}
|
|
|
|
|
2015-03-28 02:21:16 -05:00
|
|
|
#define DEFAULT_CONTAINER_STR \
|
|
|
|
QTStr("Basic.Settings.Output.Adv.FFmpeg.FormatDescDef")
|
|
|
|
|
|
|
|
void OBSBasicSettings::on_advOutFFFormat_currentIndexChanged(int idx)
|
|
|
|
{
|
|
|
|
const QVariant itemDataVariant = ui->advOutFFFormat->itemData(idx);
|
|
|
|
|
|
|
|
if (!itemDataVariant.isNull()) {
|
|
|
|
FormatDesc desc = itemDataVariant.value<FormatDesc>();
|
|
|
|
SetAdvOutputFFmpegEnablement(
|
|
|
|
FF_CODEC_AUDIO, ff_format_desc_has_audio(desc.desc),
|
|
|
|
false);
|
|
|
|
SetAdvOutputFFmpegEnablement(
|
|
|
|
FF_CODEC_VIDEO, ff_format_desc_has_video(desc.desc),
|
|
|
|
false);
|
|
|
|
ReloadCodecs(desc.desc);
|
|
|
|
ui->advOutFFFormatDesc->setText(
|
|
|
|
ff_format_desc_long_name(desc.desc));
|
|
|
|
|
|
|
|
CodecDesc defaultAudioCodecDesc =
|
|
|
|
GetDefaultCodecDesc(desc.desc, FF_CODEC_AUDIO);
|
|
|
|
CodecDesc defaultVideoCodecDesc =
|
|
|
|
GetDefaultCodecDesc(desc.desc, FF_CODEC_VIDEO);
|
|
|
|
SelectEncoder(ui->advOutFFAEncoder, defaultAudioCodecDesc.name,
|
|
|
|
defaultAudioCodecDesc.id);
|
|
|
|
SelectEncoder(ui->advOutFFVEncoder, defaultVideoCodecDesc.name,
|
|
|
|
defaultVideoCodecDesc.id);
|
|
|
|
} else {
|
|
|
|
ReloadCodecs(nullptr);
|
|
|
|
ui->advOutFFFormatDesc->setText(DEFAULT_CONTAINER_STR);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::on_advOutFFAEncoder_currentIndexChanged(int idx)
|
|
|
|
{
|
|
|
|
const QVariant itemDataVariant = ui->advOutFFAEncoder->itemData(idx);
|
|
|
|
if (!itemDataVariant.isNull()) {
|
|
|
|
CodecDesc desc = itemDataVariant.value<CodecDesc>();
|
|
|
|
SetAdvOutputFFmpegEnablement(
|
|
|
|
FF_CODEC_AUDIO, desc.id != 0 || desc.name != nullptr,
|
|
|
|
true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::on_advOutFFVEncoder_currentIndexChanged(int idx)
|
|
|
|
{
|
|
|
|
const QVariant itemDataVariant = ui->advOutFFVEncoder->itemData(idx);
|
|
|
|
if (!itemDataVariant.isNull()) {
|
|
|
|
CodecDesc desc = itemDataVariant.value<CodecDesc>();
|
|
|
|
SetAdvOutputFFmpegEnablement(
|
|
|
|
FF_CODEC_VIDEO, desc.id != 0 || desc.name != nullptr,
|
|
|
|
true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-27 12:14:18 +01:00
|
|
|
void OBSBasicSettings::on_advOutFFType_currentIndexChanged(int idx)
|
|
|
|
{
|
|
|
|
ui->advOutFFNoSpace->setHidden(idx != 0);
|
|
|
|
}
|
|
|
|
|
2022-01-19 00:51:25 -08:00
|
|
|
void OBSBasicSettings::on_colorFormat_currentIndexChanged(const QString &)
|
2015-04-17 23:40:35 -07:00
|
|
|
{
|
2022-01-19 00:51:25 -08:00
|
|
|
UpdateColorFormatSpaceWarning();
|
|
|
|
}
|
2015-04-17 23:40:35 -07:00
|
|
|
|
2022-01-19 00:51:25 -08:00
|
|
|
void OBSBasicSettings::on_colorSpace_currentIndexChanged(const QString &)
|
|
|
|
{
|
|
|
|
UpdateColorFormatSpaceWarning();
|
2015-04-17 23:40:35 -07:00
|
|
|
}
|
|
|
|
|
2014-05-10 18:47:48 -07:00
|
|
|
#define INVALID_RES_STR "Basic.Settings.Video.InvalidResolution"
|
|
|
|
|
2014-01-26 15:36:15 -07:00
|
|
|
static bool ValidResolutions(Ui::OBSBasicSettings *ui)
|
|
|
|
{
|
|
|
|
QString baseRes = ui->baseResolution->lineEdit()->text();
|
|
|
|
uint32_t cx, cy;
|
|
|
|
|
2020-11-13 09:21:24 -08:00
|
|
|
if (!ConvertResText(QT_TO_UTF8(baseRes), cx, cy)) {
|
2014-05-10 18:47:48 -07:00
|
|
|
ui->videoMsg->setText(QTStr(INVALID_RES_STR));
|
2014-01-26 15:36:15 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-11-13 09:21:24 -08:00
|
|
|
bool lockedOutRes = !ui->outputResolution->isEditable();
|
|
|
|
if (!lockedOutRes) {
|
|
|
|
QString outRes = ui->outputResolution->lineEdit()->text();
|
|
|
|
if (!ConvertResText(QT_TO_UTF8(outRes), cx, cy)) {
|
|
|
|
ui->videoMsg->setText(QTStr(INVALID_RES_STR));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-22 20:14:19 -07:00
|
|
|
ui->videoMsg->setText("");
|
2014-01-26 15:36:15 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-01-25 05:25:16 -08:00
|
|
|
void OBSBasicSettings::RecalcOutputResPixels(const char *resText)
|
|
|
|
{
|
|
|
|
uint32_t newCX;
|
|
|
|
uint32_t newCY;
|
|
|
|
|
|
|
|
ConvertResText(resText, newCX, newCY);
|
|
|
|
if (newCX && newCY) {
|
|
|
|
outputCX = newCX;
|
|
|
|
outputCY = newCY;
|
2020-01-09 00:03:22 -06:00
|
|
|
|
|
|
|
std::tuple<int, int> aspect = aspect_ratio(outputCX, outputCY);
|
|
|
|
|
|
|
|
ui->scaledAspect->setText(
|
|
|
|
QTStr("AspectRatio")
|
|
|
|
.arg(QString::number(std::get<0>(aspect)),
|
|
|
|
QString::number(std::get<1>(aspect))));
|
2016-01-25 05:25:16 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-12 00:08:08 +02:00
|
|
|
bool OBSBasicSettings::AskIfCanCloseSettings()
|
|
|
|
{
|
|
|
|
bool canCloseSettings = false;
|
|
|
|
|
|
|
|
if (!Changed() || QueryChanges())
|
|
|
|
canCloseSettings = true;
|
|
|
|
|
|
|
|
if (forceAuthReload) {
|
|
|
|
main->auth->Save();
|
|
|
|
main->auth->Load();
|
|
|
|
forceAuthReload = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return canCloseSettings;
|
|
|
|
}
|
|
|
|
|
2016-03-25 02:43:38 -07:00
|
|
|
void OBSBasicSettings::on_filenameFormatting_textEdited(const QString &text)
|
|
|
|
{
|
2022-01-16 18:33:10 +01:00
|
|
|
QString safeStr = text;
|
|
|
|
|
2016-03-25 02:43:38 -07:00
|
|
|
#ifdef __APPLE__
|
2022-01-16 18:33:10 +01:00
|
|
|
safeStr.replace(QRegularExpression("[:]"), "");
|
|
|
|
#elif defined(_WIN32)
|
|
|
|
safeStr.replace(QRegularExpression("[<>:\"\\|\\?\\*]"), "");
|
2016-03-25 02:43:38 -07:00
|
|
|
#else
|
2022-01-16 18:33:10 +01:00
|
|
|
// TODO: Add filtering for other platforms
|
2016-03-25 02:43:38 -07:00
|
|
|
#endif
|
|
|
|
|
2022-01-16 18:33:10 +01:00
|
|
|
if (text != safeStr)
|
|
|
|
ui->filenameFormatting->setText(safeStr);
|
2016-03-25 02:43:38 -07:00
|
|
|
}
|
|
|
|
|
2016-01-25 05:25:16 -08:00
|
|
|
void OBSBasicSettings::on_outputResolution_editTextChanged(const QString &text)
|
|
|
|
{
|
2021-10-12 01:22:04 +02:00
|
|
|
if (!loading) {
|
2016-01-25 05:25:16 -08:00
|
|
|
RecalcOutputResPixels(QT_TO_UTF8(text));
|
2021-10-12 01:22:04 +02:00
|
|
|
LoadDownscaleFilters();
|
|
|
|
}
|
2016-01-25 05:25:16 -08:00
|
|
|
}
|
|
|
|
|
2014-03-07 12:56:31 -07:00
|
|
|
void OBSBasicSettings::on_baseResolution_editTextChanged(const QString &text)
|
2014-01-26 15:36:15 -07:00
|
|
|
{
|
2014-03-07 12:56:31 -07:00
|
|
|
if (!loading && ValidResolutions(ui.get())) {
|
2014-03-10 14:00:53 -07:00
|
|
|
QString baseResolution = text;
|
2016-01-25 05:25:16 -08:00
|
|
|
uint32_t cx, cy;
|
2014-02-14 15:13:36 -07:00
|
|
|
|
2014-03-07 12:56:31 -07:00
|
|
|
ConvertResText(QT_TO_UTF8(baseResolution), cx, cy);
|
2020-01-09 00:03:22 -06:00
|
|
|
|
|
|
|
std::tuple<int, int> aspect = aspect_ratio(cx, cy);
|
|
|
|
|
|
|
|
ui->baseAspect->setText(
|
|
|
|
QTStr("AspectRatio")
|
|
|
|
.arg(QString::number(std::get<0>(aspect)),
|
|
|
|
QString::number(std::get<1>(aspect))));
|
|
|
|
|
2016-01-25 05:25:16 -08:00
|
|
|
ResetDownscales(cx, cy);
|
2014-03-07 12:56:31 -07:00
|
|
|
}
|
2014-01-26 15:36:15 -07:00
|
|
|
}
|
|
|
|
|
2014-03-07 12:56:31 -07:00
|
|
|
void OBSBasicSettings::GeneralChanged()
|
2014-02-23 16:27:19 -07:00
|
|
|
{
|
2014-05-09 18:04:39 -04:00
|
|
|
if (!loading) {
|
2014-03-07 12:56:31 -07:00
|
|
|
generalChanged = true;
|
2014-06-23 19:54:20 -07:00
|
|
|
sender()->setProperty("changed", QVariant(true));
|
2014-05-09 18:04:39 -04:00
|
|
|
EnableApplyButton(true);
|
|
|
|
}
|
2014-02-23 16:27:19 -07:00
|
|
|
}
|
|
|
|
|
2015-02-07 08:09:57 -08:00
|
|
|
void OBSBasicSettings::Stream1Changed()
|
|
|
|
{
|
|
|
|
if (!loading) {
|
|
|
|
stream1Changed = true;
|
|
|
|
sender()->setProperty("changed", QVariant(true));
|
|
|
|
EnableApplyButton(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-10 13:10:35 -07:00
|
|
|
void OBSBasicSettings::OutputsChanged()
|
|
|
|
{
|
2014-05-09 18:04:39 -04:00
|
|
|
if (!loading) {
|
2014-03-10 13:10:35 -07:00
|
|
|
outputsChanged = true;
|
2014-06-23 19:54:20 -07:00
|
|
|
sender()->setProperty("changed", QVariant(true));
|
2014-05-09 18:04:39 -04:00
|
|
|
EnableApplyButton(true);
|
|
|
|
}
|
2014-03-10 13:10:35 -07:00
|
|
|
}
|
|
|
|
|
2014-03-07 12:56:31 -07:00
|
|
|
void OBSBasicSettings::AudioChanged()
|
2014-02-23 16:27:19 -07:00
|
|
|
{
|
2014-05-09 18:04:39 -04:00
|
|
|
if (!loading) {
|
2014-02-23 16:27:19 -07:00
|
|
|
audioChanged = true;
|
2014-06-23 19:54:20 -07:00
|
|
|
sender()->setProperty("changed", QVariant(true));
|
2014-05-09 18:04:39 -04:00
|
|
|
EnableApplyButton(true);
|
|
|
|
}
|
2014-02-23 16:27:19 -07:00
|
|
|
}
|
|
|
|
|
2014-03-07 12:56:31 -07:00
|
|
|
void OBSBasicSettings::AudioChangedRestart()
|
2014-02-23 16:27:19 -07:00
|
|
|
{
|
2014-02-23 18:00:09 -07:00
|
|
|
if (!loading) {
|
2020-01-12 13:30:06 -06:00
|
|
|
int currentChannelIndex = ui->channelSetup->currentIndex();
|
|
|
|
int currentSampleRateIndex = ui->sampleRate->currentIndex();
|
|
|
|
|
|
|
|
if (currentChannelIndex != channelIndex ||
|
|
|
|
currentSampleRateIndex != sampleRateIndex) {
|
|
|
|
audioChanged = true;
|
|
|
|
ui->audioMsg->setText(
|
|
|
|
QTStr("Basic.Settings.ProgramRestart"));
|
|
|
|
sender()->setProperty("changed", QVariant(true));
|
|
|
|
EnableApplyButton(true);
|
|
|
|
} else {
|
|
|
|
audioChanged = false;
|
|
|
|
ui->audioMsg->setText("");
|
|
|
|
sender()->setProperty("changed", QVariant(false));
|
|
|
|
EnableApplyButton(false);
|
|
|
|
}
|
2014-02-23 18:00:09 -07:00
|
|
|
}
|
2014-02-23 16:27:19 -07:00
|
|
|
}
|
|
|
|
|
2015-05-01 07:07:42 +02:00
|
|
|
void OBSBasicSettings::ReloadAudioSources()
|
|
|
|
{
|
|
|
|
LoadAudioSources();
|
|
|
|
}
|
|
|
|
|
libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)
Adds surround sound audio support to the core, core plugins, and user
interface.
Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
(due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST: stereo plugins keep in general only the first two channels.
surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
(not implemented due to lack of usefulness)
Closes jp9000/obs-studio#968
2017-05-27 02:15:54 +02:00
|
|
|
#define MULTI_CHANNEL_WARNING "Basic.Settings.Audio.MultichannelWarning"
|
|
|
|
|
|
|
|
void OBSBasicSettings::SpeakerLayoutChanged(int idx)
|
|
|
|
{
|
|
|
|
QString speakerLayoutQstr = ui->channelSetup->itemText(idx);
|
|
|
|
std::string speakerLayout = QT_TO_UTF8(speakerLayoutQstr);
|
|
|
|
bool surround = IsSurround(speakerLayout.c_str());
|
|
|
|
|
|
|
|
if (surround) {
|
|
|
|
QString warning = QTStr(MULTI_CHANNEL_WARNING ".Enabled") +
|
|
|
|
QStringLiteral("\n\n") +
|
|
|
|
QTStr(MULTI_CHANNEL_WARNING);
|
|
|
|
/*
|
|
|
|
* Display all bitrates
|
|
|
|
*/
|
|
|
|
ui->audioMsg_2->setText(warning);
|
|
|
|
PopulateAACBitrates(
|
|
|
|
{ui->simpleOutputABitrate, ui->advOutTrack1Bitrate,
|
|
|
|
ui->advOutTrack2Bitrate, ui->advOutTrack3Bitrate,
|
|
|
|
ui->advOutTrack4Bitrate, ui->advOutTrack5Bitrate,
|
|
|
|
ui->advOutTrack6Bitrate});
|
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Reset audio bitrate for simple and adv mode, update list of
|
|
|
|
* bitrates and save setting.
|
|
|
|
*/
|
|
|
|
ui->audioMsg_2->setText(QString());
|
|
|
|
RestrictResetBitrates(
|
|
|
|
{ui->simpleOutputABitrate, ui->advOutTrack1Bitrate,
|
|
|
|
ui->advOutTrack2Bitrate, ui->advOutTrack3Bitrate,
|
|
|
|
ui->advOutTrack4Bitrate, ui->advOutTrack5Bitrate,
|
|
|
|
ui->advOutTrack6Bitrate},
|
|
|
|
320);
|
|
|
|
|
|
|
|
SaveCombo(ui->simpleOutputABitrate, "SimpleOutput", "ABitrate");
|
|
|
|
SaveCombo(ui->advOutTrack1Bitrate, "AdvOut", "Track1Bitrate");
|
|
|
|
SaveCombo(ui->advOutTrack2Bitrate, "AdvOut", "Track2Bitrate");
|
|
|
|
SaveCombo(ui->advOutTrack3Bitrate, "AdvOut", "Track3Bitrate");
|
|
|
|
SaveCombo(ui->advOutTrack4Bitrate, "AdvOut", "Track4Bitrate");
|
|
|
|
SaveCombo(ui->advOutTrack5Bitrate, "AdvOut", "Track5Bitrate");
|
|
|
|
SaveCombo(ui->advOutTrack6Bitrate, "AdvOut", "Track6Bitrate");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-23 12:27:18 +11:00
|
|
|
void OBSBasicSettings::HideOBSWindowWarning(int state)
|
|
|
|
{
|
|
|
|
if (loading || state == Qt::Unchecked)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (config_get_bool(GetGlobalConfig(), "General",
|
|
|
|
"WarnedAboutHideOBSFromCapture"))
|
|
|
|
return;
|
|
|
|
|
|
|
|
OBSMessageBox::information(
|
|
|
|
this, QTStr("Basic.Settings.General.HideOBSWindowsFromCapture"),
|
|
|
|
QTStr("Basic.Settings.General.HideOBSWindowsFromCapture.Message"));
|
|
|
|
|
|
|
|
config_set_bool(GetGlobalConfig(), "General",
|
|
|
|
"WarnedAboutHideOBSFromCapture", true);
|
|
|
|
config_save_safe(GetGlobalConfig(), "tmp", nullptr);
|
|
|
|
}
|
|
|
|
|
libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)
Adds surround sound audio support to the core, core plugins, and user
interface.
Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
(due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST: stereo plugins keep in general only the first two channels.
surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
(not implemented due to lack of usefulness)
Closes jp9000/obs-studio#968
2017-05-27 02:15:54 +02:00
|
|
|
/*
|
|
|
|
* resets current bitrate if too large and restricts the number of bitrates
|
|
|
|
* displayed when multichannel OFF
|
|
|
|
*/
|
|
|
|
|
|
|
|
void RestrictResetBitrates(initializer_list<QComboBox *> boxes, int maxbitrate)
|
|
|
|
{
|
|
|
|
for (auto box : boxes) {
|
|
|
|
int idx = box->currentIndex();
|
|
|
|
int max_bitrate = FindClosestAvailableAACBitrate(maxbitrate);
|
|
|
|
int count = box->count();
|
|
|
|
int max_idx = box->findText(
|
|
|
|
QT_UTF8(std::to_string(max_bitrate).c_str()));
|
|
|
|
|
|
|
|
for (int i = (count - 1); i > max_idx; i--)
|
|
|
|
box->removeItem(i);
|
|
|
|
|
|
|
|
if (idx > max_idx) {
|
|
|
|
int default_bitrate =
|
|
|
|
FindClosestAvailableAACBitrate(maxbitrate / 2);
|
|
|
|
int default_idx = box->findText(QT_UTF8(
|
|
|
|
std::to_string(default_bitrate).c_str()));
|
|
|
|
|
|
|
|
box->setCurrentIndex(default_idx);
|
|
|
|
box->setProperty("changed", QVariant(true));
|
|
|
|
} else {
|
|
|
|
box->setCurrentIndex(idx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-07 12:56:31 -07:00
|
|
|
void OBSBasicSettings::VideoChangedRestart()
|
2014-01-26 15:36:15 -07:00
|
|
|
{
|
|
|
|
if (!loading) {
|
|
|
|
videoChanged = true;
|
2014-05-10 18:47:48 -07:00
|
|
|
ui->videoMsg->setText(QTStr("Basic.Settings.ProgramRestart"));
|
2014-06-23 19:54:20 -07:00
|
|
|
sender()->setProperty("changed", QVariant(true));
|
2014-05-09 18:04:39 -04:00
|
|
|
EnableApplyButton(true);
|
2014-01-26 15:36:15 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-11 12:55:06 -08:00
|
|
|
void OBSBasicSettings::AdvancedChangedRestart()
|
|
|
|
{
|
|
|
|
if (!loading) {
|
|
|
|
advancedChanged = true;
|
|
|
|
ui->advancedMsg->setText(
|
|
|
|
QTStr("Basic.Settings.ProgramRestart"));
|
|
|
|
sender()->setProperty("changed", QVariant(true));
|
|
|
|
EnableApplyButton(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-07 12:56:31 -07:00
|
|
|
void OBSBasicSettings::VideoChangedResolution()
|
2014-01-26 15:36:15 -07:00
|
|
|
{
|
2014-05-09 18:04:39 -04:00
|
|
|
if (!loading && ValidResolutions(ui.get())) {
|
2014-01-26 15:36:15 -07:00
|
|
|
videoChanged = true;
|
2014-06-23 19:54:20 -07:00
|
|
|
sender()->setProperty("changed", QVariant(true));
|
2014-05-09 18:04:39 -04:00
|
|
|
EnableApplyButton(true);
|
|
|
|
}
|
2013-12-13 23:11:23 -07:00
|
|
|
}
|
2014-02-23 16:27:19 -07:00
|
|
|
|
2014-03-07 12:56:31 -07:00
|
|
|
void OBSBasicSettings::VideoChanged()
|
2014-02-23 16:27:19 -07:00
|
|
|
{
|
2014-05-09 18:04:39 -04:00
|
|
|
if (!loading) {
|
2014-02-23 16:27:19 -07:00
|
|
|
videoChanged = true;
|
2014-06-23 19:54:20 -07:00
|
|
|
sender()->setProperty("changed", QVariant(true));
|
2014-05-09 18:04:39 -04:00
|
|
|
EnableApplyButton(true);
|
|
|
|
}
|
2014-02-23 16:27:19 -07:00
|
|
|
}
|
2015-02-11 12:55:06 -08:00
|
|
|
|
2014-11-01 21:50:36 +01:00
|
|
|
void OBSBasicSettings::HotkeysChanged()
|
|
|
|
{
|
|
|
|
using namespace std;
|
|
|
|
if (loading)
|
|
|
|
return;
|
|
|
|
|
|
|
|
hotkeysChanged =
|
|
|
|
any_of(begin(hotkeys), end(hotkeys),
|
|
|
|
[](const pair<bool, QPointer<OBSHotkeyWidget>> &hotkey) {
|
|
|
|
const auto &hw = *hotkey.second;
|
|
|
|
return hw.Changed();
|
|
|
|
});
|
|
|
|
|
|
|
|
if (hotkeysChanged)
|
|
|
|
EnableApplyButton(true);
|
|
|
|
}
|
|
|
|
|
2022-01-03 17:41:28 +11:00
|
|
|
void OBSBasicSettings::SearchHotkeys(const QString &text,
|
|
|
|
obs_key_combination_t filterCombo)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (ui->hotkeyFormLayout->rowCount() == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
std::vector<obs_key_combination_t> combos;
|
|
|
|
bool showHotkey;
|
|
|
|
ui->hotkeyScrollArea->ensureVisible(0, 0);
|
|
|
|
ui->hotkeyScrollArea->setUpdatesEnabled(false);
|
|
|
|
|
|
|
|
QLayoutItem *hotkeysItem = ui->hotkeyFormLayout->itemAt(0);
|
|
|
|
QWidget *hotkeys = hotkeysItem->widget();
|
|
|
|
if (!hotkeys)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QFormLayout *hotkeysLayout =
|
|
|
|
qobject_cast<QFormLayout *>(hotkeys->layout());
|
|
|
|
|
|
|
|
for (int i = 0; i < hotkeysLayout->rowCount(); i++) {
|
|
|
|
auto label = hotkeysLayout->itemAt(i, QFormLayout::LabelRole);
|
|
|
|
if (!label)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
OBSHotkeyLabel *item =
|
|
|
|
qobject_cast<OBSHotkeyLabel *>(label->widget());
|
|
|
|
if (!item)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
item->widget->GetCombinations(combos);
|
|
|
|
QString fullname = item->property("fullName").value<QString>();
|
|
|
|
|
|
|
|
showHotkey = text.isEmpty() ||
|
|
|
|
fullname.toLower().contains(text.toLower());
|
|
|
|
|
|
|
|
if (showHotkey && !obs_key_combination_is_empty(filterCombo)) {
|
|
|
|
showHotkey = false;
|
|
|
|
for (auto combo : combos) {
|
|
|
|
if (combo == filterCombo) {
|
|
|
|
showHotkey = true;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
label->widget()->setVisible(showHotkey);
|
|
|
|
|
|
|
|
auto field = hotkeysLayout->itemAt(i, QFormLayout::FieldRole);
|
|
|
|
if (field)
|
|
|
|
field->widget()->setVisible(showHotkey);
|
|
|
|
}
|
|
|
|
ui->hotkeyScrollArea->setUpdatesEnabled(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::on_hotkeyFilterReset_clicked()
|
|
|
|
{
|
|
|
|
ui->hotkeyFilterSearch->setText("");
|
|
|
|
ui->hotkeyFilterInput->ResetKey();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::on_hotkeyFilterSearch_textChanged(const QString text)
|
|
|
|
{
|
|
|
|
SearchHotkeys(text, ui->hotkeyFilterInput->key);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::on_hotkeyFilterInput_KeyChanged(
|
|
|
|
obs_key_combination_t combo)
|
|
|
|
{
|
|
|
|
SearchHotkeys(ui->hotkeyFilterSearch->text(), combo);
|
|
|
|
}
|
|
|
|
|
2021-09-09 00:21:00 -03:00
|
|
|
static bool MarkHotkeyConflicts(OBSHotkeyLabel *item1, OBSHotkeyLabel *item2)
|
|
|
|
{
|
|
|
|
if (item1->pairPartner == item2)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
auto &edits1 = item1->widget->edits;
|
|
|
|
auto &edits2 = item2->widget->edits;
|
|
|
|
bool hasDupes = false;
|
|
|
|
|
|
|
|
for (auto &edit1 : edits1) {
|
|
|
|
for (auto &edit2 : edits2) {
|
|
|
|
bool isDupe =
|
|
|
|
!obs_key_combination_is_empty(edit1->key) &&
|
|
|
|
edit1->key == edit2->key;
|
|
|
|
|
|
|
|
hasDupes |= isDupe;
|
|
|
|
edit1->hasDuplicate |= isDupe;
|
|
|
|
edit2->hasDuplicate |= isDupe;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return hasDupes;
|
|
|
|
};
|
|
|
|
|
|
|
|
bool OBSBasicSettings::ScanDuplicateHotkeys(QFormLayout *layout)
|
|
|
|
{
|
|
|
|
vector<OBSHotkeyLabel *> items;
|
|
|
|
bool hasDupes = false;
|
|
|
|
|
|
|
|
for (int i = 0; i < layout->rowCount(); i++) {
|
|
|
|
auto label = layout->itemAt(i, QFormLayout::LabelRole);
|
|
|
|
if (!label)
|
|
|
|
continue;
|
|
|
|
OBSHotkeyLabel *item =
|
|
|
|
qobject_cast<OBSHotkeyLabel *>(label->widget());
|
|
|
|
if (!item)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
items.push_back(item);
|
|
|
|
|
|
|
|
for (auto &edit : item->widget->edits)
|
|
|
|
edit->hasDuplicate = false;
|
|
|
|
}
|
|
|
|
|
2021-11-03 13:14:46 -05:00
|
|
|
for (size_t i = 0; i < items.size(); i++) {
|
2021-09-09 00:21:00 -03:00
|
|
|
OBSHotkeyLabel *item1 = items[i];
|
|
|
|
|
2021-11-03 13:14:46 -05:00
|
|
|
for (size_t j = i + 1; j < items.size(); j++)
|
2021-09-09 00:21:00 -03:00
|
|
|
hasDupes |= MarkHotkeyConflicts(item1, items[j]);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (auto *item : items) {
|
|
|
|
for (auto &edit : item->widget->edits) {
|
|
|
|
edit->UpdateDuplicationState();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return hasDupes;
|
|
|
|
}
|
|
|
|
|
2014-11-01 21:50:36 +01:00
|
|
|
void OBSBasicSettings::ReloadHotkeys(obs_hotkey_id ignoreKey)
|
|
|
|
{
|
|
|
|
LoadHotkeySettings(ignoreKey);
|
|
|
|
}
|
|
|
|
|
2015-02-11 12:55:06 -08:00
|
|
|
void OBSBasicSettings::AdvancedChanged()
|
|
|
|
{
|
|
|
|
if (!loading) {
|
|
|
|
advancedChanged = true;
|
|
|
|
sender()->setProperty("changed", QVariant(true));
|
|
|
|
EnableApplyButton(true);
|
|
|
|
}
|
|
|
|
}
|
2015-06-17 12:07:55 -07:00
|
|
|
|
2021-10-03 19:06:46 +09:00
|
|
|
void OBSBasicSettings::AdvOutSplitFileChanged()
|
|
|
|
{
|
|
|
|
bool splitFile = ui->advOutSplitFile->isChecked();
|
|
|
|
int splitFileType = splitFile ? ui->advOutSplitFileType->currentIndex()
|
|
|
|
: -1;
|
|
|
|
|
|
|
|
ui->advOutSplitFileType->setEnabled(splitFile);
|
|
|
|
ui->advOutSplitFileTimeLabel->setVisible(splitFileType == 0);
|
|
|
|
ui->advOutSplitFileTime->setVisible(splitFileType == 0);
|
|
|
|
ui->advOutSplitFileSizeLabel->setVisible(splitFileType == 1);
|
|
|
|
ui->advOutSplitFileSize->setVisible(splitFileType == 1);
|
2021-12-24 15:59:26 +09:00
|
|
|
ui->advOutSplitFileRstTS->setVisible(splitFile);
|
2021-10-03 19:06:46 +09:00
|
|
|
}
|
|
|
|
|
2015-06-17 12:07:55 -07:00
|
|
|
void OBSBasicSettings::AdvOutRecCheckWarnings()
|
|
|
|
{
|
|
|
|
auto Checked = [](QCheckBox *box) { return box->isChecked() ? 1 : 0; };
|
|
|
|
|
2017-02-04 18:47:44 +01:00
|
|
|
QString errorMsg;
|
|
|
|
QString warningMsg;
|
2015-06-17 12:07:55 -07:00
|
|
|
uint32_t tracks =
|
|
|
|
Checked(ui->advOutRecTrack1) + Checked(ui->advOutRecTrack2) +
|
2016-12-21 17:14:24 -08:00
|
|
|
Checked(ui->advOutRecTrack3) + Checked(ui->advOutRecTrack4) +
|
|
|
|
Checked(ui->advOutRecTrack5) + Checked(ui->advOutRecTrack6);
|
2015-06-17 12:07:55 -07:00
|
|
|
|
2019-07-07 15:47:29 -07:00
|
|
|
bool useStreamEncoder = ui->advOutRecEncoder->currentIndex() == 0;
|
|
|
|
if (useStreamEncoder) {
|
|
|
|
if (!warningMsg.isEmpty())
|
|
|
|
warningMsg += "\n\n";
|
|
|
|
warningMsg += QTStr("OutputWarnings.CannotPause");
|
|
|
|
}
|
|
|
|
|
2019-07-23 07:20:13 -05:00
|
|
|
if (ui->advOutRecFormat->currentText().compare("flv") == 0) {
|
|
|
|
ui->advRecTrackWidget->setCurrentWidget(ui->flvTracks);
|
|
|
|
} else {
|
|
|
|
ui->advRecTrackWidget->setCurrentWidget(ui->recTracks);
|
|
|
|
|
|
|
|
if (tracks == 0)
|
|
|
|
errorMsg = QTStr("OutputWarnings.NoTracksSelected");
|
|
|
|
}
|
|
|
|
|
2019-02-24 05:12:37 +01:00
|
|
|
if (ui->advOutRecFormat->currentText().compare("mp4") == 0 ||
|
|
|
|
ui->advOutRecFormat->currentText().compare("mov") == 0) {
|
2017-02-04 18:47:44 +01:00
|
|
|
if (!warningMsg.isEmpty())
|
|
|
|
warningMsg += "\n\n";
|
|
|
|
warningMsg += QTStr("OutputWarnings.MP4Recording");
|
2017-05-08 06:53:35 -05:00
|
|
|
ui->autoRemux->setText(
|
|
|
|
QTStr("Basic.Settings.Advanced.AutoRemux") + " " +
|
|
|
|
QTStr("Basic.Settings.Advanced.AutoRemux.MP4"));
|
|
|
|
} else {
|
|
|
|
ui->autoRemux->setText(
|
|
|
|
QTStr("Basic.Settings.Advanced.AutoRemux"));
|
2015-06-17 12:07:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
delete advOutRecWarning;
|
|
|
|
|
2017-02-04 18:47:44 +01:00
|
|
|
if (!errorMsg.isEmpty() || !warningMsg.isEmpty()) {
|
|
|
|
advOutRecWarning = new QLabel(
|
|
|
|
errorMsg.isEmpty() ? warningMsg : errorMsg, this);
|
|
|
|
advOutRecWarning->setObjectName(
|
|
|
|
errorMsg.isEmpty() ? "warningLabel" : "errorLabel");
|
|
|
|
advOutRecWarning->setWordWrap(true);
|
2015-06-17 12:07:55 -07:00
|
|
|
|
|
|
|
QFormLayout *formLayout = reinterpret_cast<QFormLayout *>(
|
|
|
|
ui->advOutRecTopContainer->layout());
|
|
|
|
|
|
|
|
formLayout->addRow(nullptr, advOutRecWarning);
|
|
|
|
}
|
|
|
|
}
|
2015-09-06 16:12:03 -07:00
|
|
|
|
|
|
|
static inline QString MakeMemorySizeString(int bitrate, int seconds)
|
|
|
|
{
|
|
|
|
QString str = QTStr("Basic.Settings.Advanced.StreamDelay.MemoryUsage");
|
|
|
|
int megabytes = bitrate * seconds / 1000 / 8;
|
|
|
|
|
|
|
|
return str.arg(QString::number(megabytes));
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::UpdateSimpleOutStreamDelayEstimate()
|
|
|
|
{
|
|
|
|
int seconds = ui->streamDelaySec->value();
|
|
|
|
int vBitrate = ui->simpleOutputVBitrate->value();
|
|
|
|
int aBitrate = ui->simpleOutputABitrate->currentText().toInt();
|
|
|
|
|
|
|
|
QString msg = MakeMemorySizeString(vBitrate + aBitrate, seconds);
|
|
|
|
|
|
|
|
ui->streamDelayInfo->setText(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::UpdateAdvOutStreamDelayEstimate()
|
|
|
|
{
|
|
|
|
if (!streamEncoderProps)
|
|
|
|
return;
|
|
|
|
|
|
|
|
OBSData settings = streamEncoderProps->GetSettings();
|
|
|
|
int trackIndex = config_get_int(main->Config(), "AdvOut", "TrackIndex");
|
|
|
|
QString aBitrateText;
|
|
|
|
|
|
|
|
switch (trackIndex) {
|
|
|
|
case 1:
|
|
|
|
aBitrateText = ui->advOutTrack1Bitrate->currentText();
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
aBitrateText = ui->advOutTrack2Bitrate->currentText();
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
aBitrateText = ui->advOutTrack3Bitrate->currentText();
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
aBitrateText = ui->advOutTrack4Bitrate->currentText();
|
|
|
|
break;
|
2016-12-21 17:14:24 -08:00
|
|
|
case 5:
|
|
|
|
aBitrateText = ui->advOutTrack5Bitrate->currentText();
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
aBitrateText = ui->advOutTrack6Bitrate->currentText();
|
|
|
|
break;
|
2015-09-06 16:12:03 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
int seconds = ui->streamDelaySec->value();
|
|
|
|
int vBitrate = (int)obs_data_get_int(settings, "bitrate");
|
|
|
|
int aBitrate = aBitrateText.toInt();
|
|
|
|
|
|
|
|
QString msg = MakeMemorySizeString(vBitrate + aBitrate, seconds);
|
|
|
|
|
|
|
|
ui->streamDelayInfo->setText(msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::UpdateStreamDelayEstimate()
|
|
|
|
{
|
|
|
|
if (ui->outputMode->currentIndex() == 0)
|
|
|
|
UpdateSimpleOutStreamDelayEstimate();
|
|
|
|
else
|
|
|
|
UpdateAdvOutStreamDelayEstimate();
|
2017-01-04 16:11:52 -05:00
|
|
|
|
|
|
|
UpdateAutomaticReplayBufferCheckboxes();
|
2015-09-06 16:12:03 -07:00
|
|
|
}
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
|
2019-02-05 18:05:19 -08:00
|
|
|
bool EncoderAvailable(const char *encoder)
|
2016-04-18 00:56:51 -07:00
|
|
|
{
|
|
|
|
const char *val;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
while (obs_enum_encoder_types(i++, &val))
|
|
|
|
if (strcmp(val, encoder) == 0)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
void OBSBasicSettings::FillSimpleRecordingValues()
|
|
|
|
{
|
|
|
|
#define ADD_QUALITY(str) \
|
|
|
|
ui->simpleOutRecQuality->addItem( \
|
|
|
|
QTStr("Basic.Settings.Output.Simple.RecordingQuality." str), \
|
|
|
|
QString(str));
|
|
|
|
#define ENCODER_STR(str) QTStr("Basic.Settings.Output.Simple.Encoder." str)
|
|
|
|
|
|
|
|
ADD_QUALITY("Stream");
|
|
|
|
ADD_QUALITY("Small");
|
|
|
|
ADD_QUALITY("HQ");
|
|
|
|
ADD_QUALITY("Lossless");
|
|
|
|
|
|
|
|
ui->simpleOutRecEncoder->addItem(ENCODER_STR("Software"),
|
|
|
|
QString(SIMPLE_ENCODER_X264));
|
|
|
|
ui->simpleOutRecEncoder->addItem(ENCODER_STR("SoftwareLowCPU"),
|
|
|
|
QString(SIMPLE_ENCODER_X264_LOWCPU));
|
2016-04-18 00:56:51 -07:00
|
|
|
if (EncoderAvailable("obs_qsv11"))
|
2022-05-05 10:14:42 -07:00
|
|
|
ui->simpleOutRecEncoder->addItem(
|
|
|
|
ENCODER_STR("Hardware.QSV.H264"),
|
|
|
|
QString(SIMPLE_ENCODER_QSV));
|
2016-04-18 16:12:59 -07:00
|
|
|
if (EncoderAvailable("ffmpeg_nvenc"))
|
2022-05-05 10:14:42 -07:00
|
|
|
ui->simpleOutRecEncoder->addItem(
|
|
|
|
ENCODER_STR("Hardware.NVENC.H264"),
|
|
|
|
QString(SIMPLE_ENCODER_NVENC));
|
2022-05-19 07:53:37 +03:00
|
|
|
#ifdef ENABLE_HEVC
|
|
|
|
if (EncoderAvailable("ffmpeg_hevc_nvenc"))
|
|
|
|
ui->simpleOutRecEncoder->addItem(
|
|
|
|
ENCODER_STR("Hardware.NVENC.HEVC"),
|
|
|
|
QString(SIMPLE_ENCODER_NVENC_HEVC));
|
|
|
|
#endif
|
2016-09-26 16:29:33 -07:00
|
|
|
if (EncoderAvailable("amd_amf_h264"))
|
2022-05-05 10:14:42 -07:00
|
|
|
ui->simpleOutRecEncoder->addItem(
|
|
|
|
ENCODER_STR("Hardware.AMD.H264"),
|
|
|
|
QString(SIMPLE_ENCODER_AMD));
|
2022-06-23 02:46:03 +02:00
|
|
|
if (EncoderAvailable("com.apple.videotoolbox.videoencoder.ave.avc")
|
|
|
|
#ifndef __aarch64__
|
|
|
|
&& os_get_emulation_status() == true
|
|
|
|
#endif
|
|
|
|
)
|
|
|
|
ui->simpleOutRecEncoder->addItem(
|
|
|
|
ENCODER_STR("Hardware.Apple.H264"),
|
|
|
|
QString(SIMPLE_ENCODER_APPLE_H264));
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
#undef ADD_QUALITY
|
2016-04-18 00:56:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::FillSimpleStreamingValues()
|
|
|
|
{
|
|
|
|
ui->simpleOutStrEncoder->addItem(ENCODER_STR("Software"),
|
|
|
|
QString(SIMPLE_ENCODER_X264));
|
|
|
|
if (EncoderAvailable("obs_qsv11"))
|
2022-05-05 10:14:42 -07:00
|
|
|
ui->simpleOutStrEncoder->addItem(
|
|
|
|
ENCODER_STR("Hardware.QSV.H264"),
|
|
|
|
QString(SIMPLE_ENCODER_QSV));
|
2016-04-18 16:12:59 -07:00
|
|
|
if (EncoderAvailable("ffmpeg_nvenc"))
|
2022-05-05 10:14:42 -07:00
|
|
|
ui->simpleOutStrEncoder->addItem(
|
|
|
|
ENCODER_STR("Hardware.NVENC.H264"),
|
|
|
|
QString(SIMPLE_ENCODER_NVENC));
|
2022-05-19 07:53:37 +03:00
|
|
|
#ifdef ENABLE_HEVC
|
|
|
|
if (EncoderAvailable("ffmpeg_hevc_nvenc"))
|
|
|
|
ui->simpleOutStrEncoder->addItem(
|
|
|
|
ENCODER_STR("Hardware.NVENC.HEVC"),
|
|
|
|
QString(SIMPLE_ENCODER_NVENC_HEVC));
|
|
|
|
#endif
|
2016-09-26 16:29:33 -07:00
|
|
|
if (EncoderAvailable("amd_amf_h264"))
|
2022-05-05 10:14:42 -07:00
|
|
|
ui->simpleOutStrEncoder->addItem(
|
|
|
|
ENCODER_STR("Hardware.AMD.H264"),
|
|
|
|
QString(SIMPLE_ENCODER_AMD));
|
2022-06-23 02:46:03 +02:00
|
|
|
/* Preprocessor guard required for the macOS version check */
|
|
|
|
#ifdef __APPLE__
|
|
|
|
if (EncoderAvailable("com.apple.videotoolbox.videoencoder.ave.avc")
|
|
|
|
#ifndef __aarch64__
|
|
|
|
&& os_get_emulation_status() == true
|
|
|
|
#endif
|
|
|
|
)
|
|
|
|
if (__builtin_available(macOS 13.0, *))
|
|
|
|
ui->simpleOutStrEncoder->addItem(
|
|
|
|
ENCODER_STR("Hardware.Apple.H264"),
|
|
|
|
QString(SIMPLE_ENCODER_APPLE_H264));
|
|
|
|
#endif
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
#undef ENCODER_STR
|
|
|
|
}
|
|
|
|
|
2017-02-05 21:51:50 -08:00
|
|
|
void OBSBasicSettings::FillAudioMonitoringDevices()
|
|
|
|
{
|
|
|
|
QComboBox *cb = ui->monitoringDevice;
|
|
|
|
|
|
|
|
auto enum_devices = [](void *param, const char *name, const char *id) {
|
|
|
|
QComboBox *cb = (QComboBox *)param;
|
|
|
|
cb->addItem(name, id);
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
|
|
|
cb->addItem(QTStr("Basic.Settings.Advanced.Audio.MonitoringDevice"
|
|
|
|
".Default"),
|
|
|
|
"default");
|
|
|
|
|
|
|
|
obs_enum_audio_monitoring_devices(enum_devices, cb);
|
|
|
|
}
|
|
|
|
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
void OBSBasicSettings::SimpleRecordingQualityChanged()
|
|
|
|
{
|
|
|
|
QString qual = ui->simpleOutRecQuality->currentData().toString();
|
|
|
|
bool streamQuality = qual == "Stream";
|
|
|
|
bool losslessQuality = !streamQuality && qual == "Lossless";
|
|
|
|
|
|
|
|
bool showEncoder = !streamQuality && !losslessQuality;
|
|
|
|
ui->simpleOutRecEncoder->setVisible(showEncoder);
|
|
|
|
ui->simpleOutRecEncoderLabel->setVisible(showEncoder);
|
|
|
|
ui->simpleOutRecFormat->setVisible(!losslessQuality);
|
|
|
|
ui->simpleOutRecFormatLabel->setVisible(!losslessQuality);
|
|
|
|
|
|
|
|
SimpleRecordingEncoderChanged();
|
2016-12-07 05:21:44 -08:00
|
|
|
SimpleReplayBufferChanged();
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
}
|
|
|
|
|
2016-04-18 00:56:51 -07:00
|
|
|
void OBSBasicSettings::SimpleStreamingEncoderChanged()
|
|
|
|
{
|
|
|
|
QString encoder = ui->simpleOutStrEncoder->currentData().toString();
|
|
|
|
QString preset;
|
|
|
|
const char *defaultPreset = nullptr;
|
|
|
|
|
2022-06-23 02:46:03 +02:00
|
|
|
ui->simpleOutAdvanced->setVisible(true);
|
|
|
|
ui->simpleOutPresetLabel->setVisible(true);
|
|
|
|
ui->simpleOutPreset->setVisible(true);
|
2016-04-18 00:56:51 -07:00
|
|
|
ui->simpleOutPreset->clear();
|
|
|
|
|
|
|
|
if (encoder == SIMPLE_ENCODER_QSV) {
|
|
|
|
ui->simpleOutPreset->addItem("speed", "speed");
|
|
|
|
ui->simpleOutPreset->addItem("balanced", "balanced");
|
|
|
|
ui->simpleOutPreset->addItem("quality", "quality");
|
|
|
|
|
|
|
|
defaultPreset = "balanced";
|
|
|
|
preset = curQSVPreset;
|
2016-04-18 16:12:59 -07:00
|
|
|
|
|
|
|
} else if (encoder == SIMPLE_ENCODER_NVENC) {
|
|
|
|
obs_properties_t *props =
|
|
|
|
obs_get_encoder_properties("ffmpeg_nvenc");
|
|
|
|
|
|
|
|
obs_property_t *p = obs_properties_get(props, "preset");
|
|
|
|
size_t num = obs_property_list_item_count(p);
|
|
|
|
for (size_t i = 0; i < num; i++) {
|
|
|
|
const char *name = obs_property_list_item_name(p, i);
|
|
|
|
const char *val = obs_property_list_item_string(p, i);
|
|
|
|
|
|
|
|
/* bluray is for ideal bluray disc recording settings,
|
|
|
|
* not streaming */
|
|
|
|
if (strcmp(val, "bd") == 0)
|
|
|
|
continue;
|
2016-05-05 00:19:38 -07:00
|
|
|
/* lossless should of course not be used to stream */
|
|
|
|
if (astrcmp_n(val, "lossless", 8) == 0)
|
|
|
|
continue;
|
2016-04-18 16:12:59 -07:00
|
|
|
|
|
|
|
ui->simpleOutPreset->addItem(QT_UTF8(name), val);
|
|
|
|
}
|
|
|
|
|
|
|
|
obs_properties_destroy(props);
|
|
|
|
|
|
|
|
defaultPreset = "default";
|
|
|
|
preset = curNVENCPreset;
|
|
|
|
|
2022-05-19 07:53:37 +03:00
|
|
|
#ifdef ENABLE_HEVC
|
|
|
|
} else if (encoder == SIMPLE_ENCODER_NVENC_HEVC) {
|
|
|
|
obs_properties_t *props =
|
|
|
|
obs_get_encoder_properties("ffmpeg_hevc_nvenc");
|
|
|
|
|
|
|
|
obs_property_t *p = obs_properties_get(props, "preset");
|
|
|
|
size_t num = obs_property_list_item_count(p);
|
|
|
|
for (size_t i = 0; i < num; i++) {
|
|
|
|
const char *name = obs_property_list_item_name(p, i);
|
|
|
|
const char *val = obs_property_list_item_string(p, i);
|
|
|
|
|
|
|
|
/* bluray is for ideal bluray disc recording settings,
|
|
|
|
* not streaming */
|
|
|
|
if (strcmp(val, "bd") == 0)
|
|
|
|
continue;
|
|
|
|
/* lossless should of course not be used to stream */
|
|
|
|
if (astrcmp_n(val, "lossless", 8) == 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
ui->simpleOutPreset->addItem(QT_UTF8(name), val);
|
|
|
|
}
|
|
|
|
|
|
|
|
obs_properties_destroy(props);
|
|
|
|
|
|
|
|
defaultPreset = "default";
|
|
|
|
preset = curNVENCPreset;
|
|
|
|
#endif
|
|
|
|
|
2016-09-26 16:29:33 -07:00
|
|
|
} else if (encoder == SIMPLE_ENCODER_AMD) {
|
2016-11-03 20:34:57 +01:00
|
|
|
ui->simpleOutPreset->addItem("Speed", "speed");
|
|
|
|
ui->simpleOutPreset->addItem("Balanced", "balanced");
|
|
|
|
ui->simpleOutPreset->addItem("Quality", "quality");
|
2016-09-26 16:29:33 -07:00
|
|
|
|
2016-11-03 20:34:57 +01:00
|
|
|
defaultPreset = "balanced";
|
|
|
|
preset = curAMDPreset;
|
2022-06-23 02:46:03 +02:00
|
|
|
} else if (encoder == SIMPLE_ENCODER_APPLE_H264) {
|
|
|
|
ui->simpleOutAdvanced->setChecked(false);
|
|
|
|
ui->simpleOutAdvanced->setVisible(false);
|
|
|
|
ui->simpleOutPreset->setVisible(false);
|
|
|
|
ui->simpleOutPresetLabel->setVisible(false);
|
2016-04-18 00:56:51 -07:00
|
|
|
} else {
|
2022-06-25 19:25:18 +02:00
|
|
|
|
|
|
|
#define PRESET_STR(val) \
|
|
|
|
QString(Str("Basic.Settings.Output.EncoderPreset." val)).arg(val)
|
|
|
|
ui->simpleOutPreset->addItem(PRESET_STR("ultrafast"),
|
|
|
|
"ultrafast");
|
2016-04-18 00:56:51 -07:00
|
|
|
ui->simpleOutPreset->addItem("superfast", "superfast");
|
2022-06-25 19:25:18 +02:00
|
|
|
ui->simpleOutPreset->addItem(PRESET_STR("veryfast"),
|
|
|
|
"veryfast");
|
2016-04-18 00:56:51 -07:00
|
|
|
ui->simpleOutPreset->addItem("faster", "faster");
|
2022-06-25 19:25:18 +02:00
|
|
|
ui->simpleOutPreset->addItem(PRESET_STR("fast"), "fast");
|
|
|
|
#undef PRESET_STR
|
|
|
|
|
|
|
|
/* Users might have previously selected a preset which is no
|
|
|
|
* longer available in simple mode. Make sure we don't mess
|
|
|
|
* with their setups without them knowing. */
|
|
|
|
if (ui->simpleOutPreset->findData(curPreset) == -1) {
|
|
|
|
ui->simpleOutPreset->addItem(curPreset, curPreset);
|
|
|
|
QStandardItemModel *model =
|
|
|
|
qobject_cast<QStandardItemModel *>(
|
|
|
|
ui->simpleOutPreset->model());
|
|
|
|
QStandardItem *item =
|
|
|
|
model->item(model->rowCount() - 1);
|
|
|
|
item->setEnabled(false);
|
|
|
|
}
|
2016-04-18 00:56:51 -07:00
|
|
|
|
|
|
|
defaultPreset = "veryfast";
|
|
|
|
preset = curPreset;
|
|
|
|
}
|
|
|
|
|
|
|
|
int idx = ui->simpleOutPreset->findData(QVariant(preset));
|
|
|
|
if (idx == -1)
|
|
|
|
idx = ui->simpleOutPreset->findData(QVariant(defaultPreset));
|
|
|
|
|
|
|
|
ui->simpleOutPreset->setCurrentIndex(idx);
|
|
|
|
}
|
|
|
|
|
2016-12-07 05:21:44 -08:00
|
|
|
#define ESTIMATE_STR "Basic.Settings.Output.ReplayBuffer.Estimate"
|
|
|
|
#define ESTIMATE_UNKNOWN_STR \
|
|
|
|
"Basic.Settings.Output.ReplayBuffer.EstimateUnknown"
|
|
|
|
|
2017-01-04 16:11:52 -05:00
|
|
|
void OBSBasicSettings::UpdateAutomaticReplayBufferCheckboxes()
|
|
|
|
{
|
2017-09-05 20:01:49 -04:00
|
|
|
bool state = false;
|
|
|
|
switch (ui->outputMode->currentIndex()) {
|
|
|
|
case 0:
|
|
|
|
state = ui->simpleReplayBuf->isChecked();
|
2020-10-08 16:32:12 +11:00
|
|
|
ui->simpleReplayBuf->setEnabled(
|
|
|
|
!obs_frontend_replay_buffer_active());
|
2017-09-05 20:01:49 -04:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
state = ui->advReplayBuf->isChecked();
|
2020-10-08 16:32:12 +11:00
|
|
|
ui->advReplayBuf->setEnabled(
|
|
|
|
!obs_frontend_replay_buffer_active());
|
2017-09-05 20:01:49 -04:00
|
|
|
break;
|
|
|
|
}
|
2017-01-04 16:11:52 -05:00
|
|
|
ui->replayWhileStreaming->setEnabled(state);
|
|
|
|
ui->keepReplayStreamStops->setEnabled(
|
|
|
|
state && ui->replayWhileStreaming->isChecked());
|
|
|
|
}
|
|
|
|
|
2016-12-07 05:21:44 -08:00
|
|
|
void OBSBasicSettings::SimpleReplayBufferChanged()
|
|
|
|
{
|
|
|
|
QString qual = ui->simpleOutRecQuality->currentData().toString();
|
|
|
|
bool replayBufferEnabled = ui->simpleReplayBuf->isChecked();
|
|
|
|
bool lossless = qual == "Lossless";
|
|
|
|
bool streamQuality = qual == "Stream";
|
|
|
|
|
|
|
|
ui->simpleRBMegsMax->setVisible(!streamQuality);
|
|
|
|
ui->simpleRBMegsMaxLabel->setVisible(!streamQuality);
|
|
|
|
|
|
|
|
int vbitrate = ui->simpleOutputVBitrate->value();
|
|
|
|
int abitrate = ui->simpleOutputABitrate->currentText().toInt();
|
|
|
|
int seconds = ui->simpleRBSecMax->value();
|
|
|
|
|
|
|
|
int64_t memMB = int64_t(seconds) * int64_t(vbitrate + abitrate) * 1000 /
|
|
|
|
8 / 1024 / 1024;
|
|
|
|
if (memMB < 1)
|
|
|
|
memMB = 1;
|
|
|
|
|
|
|
|
if (streamQuality)
|
|
|
|
ui->simpleRBEstimate->setText(
|
|
|
|
QTStr(ESTIMATE_STR).arg(QString::number(int(memMB))));
|
|
|
|
else
|
|
|
|
ui->simpleRBEstimate->setText(QTStr(ESTIMATE_UNKNOWN_STR));
|
|
|
|
|
|
|
|
ui->replayBufferGroupBox->setVisible(!lossless && replayBufferEnabled);
|
|
|
|
ui->simpleReplayBuf->setVisible(!lossless);
|
2017-01-04 16:11:52 -05:00
|
|
|
|
|
|
|
UpdateAutomaticReplayBufferCheckboxes();
|
2017-09-05 20:01:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::AdvReplayBufferChanged()
|
|
|
|
{
|
|
|
|
obs_data_t *settings;
|
|
|
|
QString encoder = ui->advOutRecEncoder->currentText();
|
|
|
|
bool useStream = QString::compare(encoder, TEXT_USE_STREAM_ENC) == 0;
|
|
|
|
|
|
|
|
if (useStream && streamEncoderProps) {
|
|
|
|
settings = streamEncoderProps->GetSettings();
|
|
|
|
} else if (!useStream && recordEncoderProps) {
|
|
|
|
settings = recordEncoderProps->GetSettings();
|
|
|
|
} else {
|
|
|
|
if (useStream)
|
|
|
|
encoder = GetComboData(ui->advOutEncoder);
|
|
|
|
settings = obs_encoder_defaults(encoder.toUtf8().constData());
|
2017-01-04 16:11:52 -05:00
|
|
|
|
2017-09-05 20:01:49 -04:00
|
|
|
if (!settings)
|
|
|
|
return;
|
|
|
|
|
|
|
|
char encoderJsonPath[512];
|
|
|
|
int ret = GetProfilePath(encoderJsonPath,
|
|
|
|
sizeof(encoderJsonPath),
|
|
|
|
"recordEncoder.json");
|
|
|
|
if (ret > 0) {
|
2021-11-26 22:25:39 +13:00
|
|
|
OBSDataAutoRelease data =
|
|
|
|
obs_data_create_from_json_file_safe(
|
|
|
|
encoderJsonPath, "bak");
|
2017-09-05 20:01:49 -04:00
|
|
|
obs_data_apply(settings, data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int vbitrate = (int)obs_data_get_int(settings, "bitrate");
|
|
|
|
const char *rateControl = obs_data_get_string(settings, "rate_control");
|
|
|
|
|
2018-07-30 15:11:41 +03:00
|
|
|
if (!rateControl)
|
|
|
|
rateControl = "";
|
|
|
|
|
2017-09-05 20:01:49 -04:00
|
|
|
bool lossless = strcmp(rateControl, "lossless") == 0 ||
|
|
|
|
ui->advOutRecType->currentIndex() == 1;
|
|
|
|
bool replayBufferEnabled = ui->advReplayBuf->isChecked();
|
|
|
|
|
|
|
|
int abitrate = 0;
|
|
|
|
if (ui->advOutRecTrack1->isChecked())
|
|
|
|
abitrate += ui->advOutTrack1Bitrate->currentText().toInt();
|
|
|
|
if (ui->advOutRecTrack2->isChecked())
|
|
|
|
abitrate += ui->advOutTrack2Bitrate->currentText().toInt();
|
|
|
|
if (ui->advOutRecTrack3->isChecked())
|
|
|
|
abitrate += ui->advOutTrack3Bitrate->currentText().toInt();
|
|
|
|
if (ui->advOutRecTrack4->isChecked())
|
|
|
|
abitrate += ui->advOutTrack4Bitrate->currentText().toInt();
|
|
|
|
if (ui->advOutRecTrack5->isChecked())
|
|
|
|
abitrate += ui->advOutTrack5Bitrate->currentText().toInt();
|
|
|
|
if (ui->advOutRecTrack6->isChecked())
|
|
|
|
abitrate += ui->advOutTrack6Bitrate->currentText().toInt();
|
|
|
|
|
|
|
|
int seconds = ui->advRBSecMax->value();
|
|
|
|
|
|
|
|
int64_t memMB = int64_t(seconds) * int64_t(vbitrate + abitrate) * 1000 /
|
|
|
|
8 / 1024 / 1024;
|
|
|
|
if (memMB < 1)
|
|
|
|
memMB = 1;
|
|
|
|
|
|
|
|
bool varRateControl = (astrcmpi(rateControl, "CBR") == 0 ||
|
|
|
|
astrcmpi(rateControl, "VBR") == 0 ||
|
|
|
|
astrcmpi(rateControl, "ABR") == 0);
|
|
|
|
if (vbitrate == 0)
|
|
|
|
varRateControl = false;
|
|
|
|
|
|
|
|
ui->advRBMegsMax->setVisible(!varRateControl);
|
|
|
|
ui->advRBMegsMaxLabel->setVisible(!varRateControl);
|
|
|
|
|
|
|
|
if (varRateControl)
|
|
|
|
ui->advRBEstimate->setText(
|
|
|
|
QTStr(ESTIMATE_STR).arg(QString::number(int(memMB))));
|
|
|
|
else
|
|
|
|
ui->advRBEstimate->setText(QTStr(ESTIMATE_UNKNOWN_STR));
|
|
|
|
|
|
|
|
ui->advReplayBufferGroupBox->setVisible(!lossless &&
|
|
|
|
replayBufferEnabled);
|
|
|
|
ui->advReplayBuf->setEnabled(!lossless);
|
|
|
|
|
|
|
|
UpdateAutomaticReplayBufferCheckboxes();
|
2016-12-07 05:21:44 -08:00
|
|
|
}
|
|
|
|
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
#define SIMPLE_OUTPUT_WARNING(str) \
|
|
|
|
QTStr("Basic.Settings.Output.Simple.Warn." str)
|
|
|
|
|
|
|
|
void OBSBasicSettings::SimpleRecordingEncoderChanged()
|
|
|
|
{
|
|
|
|
QString qual = ui->simpleOutRecQuality->currentData().toString();
|
|
|
|
QString warning;
|
2020-11-11 09:48:39 -08:00
|
|
|
bool enforceBitrate = !ui->ignoreRecommended->isChecked();
|
2020-11-11 09:46:52 -08:00
|
|
|
OBSService service = GetStream1Service();
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
|
|
|
|
delete simpleOutRecWarning;
|
|
|
|
|
2016-04-10 03:12:25 -07:00
|
|
|
if (enforceBitrate && service) {
|
2021-11-26 22:25:39 +13:00
|
|
|
OBSDataAutoRelease videoSettings = obs_data_create();
|
|
|
|
OBSDataAutoRelease audioSettings = obs_data_create();
|
2016-04-10 03:12:25 -07:00
|
|
|
int oldVBitrate = ui->simpleOutputVBitrate->value();
|
|
|
|
int oldABitrate =
|
|
|
|
ui->simpleOutputABitrate->currentText().toInt();
|
|
|
|
obs_data_set_int(videoSettings, "bitrate", oldVBitrate);
|
|
|
|
obs_data_set_int(audioSettings, "bitrate", oldABitrate);
|
|
|
|
|
|
|
|
obs_service_apply_encoder_settings(service, videoSettings,
|
|
|
|
audioSettings);
|
|
|
|
|
|
|
|
int newVBitrate = obs_data_get_int(videoSettings, "bitrate");
|
|
|
|
int newABitrate = obs_data_get_int(audioSettings, "bitrate");
|
|
|
|
|
|
|
|
if (newVBitrate < oldVBitrate)
|
|
|
|
warning = SIMPLE_OUTPUT_WARNING("VideoBitrate")
|
|
|
|
.arg(newVBitrate);
|
|
|
|
if (newABitrate < oldABitrate) {
|
|
|
|
if (!warning.isEmpty())
|
|
|
|
warning += "\n\n";
|
|
|
|
warning += SIMPLE_OUTPUT_WARNING("AudioBitrate")
|
|
|
|
.arg(newABitrate);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (qual == "Lossless") {
|
|
|
|
if (!warning.isEmpty())
|
|
|
|
warning += "\n\n";
|
|
|
|
warning += SIMPLE_OUTPUT_WARNING("Lossless");
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
warning += "\n\n";
|
|
|
|
warning += SIMPLE_OUTPUT_WARNING("Encoder");
|
|
|
|
|
2016-04-10 03:12:25 -07:00
|
|
|
} else if (qual != "Stream") {
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
QString enc = ui->simpleOutRecEncoder->currentData().toString();
|
2016-04-23 16:02:58 -07:00
|
|
|
QString streamEnc =
|
|
|
|
ui->simpleOutStrEncoder->currentData().toString();
|
2016-04-23 16:26:33 -07:00
|
|
|
bool x264RecEnc = (enc == SIMPLE_ENCODER_X264 ||
|
|
|
|
enc == SIMPLE_ENCODER_X264_LOWCPU);
|
2016-04-23 16:02:58 -07:00
|
|
|
|
2016-04-23 16:26:33 -07:00
|
|
|
if (streamEnc == SIMPLE_ENCODER_X264 && x264RecEnc) {
|
2016-04-10 03:12:25 -07:00
|
|
|
if (!warning.isEmpty())
|
|
|
|
warning += "\n\n";
|
|
|
|
warning += SIMPLE_OUTPUT_WARNING("Encoder");
|
|
|
|
}
|
2019-07-07 15:47:29 -07:00
|
|
|
} else {
|
|
|
|
if (!warning.isEmpty())
|
|
|
|
warning += "\n\n";
|
|
|
|
warning += SIMPLE_OUTPUT_WARNING("CannotPause");
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
}
|
|
|
|
|
2019-07-06 08:56:18 -07:00
|
|
|
if (qual != "Lossless" &&
|
|
|
|
(ui->simpleOutRecFormat->currentText().compare("mp4") == 0 ||
|
|
|
|
ui->simpleOutRecFormat->currentText().compare("mov") == 0)) {
|
2017-02-04 18:47:44 +01:00
|
|
|
if (!warning.isEmpty())
|
|
|
|
warning += "\n\n";
|
|
|
|
warning += QTStr("OutputWarnings.MP4Recording");
|
2017-05-08 06:53:35 -05:00
|
|
|
ui->autoRemux->setText(
|
|
|
|
QTStr("Basic.Settings.Advanced.AutoRemux") + " " +
|
|
|
|
QTStr("Basic.Settings.Advanced.AutoRemux.MP4"));
|
|
|
|
} else {
|
|
|
|
ui->autoRemux->setText(
|
|
|
|
QTStr("Basic.Settings.Advanced.AutoRemux"));
|
2017-02-04 18:47:44 +01:00
|
|
|
}
|
|
|
|
|
2016-04-10 03:12:25 -07:00
|
|
|
if (warning.isEmpty())
|
|
|
|
return;
|
|
|
|
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
simpleOutRecWarning = new QLabel(warning, this);
|
|
|
|
simpleOutRecWarning->setObjectName("warningLabel");
|
|
|
|
simpleOutRecWarning->setWordWrap(true);
|
|
|
|
ui->simpleOutInfoLayout->addWidget(simpleOutRecWarning);
|
|
|
|
}
|
|
|
|
|
libobs: Add surround sound audio support
(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)
Adds surround sound audio support to the core, core plugins, and user
interface.
Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
(due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST: stereo plugins keep in general only the first two channels.
surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
(not implemented due to lack of usefulness)
Closes jp9000/obs-studio#968
2017-05-27 02:15:54 +02:00
|
|
|
void OBSBasicSettings::SurroundWarning(int idx)
|
|
|
|
{
|
|
|
|
if (idx == lastChannelSetupIdx || idx == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (loading) {
|
|
|
|
lastChannelSetupIdx = idx;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString speakerLayoutQstr = ui->channelSetup->itemText(idx);
|
|
|
|
bool surround = IsSurround(QT_TO_UTF8(speakerLayoutQstr));
|
|
|
|
|
|
|
|
QString lastQstr = ui->channelSetup->itemText(lastChannelSetupIdx);
|
|
|
|
bool wasSurround = IsSurround(QT_TO_UTF8(lastQstr));
|
|
|
|
|
|
|
|
if (surround && !wasSurround) {
|
|
|
|
QMessageBox::StandardButton button;
|
|
|
|
|
|
|
|
QString warningString = QTStr("Basic.Settings.ProgramRestart") +
|
|
|
|
QStringLiteral("\n\n") +
|
|
|
|
QTStr(MULTI_CHANNEL_WARNING) +
|
|
|
|
QStringLiteral("\n\n") +
|
|
|
|
QTStr(MULTI_CHANNEL_WARNING ".Confirm");
|
|
|
|
|
|
|
|
button = OBSMessageBox::question(
|
|
|
|
this, QTStr(MULTI_CHANNEL_WARNING ".Title"),
|
|
|
|
warningString);
|
|
|
|
|
|
|
|
if (button == QMessageBox::No) {
|
|
|
|
QMetaObject::invokeMethod(
|
|
|
|
ui->channelSetup, "setCurrentIndex",
|
|
|
|
Qt::QueuedConnection,
|
|
|
|
Q_ARG(int, lastChannelSetupIdx));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lastChannelSetupIdx = idx;
|
|
|
|
}
|
|
|
|
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
void OBSBasicSettings::SimpleRecordingQualityLosslessWarning(int idx)
|
|
|
|
{
|
|
|
|
if (idx == lastSimpleRecQualityIdx || idx == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
QString qual = ui->simpleOutRecQuality->itemData(idx).toString();
|
|
|
|
|
|
|
|
if (loading) {
|
|
|
|
lastSimpleRecQualityIdx = idx;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (qual == "Lossless") {
|
|
|
|
QMessageBox::StandardButton button;
|
|
|
|
|
|
|
|
QString warningString = SIMPLE_OUTPUT_WARNING("Lossless") +
|
|
|
|
QString("\n\n") +
|
|
|
|
SIMPLE_OUTPUT_WARNING("Lossless.Msg");
|
|
|
|
|
2017-05-13 14:06:32 -07:00
|
|
|
button = OBSMessageBox::question(
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
this, SIMPLE_OUTPUT_WARNING("Lossless.Title"),
|
2017-05-13 14:06:32 -07:00
|
|
|
warningString);
|
UI: Add recording presets to simple output
So certain high-profile individuals were complaining that it was
difficult to configure recording settings for quality in OBS. So, I
decided to add a very easy-to-use auto-configuration for high quality
encoding -- including lossless encoding. This feature will
automatically configure ideal recording settings based upon a specified
quality level.
Recording quality presets added to simple output:
- Same as stream: Copies the encoded streaming data with no extra usage
hit.
- High quality: uses a higher CRF value (starting at 23) if using x264.
- Indistinguishable quality: uses a low CRF value (starting at 16) if
using x264.
- Lossless will spawn an FFmpeg output that uses huffyuv encoding. If a
user tries to select lossless, they will be warned both via a dialog
prompt and a warning message in the settings window to ensure they
understand that it requires tremendous amounts of free space. It will
always use the AVI file format.
Extra Notes:
- When High/Indistinguishable quality is set, it will allow you to
select the recording encoder. Currently, it just allows you to select
x264 (at either veryfast or ultrafast). Later on, it'll be useful to
be able to set up pre-configured presets for hardware encoders once
more are implemented and tested.
- I decided to allow the use of x264 at both veryfast or ultrafast
presets. The reasoning is two-fold:
1.) ultrafast is perfectly viable even for near indistinguishable
quality as long as it has the appropriate CRF value. It's nice if you
want to record but would like to or need to reduce the impact of
encoding on the CPU. It will automatically compensate for the preset at
the cost of larger file size.
2.) It was suggested to just always use ultrafast, but ultrafast
requires 2-4x as much disk space for the same CRF (most likely due to
x264 compensating for the preset). Providing veryfast is important if
you really want to reduce file size and/or reduce blocking at lower
quality levels.
- When a recording preset is used, a secondary audio encoder is also
spawned at 192 bitrate to ensure high quality audio. I chose 192
because that's the limit of the media foundation aac encoder on
windows, which I want to make sure is used if available due to its
high performance.
- The CRF calculation is based upon resolution, quality, and whether
it's set to ultrafast. First, quality sets the base CRF, 23 for
"good" quality, 16 for "very high" quality. If set to ultrafast,
it'll subtract 2 points from the CRF value to help compensate. Lower
resolutions will also lower the CRF value to help improve higher
details with a smaller pixel ratio.
2015-09-18 22:29:36 -07:00
|
|
|
|
|
|
|
if (button == QMessageBox::No) {
|
|
|
|
QMetaObject::invokeMethod(
|
|
|
|
ui->simpleOutRecQuality, "setCurrentIndex",
|
|
|
|
Qt::QueuedConnection,
|
|
|
|
Q_ARG(int, lastSimpleRecQualityIdx));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lastSimpleRecQualityIdx = idx;
|
|
|
|
}
|
2016-01-25 17:09:59 -08:00
|
|
|
|
|
|
|
void OBSBasicSettings::on_disableOSXVSync_clicked()
|
|
|
|
{
|
|
|
|
#ifdef __APPLE__
|
|
|
|
if (!loading) {
|
|
|
|
bool disable = ui->disableOSXVSync->isChecked();
|
|
|
|
ui->resetOSXVSync->setEnabled(disable);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
2018-12-14 07:42:05 -06:00
|
|
|
|
2019-07-15 06:50:23 -05:00
|
|
|
QIcon OBSBasicSettings::GetGeneralIcon() const
|
|
|
|
{
|
|
|
|
return generalIcon;
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon OBSBasicSettings::GetStreamIcon() const
|
|
|
|
{
|
|
|
|
return streamIcon;
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon OBSBasicSettings::GetOutputIcon() const
|
|
|
|
{
|
|
|
|
return outputIcon;
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon OBSBasicSettings::GetAudioIcon() const
|
|
|
|
{
|
|
|
|
return audioIcon;
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon OBSBasicSettings::GetVideoIcon() const
|
|
|
|
{
|
|
|
|
return videoIcon;
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon OBSBasicSettings::GetHotkeysIcon() const
|
|
|
|
{
|
|
|
|
return hotkeysIcon;
|
|
|
|
}
|
|
|
|
|
|
|
|
QIcon OBSBasicSettings::GetAdvancedIcon() const
|
|
|
|
{
|
|
|
|
return advancedIcon;
|
|
|
|
}
|
|
|
|
|
2018-12-14 07:42:05 -06:00
|
|
|
void OBSBasicSettings::SetGeneralIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
ui->listWidget->item(0)->setIcon(icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SetStreamIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
ui->listWidget->item(1)->setIcon(icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SetOutputIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
ui->listWidget->item(2)->setIcon(icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SetAudioIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
ui->listWidget->item(3)->setIcon(icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SetVideoIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
ui->listWidget->item(4)->setIcon(icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SetHotkeysIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
ui->listWidget->item(5)->setIcon(icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
void OBSBasicSettings::SetAdvancedIcon(const QIcon &icon)
|
|
|
|
{
|
|
|
|
ui->listWidget->item(6)->setIcon(icon);
|
|
|
|
}
|
2019-07-23 07:20:13 -05:00
|
|
|
|
|
|
|
int OBSBasicSettings::CurrentFLVTrack()
|
|
|
|
{
|
|
|
|
if (ui->flvTrack1->isChecked())
|
|
|
|
return 1;
|
|
|
|
else if (ui->flvTrack2->isChecked())
|
|
|
|
return 2;
|
|
|
|
else if (ui->flvTrack3->isChecked())
|
|
|
|
return 3;
|
|
|
|
else if (ui->flvTrack4->isChecked())
|
|
|
|
return 4;
|
|
|
|
else if (ui->flvTrack5->isChecked())
|
|
|
|
return 5;
|
|
|
|
else if (ui->flvTrack6->isChecked())
|
|
|
|
return 6;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2020-11-13 09:21:24 -08:00
|
|
|
|
|
|
|
/* Using setEditable(true) on a QComboBox when there's a custom style in use
|
|
|
|
* does not work properly, so instead completely recreate the widget, which
|
|
|
|
* seems to work fine. */
|
|
|
|
void OBSBasicSettings::RecreateOutputResolutionWidget()
|
|
|
|
{
|
|
|
|
QSizePolicy sizePolicy = ui->outputResolution->sizePolicy();
|
2020-11-14 02:45:19 -08:00
|
|
|
bool changed = WidgetChanged(ui->outputResolution);
|
|
|
|
|
2020-11-13 09:21:24 -08:00
|
|
|
delete ui->outputResolution;
|
|
|
|
ui->outputResolution = new QComboBox(ui->videoPage);
|
|
|
|
ui->outputResolution->setObjectName(
|
|
|
|
QString::fromUtf8("outputResolution"));
|
|
|
|
ui->outputResolution->setSizePolicy(sizePolicy);
|
|
|
|
ui->outputResolution->setEditable(true);
|
2020-11-14 02:45:19 -08:00
|
|
|
ui->outputResolution->setProperty("changed", changed);
|
2020-11-13 09:21:24 -08:00
|
|
|
ui->outputResLabel->setBuddy(ui->outputResolution);
|
|
|
|
|
|
|
|
ui->outputResLayout->insertWidget(0, ui->outputResolution);
|
|
|
|
|
|
|
|
QWidget::setTabOrder(ui->baseResolution, ui->outputResolution);
|
|
|
|
QWidget::setTabOrder(ui->outputResolution, ui->downscaleFilter);
|
|
|
|
|
|
|
|
HookWidget(ui->outputResolution, CBEDIT_CHANGED, VIDEO_RES);
|
|
|
|
|
|
|
|
connect(ui->outputResolution, &QComboBox::editTextChanged, this,
|
|
|
|
&OBSBasicSettings::on_outputResolution_editTextChanged);
|
|
|
|
|
|
|
|
ui->outputResolution->lineEdit()->setValidator(
|
|
|
|
ui->baseResolution->lineEdit()->validator());
|
|
|
|
}
|