UI: Use radio buttons for FLV track selection

master
Clayton Groeneveld 2019-07-23 07:20:13 -05:00 committed by jp9000
parent 768a58771a
commit bab3391ce4
6 changed files with 267 additions and 131 deletions

View File

@ -935,7 +935,6 @@ SceneItemHide="Hide '%1'"
# Output warnings
OutputWarnings.NoTracksSelected="You must select at least one track"
OutputWarnings.MultiTrackRecording="Warning: Certain formats (such as FLV) do not support multiple tracks per recording"
OutputWarnings.MP4Recording="Warning: Recordings saved to MP4/MOV will be unrecoverable if the file cannot be finalized (e.g. as a result of BSODs, power losses, etc.). If you want to record multiple audio tracks consider using MKV and remux the recording to MP4/MOV after it is finished (File → Remux Recordings)"
OutputWarnings.CannotPause="Warning: Recordings cannot be paused if the recording encoder is set to \"(Use stream encoder)\""

View File

@ -1849,6 +1849,55 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="advOutEncLabel">
<property name="text">
<string>Basic.Settings.Output.Encoder</string>
</property>
<property name="buddy">
<cstring>advOutEncoder</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="advOutEncoder"/>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="advOutApplyService">
<property name="text">
<string>Basic.Settings.Output.Adv.ApplyServiceSettings</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="advOutUseRescale">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Basic.Settings.Output.Adv.Rescale</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="advOutRescale">
<property name="enabled">
<bool>false</bool>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QWidget" name="widget_8" native="true">
<property name="sizePolicy">
@ -1918,55 +1967,6 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="advOutEncLabel">
<property name="text">
<string>Basic.Settings.Output.Encoder</string>
</property>
<property name="buddy">
<cstring>advOutEncoder</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="advOutEncoder"/>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="advOutApplyService">
<property name="text">
<string>Basic.Settings.Output.Adv.ApplyServiceSettings</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="advOutUseRescale">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Basic.Settings.Output.Adv.Rescale</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="advOutRescale">
<property name="enabled">
<bool>false</bool>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -2187,72 +2187,6 @@
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QWidget" name="widget_9" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_9">
<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="QCheckBox" name="advOutRecTrack1">
<property name="text">
<string notr="true">1</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="advOutRecTrack2">
<property name="text">
<string notr="true">2</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="advOutRecTrack3">
<property name="text">
<string notr="true">3</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="advOutRecTrack4">
<property name="text">
<string notr="true">4</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="advOutRecTrack5">
<property name="text">
<string notr="true">5</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="advOutRecTrack6">
<property name="text">
<string notr="true">6</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="advOutRecEncLabel">
<property name="text">
@ -2323,6 +2257,133 @@
<item row="6" column="1">
<widget class="QLineEdit" name="advOutMuxCustom"/>
</item>
<item row="3" column="1">
<widget class="QStackedWidget" name="advRecTrackWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="recTracks" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<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="QCheckBox" name="advOutRecTrack1">
<property name="text">
<string notr="true">1</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="advOutRecTrack2">
<property name="text">
<string notr="true">2</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="advOutRecTrack3">
<property name="text">
<string notr="true">3</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="advOutRecTrack4">
<property name="text">
<string notr="true">4</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="advOutRecTrack5">
<property name="text">
<string notr="true">5</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="advOutRecTrack6">
<property name="text">
<string notr="true">6</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="flvTracks">
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>9</x>
<y>0</y>
<width>221</width>
<height>21</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_24">
<item>
<widget class="QRadioButton" name="flvTrack1">
<property name="text">
<string>1</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="flvTrack2">
<property name="text">
<string>2</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="flvTrack3">
<property name="text">
<string>3</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="flvTrack4">
<property name="text">
<string>4</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="flvTrack5">
<property name="text">
<string>5</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="flvTrack6">
<property name="text">
<string>6</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</widget>
</item>
</layout>
</widget>
</item>

View File

@ -1305,7 +1305,18 @@ inline void AdvancedOutput::SetupRecording()
bool rescale = config_get_bool(main->Config(), "AdvOut", "RecRescale");
const char *rescaleRes =
config_get_string(main->Config(), "AdvOut", "RecRescaleRes");
int tracks = config_get_int(main->Config(), "AdvOut", "RecTracks");
int tracks;
const char *recFormat =
config_get_string(main->Config(), "AdvOut", "RecFormat");
bool flv = strcmp(recFormat, "flv") == 0;
if (flv)
tracks = config_get_int(main->Config(), "AdvOut", "FLVTrack");
else
tracks = config_get_int(main->Config(), "AdvOut", "RecTracks");
obs_data_t *settings = obs_data_create();
unsigned int cx = 0;
unsigned int cy = 0;
@ -1340,15 +1351,24 @@ inline void AdvancedOutput::SetupRecording()
h264Recording);
}
for (int i = 0; i < MAX_AUDIO_MIXES; i++) {
if ((tracks & (1 << i)) != 0) {
obs_output_set_audio_encoder(fileOutput, aacTrack[i],
idx);
if (replayBuffer)
obs_output_set_audio_encoder(replayBuffer,
if (!flv) {
for (int i = 0; i < MAX_AUDIO_MIXES; i++) {
if ((tracks & (1 << i)) != 0) {
obs_output_set_audio_encoder(fileOutput,
aacTrack[i], idx);
idx++;
if (replayBuffer)
obs_output_set_audio_encoder(
replayBuffer, aacTrack[i], idx);
idx++;
}
}
} else if (flv && tracks != 0) {
obs_output_set_audio_encoder(fileOutput, aacTrack[tracks - 1],
idx);
if (replayBuffer)
obs_output_set_audio_encoder(replayBuffer,
aacTrack[tracks - 1], idx);
}
obs_data_set_string(settings, "path", path);

View File

@ -1243,6 +1243,7 @@ bool OBSBasic::InitBasicConfigDefaults()
config_set_default_bool(basicConfig, "AdvOut", "RecUseRescale", false);
config_set_default_uint(basicConfig, "AdvOut", "RecTracks", (1 << 0));
config_set_default_string(basicConfig, "AdvOut", "RecEncoder", "none");
config_set_default_uint(basicConfig, "AdvOut", "FLVTrack", 1);
config_set_default_bool(basicConfig, "AdvOut", "FFOutputToFile", true);
config_set_default_string(basicConfig, "AdvOut", "FFFilePath",

View File

@ -381,6 +381,12 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
HookWidget(ui->advOutRecTrack4, CHECK_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->advOutRecTrack5, CHECK_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->advOutRecTrack6, CHECK_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->flvTrack1, CHECK_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->flvTrack2, CHECK_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->flvTrack3, CHECK_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->flvTrack4, CHECK_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->flvTrack5, CHECK_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->flvTrack6, CHECK_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->advOutFFType, COMBO_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->advOutFFRecPath, EDIT_CHANGED, OUTPUTS_CHANGED);
HookWidget(ui->advOutFFNoSpace, CHECK_CHANGED, OUTPUTS_CHANGED);
@ -1692,6 +1698,7 @@ void OBSBasicSettings::LoadAdvOutputRecordingSettings()
const char *muxCustom =
config_get_string(main->Config(), "AdvOut", "RecMuxerCustom");
int tracks = config_get_int(main->Config(), "AdvOut", "RecTracks");
int flvTrack = config_get_int(main->Config(), "AdvOut", "FLVTrack");
int typeIndex = (astrcmpi(type, "FFmpeg") == 0) ? 1 : 0;
ui->advOutRecType->setCurrentIndex(typeIndex);
@ -1710,6 +1717,30 @@ void OBSBasicSettings::LoadAdvOutputRecordingSettings()
ui->advOutRecTrack4->setChecked(tracks & (1 << 3));
ui->advOutRecTrack5->setChecked(tracks & (1 << 4));
ui->advOutRecTrack6->setChecked(tracks & (1 << 5));
switch (flvTrack) {
case 1:
ui->flvTrack1->setChecked(true);
break;
case 2:
ui->flvTrack2->setChecked(true);
break;
case 3:
ui->flvTrack3->setChecked(true);
break;
case 4:
ui->flvTrack4->setChecked(true);
break;
case 5:
ui->flvTrack5->setChecked(true);
break;
case 6:
ui->flvTrack6->setChecked(true);
break;
default:
ui->flvTrack1->setChecked(true);
break;
}
}
void OBSBasicSettings::LoadAdvOutputRecordingEncoderProperties()
@ -3171,6 +3202,8 @@ void OBSBasicSettings::SaveOutputSettings()
(ui->advOutRecTrack5->isChecked() ? (1 << 4) : 0) |
(ui->advOutRecTrack6->isChecked() ? (1 << 5) : 0));
config_set_int(main->Config(), "AdvOut", "FLVTrack", CurrentFLVTrack());
config_set_bool(main->Config(), "AdvOut", "FFOutputToFile",
ui->advOutFFType->currentIndex() == 0 ? true : false);
SaveEdit(ui->advOutFFRecPath, "AdvOut", "FFFilePath");
@ -3953,13 +3986,6 @@ void OBSBasicSettings::AdvOutRecCheckWarnings()
Checked(ui->advOutRecTrack3) + Checked(ui->advOutRecTrack4) +
Checked(ui->advOutRecTrack5) + Checked(ui->advOutRecTrack6);
if (tracks == 0) {
errorMsg = QTStr("OutputWarnings.NoTracksSelected");
} else if (tracks > 1) {
warningMsg = QTStr("OutputWarnings.MultiTrackRecording");
}
bool useStreamEncoder = ui->advOutRecEncoder->currentIndex() == 0;
if (useStreamEncoder) {
if (!warningMsg.isEmpty())
@ -3967,6 +3993,15 @@ void OBSBasicSettings::AdvOutRecCheckWarnings()
warningMsg += QTStr("OutputWarnings.CannotPause");
}
if (ui->advOutRecFormat->currentText().compare("flv") == 0) {
ui->advRecTrackWidget->setCurrentWidget(ui->flvTracks);
} else {
ui->advRecTrackWidget->setCurrentWidget(ui->recTracks);
if (tracks == 0)
errorMsg = QTStr("OutputWarnings.NoTracksSelected");
}
if (ui->advOutRecFormat->currentText().compare("mp4") == 0 ||
ui->advOutRecFormat->currentText().compare("mov") == 0) {
if (!warningMsg.isEmpty())
@ -4609,3 +4644,21 @@ void OBSBasicSettings::SetAdvancedIcon(const QIcon &icon)
{
ui->listWidget->item(6)->setIcon(icon);
}
int OBSBasicSettings::CurrentFLVTrack()
{
if (ui->flvTrack1->isChecked())
return 1;
else if (ui->flvTrack2->isChecked())
return 2;
else if (ui->flvTrack3->isChecked())
return 3;
else if (ui->flvTrack4->isChecked())
return 4;
else if (ui->flvTrack5->isChecked())
return 5;
else if (ui->flvTrack6->isChecked())
return 6;
return 0;
}

View File

@ -300,6 +300,8 @@ private:
QIcon GetHotkeysIcon() const;
QIcon GetAdvancedIcon() const;
int CurrentFLVTrack();
private slots:
void on_theme_activated(int idx);