Commit 926d39d2 authored by Julius Künzel's avatar Julius Künzel 💬
Browse files

[kdenlive_render] Drop --in and --out parameter

The seem to have been needed in the past, but now ee don't need them
since we can get the in and out point from the playlist. We only need
them to calculate the progress in some cases.
parent aa298b79
......@@ -159,12 +159,6 @@ int main(int argc, char **argv)
QCommandLineOption pidOption("pid", "Process ID to send back progress.", "pid");
parser.addOption(pidOption);
QCommandLineOption inOption("in", "Start rendering at frame pos", "frame");
parser.addOption(inOption);
QCommandLineOption outOption("out", "End rendering at frame pos.", "frame");
parser.addOption(outOption);
QCommandLineOption subtitleOption("subtitle", "Subtitle file.", "file");
parser.addOption(subtitleOption);
......@@ -190,21 +184,22 @@ int main(int argc, char **argv)
args.removeFirst();
int pid = parser.value(pidOption).toInt();
int out = parser.value(outOption).toInt();
if (out == 0) {
out = -1;
}
QString subtitleFile = parser.value(subtitleOption);
LocaleHandling::resetAllLocale();
/*QFile f(playlist);
QFile f(playlist);
QDomDocument doc;
doc.setContent(&f, false);
f.close();
QDomElement consumer = doc.documentElement().firstChildElement(QStringLiteral("consumer"));
if (!consumer.isNull()) {
}*/
int in = -1;
int out = -1;
// get in and out point, we need them to calculate the progress in some cases
if (!consumer.isNull()) {
in = consumer.attribute(QStringLiteral("in"), "-1").toInt();
out = consumer.attribute(QStringLiteral("out"), "-1").toInt();
}
qDebug() << "Start renderjob in out" << in << out;
auto *rJob = new RenderJob(render, playlist, target, pid, in, out, subtitleFile, &app);
QObject::connect(rJob, &RenderJob::renderingFinished, rJob, [&]() {
rJob->deleteLater();
......
......@@ -58,12 +58,6 @@ RenderJob::RenderJob(const QString &render, const QString &scenelist, const QStr
// Disable VDPAU so that rendering will work even if there is a Kdenlive instance using VDPAU
qputenv("MLT_NO_VDPAU", "1");
m_args << "-progress" << scenelist;
if (in != -1) {
m_args << QStringLiteral("in=") + QString::number(in);
}
if (out != -1) {
m_args << QStringLiteral("out=") + QString::number(out);
}
// Create a log of every render process.
if (!m_logfile.open(QIODevice::WriteOnly | QIODevice::Text)) {
......
......@@ -996,7 +996,7 @@ void RenderWidget::generateRenderFiles(QDomDocument doc, int in, int out, QStrin
QList<RenderJobItem *> jobList;
QMap<QString, QString>::const_iterator i = renderFiles.constBegin();
while (i != renderFiles.constEnd()) {
RenderJobItem *renderItem = createRenderJob(i.key(), i.value(), in, out, subtitleFile);
RenderJobItem *renderItem = createRenderJob(i.key(), i.value(), subtitleFile);
if (renderItem != nullptr) {
jobList << renderItem;
}
......@@ -1010,7 +1010,7 @@ void RenderWidget::generateRenderFiles(QDomDocument doc, int in, int out, QStrin
checkRenderStatus();
}
RenderJobItem *RenderWidget::createRenderJob(const QString &playlist, const QString &outputFile, int in, int out, const QString &subtitleFile)
RenderJobItem *RenderWidget::createRenderJob(const QString &playlist, const QString &outputFile, const QString &subtitleFile)
{
QList<QTreeWidgetItem *> existing = m_view.running_jobs->findItems(outputFile, Qt::MatchExactly, 1);
RenderJobItem *renderItem = nullptr;
......@@ -1034,15 +1034,13 @@ RenderJobItem *RenderWidget::createRenderJob(const QString &playlist, const QStr
QDateTime t = QDateTime::currentDateTime();
renderItem->setData(1, StartTimeRole, t);
renderItem->setData(1, LastTimeRole, t);
renderItem->setData(1, LastFrameRole, in);
renderItem->setData(1, LastFrameRole, 0);
QStringList argsJob = {QStringLiteral("delivery"),
KdenliveSettings::rendererpath(),
playlist,
outputFile,
QStringLiteral("--pid"),
QString::number(QCoreApplication::applicationPid()),
QStringLiteral("--out"),
QString::number(out)};
QString::number(QCoreApplication::applicationPid())};
if (!subtitleFile.isEmpty()) {
argsJob << QStringLiteral("--subtitle") << subtitleFile;
}
......@@ -1679,7 +1677,6 @@ void RenderWidget::parseScriptFiles()
continue;
}
QString target = consumer.attribute(QStringLiteral("target"));
int out = consumer.attribute(QStringLiteral("out"), QStringLiteral("0")).toInt();
if (target.isEmpty()) {
continue;
}
......@@ -1690,7 +1687,6 @@ void RenderWidget::parseScriptFiles()
item->setSizeHint(0, QSize(m_view.scripts_list->columnWidth(0), fontMetrics().height() * 2));
item->setData(1, Qt::UserRole, QUrl(QUrl::fromEncoded(target.toUtf8())).url(QUrl::PreferLocalFile));
item->setData(1, Qt::UserRole + 1, scriptpath.toLocalFile());
item->setData(1, Qt::UserRole + 2, out);
}
QTreeWidgetItem *script = m_view.scripts_list->topLevelItem(0);
if (script) {
......@@ -1722,7 +1718,6 @@ void RenderWidget::slotStartScript()
auto *item = static_cast<RenderJobItem *>(m_view.scripts_list->currentItem());
if (item) {
QString destination = item->data(1, Qt::UserRole).toString();
int out = item->data(1, Qt::UserRole + 2).toInt();
if (QFile::exists(destination)) {
if (KMessageBox::warningTwoActions(this, i18n("Output file already exists. Do you want to overwrite it?"), {}, KStandardGuiItem::overwrite(),
KStandardGuiItem::cancel()) != KMessageBox::PrimaryAction) {
......@@ -1759,9 +1754,7 @@ void RenderWidget::slotStartScript()
path,
destination,
QStringLiteral("--pid"),
QString::number(QCoreApplication::applicationPid()),
QStringLiteral("--out"),
QString::number(out)};
QString::number(QCoreApplication::applicationPid())};
renderItem->setData(1, ParametersRole, argsJob);
checkRenderStatus();
m_view.tabWidget->setCurrentIndex(Tabs::JobsTab);
......
......@@ -231,7 +231,7 @@ private:
/** @brief Create a new empty playlist (*.mlt) file and @returns the filename of the created file */
QString generatePlaylistFile(bool delayedRendering);
void generateRenderFiles(QDomDocument doc, int in, int out, QString outputFile, bool delayedRendering, const QString &subtitleFile = QString());
RenderJobItem *createRenderJob(const QString &playlist, const QString &outputFile, int in, int out, const QString &subtitleFile = QString());
RenderJobItem *createRenderJob(const QString &playlist, const QString &outputFile, const QString &subtitleFile = QString());
signals:
void abortProcess(const QString &url);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment