Skip to content

Commit

Permalink
disable Reframe and Resample when not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Sep 13, 2024
1 parent da4a912 commit 82ef16e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/docks/encodedock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ Mlt::Producer *EncodeDock::fromProducer() const
else if (from == "timeline" || from.startsWith("marker:"))
return MAIN.multitrack();
else
return 0;
return nullptr;
}

void EncodeDock::filterCodecParams(const QString &vcodec, QStringList &other)
Expand Down Expand Up @@ -1913,7 +1913,9 @@ void EncodeDock::onProfileChanged()
ui->gopSpinner->setValue(qRound(MLT.profile().fps() * 5.0));
ui->gopSpinner->blockSignals(false);
}
auto reframe = getReframeFilter(fromProducer());
auto producer = fromProducer();
ui->reframeButton->setEnabled(producer && producer == MAIN.multitrack());
auto reframe = getReframeFilter(producer);
if (reframe.is_valid()) {
auto rect = reframe.anim_get_rect("rect", 0);
if (rect.w > 0 && rect.h > 0) {
Expand All @@ -1925,7 +1927,7 @@ void EncodeDock::onProfileChanged()
ui->resampleButton->setDisabled(true);
}
} else {
ui->resampleButton->setEnabled(true);
ui->resampleButton->setEnabled(producer && producer->is_valid());
}
ui->resampleButton->setChecked(false);
setResampleEnabled(false);
Expand Down Expand Up @@ -2232,7 +2234,10 @@ void EncodeDock::on_gopSpinner_valueChanged(int value)
void EncodeDock::on_fromCombo_currentIndexChanged(int index)
{
Q_UNUSED(index)
if (MLT.isSeekable(fromProducer()))
auto producer = fromProducer();
ui->reframeButton->setEnabled(producer && producer == MAIN.multitrack());
ui->resampleButton->setEnabled(!getReframeFilter(producer).is_valid());
if (MLT.isSeekable(producer))
ui->encodeButton->setText(tr("Export File"));
else
ui->encodeButton->setText(tr("Capture File"));
Expand Down

0 comments on commit 82ef16e

Please sign in to comment.