Enable 2 pass encoding for rendering. All you need to do is add "pass=2" to the rendering arguments

svn path=/branches/KDE4/; revision=3082
parent ddbd58f6
......@@ -68,9 +68,22 @@ int main(int argc, char **argv) {
args.takeFirst();
QString dest = args.at(0);
args.takeFirst();
bool dualpass = false;
bool doerase;
if (args.contains("pass=2")) {
// dual pass encoding
dualpass = true;
doerase = false;
args.replace(args.indexOf("pass=2"), "pass=1");
} else doerase = erase;
qDebug() << "//STARTING RENDERING: " << erase << "," << usekuiserver << "," << render << "," << profile << "," << rendermodule << "," << player << "," << src << "," << dest << "," << preargs << "," << args << "," << in << "," << out ;
RenderJob *job = new RenderJob(erase, usekuiserver, render, profile, rendermodule, player, src, dest, preargs, args, in, out);
RenderJob *job = new RenderJob(doerase, usekuiserver, render, profile, rendermodule, player, src, dest, preargs, args, in, out);
job->start();
if (dualpass) {
args.replace(args.indexOf("pass=1"), "pass=2");
RenderJob *dualjob = new RenderJob(erase, usekuiserver, render, profile, rendermodule, player, src, dest, preargs, args, in, out);
QObject::connect(job, SIGNAL(renderingFinished()), dualjob, SLOT(start()));
}
app.exec();
} else {
fprintf(stderr, "Kdenlive video renderer for MLT.\nUsage: "
......
......@@ -44,6 +44,7 @@ RenderJob::RenderJob(bool erase, bool usekuiserver, const QString &renderer, con
m_args << scenelist;
if (in != -1) m_args << "in=" + QString::number(in);
if (out != -1) m_args << "out=" + QString::number(out);
m_args << preargs;
//qDebug()<<"PRE ARGS: "<<preargs;
if (scenelist.startsWith("consumer:")) {
......@@ -51,6 +52,10 @@ RenderJob::RenderJob(bool erase, bool usekuiserver, const QString &renderer, con
m_args << "profile=" + profile;
} else m_args << "-profile" << profile;
m_args << "-consumer" << rendermodule + ":" + m_dest << "progress=1" << args;
m_dualpass = false;
if (args.contains("pass=1")) m_dualpass = true;
connect(m_renderProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotIsOver(int, QProcess::ExitStatus)));
m_renderProcess->setReadChannel(QProcess::StandardError);
......@@ -239,14 +244,15 @@ void RenderJob::slotIsOver(int exitcode, QProcess::ExitStatus status) {
// m_logstream << "Rendering of " << m_dest << " aborted, resulting video will probably be corrupted." << endl;
qDebug() << "Rendering of " << m_dest << " aborted, resulting video will probably be corrupted.";
QProcess::startDetached("kdialog", args);
qApp->quit();
} else {
if (m_kdenliveinterface) {
if (!m_dualpass && m_kdenliveinterface) {
m_dbusargs[1] = (int) - 1;
m_dbusargs.append(QString());
m_kdenliveinterface->callWithArgumentList(QDBus::NoBlock, "setRenderingFinished", m_dbusargs);
}
QDBusConnectionInterface* interface = QDBusConnection::sessionBus().interface();
if (interface && interface->isServiceRegistered("org.kde.knotify")) {
if (!m_dualpass && interface && interface->isServiceRegistered("org.kde.knotify")) {
QDBusMessage m = QDBusMessage::createMethodCall("org.kde.knotify",
"/Notify",
"org.kde.KNotify",
......@@ -268,14 +274,17 @@ void RenderJob::slotIsOver(int exitcode, QProcess::ExitStatus status) {
}
// m_logstream << "Rendering of " << m_dest << " finished" << endl;
qDebug() << "Rendering of " << m_dest << " finished";
if (m_player != "-") {
if (!m_dualpass && m_player != "-") {
// m_logstream << "Starting player" << endl;
QStringList args;
args << m_dest;
QProcess::startDetached(m_player, args);
}
if (m_dualpass) {
emit renderingFinished();
deleteLater();
} else qApp->quit();
}
qApp->quit();
}
#include "renderjob.moc"
......@@ -31,9 +31,12 @@
class RenderJob : public QObject {
Q_OBJECT
public:
RenderJob(bool erase, bool usekuiserver, const QString &renderer, const QString &profile, const QString &rendermodule, const QString &player, const QString &scenelist, const QString &dest, const QStringList &preargs, const QStringList &args, int in = -1, int out = -1);
~RenderJob();
public slots:
void start();
private slots:
......@@ -52,6 +55,7 @@ private:
QString m_player;
QStringList m_args;
bool m_erase;
bool m_dualpass;
QDBusInterface *m_jobUiserver;
QDBusInterface *m_kdenliveinterface;
QList<QVariant> m_dbusargs;
......@@ -62,6 +66,9 @@ private:
QTemporaryFile m_logfile;
/** \brief Used to write to the log file */
QTextStream m_logstream;
signals:
void renderingFinished();
};
#endif
Markdown is supported
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