2013-12-11 20:50:10 -08:00
|
|
|
|
/******************************************************************************
|
2014-03-07 11:56:31 -08:00
|
|
|
|
Copyright (C) 2013-2014 by Hugh Bailey <obs.jim@gmail.com>
|
2015-02-16 23:45:34 -08:00
|
|
|
|
Philippe Groarke <philippe.groarke@gmail.com>
|
2013-12-11 20:50:10 -08: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 19:14:19 -08:00
|
|
|
|
#include <obs.hpp>
|
2014-01-26 14:36:15 -08:00
|
|
|
|
#include <util/util.hpp>
|
|
|
|
|
#include <util/lexer.h>
|
|
|
|
|
#include <sstream>
|
|
|
|
|
#include <QLineEdit>
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
#include <QCloseEvent>
|
2014-05-20 23:27:27 -07:00
|
|
|
|
#include <QFileDialog>
|
2015-02-16 23:45:34 -08:00
|
|
|
|
#include <QDirIterator>
|
2015-03-28 00:21:16 -07:00
|
|
|
|
#include <QVariant>
|
|
|
|
|
#include <QTreeView>
|
|
|
|
|
#include <QStandardItemModel>
|
2014-11-01 13:50:36 -07:00
|
|
|
|
#include <QSpacerItem>
|
2014-01-26 14:36:15 -08:00
|
|
|
|
|
2014-11-01 13:50:36 -07:00
|
|
|
|
#include "hotkey-edit.hpp"
|
|
|
|
|
#include "source-label.hpp"
|
2014-01-25 08:08:56 -08:00
|
|
|
|
#include "obs-app.hpp"
|
2014-01-26 14:36:15 -08: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 14:36:15 -08:00
|
|
|
|
#include "qt-wrappers.hpp"
|
2014-02-22 19:14:19 -08:00
|
|
|
|
#include "window-basic-main.hpp"
|
2013-12-28 20:51:18 -08:00
|
|
|
|
#include "window-basic-settings.hpp"
|
2013-12-10 20:14:20 -08:00
|
|
|
|
|
2014-01-26 14:36:15 -08:00
|
|
|
|
#include <util/platform.h>
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
2015-03-28 00:21:16 -07:00
|
|
|
|
// Used for QVariant in codec comboboxes
|
|
|
|
|
namespace {
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
|
if ((name == nullptr) ^ (f.name == nullptr))
|
|
|
|
|
return false;
|
|
|
|
|
if (name != nullptr && strcmp(name, f.name) != 0)
|
|
|
|
|
return false;
|
|
|
|
|
if ((mimeType == nullptr) ^ (f.mimeType == nullptr))
|
|
|
|
|
return false;
|
|
|
|
|
if (mimeType != nullptr && strcmp(mimeType, f.mimeType) != 0)
|
|
|
|
|
return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
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 ((name == nullptr) ^ (codecDesc.name == nullptr))
|
|
|
|
|
return false;
|
|
|
|
|
if (id != codecDesc.id)
|
|
|
|
|
return false;
|
|
|
|
|
return name == nullptr || strcmp(name, codecDesc.name) == 0;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
Q_DECLARE_METATYPE(FormatDesc)
|
|
|
|
|
Q_DECLARE_METATYPE(CodecDesc)
|
|
|
|
|
|
2014-01-26 14:36:15 -08: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;
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline void SetComboByValue(QComboBox *combo, const char *name)
|
|
|
|
|
{
|
|
|
|
|
int idx = combo->findData(QT_UTF8(name));
|
|
|
|
|
if (idx != -1)
|
|
|
|
|
combo->setCurrentIndex(idx);
|
|
|
|
|
}
|
|
|
|
|
|
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 00:21:16 -07: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
|
|
|
|
|
|
2014-03-07 11:56:31 -08: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 11:56:31 -08: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 11:56:31 -08:00
|
|
|
|
#define CBEDIT_CHANGED SIGNAL(editTextChanged(const QString &))
|
2014-07-03 18:07:33 -07:00
|
|
|
|
#define CHECK_CHANGED SIGNAL(clicked(bool))
|
2014-03-07 11:56:31 -08:00
|
|
|
|
#define SCROLL_CHANGED SIGNAL(valueChanged(int))
|
|
|
|
|
|
|
|
|
|
#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 21:34:49 -08:00
|
|
|
|
#define AUDIO_RESTART SLOT(AudioChangedRestart())
|
|
|
|
|
#define AUDIO_CHANGED SLOT(AudioChanged())
|
2014-03-07 11:56:31 -08: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())
|
2014-03-07 11:56:31 -08:00
|
|
|
|
|
2014-01-24 20:19:50 -08: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 20:50:10 -08:00
|
|
|
|
{
|
2014-01-26 14:36:15 -08:00
|
|
|
|
string path;
|
|
|
|
|
|
2014-01-24 20:19:50 -08:00
|
|
|
|
ui->setupUi(this);
|
2014-01-25 08:08:56 -08:00
|
|
|
|
|
2014-10-29 09:18:00 -07:00
|
|
|
|
ui->listWidget->setAttribute(Qt::WA_MacShowFocusRect, false);
|
|
|
|
|
|
2015-05-21 12:33:09 -07:00
|
|
|
|
auto policy = ui->audioSourceScrollArea->sizePolicy();
|
|
|
|
|
policy.setVerticalStretch(true);
|
|
|
|
|
ui->audioSourceScrollArea->setSizePolicy(policy);
|
|
|
|
|
|
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-16 23:45:34 -08:00
|
|
|
|
HookWidget(ui->theme, COMBO_CHANGED, GENERAL_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);
|
2015-02-07 08:09:57 -08:00
|
|
|
|
HookWidget(ui->streamType, COMBO_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->simpleOutputPath, EDIT_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
|
HookWidget(ui->simpleOutputVBitrate, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
|
HookWidget(ui->simpleOutputABitrate, COMBO_CHANGED, OUTPUTS_CHANGED);
|
2014-07-03 18:07:33 -07:00
|
|
|
|
HookWidget(ui->simpleOutReconnect, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
|
HookWidget(ui->simpleOutRetryDelay, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
|
HookWidget(ui->simpleOutMaxRetries, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
2014-08-25 07:48:51 -07:00
|
|
|
|
HookWidget(ui->simpleOutAdvanced, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2014-09-24 20:23:42 -07:00
|
|
|
|
HookWidget(ui->simpleOutUseCBR, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2014-08-25 07:48:51 -07:00
|
|
|
|
HookWidget(ui->simpleOutPreset, COMBO_CHANGED, OUTPUTS_CHANGED);
|
2015-02-06 03:56:19 -08:00
|
|
|
|
HookWidget(ui->simpleOutUseBufsize, CHECK_CHANGED, OUTPUTS_CHANGED);
|
2015-01-26 13:41:22 -08:00
|
|
|
|
HookWidget(ui->simpleOutPreset, COMBO_CHANGED, OUTPUTS_CHANGED);
|
2015-02-06 03:56:19 -08:00
|
|
|
|
HookWidget(ui->simpleOutVBufsize, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
2015-02-10 19:38:59 -08:00
|
|
|
|
HookWidget(ui->simpleOutCustom, EDIT_CHANGED, OUTPUTS_CHANGED);
|
2015-01-26 13:41:22 -08:00
|
|
|
|
HookWidget(ui->advOutReconnect, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
|
HookWidget(ui->advOutRetryDelay, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
|
HookWidget(ui->advOutMaxRetries, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
|
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);
|
2015-02-10 20:06:00 -08:00
|
|
|
|
HookWidget(ui->advOutApplyService, 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);
|
|
|
|
|
HookWidget(ui->advOutRecEncoder, COMBO_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
|
HookWidget(ui->advOutRecUseRescale, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
|
HookWidget(ui->advOutRecRescale, CBEDIT_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
|
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);
|
|
|
|
|
HookWidget(ui->advOutFFURL, EDIT_CHANGED, OUTPUTS_CHANGED);
|
2015-03-28 00:21:16 -07:00
|
|
|
|
HookWidget(ui->advOutFFFormat, COMBO_CHANGED, OUTPUTS_CHANGED);
|
2015-01-26 13:41:22 -08:00
|
|
|
|
HookWidget(ui->advOutFFVBitrate, SCROLL_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
|
HookWidget(ui->advOutFFUseRescale, CHECK_CHANGED, OUTPUTS_CHANGED);
|
|
|
|
|
HookWidget(ui->advOutFFRescale, CBEDIT_CHANGED, OUTPUTS_CHANGED);
|
2015-03-28 00:21:16 -07: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);
|
2015-03-28 00:21:16 -07: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);
|
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);
|
|
|
|
|
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);
|
|
|
|
|
HookWidget(ui->renderer, COMBO_CHANGED, VIDEO_RESTART);
|
|
|
|
|
HookWidget(ui->adapter, COMBO_CHANGED, VIDEO_RESTART);
|
|
|
|
|
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->fpsInteger, SCROLL_CHANGED, VIDEO_CHANGED);
|
|
|
|
|
HookWidget(ui->fpsNumerator, SCROLL_CHANGED, VIDEO_CHANGED);
|
|
|
|
|
HookWidget(ui->fpsDenominator, SCROLL_CHANGED, VIDEO_CHANGED);
|
2015-02-11 12:55:06 -08:00
|
|
|
|
HookWidget(ui->audioBufferingTime, SCROLL_CHANGED, ADV_RESTART);
|
|
|
|
|
HookWidget(ui->colorFormat, COMBO_CHANGED, ADV_CHANGED);
|
|
|
|
|
HookWidget(ui->colorSpace, COMBO_CHANGED, ADV_CHANGED);
|
|
|
|
|
HookWidget(ui->colorRange, COMBO_CHANGED, ADV_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
|
|
|
|
|
2015-05-25 01:37:13 -07:00
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
uint32_t winVer = GetWindowsVersion();
|
|
|
|
|
if (winVer > 0 && winVer < 0x602) {
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2014-05-09 15:04:39 -07:00
|
|
|
|
//Apply button disabled until change.
|
|
|
|
|
EnableApplyButton(false);
|
|
|
|
|
|
2015-03-28 00:21:16 -07:00
|
|
|
|
// Initialize libff library
|
|
|
|
|
ff_init();
|
|
|
|
|
|
2014-11-01 13:48:58 -07:00
|
|
|
|
installEventFilter(CreateShortcutFilter());
|
|
|
|
|
|
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
|
|
|
|
LoadServiceTypes();
|
2015-01-26 13:41:22 -08:00
|
|
|
|
LoadEncoderTypes();
|
2015-02-11 12:55:06 -08:00
|
|
|
|
LoadColorRanges();
|
2015-03-28 00:21:16 -07:00
|
|
|
|
LoadFormats();
|
2014-11-01 13:50:36 -07:00
|
|
|
|
|
2015-04-30 22:07:42 -07: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"));
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
2014-11-01 13:50:36 -07: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);
|
|
|
|
|
|
2014-01-26 14:36:15 -08:00
|
|
|
|
LoadSettings(false);
|
|
|
|
|
}
|
|
|
|
|
|
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());
|
|
|
|
|
}
|
|
|
|
|
|
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::LoadServiceTypes()
|
|
|
|
|
{
|
|
|
|
|
const char *type;
|
|
|
|
|
size_t idx = 0;
|
|
|
|
|
|
|
|
|
|
while (obs_enum_service_types(idx++, &type)) {
|
2014-08-04 08:41:15 -07:00
|
|
|
|
const char *name = obs_service_get_display_name(type);
|
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
|
|
|
|
QString qName = QT_UTF8(name);
|
|
|
|
|
QString qType = QT_UTF8(type);
|
|
|
|
|
|
|
|
|
|
ui->streamType->addItem(qName, qType);
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-07 08:19:34 -08:00
|
|
|
|
type = obs_service_get_type(main->GetService());
|
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
|
|
|
|
SetComboByValue(ui->streamType, type);
|
|
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
if (strcmp(codec, "h264") != 0)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
QString qName = QT_UTF8(name);
|
|
|
|
|
QString qType = QT_UTF8(type);
|
|
|
|
|
|
|
|
|
|
ui->advOutEncoder->addItem(qName, qType);
|
|
|
|
|
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");
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-28 00:21:16 -07: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 20:34:55 -07:00
|
|
|
|
ui->advOutFFFormat->blockSignals(true);
|
|
|
|
|
|
2015-03-28 00:21:16 -07: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(itemText,
|
|
|
|
|
qVariantFromValue(formatDesc));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
format = ff_format_desc_next(format);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ui->advOutFFFormat->model()->sort(0);
|
|
|
|
|
|
|
|
|
|
ui->advOutFFFormat->insertItem(0, AV_FORMAT_DEFAULT_STR);
|
2015-04-26 20:34:55 -07:00
|
|
|
|
|
|
|
|
|
ui->advOutFFFormat->blockSignals(false);
|
2015-03-28 00:21:16 -07: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));
|
|
|
|
|
|
|
|
|
|
combo->addItem(itemText, qVariantFromValue(cd));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#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),
|
|
|
|
|
qVariantFromValue(cd));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#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;
|
|
|
|
|
|
|
|
|
|
OBSFFCodecDesc codecDescs(ff_codec_supported(formatDesc));
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
QVariant disable = qVariantFromValue(CodecDesc());
|
|
|
|
|
|
|
|
|
|
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 14:36:15 -08:00
|
|
|
|
void OBSBasicSettings::LoadLanguageList()
|
|
|
|
|
{
|
2014-07-11 11:35:04 -07:00
|
|
|
|
const char *currentLang = App()->GetLocale();
|
2014-01-26 14:36:15 -08:00
|
|
|
|
|
|
|
|
|
ui->language->clear();
|
|
|
|
|
|
2014-07-11 11:12:32 -07:00
|
|
|
|
for (const auto &locale : GetLocaleNames()) {
|
2014-01-26 14:36:15 -08:00
|
|
|
|
int idx = ui->language->count();
|
|
|
|
|
|
2014-07-11 11:12:32 -07:00
|
|
|
|
ui->language->addItem(QT_UTF8(locale.second.c_str()),
|
|
|
|
|
QT_UTF8(locale.first.c_str()));
|
2014-01-26 14:36:15 -08:00
|
|
|
|
|
2014-07-11 11:12:32 -07:00
|
|
|
|
if (locale.first == currentLang)
|
2014-01-26 14:36:15 -08:00
|
|
|
|
ui->language->setCurrentIndex(idx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ui->language->model()->sort(0);
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-16 23:45:34 -08: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-16 23:45:34 -08: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();
|
|
|
|
|
QString name = it.fileName().section(".",0,0);
|
|
|
|
|
ui->theme->addItem(name);
|
|
|
|
|
uniqueSet.insert(name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Check shipped themes. */
|
|
|
|
|
QDirIterator uIt(QString(themeDir.c_str()), QStringList() << "*.qss",
|
|
|
|
|
QDir::Files);
|
|
|
|
|
while (uIt.hasNext()) {
|
|
|
|
|
uIt.next();
|
|
|
|
|
QString name = uIt.fileName().section(".",0,0);
|
|
|
|
|
if (!uniqueSet.contains(name))
|
|
|
|
|
ui->theme->addItem(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int idx = ui->theme->findText(App()->GetTheme());
|
|
|
|
|
if (idx != -1)
|
|
|
|
|
ui->theme->setCurrentIndex(idx);
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-26 14:36:15 -08:00
|
|
|
|
void OBSBasicSettings::LoadGeneralSettings()
|
|
|
|
|
{
|
|
|
|
|
loading = true;
|
|
|
|
|
|
|
|
|
|
LoadLanguageList();
|
2015-02-16 23:45:34 -08:00
|
|
|
|
LoadThemeList();
|
2014-01-26 14:36:15 -08:00
|
|
|
|
|
|
|
|
|
loading = false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-07 08:09:57 -08:00
|
|
|
|
void OBSBasicSettings::LoadStream1Settings()
|
|
|
|
|
{
|
|
|
|
|
QLayout *layout = ui->streamContainer->layout();
|
|
|
|
|
obs_service_t *service = main->GetService();
|
2015-02-07 08:19:34 -08:00
|
|
|
|
const char *type = obs_service_get_type(service);
|
2015-02-07 08:09:57 -08:00
|
|
|
|
|
|
|
|
|
loading = true;
|
|
|
|
|
|
|
|
|
|
obs_data_t *settings = obs_service_get_settings(service);
|
|
|
|
|
|
|
|
|
|
delete streamProperties;
|
|
|
|
|
streamProperties = new OBSPropertiesView(settings, type,
|
|
|
|
|
(PropertiesReloadCallback)obs_get_service_properties,
|
|
|
|
|
170);
|
|
|
|
|
|
|
|
|
|
streamProperties->setProperty("changed", QVariant(false));
|
|
|
|
|
layout->addWidget(streamProperties);
|
|
|
|
|
|
|
|
|
|
QObject::connect(streamProperties, SIGNAL(Changed()),
|
|
|
|
|
this, STREAM1_CHANGED);
|
|
|
|
|
|
|
|
|
|
obs_data_release(settings);
|
|
|
|
|
|
|
|
|
|
loading = false;
|
|
|
|
|
|
|
|
|
|
if (main->StreamingActive()) {
|
|
|
|
|
ui->streamType->setEnabled(false);
|
|
|
|
|
ui->streamContainer->setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-26 14:36:15 -08:00
|
|
|
|
void OBSBasicSettings::LoadRendererList()
|
|
|
|
|
{
|
|
|
|
|
const char *renderer = config_get_string(GetGlobalConfig(), "Video",
|
|
|
|
|
"Renderer");
|
|
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
ui->renderer->addItem(QT_UTF8("Direct3D 11"));
|
|
|
|
|
#endif
|
|
|
|
|
ui->renderer->addItem(QT_UTF8("OpenGL"));
|
|
|
|
|
|
|
|
|
|
int idx = ui->renderer->findText(QT_UTF8(renderer));
|
|
|
|
|
if (idx == -1)
|
|
|
|
|
idx = 0;
|
|
|
|
|
|
|
|
|
|
ui->renderer->setCurrentIndex(idx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(MonitorInfo);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
2015-02-08 01:29:15 -08:00
|
|
|
|
void OBSBasicSettings::ResetDownscales(uint32_t cx, uint32_t cy,
|
|
|
|
|
uint32_t out_cx, uint32_t out_cy)
|
2014-01-26 14:36:15 -08:00
|
|
|
|
{
|
2015-01-26 13:41:22 -08:00
|
|
|
|
QString advRescale;
|
|
|
|
|
QString advRecRescale;
|
|
|
|
|
QString advFFRescale;
|
|
|
|
|
|
|
|
|
|
advRescale = ui->advOutRescale->lineEdit()->text();
|
|
|
|
|
advRecRescale = ui->advOutRecRescale->lineEdit()->text();
|
|
|
|
|
advFFRescale = ui->advOutFFRescale->lineEdit()->text();
|
|
|
|
|
|
2014-02-23 15:27:19 -08:00
|
|
|
|
ui->outputResolution->clear();
|
2015-01-26 13:41:22 -08:00
|
|
|
|
ui->advOutRescale->clear();
|
|
|
|
|
ui->advOutRecRescale->clear();
|
|
|
|
|
ui->advOutFFRescale->clear();
|
2014-02-23 15:27:19 -08:00
|
|
|
|
|
2014-01-26 14:36:15 -08: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 14:36:15 -08:00
|
|
|
|
|
2015-02-08 01:31:02 -08:00
|
|
|
|
downscaleCX &= 0xFFFFFFFC;
|
|
|
|
|
downscaleCY &= 0xFFFFFFFE;
|
|
|
|
|
outDownscaleCX &= 0xFFFFFFFE;
|
|
|
|
|
outDownscaleCY &= 0xFFFFFFFE;
|
|
|
|
|
|
2014-01-26 14:36:15 -08:00
|
|
|
|
string res = ResString(downscaleCX, downscaleCY);
|
2015-02-08 01:29:15 -08:00
|
|
|
|
string outRes = ResString(outDownscaleCX, outDownscaleCY);
|
2014-01-26 14:36:15 -08:00
|
|
|
|
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());
|
2014-01-26 14:36:15 -08:00
|
|
|
|
}
|
|
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
|
string res = ResString(cx, cy);
|
|
|
|
|
|
|
|
|
|
ui->outputResolution->lineEdit()->setText(res.c_str());
|
|
|
|
|
|
|
|
|
|
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);
|
2014-01-26 14:36:15 -08:00
|
|
|
|
}
|
|
|
|
|
|
2014-12-15 01:08:46 -08:00
|
|
|
|
void OBSBasicSettings::LoadDownscaleFilters()
|
|
|
|
|
{
|
|
|
|
|
ui->downscaleFilter->addItem(
|
|
|
|
|
QTStr("Basic.Settings.Video.DownscaleFilter.Bilinear"),
|
|
|
|
|
QT_UTF8("bilinear"));
|
|
|
|
|
ui->downscaleFilter->addItem(
|
|
|
|
|
QTStr("Basic.Settings.Video.DownscaleFilter.Bicubic"),
|
|
|
|
|
QT_UTF8("bicubic"));
|
|
|
|
|
ui->downscaleFilter->addItem(
|
|
|
|
|
QTStr("Basic.Settings.Video.DownscaleFilter.Lanczos"),
|
|
|
|
|
QT_UTF8("lanczos"));
|
|
|
|
|
|
|
|
|
|
const char *scaleType = config_get_string(main->Config(),
|
|
|
|
|
"Video", "ScaleType");
|
|
|
|
|
|
|
|
|
|
if (astrcmpi(scaleType, "bilinear") == 0)
|
|
|
|
|
ui->downscaleFilter->setCurrentIndex(0);
|
|
|
|
|
else if (astrcmpi(scaleType, "lanczos") == 0)
|
|
|
|
|
ui->downscaleFilter->setCurrentIndex(2);
|
|
|
|
|
else
|
|
|
|
|
ui->downscaleFilter->setCurrentIndex(1);
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-26 14:36:15 -08:00
|
|
|
|
void OBSBasicSettings::LoadResolutionLists()
|
|
|
|
|
{
|
2014-03-06 20:08:12 -08: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 14:36:15 -08:00
|
|
|
|
vector<MonitorInfo> monitors;
|
|
|
|
|
|
|
|
|
|
ui->baseResolution->clear();
|
|
|
|
|
|
|
|
|
|
GetMonitors(monitors);
|
|
|
|
|
|
|
|
|
|
for (MonitorInfo &monitor : monitors) {
|
|
|
|
|
string res = ResString(monitor.cx, monitor.cy);
|
|
|
|
|
ui->baseResolution->addItem(res.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-08 01:29:15 -08:00
|
|
|
|
ResetDownscales(cx, cy, out_cx, out_cy);
|
2014-01-26 14:36:15 -08:00
|
|
|
|
|
2014-02-22 19:14:19 -08:00
|
|
|
|
ui->baseResolution->lineEdit()->setText(ResString(cx, cy).c_str());
|
2015-02-08 01:29:15 -08:00
|
|
|
|
ui->outputResolution->lineEdit()->setText(
|
|
|
|
|
ResString(out_cx, out_cy).c_str());
|
2014-01-26 14:36:15 -08:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-06 20:08:12 -08:00
|
|
|
|
static inline void LoadFPSCommon(OBSBasic *main, Ui::OBSBasicSettings *ui)
|
2014-01-26 14:36:15 -08:00
|
|
|
|
{
|
2014-03-06 20:08:12 -08:00
|
|
|
|
const char *val = config_get_string(main->Config(), "Video",
|
2014-01-26 14:36:15 -08:00
|
|
|
|
"FPSCommon");
|
|
|
|
|
|
|
|
|
|
int idx = ui->fpsCommon->findText(val);
|
|
|
|
|
if (idx == -1) idx = 3;
|
|
|
|
|
ui->fpsCommon->setCurrentIndex(idx);
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-06 20:08:12 -08:00
|
|
|
|
static inline void LoadFPSInteger(OBSBasic *main, Ui::OBSBasicSettings *ui)
|
2014-01-26 14:36:15 -08:00
|
|
|
|
{
|
2014-03-06 20:08:12 -08:00
|
|
|
|
uint32_t val = config_get_uint(main->Config(), "Video", "FPSInt");
|
2014-01-26 14:36:15 -08:00
|
|
|
|
ui->fpsInteger->setValue(val);
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-06 20:08:12 -08:00
|
|
|
|
static inline void LoadFPSFraction(OBSBasic *main, Ui::OBSBasicSettings *ui)
|
2014-01-26 14:36:15 -08:00
|
|
|
|
{
|
2014-03-06 20:08:12 -08:00
|
|
|
|
uint32_t num = config_get_uint(main->Config(), "Video", "FPSNum");
|
|
|
|
|
uint32_t den = config_get_uint(main->Config(), "Video", "FPSDen");
|
2014-01-26 14:36:15 -08:00
|
|
|
|
|
|
|
|
|
ui->fpsNumerator->setValue(num);
|
|
|
|
|
ui->fpsDenominator->setValue(den);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadFPSData()
|
|
|
|
|
{
|
2014-03-06 20:08:12 -08:00
|
|
|
|
LoadFPSCommon(main, ui.get());
|
|
|
|
|
LoadFPSInteger(main, ui.get());
|
|
|
|
|
LoadFPSFraction(main, ui.get());
|
2014-01-26 14:36:15 -08:00
|
|
|
|
|
2014-03-06 20:08:12 -08:00
|
|
|
|
uint32_t fpsType = config_get_uint(main->Config(), "Video",
|
2014-01-28 23:40:04 -08:00
|
|
|
|
"FPSType");
|
|
|
|
|
if (fpsType > 2) fpsType = 0;
|
2014-01-26 14:36:15 -08:00
|
|
|
|
|
|
|
|
|
ui->fpsType->setCurrentIndex(fpsType);
|
|
|
|
|
ui->fpsTypes->setCurrentIndex(fpsType);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadVideoSettings()
|
|
|
|
|
{
|
|
|
|
|
loading = true;
|
|
|
|
|
|
2014-08-04 09:09:02 -07:00
|
|
|
|
if (video_output_active(obs_get_video())) {
|
2014-02-22 19:14:19 -08:00
|
|
|
|
ui->videoPage->setEnabled(false);
|
2014-05-10 18:47:48 -07:00
|
|
|
|
ui->videoMsg->setText(
|
|
|
|
|
QTStr("Basic.Settings.Video.CurrentlyActive"));
|
2014-02-22 19:14:19 -08:00
|
|
|
|
}
|
|
|
|
|
|
2014-01-26 14:36:15 -08:00
|
|
|
|
LoadRendererList();
|
|
|
|
|
LoadResolutionLists();
|
|
|
|
|
LoadFPSData();
|
2014-12-15 01:08:46 -08:00
|
|
|
|
LoadDownscaleFilters();
|
2014-01-26 14:36:15 -08: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 14:36:15 -08:00
|
|
|
|
loading = 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",
|
2014-05-20 23:27:27 -07:00
|
|
|
|
"FilePath");
|
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",
|
2014-03-10 13:10:35 -07:00
|
|
|
|
"VBitrate");
|
2015-02-06 03:56:19 -08:00
|
|
|
|
int videoBufsize = config_get_uint(main->Config(), "SimpleOutput",
|
2015-04-04 13:14:37 -07:00
|
|
|
|
"VBufsize");
|
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",
|
2014-03-10 13:10:35 -07:00
|
|
|
|
"ABitrate");
|
2014-07-03 18:07:33 -07:00
|
|
|
|
bool reconnect = config_get_bool(main->Config(), "SimpleOutput",
|
|
|
|
|
"Reconnect");
|
|
|
|
|
int retryDelay = config_get_uint(main->Config(), "SimpleOutput",
|
|
|
|
|
"RetryDelay");
|
|
|
|
|
int maxRetries = config_get_uint(main->Config(), "SimpleOutput",
|
|
|
|
|
"MaxRetries");
|
2014-08-25 07:48:51 -07:00
|
|
|
|
bool advanced = config_get_bool(main->Config(), "SimpleOutput",
|
|
|
|
|
"UseAdvanced");
|
2014-09-24 20:23:42 -07:00
|
|
|
|
bool useCBR = config_get_bool(main->Config(), "SimpleOutput",
|
|
|
|
|
"UseCBR");
|
2015-02-06 03:56:19 -08:00
|
|
|
|
bool useBufsize = config_get_bool(main->Config(), "SimpleOutput",
|
|
|
|
|
"UseBufsize");
|
2014-08-25 07:48:51 -07:00
|
|
|
|
const char *preset = config_get_string(main->Config(), "SimpleOutput",
|
|
|
|
|
"Preset");
|
|
|
|
|
const char *custom = config_get_string(main->Config(), "SimpleOutput",
|
|
|
|
|
"x264Settings");
|
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
|
|
|
|
ui->simpleOutputPath->setText(path);
|
|
|
|
|
ui->simpleOutputVBitrate->setValue(videoBitrate);
|
2015-02-06 03:56:19 -08:00
|
|
|
|
ui->simpleOutUseBufsize->setChecked(useBufsize);
|
|
|
|
|
ui->simpleOutVBufsize->setValue(
|
|
|
|
|
useBufsize ? videoBufsize : videoBitrate);
|
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
|
|
|
|
|
|
|
|
|
ui->simpleOutReconnect->setChecked(reconnect);
|
|
|
|
|
ui->simpleOutRetryDelay->setValue(retryDelay);
|
|
|
|
|
ui->simpleOutMaxRetries->setValue(maxRetries);
|
2014-08-25 07:48:51 -07:00
|
|
|
|
ui->simpleOutAdvanced->setChecked(advanced);
|
2014-09-24 20:23:42 -07:00
|
|
|
|
ui->simpleOutUseCBR->setChecked(useCBR);
|
2014-08-25 07:48:51 -07:00
|
|
|
|
ui->simpleOutPreset->setCurrentText(preset);
|
2015-01-18 06:29:24 -08:00
|
|
|
|
ui->simpleOutCustom->setText(custom);
|
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 reconnect = config_get_bool(main->Config(), "AdvOut",
|
|
|
|
|
"Reconnect");
|
|
|
|
|
int retryDelay = config_get_int(main->Config(), "AdvOut",
|
|
|
|
|
"RetryDelay");
|
|
|
|
|
int maxRetries = config_get_int(main->Config(), "AdvOut",
|
|
|
|
|
"MaxRetries");
|
|
|
|
|
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");
|
2015-02-10 20:06:00 -08:00
|
|
|
|
bool applyServiceSettings = config_get_bool(main->Config(), "AdvOut",
|
|
|
|
|
"ApplyServiceSettings");
|
2015-01-26 13:41:22 -08:00
|
|
|
|
|
|
|
|
|
ui->advOutReconnect->setChecked(reconnect);
|
|
|
|
|
ui->advOutRetryDelay->setValue(retryDelay);
|
|
|
|
|
ui->advOutMaxRetries->setValue(maxRetries);
|
2015-02-10 20:06:00 -08:00
|
|
|
|
ui->advOutApplyService->setChecked(applyServiceSettings);
|
2015-01-26 13:41:22 -08:00
|
|
|
|
ui->advOutUseRescale->setChecked(rescale);
|
2015-03-27 23:01:55 -07:00
|
|
|
|
ui->advOutRescale->setEnabled(rescale);
|
2015-01-26 13:41:22 -08:00
|
|
|
|
ui->advOutRescale->setCurrentText(rescaleRes);
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OBSPropertiesView *OBSBasicSettings::CreateEncoderPropertyView(
|
|
|
|
|
const char *encoder, const char *path, bool changed)
|
|
|
|
|
{
|
|
|
|
|
obs_data_t *settings = obs_encoder_defaults(encoder);
|
|
|
|
|
OBSPropertiesView *view;
|
|
|
|
|
|
|
|
|
|
char encoderJsonPath[512];
|
2015-06-01 16:11:57 -07:00
|
|
|
|
int ret = GetConfigPath(encoderJsonPath, sizeof(encoderJsonPath),
|
2015-01-26 13:41:22 -08:00
|
|
|
|
path);
|
|
|
|
|
if (ret > 0) {
|
|
|
|
|
BPtr<char> jsonData = os_quick_read_utf8_file(encoderJsonPath);
|
|
|
|
|
if (!!jsonData) {
|
|
|
|
|
obs_data_t *data = obs_data_create_from_json(jsonData);
|
|
|
|
|
obs_data_apply(settings, data);
|
|
|
|
|
obs_data_release(data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
view = new OBSPropertiesView(settings, encoder,
|
|
|
|
|
(PropertiesReloadCallback)obs_get_encoder_properties,
|
|
|
|
|
170);
|
|
|
|
|
view->setFrameShape(QFrame::StyledPanel);
|
|
|
|
|
view->setProperty("changed", QVariant(changed));
|
|
|
|
|
QObject::connect(view, SIGNAL(Changed()), this, SLOT(OutputsChanged()));
|
|
|
|
|
|
|
|
|
|
obs_data_release(settings);
|
|
|
|
|
return view;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadAdvOutputStreamingEncoderProperties()
|
|
|
|
|
{
|
|
|
|
|
const char *encoder = config_get_string(main->Config(), "AdvOut",
|
|
|
|
|
"Encoder");
|
|
|
|
|
|
|
|
|
|
delete streamEncoderProps;
|
|
|
|
|
streamEncoderProps = CreateEncoderPropertyView(encoder,
|
|
|
|
|
"obs-studio/basic/streamEncoder.json");
|
|
|
|
|
ui->advOutputStreamTab->layout()->addWidget(streamEncoderProps);
|
|
|
|
|
|
|
|
|
|
SetComboByValue(ui->advOutEncoder, encoder);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadAdvOutputRecordingSettings()
|
|
|
|
|
{
|
|
|
|
|
const char *type = config_get_string(main->Config(), "AdvOut",
|
|
|
|
|
"RecType");
|
|
|
|
|
const char *path = config_get_string(main->Config(), "AdvOut",
|
|
|
|
|
"RecFilePath");
|
|
|
|
|
bool rescale = config_get_bool(main->Config(), "AdvOut",
|
|
|
|
|
"RecRescale");
|
|
|
|
|
const char *rescaleRes = config_get_string(main->Config(), "AdvOut",
|
|
|
|
|
"RecRescaleRes");
|
|
|
|
|
int trackIndex = config_get_int(main->Config(), "AdvOut",
|
|
|
|
|
"RecTrackIndex");
|
|
|
|
|
|
|
|
|
|
int typeIndex = (astrcmpi(type, "FFmpeg") == 0) ? 1 : 0;
|
|
|
|
|
ui->advOutRecType->setCurrentIndex(typeIndex);
|
|
|
|
|
ui->advOutRecPath->setText(path);
|
|
|
|
|
ui->advOutRecUseRescale->setChecked(rescale);
|
|
|
|
|
ui->advOutRecRescale->setCurrentText(rescaleRes);
|
|
|
|
|
|
|
|
|
|
switch (trackIndex) {
|
|
|
|
|
case 1: ui->advOutRecTrack1->setChecked(true); break;
|
|
|
|
|
case 2: ui->advOutRecTrack2->setChecked(true); break;
|
|
|
|
|
case 3: ui->advOutRecTrack3->setChecked(true); break;
|
|
|
|
|
case 4: ui->advOutRecTrack4->setChecked(true); break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OBSBasicSettings::LoadAdvOutputRecordingEncoderProperties()
|
|
|
|
|
{
|
|
|
|
|
const char *encoder = config_get_string(main->Config(), "AdvOut",
|
|
|
|
|
"RecEncoder");
|
|
|
|
|
|
|
|
|
|
delete recordEncoderProps;
|
|
|
|
|
recordEncoderProps = nullptr;
|
|
|
|
|
|
|
|
|
|
if (astrcmpi(encoder, "none") != 0) {
|
|
|
|
|
recordEncoderProps = CreateEncoderPropertyView(encoder,
|
|
|
|
|
"obs-studio/basic/recordEncoder.json");
|
|
|
|
|
ui->advOutRecStandard->layout()->addWidget(recordEncoderProps);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SetComboByValue(ui->advOutRecEncoder, encoder);
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-28 00:21:16 -07: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()
|
|
|
|
|
{
|
|
|
|
|
const char *url = config_get_string(main->Config(), "AdvOut", "FFURL");
|
2015-03-28 00:21:16 -07:00
|
|
|
|
const char *format = config_get_string(main->Config(), "AdvOut",
|
|
|
|
|
"FFFormat");
|
|
|
|
|
const char *mimeType = config_get_string(main->Config(), "AdvOut",
|
|
|
|
|
"FFFormatMimeType");
|
2015-01-26 13:41:22 -08:00
|
|
|
|
int videoBitrate = config_get_int(main->Config(), "AdvOut",
|
|
|
|
|
"FFVBitrate");
|
|
|
|
|
bool rescale = config_get_bool(main->Config(), "AdvOut",
|
|
|
|
|
"FFRescale");
|
|
|
|
|
const char *rescaleRes = config_get_string(main->Config(), "AdvOut",
|
|
|
|
|
"FFRescaleRes");
|
|
|
|
|
const char *vEncoder = config_get_string(main->Config(), "AdvOut",
|
|
|
|
|
"FFVEncoder");
|
2015-03-28 00:21:16 -07: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");
|
|
|
|
|
int audioTrack = config_get_int(main->Config(), "AdvOut",
|
|
|
|
|
"FFAudioTrack");
|
|
|
|
|
const char *aEncoder = config_get_string(main->Config(), "AdvOut",
|
|
|
|
|
"FFAEncoder");
|
2015-03-28 00:21:16 -07: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");
|
|
|
|
|
|
|
|
|
|
ui->advOutFFURL->setText(url);
|
2015-03-28 00:21:16 -07:00
|
|
|
|
SelectFormat(ui->advOutFFFormat, format, mimeType);
|
2015-01-26 13:41:22 -08:00
|
|
|
|
ui->advOutFFVBitrate->setValue(videoBitrate);
|
|
|
|
|
ui->advOutFFUseRescale->setChecked(rescale);
|
2015-03-27 23:01:55 -07:00
|
|
|
|
ui->advOutFFRescale->setEnabled(rescale);
|
2015-01-26 13:41:22 -08:00
|
|
|
|
ui->advOutFFRescale->setCurrentText(rescaleRes);
|
2015-03-28 00:21:16 -07: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 00:21:16 -07:00
|
|
|
|
SelectEncoder(ui->advOutFFAEncoder, aEncoder, aEncoderId);
|
2015-01-26 13:41:22 -08:00
|
|
|
|
ui->advOutFFACfg->setText(aEncCustom);
|
|
|
|
|
|
|
|
|
|
switch (audioTrack) {
|
|
|
|
|
case 1: ui->advOutFFTrack1->setChecked(true); break;
|
|
|
|
|
case 2: ui->advOutFFTrack2->setChecked(true); break;
|
|
|
|
|
case 3: ui->advOutFFTrack3->setChecked(true); break;
|
|
|
|
|
case 4: ui->advOutFFTrack4->setChecked(true); break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
|
|
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());
|
|
|
|
|
|
|
|
|
|
ui->advOutTrack1Name->setText(name1);
|
|
|
|
|
ui->advOutTrack2Name->setText(name2);
|
|
|
|
|
ui->advOutTrack3Name->setText(name3);
|
|
|
|
|
ui->advOutTrack4Name->setText(name4);
|
|
|
|
|
}
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
if (video_output_active(obs_get_video())) {
|
|
|
|
|
ui->outputMode->setEnabled(false);
|
2015-03-12 08:49:07 -07:00
|
|
|
|
ui->outputModeLabel->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);
|
|
|
|
|
}
|
2014-03-10 13:10:35 -07:00
|
|
|
|
|
|
|
|
|
loading = false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-28 00:21:16 -07: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);
|
|
|
|
|
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);
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-06 06:02:25 -08: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,
|
2014-03-07 11:56:31 -08:00
|
|
|
|
const char *configName)
|
2014-03-06 06:02:25 -08:00
|
|
|
|
{
|
|
|
|
|
size_t count = obs_property_list_item_count(prop);
|
2014-03-07 11:56:31 -08:00
|
|
|
|
const char *deviceId = config_get_string(main->Config(), "Audio",
|
|
|
|
|
configName);
|
2014-03-06 06:02:25 -08:00
|
|
|
|
|
|
|
|
|
widget->addItem(QTStr("Disabled"), "disabled");
|
|
|
|
|
|
|
|
|
|
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 06:02:25 -08:00
|
|
|
|
LoadListValue(widget, name, val);
|
|
|
|
|
}
|
2014-03-07 11:56:31 -08:00
|
|
|
|
|
|
|
|
|
int idx = widget->findData(QVariant(QT_UTF8(deviceId)));
|
|
|
|
|
if (idx == -1) {
|
|
|
|
|
deviceId = config_get_default_string(main->Config(), "Audio",
|
|
|
|
|
configName);
|
|
|
|
|
idx = widget->findData(QVariant(QT_UTF8(deviceId)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (idx != -1)
|
|
|
|
|
widget->setCurrentIndex(idx);
|
2014-03-06 06:02:25 -08: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 06:02:25 -08:00
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
|
obs_properties_t *input_props = obs_get_source_properties(
|
2014-06-25 00:13:00 -07:00
|
|
|
|
OBS_SOURCE_TYPE_INPUT, input_id);
|
2014-09-25 17:44:05 -07:00
|
|
|
|
obs_properties_t *output_props = obs_get_source_properties(
|
2014-06-25 00:13:00 -07:00
|
|
|
|
OBS_SOURCE_TYPE_INPUT, output_id);
|
2014-03-06 06:02:25 -08: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,
|
2014-03-10 13:59:15 -07:00
|
|
|
|
"device_id");
|
|
|
|
|
LoadListValues(ui->auxAudioDevice1, inputs, "AuxDevice1");
|
|
|
|
|
LoadListValues(ui->auxAudioDevice2, inputs, "AuxDevice2");
|
|
|
|
|
LoadListValues(ui->auxAudioDevice3, inputs, "AuxDevice3");
|
|
|
|
|
obs_properties_destroy(input_props);
|
|
|
|
|
}
|
2014-03-06 06:02:25 -08: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,
|
2014-03-10 13:59:15 -07:00
|
|
|
|
"device_id");
|
|
|
|
|
LoadListValues(ui->desktopAudioDevice1, outputs,
|
|
|
|
|
"DesktopDevice1");
|
|
|
|
|
LoadListValues(ui->desktopAudioDevice2, outputs,
|
|
|
|
|
"DesktopDevice2");
|
|
|
|
|
obs_properties_destroy(output_props);
|
|
|
|
|
}
|
2014-03-06 06:02:25 -08:00
|
|
|
|
}
|
|
|
|
|
|
2015-04-30 22:07:42 -07:00
|
|
|
|
void OBSBasicSettings::LoadAudioSources()
|
|
|
|
|
{
|
|
|
|
|
auto layout = new QFormLayout();
|
|
|
|
|
layout->setVerticalSpacing(15);
|
|
|
|
|
layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
|
|
|
|
|
|
|
|
|
ui->audioSourceScrollArea->takeWidget()->deleteLater();
|
|
|
|
|
audioSourceSignals.clear();
|
|
|
|
|
audioSources.clear();
|
|
|
|
|
|
|
|
|
|
auto widget = new QWidget();
|
|
|
|
|
widget->setLayout(layout);
|
|
|
|
|
ui->audioSourceScrollArea->setWidget(widget);
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
ptmSB->setSuffix(" ms");
|
|
|
|
|
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();
|
|
|
|
|
pttSB->setSuffix(" ms");
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
audioSources.emplace_back(OBSGetWeakRef(source),
|
|
|
|
|
ptmCB, pttSB, pttCB, pttSB);
|
|
|
|
|
|
|
|
|
|
auto label = new OBSSourceLabel(source);
|
|
|
|
|
connect(label, &OBSSourceLabel::Removed,
|
|
|
|
|
[=]()
|
|
|
|
|
{
|
|
|
|
|
LoadAudioSources();
|
|
|
|
|
});
|
|
|
|
|
connect(label, &OBSSourceLabel::Destroyed,
|
|
|
|
|
[=]()
|
|
|
|
|
{
|
|
|
|
|
LoadAudioSources();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
layout->addRow(label, form);
|
|
|
|
|
return true;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < MAX_CHANNELS; i++) {
|
|
|
|
|
obs_source_t *source = obs_get_output_source(i);
|
|
|
|
|
if (!source) continue;
|
|
|
|
|
|
|
|
|
|
AddSource(source);
|
|
|
|
|
obs_source_release(source);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
using AddSource_t = decltype(AddSource);
|
|
|
|
|
obs_enum_sources([](void *data, obs_source_t *source)
|
|
|
|
|
{
|
|
|
|
|
auto &AddSource = *static_cast<AddSource_t*>(data);
|
|
|
|
|
AddSource(source);
|
|
|
|
|
return true;
|
|
|
|
|
}, static_cast<void*>(&AddSource));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (layout->rowCount() == 0)
|
|
|
|
|
ui->audioSourceScrollArea->hide();
|
|
|
|
|
else
|
|
|
|
|
ui->audioSourceScrollArea->show();
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-23 15:27:19 -08:00
|
|
|
|
void OBSBasicSettings::LoadAudioSettings()
|
|
|
|
|
{
|
2014-03-06 20:08:12 -08:00
|
|
|
|
uint32_t sampleRate = config_get_uint(main->Config(), "Audio",
|
2014-02-23 15:27:19 -08:00
|
|
|
|
"SampleRate");
|
2014-03-06 20:08:12 -08:00
|
|
|
|
const char *speakers = config_get_string(main->Config(), "Audio",
|
2014-02-23 15:27:19 -08:00
|
|
|
|
"ChannelSetup");
|
|
|
|
|
|
|
|
|
|
loading = true;
|
|
|
|
|
|
|
|
|
|
const char *str;
|
|
|
|
|
if (sampleRate == 22050)
|
|
|
|
|
str = "22.05khz";
|
|
|
|
|
else if (sampleRate == 48000)
|
|
|
|
|
str = "48khz";
|
|
|
|
|
else
|
|
|
|
|
str = "44.1khz";
|
|
|
|
|
|
|
|
|
|
int sampleRateIdx = ui->sampleRate->findText(str);
|
|
|
|
|
if (sampleRateIdx != -1)
|
|
|
|
|
ui->sampleRate->setCurrentIndex(sampleRateIdx);
|
|
|
|
|
|
|
|
|
|
if (strcmp(speakers, "Mono") == 0)
|
|
|
|
|
ui->channelSetup->setCurrentIndex(0);
|
|
|
|
|
else
|
|
|
|
|
ui->channelSetup->setCurrentIndex(1);
|
|
|
|
|
|
2014-03-06 06:02:25 -08:00
|
|
|
|
LoadAudioDevices();
|
2015-04-30 22:07:42 -07:00
|
|
|
|
LoadAudioSources();
|
2014-03-06 06:02:25 -08:00
|
|
|
|
|
2014-02-23 15:27:19 -08:00
|
|
|
|
loading = false;
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-11 12:55:06 -08:00
|
|
|
|
void OBSBasicSettings::LoadAdvancedSettings()
|
|
|
|
|
{
|
|
|
|
|
uint32_t audioBufferingTime = config_get_uint(main->Config(),
|
|
|
|
|
"Audio", "BufferingTime");
|
|
|
|
|
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");
|
|
|
|
|
|
|
|
|
|
loading = true;
|
|
|
|
|
|
|
|
|
|
ui->audioBufferingTime->setValue(audioBufferingTime);
|
|
|
|
|
SetComboByName(ui->colorFormat, videoColorFormat);
|
|
|
|
|
SetComboByName(ui->colorSpace, videoColorSpace);
|
|
|
|
|
SetComboByValue(ui->colorRange, videoColorRange);
|
|
|
|
|
|
|
|
|
|
if (video_output_active(obs_get_video())) {
|
|
|
|
|
ui->advancedVideoContainer->setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loading = false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-01 13:50:36 -07:00
|
|
|
|
template <typename Func>
|
|
|
|
|
static inline void LayoutHotkey(obs_hotkey_id id, obs_hotkey_t *key, Func &&fun,
|
|
|
|
|
const map<obs_hotkey_id, vector<obs_key_combination_t>> &keys)
|
|
|
|
|
{
|
|
|
|
|
auto *label = new OBSHotkeyLabel;
|
|
|
|
|
label->setText(obs_hotkey_get_description(key));
|
|
|
|
|
|
|
|
|
|
OBSHotkeyWidget *hw = nullptr;
|
|
|
|
|
|
|
|
|
|
auto combos = keys.find(id);
|
|
|
|
|
if (combos == std::end(keys))
|
|
|
|
|
hw = new OBSHotkeyWidget(id, obs_hotkey_get_name(key));
|
|
|
|
|
else
|
|
|
|
|
hw = new OBSHotkeyWidget(id, obs_hotkey_get_name(key),
|
|
|
|
|
combos->second);
|
|
|
|
|
|
|
|
|
|
hw->label = label;
|
|
|
|
|
label->widget = hw;
|
|
|
|
|
|
|
|
|
|
fun(key, label, hw);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename Func, typename T>
|
|
|
|
|
static QLabel *makeLabel(T &t, Func &&getName)
|
|
|
|
|
{
|
|
|
|
|
return new QLabel(getName(t));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename Func>
|
|
|
|
|
static QLabel *makeLabel(const OBSSource &source, Func &&)
|
|
|
|
|
{
|
|
|
|
|
return new OBSSourceLabel(source);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
auto line = new QFrame();
|
|
|
|
|
line->setFrameShape(QFrame::HLine);
|
|
|
|
|
line->setFrameShadow(QFrame::Sunken);
|
|
|
|
|
|
|
|
|
|
layout.setItem(layout.rowCount(), QFormLayout::SpanningRole,
|
|
|
|
|
new QSpacerItem(0, 10));
|
|
|
|
|
layout.addRow(line);
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
ui->hotkeyPage->takeWidget()->deleteLater();
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
auto layout = new QFormLayout();
|
|
|
|
|
layout->setVerticalSpacing(0);
|
|
|
|
|
layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
|
|
|
|
|
layout->setLabelAlignment(
|
|
|
|
|
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
|
|
|
|
|
|
|
|
|
|
auto widget = new QWidget();
|
|
|
|
|
widget->setLayout(layout);
|
|
|
|
|
ui->hotkeyPage->setWidget(widget);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
else
|
|
|
|
|
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:
|
|
|
|
|
layout->addRow(label, hw);
|
|
|
|
|
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);
|
|
|
|
|
connect(hw, &OBSHotkeyWidget::KeyChanged,
|
|
|
|
|
this, &OBSBasicSettings::HotkeysChanged);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
auto data = make_tuple(RegisterHotkey, std::move(keys), ignoreKey);
|
|
|
|
|
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))
|
|
|
|
|
LayoutHotkey(id, key, get<0>(d), get<1>(d));
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
label->setToolTip(tt.arg(otherName));
|
|
|
|
|
label->setText(name + " ✳");
|
|
|
|
|
label->pairPartner = other;
|
|
|
|
|
};
|
|
|
|
|
Update(label1, name1, label2, name2);
|
|
|
|
|
Update(label2, name2, label1, name1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AddHotkeys(*layout, obs_output_get_name, outputs);
|
|
|
|
|
AddHotkeys(*layout, obs_source_get_name, scenes);
|
|
|
|
|
AddHotkeys(*layout, obs_source_get_name, sources);
|
|
|
|
|
AddHotkeys(*layout, obs_encoder_get_name, encoders);
|
|
|
|
|
AddHotkeys(*layout, obs_service_get_name, services);
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-26 14:36:15 -08: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 15:27:19 -08:00
|
|
|
|
if (!changedOnly || audioChanged)
|
|
|
|
|
LoadAudioSettings();
|
2014-01-26 14:36:15 -08:00
|
|
|
|
if (!changedOnly || videoChanged)
|
|
|
|
|
LoadVideoSettings();
|
2014-11-01 13:50:36 -07:00
|
|
|
|
if (!changedOnly || hotkeysChanged)
|
|
|
|
|
LoadHotkeySettings();
|
2015-02-11 12:55:06 -08:00
|
|
|
|
if (!changedOnly || advancedChanged)
|
|
|
|
|
LoadAdvancedSettings();
|
2014-01-26 14:36:15 -08: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-16 23:45:34 -08:00
|
|
|
|
|
|
|
|
|
int themeIndex = ui->theme->currentIndex();
|
|
|
|
|
QString themeData = ui->theme->itemText(themeIndex);
|
|
|
|
|
string theme = themeData.toStdString();
|
|
|
|
|
|
|
|
|
|
if (WidgetChanged(ui->theme)) {
|
|
|
|
|
config_set_string(GetGlobalConfig(), "General", "Theme",
|
|
|
|
|
theme.c_str());
|
|
|
|
|
App()->SetTheme(theme);
|
|
|
|
|
}
|
2014-01-26 14:36:15 -08:00
|
|
|
|
}
|
|
|
|
|
|
2015-02-07 08:09:57 -08:00
|
|
|
|
void OBSBasicSettings::SaveStream1Settings()
|
|
|
|
|
{
|
|
|
|
|
QString streamType = GetComboData(ui->streamType);
|
|
|
|
|
|
2015-04-04 15:03:40 -07:00
|
|
|
|
obs_service_t *oldService = main->GetService();
|
|
|
|
|
obs_data_t *hotkeyData = obs_hotkeys_save_service(oldService);
|
|
|
|
|
|
2015-02-07 08:09:57 -08:00
|
|
|
|
obs_service_t *newService = obs_service_create(QT_TO_UTF8(streamType),
|
2014-11-01 13:41:17 -07:00
|
|
|
|
"default_service", streamProperties->GetSettings(),
|
2015-04-04 15:03:40 -07:00
|
|
|
|
hotkeyData);
|
|
|
|
|
|
|
|
|
|
obs_data_release(hotkeyData);
|
2015-02-07 08:09:57 -08:00
|
|
|
|
if (!newService)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
main->SetService(newService);
|
|
|
|
|
main->SaveService();
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-26 14:36:15 -08: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 14:36:15 -08:00
|
|
|
|
|
|
|
|
|
/* ------------------- */
|
|
|
|
|
|
2014-06-29 20:23:40 -07:00
|
|
|
|
if (WidgetChanged(ui->renderer))
|
|
|
|
|
config_set_string(App()->GlobalConfig(), "Video", "Renderer",
|
|
|
|
|
QT_TO_UTF8(ui->renderer->currentText()));
|
2014-01-26 14:36:15 -08:00
|
|
|
|
|
2014-06-23 19:54:20 -07:00
|
|
|
|
if (WidgetChanged(ui->baseResolution) &&
|
|
|
|
|
ConvertResText(QT_TO_UTF8(baseResolution), cx, cy)) {
|
2014-03-06 20:08:12 -08:00
|
|
|
|
config_set_uint(main->Config(), "Video", "BaseCX", cx);
|
|
|
|
|
config_set_uint(main->Config(), "Video", "BaseCY", cy);
|
2014-01-26 14:36:15 -08:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-23 19:54:20 -07:00
|
|
|
|
if (WidgetChanged(ui->outputResolution) &&
|
|
|
|
|
ConvertResText(QT_TO_UTF8(outputResolution), cx, cy)) {
|
2014-03-06 20:08:12 -08:00
|
|
|
|
config_set_uint(main->Config(), "Video", "OutputCX", cx);
|
|
|
|
|
config_set_uint(main->Config(), "Video", "OutputCY", cy);
|
2014-01-26 14:36:15 -08: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 19:14:19 -08:00
|
|
|
|
|
2015-02-11 12:55:06 -08:00
|
|
|
|
void OBSBasicSettings::SaveAdvancedSettings()
|
|
|
|
|
{
|
|
|
|
|
SaveSpinBox(ui->audioBufferingTime, "Audio", "BufferingTime");
|
|
|
|
|
SaveCombo(ui->colorFormat, "Video", "ColorFormat");
|
|
|
|
|
SaveCombo(ui->colorSpace, "Video", "ColorSpace");
|
|
|
|
|
SaveComboData(ui->colorRange, "Video", "ColorRange");
|
2014-01-26 14:36:15 -08: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";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void WriteJsonData(OBSPropertiesView *view, const char *path)
|
|
|
|
|
{
|
|
|
|
|
char full_path[512];
|
|
|
|
|
|
|
|
|
|
if (!view || !WidgetChanged(view))
|
|
|
|
|
return;
|
|
|
|
|
|
2015-06-01 16:11:57 -07:00
|
|
|
|
int ret = GetConfigPath(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) {
|
|
|
|
|
const char *json = obs_data_get_json(settings);
|
|
|
|
|
if (json && *json) {
|
|
|
|
|
os_quick_write_utf8_file(full_path, json,
|
|
|
|
|
strlen(json), false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void SaveTrackIndex(config_t *config, const char *section,
|
|
|
|
|
const char *name,
|
|
|
|
|
QAbstractButton *check1,
|
|
|
|
|
QAbstractButton *check2,
|
|
|
|
|
QAbstractButton *check3,
|
|
|
|
|
QAbstractButton *check4)
|
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-28 00:21:16 -07: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);
|
|
|
|
|
} else {
|
|
|
|
|
config_set_string(main->Config(), "AdvOut", "FFFormat",
|
|
|
|
|
nullptr);
|
|
|
|
|
config_set_string(main->Config(), "AdvOut", "FFFormatMimeType",
|
|
|
|
|
nullptr);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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()));
|
|
|
|
|
|
2014-06-23 19:54:20 -07:00
|
|
|
|
SaveSpinBox(ui->simpleOutputVBitrate, "SimpleOutput", "VBitrate");
|
|
|
|
|
SaveCombo(ui->simpleOutputABitrate, "SimpleOutput", "ABitrate");
|
|
|
|
|
SaveEdit(ui->simpleOutputPath, "SimpleOutput", "FilePath");
|
2014-07-03 18:07:33 -07:00
|
|
|
|
SaveCheckBox(ui->simpleOutReconnect, "SimpleOutput", "Reconnect");
|
|
|
|
|
SaveSpinBox(ui->simpleOutRetryDelay, "SimpleOutput", "RetryDelay");
|
|
|
|
|
SaveSpinBox(ui->simpleOutMaxRetries, "SimpleOutput", "MaxRetries");
|
2014-08-25 07:48:51 -07:00
|
|
|
|
SaveCheckBox(ui->simpleOutAdvanced, "SimpleOutput", "UseAdvanced");
|
2014-09-24 20:23:42 -07:00
|
|
|
|
SaveCheckBox(ui->simpleOutUseCBR, "SimpleOutput", "UseCBR");
|
2015-02-06 03:56:19 -08:00
|
|
|
|
SaveCheckBox(ui->simpleOutUseBufsize, "SimpleOutput", "UseBufsize");
|
2014-08-25 07:48:51 -07:00
|
|
|
|
SaveCombo(ui->simpleOutPreset, "SimpleOutput", "Preset");
|
2015-01-18 06:29:24 -08:00
|
|
|
|
SaveEdit(ui->simpleOutCustom, "SimpleOutput", "x264Settings");
|
2015-02-06 03:56:19 -08:00
|
|
|
|
|
|
|
|
|
if (ui->simpleOutUseBufsize->isChecked())
|
|
|
|
|
SaveSpinBox(ui->simpleOutVBufsize, "SimpleOutput", "VBufsize");
|
2015-01-26 13:41:22 -08:00
|
|
|
|
|
|
|
|
|
SaveCheckBox(ui->advOutReconnect, "AdvOut", "Reconnect");
|
|
|
|
|
SaveSpinBox(ui->advOutRetryDelay, "AdvOut", "RetryDelay");
|
|
|
|
|
SaveSpinBox(ui->advOutMaxRetries, "AdvOut", "MaxRetries");
|
2015-02-10 20:06:00 -08:00
|
|
|
|
SaveCheckBox(ui->advOutApplyService, "AdvOut", "ApplyServiceSettings");
|
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, ui->advOutTrack2,
|
|
|
|
|
ui->advOutTrack3, ui->advOutTrack4);
|
|
|
|
|
|
|
|
|
|
config_set_string(main->Config(), "AdvOut", "RecType",
|
|
|
|
|
RecTypeFromIdx(ui->advOutRecType->currentIndex()));
|
|
|
|
|
|
|
|
|
|
SaveEdit(ui->advOutRecPath, "AdvOut", "RecFilePath");
|
|
|
|
|
SaveComboData(ui->advOutRecEncoder, "AdvOut", "RecEncoder");
|
|
|
|
|
SaveCheckBox(ui->advOutRecUseRescale, "AdvOut", "RecRescale");
|
|
|
|
|
SaveCombo(ui->advOutRecRescale, "AdvOut", "RecRescaleRes");
|
|
|
|
|
SaveTrackIndex(main->Config(), "AdvOut", "RecTrackIndex",
|
|
|
|
|
ui->advOutRecTrack1, ui->advOutRecTrack2,
|
|
|
|
|
ui->advOutRecTrack3, ui->advOutRecTrack4);
|
|
|
|
|
|
|
|
|
|
SaveEdit(ui->advOutFFURL, "AdvOut", "FFURL");
|
2015-03-28 00:21:16 -07:00
|
|
|
|
SaveFormat(ui->advOutFFFormat);
|
2015-01-26 13:41:22 -08:00
|
|
|
|
SaveSpinBox(ui->advOutFFVBitrate, "AdvOut", "FFVBitrate");
|
|
|
|
|
SaveCheckBox(ui->advOutFFUseRescale, "AdvOut", "FFRescale");
|
|
|
|
|
SaveCombo(ui->advOutFFRescale, "AdvOut", "FFRescaleRes");
|
2015-03-28 00:21:16 -07: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 00:21:16 -07:00
|
|
|
|
SaveEncoder(ui->advOutFFAEncoder, "AdvOut", "FFAEncoder");
|
2015-01-26 13:41:22 -08:00
|
|
|
|
SaveEdit(ui->advOutFFACfg, "AdvOut", "FFACustom");
|
|
|
|
|
SaveTrackIndex(main->Config(), "AdvOut", "FFAudioTrack",
|
|
|
|
|
ui->advOutFFTrack1, ui->advOutFFTrack2,
|
|
|
|
|
ui->advOutFFTrack3, ui->advOutFFTrack4);
|
|
|
|
|
|
|
|
|
|
SaveCombo(ui->advOutTrack1Bitrate, "AdvOut", "Track1Bitrate");
|
|
|
|
|
SaveCombo(ui->advOutTrack2Bitrate, "AdvOut", "Track2Bitrate");
|
|
|
|
|
SaveCombo(ui->advOutTrack3Bitrate, "AdvOut", "Track3Bitrate");
|
|
|
|
|
SaveCombo(ui->advOutTrack4Bitrate, "AdvOut", "Track4Bitrate");
|
|
|
|
|
SaveEdit(ui->advOutTrack1Name, "AdvOut", "Track1Name");
|
|
|
|
|
SaveEdit(ui->advOutTrack2Name, "AdvOut", "Track2Name");
|
|
|
|
|
SaveEdit(ui->advOutTrack3Name, "AdvOut", "Track3Name");
|
|
|
|
|
SaveEdit(ui->advOutTrack4Name, "AdvOut", "Track4Name");
|
|
|
|
|
|
|
|
|
|
WriteJsonData(streamEncoderProps,
|
|
|
|
|
"obs-studio/basic/streamEncoder.json");
|
|
|
|
|
WriteJsonData(recordEncoderProps,
|
|
|
|
|
"obs-studio/basic/recordEncoder.json");
|
|
|
|
|
main->ResetOutputs();
|
2014-03-07 11:56:31 -08:00
|
|
|
|
}
|
|
|
|
|
|
2014-02-23 15:27:19 -08:00
|
|
|
|
void OBSBasicSettings::SaveAudioSettings()
|
|
|
|
|
{
|
2014-03-07 11:56:31 -08:00
|
|
|
|
QString sampleRateStr = ui->sampleRate->currentText();
|
|
|
|
|
int channelSetupIdx = ui->channelSetup->currentIndex();
|
2014-02-23 15:27:19 -08:00
|
|
|
|
|
2014-05-15 17:40:53 -07:00
|
|
|
|
const char *channelSetup = (channelSetupIdx == 0) ? "Mono" : "Stereo";
|
2014-02-23 15:27:19 -08:00
|
|
|
|
|
|
|
|
|
int sampleRate = 44100;
|
|
|
|
|
if (sampleRateStr == "22.05khz")
|
|
|
|
|
sampleRate = 22050;
|
|
|
|
|
else if (sampleRateStr == "48khz")
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
SaveComboData(ui->desktopAudioDevice1, "Audio", "DesktopDevice1");
|
|
|
|
|
SaveComboData(ui->desktopAudioDevice2, "Audio", "DesktopDevice2");
|
|
|
|
|
SaveComboData(ui->auxAudioDevice1, "Audio", "AuxDevice1");
|
|
|
|
|
SaveComboData(ui->auxAudioDevice2, "Audio", "AuxDevice2");
|
|
|
|
|
SaveComboData(ui->auxAudioDevice3, "Audio", "AuxDevice3");
|
2014-03-07 16:03:34 -08:00
|
|
|
|
|
2015-04-30 22:07:42 -07: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());
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-07 16:03:34 -08:00
|
|
|
|
main->ResetAudioDevices();
|
2014-02-23 15:27:19 -08:00
|
|
|
|
}
|
|
|
|
|
|
2014-11-01 13:50:36 -07: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;
|
|
|
|
|
|
|
|
|
|
obs_data_array_t *array = obs_hotkey_save(hw.id);
|
|
|
|
|
obs_data_t *data = obs_data_create();
|
|
|
|
|
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);
|
|
|
|
|
obs_data_release(data);
|
|
|
|
|
obs_data_array_release(array);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-26 14:36:15 -08: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 15:27:19 -08:00
|
|
|
|
if (audioChanged)
|
|
|
|
|
SaveAudioSettings();
|
2014-01-26 14:36:15 -08:00
|
|
|
|
if (videoChanged)
|
|
|
|
|
SaveVideoSettings();
|
2014-11-01 13:50:36 -07:00
|
|
|
|
if (hotkeysChanged)
|
|
|
|
|
SaveHotkeySettings();
|
2015-02-11 12:55:06 -08:00
|
|
|
|
if (advancedChanged)
|
|
|
|
|
SaveAdvancedSettings();
|
|
|
|
|
|
|
|
|
|
if (videoChanged || advancedChanged)
|
|
|
|
|
main->ResetVideo();
|
2014-01-26 14:36:15 -08:00
|
|
|
|
|
2014-03-06 20:08:12 -08:00
|
|
|
|
config_save(main->Config());
|
2014-01-26 14:36:15 -08:00
|
|
|
|
config_save(GetGlobalConfig());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool OBSBasicSettings::QueryChanges()
|
|
|
|
|
{
|
|
|
|
|
QMessageBox::StandardButton button;
|
|
|
|
|
|
|
|
|
|
button = QMessageBox::question(this,
|
2014-05-10 18:47:48 -07:00
|
|
|
|
QTStr("Basic.Settings.ConfirmTitle"),
|
|
|
|
|
QTStr("Basic.Settings.Confirm"),
|
2014-01-26 14:36:15 -08:00
|
|
|
|
QMessageBox::Yes | QMessageBox::No |
|
|
|
|
|
QMessageBox::Cancel);
|
|
|
|
|
|
2015-05-25 01:37:13 -07:00
|
|
|
|
if (button == QMessageBox::Cancel) {
|
2014-01-26 14:36:15 -08:00
|
|
|
|
return false;
|
2015-05-25 01:37:13 -07:00
|
|
|
|
} else if (button == QMessageBox::Yes) {
|
2014-01-26 14:36:15 -08:00
|
|
|
|
SaveSettings();
|
2015-05-25 01:37:13 -07:00
|
|
|
|
} else {
|
2014-01-26 14:36:15 -08:00
|
|
|
|
LoadSettings(true);
|
2015-05-25 01:37:13 -07:00
|
|
|
|
#ifdef _WIN32
|
|
|
|
|
if (toggleAero)
|
|
|
|
|
SetAeroEnabled(!aeroWasDisabled);
|
|
|
|
|
#endif
|
|
|
|
|
}
|
2014-01-26 14:36:15 -08:00
|
|
|
|
|
|
|
|
|
ClearChanged();
|
|
|
|
|
return true;
|
2013-12-11 20:50:10 -08:00
|
|
|
|
}
|
|
|
|
|
|
2014-01-24 20:19:50 -08:00
|
|
|
|
void OBSBasicSettings::closeEvent(QCloseEvent *event)
|
2013-12-11 20:50:10 -08:00
|
|
|
|
{
|
2014-01-26 14:36:15 -08:00
|
|
|
|
if (Changed() && !QueryChanges())
|
|
|
|
|
event->ignore();
|
2013-12-17 12:56:58 -08:00
|
|
|
|
}
|
|
|
|
|
|
2015-02-16 23:45:34 -08:00
|
|
|
|
void OBSBasicSettings::on_theme_activated(int idx)
|
|
|
|
|
{
|
|
|
|
|
string currT = ui->theme->itemText(idx).toStdString();
|
|
|
|
|
App()->SetTheme(currT);
|
|
|
|
|
}
|
|
|
|
|
|
2015-02-06 03:56:19 -08:00
|
|
|
|
void OBSBasicSettings::on_simpleOutUseBufsize_toggled(bool checked)
|
|
|
|
|
{
|
|
|
|
|
if (!checked)
|
|
|
|
|
ui->simpleOutVBufsize->setValue(
|
|
|
|
|
ui->simpleOutputVBitrate->value());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OBSBasicSettings::on_simpleOutputVBitrate_valueChanged(int val)
|
|
|
|
|
{
|
|
|
|
|
if (!ui->simpleOutUseBufsize->isChecked())
|
|
|
|
|
ui->simpleOutVBufsize->setValue(val);
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-26 14:36:15 -08:00
|
|
|
|
void OBSBasicSettings::on_listWidget_itemSelectionChanged()
|
2013-12-17 12:56:58 -08:00
|
|
|
|
{
|
2014-01-26 14:36:15 -08:00
|
|
|
|
int row = ui->listWidget->currentRow();
|
|
|
|
|
|
|
|
|
|
if (loading || row == pageIndex)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
pageIndex = row;
|
2013-12-17 12:56:58 -08:00
|
|
|
|
}
|
|
|
|
|
|
2014-01-24 20:19:50 -08:00
|
|
|
|
void OBSBasicSettings::on_buttonBox_clicked(QAbstractButton *button)
|
2013-12-17 12:56:58 -08:00
|
|
|
|
{
|
2014-01-26 14:36:15 -08: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-02-16 23:45:34 -08:00
|
|
|
|
if (val == QDialogButtonBox::RejectRole)
|
|
|
|
|
App()->SetTheme(savedTheme);
|
2014-01-26 14:36:15 -08:00
|
|
|
|
ClearChanged();
|
|
|
|
|
close();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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::on_streamType_currentIndexChanged(int idx)
|
|
|
|
|
{
|
|
|
|
|
if (loading)
|
|
|
|
|
return;
|
|
|
|
|
|
2015-02-07 08:09:57 -08:00
|
|
|
|
QLayout *layout = ui->streamContainer->layout();
|
|
|
|
|
QString streamType = ui->streamType->itemData(idx).toString();
|
|
|
|
|
obs_data_t *settings = obs_service_defaults(QT_TO_UTF8(streamType));
|
|
|
|
|
|
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
|
|
|
|
delete streamProperties;
|
2015-02-07 08:09:57 -08:00
|
|
|
|
streamProperties = new OBSPropertiesView(settings,
|
|
|
|
|
QT_TO_UTF8(streamType),
|
|
|
|
|
(PropertiesReloadCallback)obs_get_service_properties,
|
|
|
|
|
170);
|
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-02-07 08:09:57 -08:00
|
|
|
|
streamProperties->setProperty("changed", QVariant(true));
|
|
|
|
|
layout->addWidget(streamProperties);
|
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-02-07 08:09:57 -08:00
|
|
|
|
QObject::connect(streamProperties, SIGNAL(Changed()),
|
|
|
|
|
this, STREAM1_CHANGED);
|
|
|
|
|
|
|
|
|
|
obs_data_release(settings);
|
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
|
|
|
|
}
|
|
|
|
|
|
2014-05-20 23:27:27 -07:00
|
|
|
|
void OBSBasicSettings::on_simpleOutputBrowse_clicked()
|
|
|
|
|
{
|
|
|
|
|
QString dir = QFileDialog::getExistingDirectory(this,
|
2015-01-26 13:41:22 -08:00
|
|
|
|
QTStr("Basic.Settings.Output.SelectDirectory"),
|
2014-05-20 23:27:27 -07:00
|
|
|
|
ui->simpleOutputPath->text(),
|
|
|
|
|
QFileDialog::ShowDirsOnly |
|
|
|
|
|
QFileDialog::DontResolveSymlinks);
|
|
|
|
|
if (dir.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ui->simpleOutputPath->setText(dir);
|
|
|
|
|
}
|
|
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
|
void OBSBasicSettings::on_advOutRecPathBrowse_clicked()
|
|
|
|
|
{
|
|
|
|
|
QString dir = QFileDialog::getExistingDirectory(this,
|
|
|
|
|
QTStr("Basic.Settings.Output.SelectDirectory"),
|
|
|
|
|
ui->advOutRecPath->text(),
|
|
|
|
|
QFileDialog::ShowDirsOnly |
|
|
|
|
|
QFileDialog::DontResolveSymlinks);
|
|
|
|
|
if (dir.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ui->advOutRecPath->setText(dir);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OBSBasicSettings::on_advOutFFPathBrowse_clicked()
|
|
|
|
|
{
|
2015-02-07 12:12:12 -08:00
|
|
|
|
QString filter;
|
|
|
|
|
filter += QTStr("Basic.Settings.Output.Adv.FFmpeg.SaveFilter.Common");
|
|
|
|
|
filter += " (*.avi *.mp4 *.flv *.ts *.mkv *.wav *.aac);;";
|
|
|
|
|
filter += QTStr("Basic.Settings.Output.Adv.FFmpeg.SaveFilter.All");
|
|
|
|
|
filter += " (*.*)";
|
|
|
|
|
|
2015-01-26 13:41:22 -08:00
|
|
|
|
QString file = QFileDialog::getSaveFileName(this,
|
|
|
|
|
QTStr("Basic.Settings.Output.SelectFile"),
|
2015-02-07 12:12:12 -08:00
|
|
|
|
ui->simpleOutputPath->text(), filter);
|
2015-01-26 13:41:22 -08:00
|
|
|
|
if (file.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
ui->advOutFFURL->setText(file);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OBSBasicSettings::on_advOutEncoder_currentIndexChanged(int idx)
|
|
|
|
|
{
|
|
|
|
|
QString encoder = GetComboData(ui->advOutEncoder);
|
|
|
|
|
|
|
|
|
|
delete streamEncoderProps;
|
|
|
|
|
streamEncoderProps = CreateEncoderPropertyView(QT_TO_UTF8(encoder),
|
|
|
|
|
"obs-studio/basic/streamEncoder.json", true);
|
|
|
|
|
ui->advOutputStreamTab->layout()->addWidget(streamEncoderProps);
|
|
|
|
|
|
|
|
|
|
UNUSED_PARAMETER(idx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OBSBasicSettings::on_advOutRecEncoder_currentIndexChanged(int idx)
|
|
|
|
|
{
|
|
|
|
|
ui->advOutRecUseRescale->setEnabled(idx > 0);
|
|
|
|
|
ui->advOutRecRescaleContainer->setEnabled(idx > 0);
|
|
|
|
|
|
|
|
|
|
delete recordEncoderProps;
|
|
|
|
|
recordEncoderProps = nullptr;
|
|
|
|
|
|
|
|
|
|
if (idx > 0) {
|
|
|
|
|
QString encoder = GetComboData(ui->advOutRecEncoder);
|
|
|
|
|
|
|
|
|
|
recordEncoderProps = CreateEncoderPropertyView(
|
|
|
|
|
QT_TO_UTF8(encoder),
|
|
|
|
|
"obs-studio/basic/recordEncoder.json", true);
|
|
|
|
|
ui->advOutRecStandard->layout()->addWidget(recordEncoderProps);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-28 00:21:16 -07: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-04-17 23:40:35 -07:00
|
|
|
|
void OBSBasicSettings::on_colorFormat_currentIndexChanged(const QString &text)
|
|
|
|
|
{
|
|
|
|
|
bool usingNV12 = text == "NV12";
|
|
|
|
|
|
|
|
|
|
if (usingNV12)
|
|
|
|
|
ui->advancedMsg2->setText(QString());
|
|
|
|
|
else
|
|
|
|
|
ui->advancedMsg2->setText(
|
|
|
|
|
QTStr("Basic.Settings.Advanced.FormatWarning"));
|
|
|
|
|
}
|
|
|
|
|
|
2014-05-10 18:47:48 -07:00
|
|
|
|
#define INVALID_RES_STR "Basic.Settings.Video.InvalidResolution"
|
|
|
|
|
|
2014-01-26 14:36:15 -08:00
|
|
|
|
static bool ValidResolutions(Ui::OBSBasicSettings *ui)
|
|
|
|
|
{
|
|
|
|
|
QString baseRes = ui->baseResolution->lineEdit()->text();
|
|
|
|
|
QString outputRes = ui->outputResolution->lineEdit()->text();
|
|
|
|
|
uint32_t cx, cy;
|
|
|
|
|
|
|
|
|
|
if (!ConvertResText(QT_TO_UTF8(baseRes), cx, cy) ||
|
|
|
|
|
!ConvertResText(QT_TO_UTF8(outputRes), cx, cy)) {
|
|
|
|
|
|
2014-05-10 18:47:48 -07:00
|
|
|
|
ui->videoMsg->setText(QTStr(INVALID_RES_STR));
|
2014-01-26 14:36:15 -08:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-22 19:14:19 -08:00
|
|
|
|
ui->videoMsg->setText("");
|
2014-01-26 14:36:15 -08:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-07 11:56:31 -08:00
|
|
|
|
void OBSBasicSettings::on_baseResolution_editTextChanged(const QString &text)
|
2014-01-26 14:36:15 -08:00
|
|
|
|
{
|
2014-03-07 11:56:31 -08:00
|
|
|
|
if (!loading && ValidResolutions(ui.get())) {
|
2014-03-10 14:00:53 -07:00
|
|
|
|
QString baseResolution = text;
|
2015-02-08 01:29:15 -08:00
|
|
|
|
uint32_t cx, cy, out_cx, out_cy;
|
2014-02-14 14:13:36 -08:00
|
|
|
|
|
2014-03-07 11:56:31 -08:00
|
|
|
|
ConvertResText(QT_TO_UTF8(baseResolution), cx, cy);
|
2015-02-08 01:29:15 -08:00
|
|
|
|
|
|
|
|
|
QString outRes = ui->outputResolution->lineEdit()->text();
|
|
|
|
|
ConvertResText(QT_TO_UTF8(outRes), out_cx, out_cy);
|
|
|
|
|
|
|
|
|
|
ResetDownscales(cx, cy, out_cx, out_cy);
|
2014-03-07 11:56:31 -08:00
|
|
|
|
}
|
2014-01-26 14:36:15 -08:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-07 11:56:31 -08:00
|
|
|
|
void OBSBasicSettings::GeneralChanged()
|
2014-02-23 15:27:19 -08:00
|
|
|
|
{
|
2014-05-09 15:04:39 -07:00
|
|
|
|
if (!loading) {
|
2014-03-07 11:56:31 -08:00
|
|
|
|
generalChanged = true;
|
2014-06-23 19:54:20 -07:00
|
|
|
|
sender()->setProperty("changed", QVariant(true));
|
2014-05-09 15:04:39 -07:00
|
|
|
|
EnableApplyButton(true);
|
|
|
|
|
}
|
2014-02-23 15:27:19 -08: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 15:04:39 -07: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 15:04:39 -07:00
|
|
|
|
EnableApplyButton(true);
|
|
|
|
|
}
|
2014-03-10 13:10:35 -07:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-07 11:56:31 -08:00
|
|
|
|
void OBSBasicSettings::AudioChanged()
|
2014-02-23 15:27:19 -08:00
|
|
|
|
{
|
2014-05-09 15:04:39 -07:00
|
|
|
|
if (!loading) {
|
2014-02-23 15:27:19 -08:00
|
|
|
|
audioChanged = true;
|
2014-06-23 19:54:20 -07:00
|
|
|
|
sender()->setProperty("changed", QVariant(true));
|
2014-05-09 15:04:39 -07:00
|
|
|
|
EnableApplyButton(true);
|
|
|
|
|
}
|
2014-02-23 15:27:19 -08:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-07 11:56:31 -08:00
|
|
|
|
void OBSBasicSettings::AudioChangedRestart()
|
2014-02-23 15:27:19 -08:00
|
|
|
|
{
|
2014-02-23 17:00:09 -08:00
|
|
|
|
if (!loading) {
|
2014-02-23 15:27:19 -08:00
|
|
|
|
audioChanged = true;
|
2014-05-10 18:47:48 -07:00
|
|
|
|
ui->audioMsg->setText(QTStr("Basic.Settings.ProgramRestart"));
|
2014-06-23 19:54:20 -07:00
|
|
|
|
sender()->setProperty("changed", QVariant(true));
|
2014-05-09 15:04:39 -07:00
|
|
|
|
EnableApplyButton(true);
|
2014-02-23 17:00:09 -08:00
|
|
|
|
}
|
2014-02-23 15:27:19 -08:00
|
|
|
|
}
|
|
|
|
|
|
2015-04-30 22:07:42 -07:00
|
|
|
|
void OBSBasicSettings::ReloadAudioSources()
|
|
|
|
|
{
|
|
|
|
|
LoadAudioSources();
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-07 11:56:31 -08:00
|
|
|
|
void OBSBasicSettings::VideoChangedRestart()
|
2014-01-26 14:36:15 -08: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 15:04:39 -07:00
|
|
|
|
EnableApplyButton(true);
|
2014-01-26 14:36:15 -08: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 11:56:31 -08:00
|
|
|
|
void OBSBasicSettings::VideoChangedResolution()
|
2014-01-26 14:36:15 -08:00
|
|
|
|
{
|
2014-05-09 15:04:39 -07:00
|
|
|
|
if (!loading && ValidResolutions(ui.get())) {
|
2014-01-26 14:36:15 -08:00
|
|
|
|
videoChanged = true;
|
2014-06-23 19:54:20 -07:00
|
|
|
|
sender()->setProperty("changed", QVariant(true));
|
2014-05-09 15:04:39 -07:00
|
|
|
|
EnableApplyButton(true);
|
|
|
|
|
}
|
2013-12-13 22:11:23 -08:00
|
|
|
|
}
|
2014-02-23 15:27:19 -08:00
|
|
|
|
|
2014-03-07 11:56:31 -08:00
|
|
|
|
void OBSBasicSettings::VideoChanged()
|
2014-02-23 15:27:19 -08:00
|
|
|
|
{
|
2014-05-09 15:04:39 -07:00
|
|
|
|
if (!loading) {
|
2014-02-23 15:27:19 -08:00
|
|
|
|
videoChanged = true;
|
2014-06-23 19:54:20 -07:00
|
|
|
|
sender()->setProperty("changed", QVariant(true));
|
2014-05-09 15:04:39 -07:00
|
|
|
|
EnableApplyButton(true);
|
|
|
|
|
}
|
2014-02-23 15:27:19 -08:00
|
|
|
|
}
|
2015-02-11 12:55:06 -08:00
|
|
|
|
|
2014-11-01 13:50:36 -07: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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|