From f5ad8b5d67169ea61a9a2fa74751447fdcf3d591 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Tue, 5 Feb 2019 18:09:00 -0800 Subject: [PATCH] UI: If hardware encoder selected, disable post rescale The post-output rescale option in advanced output mode cannot currently be used with texture-based encoders, so disable the option when a texture-based encoder is selected. --- UI/window-basic-settings.cpp | 62 +++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/UI/window-basic-settings.cpp b/UI/window-basic-settings.cpp index 2af321219..2e1d45826 100644 --- a/UI/window-basic-settings.cpp +++ b/UI/window-basic-settings.cpp @@ -3421,35 +3421,50 @@ void OBSBasicSettings::on_advOutFFPathBrowse_clicked() void OBSBasicSettings::on_advOutEncoder_currentIndexChanged(int idx) { - if (loading) - return; - QString encoder = GetComboData(ui->advOutEncoder); - bool loadSettings = encoder == curAdvStreamEncoder; + if (!loading) { + bool loadSettings = encoder == curAdvStreamEncoder; - delete streamEncoderProps; - streamEncoderProps = CreateEncoderPropertyView(QT_TO_UTF8(encoder), - loadSettings ? "streamEncoder.json" : nullptr, true); - ui->advOutputStreamTab->layout()->addWidget(streamEncoderProps); + delete streamEncoderProps; + streamEncoderProps = CreateEncoderPropertyView( + QT_TO_UTF8(encoder), + loadSettings ? "streamEncoder.json" : nullptr, + true); + ui->advOutputStreamTab->layout()->addWidget(streamEncoderProps); + } + + uint32_t caps = obs_get_encoder_caps(QT_TO_UTF8(encoder)); + + if (caps & OBS_ENCODER_CAP_PASS_TEXTURE) { + ui->advOutUseRescale->setChecked(false); + ui->advOutUseRescale->setEnabled(false); + ui->advOutRescale->setEnabled(false); + } else { + ui->advOutUseRescale->setEnabled(true); + ui->advOutRescale->setEnabled(true); + } UNUSED_PARAMETER(idx); } void OBSBasicSettings::on_advOutRecEncoder_currentIndexChanged(int idx) { - if (loading) + if (!loading) { + ui->advOutRecUseRescale->setEnabled(idx > 0); + ui->advOutRecRescaleContainer->setEnabled(idx > 0); + + delete recordEncoderProps; + recordEncoderProps = nullptr; + } + + if (idx <= 0) { return; + } - ui->advOutRecUseRescale->setEnabled(idx > 0); - ui->advOutRecRescaleContainer->setEnabled(idx > 0); - - delete recordEncoderProps; - recordEncoderProps = nullptr; - - if (idx > 0) { - QString encoder = GetComboData(ui->advOutRecEncoder); - bool loadSettings = encoder == curAdvRecordEncoder; + QString encoder = GetComboData(ui->advOutRecEncoder); + bool loadSettings = encoder == curAdvRecordEncoder; + if (!loading) { recordEncoderProps = CreateEncoderPropertyView( QT_TO_UTF8(encoder), loadSettings ? "recordEncoder.json" : nullptr, @@ -3458,6 +3473,17 @@ void OBSBasicSettings::on_advOutRecEncoder_currentIndexChanged(int idx) connect(recordEncoderProps, SIGNAL(Changed()), this, SLOT(AdvReplayBufferChanged())); } + + uint32_t caps = obs_get_encoder_caps(QT_TO_UTF8(encoder)); + + if (caps & OBS_ENCODER_CAP_PASS_TEXTURE) { + ui->advOutRecUseRescale->setChecked(false); + ui->advOutRecUseRescale->setEnabled(false); + ui->advOutRecRescale->setEnabled(false); + } else { + ui->advOutRecUseRescale->setEnabled(true); + ui->advOutRecRescale->setEnabled(true); + } } void OBSBasicSettings::on_advOutFFIgnoreCompat_stateChanged(int)