UI: Add file prefix/suffix options for replay buffer
Adds the ability to use a specific prefix and/or suffix on replay buffer filenames to distinguish them from normal recordings. Defaults to having the prefix "Replay".
This commit is contained in:
parent
f790d0fe08
commit
ec60ab9bc6
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>981</width>
|
||||
<height>720</height>
|
||||
<height>748</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -2630,8 +2630,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>98</width>
|
||||
<height>28</height>
|
||||
<width>800</width>
|
||||
<height>69</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
@ -2949,8 +2949,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>98</width>
|
||||
<height>28</height>
|
||||
<width>818</width>
|
||||
<height>697</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="hotkeyLayout">
|
||||
@ -2996,8 +2996,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>559</width>
|
||||
<height>681</height>
|
||||
<width>803</width>
|
||||
<height>709</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||
@ -3193,6 +3193,9 @@
|
||||
<string>Basic.Settings.Output.Adv.Recording</string>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_17">
|
||||
<property name="labelAlignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
@ -3210,6 +3213,42 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="simpleRBPrefix"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_58">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Output.ReplayBuffer.Suffix</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="simpleRBSuffix"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_57">
|
||||
<property name="text">
|
||||
<string>Basic.Settings.Output.ReplayBuffer.Prefix</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -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",
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
|
Loading…
x
Reference in New Issue
Block a user