diff --git a/UI/forms/OBSBasicSettings.ui b/UI/forms/OBSBasicSettings.ui
index ad11a9dfb4c1c7741b2b703b8e820b637bc82058..376eb8575fa9d37aa14f2ceeabbdc845d90719d5 100644
--- a/UI/forms/OBSBasicSettings.ui
+++ b/UI/forms/OBSBasicSettings.ui
@@ -7,7 +7,7 @@
0
0
981
- 720
+ 748
@@ -2630,8 +2630,8 @@
0
0
- 98
- 28
+ 800
+ 69
@@ -2949,8 +2949,8 @@
0
0
- 98
- 28
+ 818
+ 697
@@ -2996,8 +2996,8 @@
0
0
- 559
- 681
+ 803
+ 709
@@ -3193,6 +3193,9 @@
Basic.Settings.Output.Adv.Recording
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
-
@@ -3210,6 +3213,42 @@
+ -
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
-
+
+
+ -
+
+
+ Basic.Settings.Output.ReplayBuffer.Suffix
+
+
+
+ -
+
+
+
+
+ -
+
+
+ Basic.Settings.Output.ReplayBuffer.Prefix
+
+
+
diff --git a/UI/window-basic-main-outputs.cpp b/UI/window-basic-main-outputs.cpp
index 525d0a68679b2d857a1ae7ff572a280a7e307743..026f4963acf1d173a77c8e05e6ddfcd559b9c54f 100644
--- a/UI/window-basic-main-outputs.cpp
+++ b/UI/window-basic-main-outputs.cpp
@@ -687,6 +687,19 @@ bool SimpleOutput::StartStreaming(obs_service_t *service)
return false;
}
+static void remove_reserved_file_characters(string &s)
+{
+ replace(s.begin(), s.end(), '/', '_');
+ replace(s.begin(), s.end(), '\\', '_');
+ replace(s.begin(), s.end(), '*', '_');
+ replace(s.begin(), s.end(), '?', '_');
+ replace(s.begin(), s.end(), '"', '_');
+ replace(s.begin(), s.end(), '|', '_');
+ replace(s.begin(), s.end(), ':', '_');
+ replace(s.begin(), s.end(), '>', '_');
+ replace(s.begin(), s.end(), '<', '_');
+}
+
static void ensure_directory_exists(string &path)
{
replace(path.begin(), path.end(), '\\', '/');
@@ -740,6 +753,10 @@ bool SimpleOutput::ConfigureRecording(bool updateReplayBuffer)
"FilenameFormatting");
bool overwriteIfExists = config_get_bool(main->Config(), "Output",
"OverwriteIfExists");
+ const char *rbPrefix = config_get_string(main->Config(), "SimpleOutput",
+ "RecRBPrefix");
+ const char *rbSuffix = config_get_string(main->Config(), "SimpleOutput",
+ "RecRBSuffix");
int rbTime = config_get_int(main->Config(), "SimpleOutput",
"RecRBTime");
int rbSize = config_get_int(main->Config(), "SimpleOutput",
@@ -775,8 +792,26 @@ bool SimpleOutput::ConfigureRecording(bool updateReplayBuffer)
obs_data_t *settings = obs_data_create();
if (updateReplayBuffer) {
+ string f;
+
+ if (rbPrefix && *rbPrefix) {
+ f += rbPrefix;
+ if (f.back() != ' ')
+ f += " ";
+ }
+
+ f += filenameFormat;
+
+ if (rbSuffix && *rbSuffix) {
+ if (*rbSuffix != ' ')
+ f += " ";
+ f += rbSuffix;
+ }
+
+ remove_reserved_file_characters(f);
+
obs_data_set_string(settings, "directory", path);
- obs_data_set_string(settings, "format", filenameFormat);
+ obs_data_set_string(settings, "format", f.c_str());
obs_data_set_string(settings, "extension", format);
obs_data_set_int(settings, "max_time_sec", rbTime);
obs_data_set_int(settings, "max_size_mb",
diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp
index 72918ddc04939cd82b020da313c33d5385937c9d..c6609cb17b09e9a96d0da5ec54b44b4ba6175a21 100644
--- a/UI/window-basic-main.cpp
+++ b/UI/window-basic-main.cpp
@@ -850,6 +850,8 @@ bool OBSBasic::InitBasicConfigDefaults()
config_set_default_bool(basicConfig, "SimpleOutput", "RecRB", false);
config_set_default_int(basicConfig, "SimpleOutput", "RecRBTime", 20);
config_set_default_int(basicConfig, "SimpleOutput", "RecRBSize", 512);
+ config_set_default_string(basicConfig, "SimpleOutput", "RecRBPrefix",
+ "Replay");
config_set_default_bool (basicConfig, "AdvOut", "ApplyServiceSettings",
true);
diff --git a/UI/window-basic-settings.cpp b/UI/window-basic-settings.cpp
index f4b741928bb7ec935ac516498f47d69276b41e92..3af09866d10b029e63bb51285f5d8c220f1ebc4c 100644
--- a/UI/window-basic-settings.cpp
+++ b/UI/window-basic-settings.cpp
@@ -374,6 +374,8 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget(ui->resetOSXVSync, CHECK_CHANGED, ADV_CHANGED);
HookWidget(ui->filenameFormatting, EDIT_CHANGED, ADV_CHANGED);
HookWidget(ui->overwriteIfExists, CHECK_CHANGED, ADV_CHANGED);
+ HookWidget(ui->simpleRBPrefix, EDIT_CHANGED, ADV_CHANGED);
+ HookWidget(ui->simpleRBSuffix, EDIT_CHANGED, ADV_CHANGED);
HookWidget(ui->streamDelayEnable, CHECK_CHANGED, ADV_CHANGED);
HookWidget(ui->streamDelaySec, SCROLL_CHANGED, ADV_CHANGED);
HookWidget(ui->streamDelayPreserve, CHECK_CHANGED, ADV_CHANGED);
@@ -1869,6 +1871,10 @@ void OBSBasicSettings::LoadAdvancedSettings()
"OverwriteIfExists");
const char *bindIP = config_get_string(main->Config(), "Output",
"BindIP");
+ const char *rbPrefix = config_get_string(main->Config(), "SimpleOutput",
+ "RecRBPrefix");
+ const char *rbSuffix = config_get_string(main->Config(), "SimpleOutput",
+ "RecRBSuffix");
loading = true;
@@ -1876,6 +1882,8 @@ void OBSBasicSettings::LoadAdvancedSettings()
ui->filenameFormatting->setText(filename);
ui->overwriteIfExists->setChecked(overwriteIfExists);
+ ui->simpleRBPrefix->setText(rbPrefix);
+ ui->simpleRBSuffix->setText(rbSuffix);
ui->reconnectEnable->setChecked(reconnect);
ui->reconnectRetryDelay->setValue(retryDelay);
@@ -2382,6 +2390,8 @@ void OBSBasicSettings::SaveAdvancedSettings()
SaveCombo(ui->colorSpace, "Video", "ColorSpace");
SaveComboData(ui->colorRange, "Video", "ColorRange");
SaveEdit(ui->filenameFormatting, "Output", "FilenameFormatting");
+ SaveEdit(ui->simpleRBPrefix, "SimpleOutput", "RecRBPrefix");
+ SaveEdit(ui->simpleRBSuffix, "SimpleOutput", "RecRBSuffix");
SaveCheckBox(ui->overwriteIfExists, "Output", "OverwriteIfExists");
SaveCheckBox(ui->streamDelayEnable, "Output", "DelayEnable");
SaveSpinBox(ui->streamDelaySec, "Output", "DelaySec");