--- /dev/null
+
+
+set(kdenlive_render_SRCS
+ kdenlive_render.cpp
+ renderjob.cpp
+)
+
+kde4_add_executable(kdenlive_render ${kdenlive_render_SRCS})
+
+target_link_libraries(kdenlive_render
+ ${QT_QTCORE_LIBRARY}
+ ${QT_QTDBUS_LIBRARY}
+)
+
+install(TARGETS kdenlive_render DESTINATION ${BIN_INSTALL_DIR})
+
--- /dev/null
+/****************************************************************************
+**
+** Copyright (C) 2006-2008 Trolltech ASA. All rights reserved.
+**
+** This file is part of the tools applications of the Qt Toolkit.
+**
+** This file may be used under the terms of the GNU General Public
+** License versions 2.0 or 3.0 as published by the Free Software
+** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Alternatively you may (at
+** your option) use any later version of the GNU General Public
+** License if such license has been publicly approved by Trolltech ASA
+** (or its successors, if any) and the KDE Free Qt Foundation. In
+** addition, as a special exception, Trolltech gives you certain
+** additional rights. These rights are described in the Trolltech GPL
+** Exception version 1.2, which can be found at
+** http://www.trolltech.com/products/qt/gplexception/ and in the file
+** GPL_EXCEPTION.txt in this package.
+**
+** Please review the following information to ensure GNU General
+** Public Licensing requirements will be met:
+** http://trolltech.com/products/qt/licenses/licensing/opensource/. If
+** you are unsure which license is appropriate for your use, please
+** review the following information:
+** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
+** or contact the sales department at sales@trolltech.com.
+**
+** In addition, as a special exception, Trolltech, as the sole
+** copyright holder for Qt Designer, grants users of the Qt/Eclipse
+** Integration plug-in the right for the Qt/Eclipse Integration to
+** link to functionality provided by Qt Designer and its related
+** libraries.
+**
+** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
+** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly
+** granted herein.
+**
+** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
+** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+**
+****************************************************************************/
+
+
+#include <QCoreApplication>
+#include <QStringList>
+#include <QString>
+
+#include "renderjob.h"
+
+int main(int argc, char **argv)
+{
+ QCoreApplication app(argc, argv);
+ QStringList args = app.arguments();
+ args.takeFirst();
+ QString player;
+ if (args.count() == 3) player = args.at(2);
+ //fprintf(stderr, "ARGS: %s %s", qPrintable(args.at(0)), qPrintable(args.at(1)));
+ RenderJob *job = new RenderJob(args.at(0), args.at(1), player);
+ job->start();
+ app.exec();
+}
+
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+
+#include <QtDBus>
+
+#include "renderjob.h"
+
+static QDBusConnection connection(QLatin1String(""));
+
+RenderJob::RenderJob(QString scenelist, QString dest, QString player) : QObject() {
+ m_scenelist = scenelist;
+ m_dest = dest;
+ m_player = player;
+ m_progress = 0;
+ m_renderProcess = new QProcess;
+ m_prog = "inigo";
+ m_args << scenelist << "-consumer" << "avformat:" + m_dest << "progress=1";
+ connect(m_renderProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotIsOver(int, QProcess::ExitStatus)));
+ connect(m_renderProcess, SIGNAL(readyReadStandardError()), this, SLOT(receivedStderr()));
+ m_renderProcess->setReadChannel(QProcess::StandardError);
+}
+
+
+RenderJob::~RenderJob() {
+ delete m_renderProcess;
+}
+
+void RenderJob::receivedStderr() {
+ QString result = QString(m_renderProcess->readAllStandardError());
+ result = result.simplified();
+ result = result.section(" ", -1);
+ int pro = result.toInt();
+ if (pro > m_progress) {
+ m_progress = pro;
+ QDBusReply<QString> reply = m_jobUiserver->call("setPercent", (uint) m_progress);
+ }
+}
+
+void RenderJob::start() {
+ QDBusInterface kuiserver("org.kde.JobViewServer", "/JobViewServer", "org.kde.JobViewServer", QDBusConnection::sessionBus());
+ QDBusReply<QString> reply = kuiserver.call("requestView", "kdenlive", "kdenlive", 1);
+ //kDebug()<<"///// JOB REPLY: "<<reply;
+ QStringList args;
+ m_jobUiserver = new QDBusInterface("org.kde.JobViewServer", "/JobViewServer/JobView_1", "org.kde.JobView", QDBusConnection::sessionBus());
+ reply = m_jobUiserver->call("setInfoMessage", tr("Rendering %1").arg(m_dest));
+ m_renderProcess->start(m_prog, m_args);
+}
+
+
+void RenderJob::slotIsOver(int exitcode, QProcess::ExitStatus status) {
+ QDBusReply<QString> reply = m_jobUiserver->call("terminate", "");
+ if (!m_player.isEmpty()) {
+ QStringList args;
+ args<<m_dest;
+ QProcess::startDetached(m_player, args);
+ }
+ exit(1);
+}
+
+#include "renderjob.moc"
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+
+#ifndef RENDERJOB_H
+#define RENDERJOB_H
+
+#include <QProcess>
+#include <QObject>
+#include <QDBusInterface>
+
+class RenderJob : public QObject {
+ Q_OBJECT
+public:
+ RenderJob(QString scenelist, QString dest, QString player);
+ ~RenderJob();
+ void start();
+
+private slots:
+ void slotIsOver(int exitcode, QProcess::ExitStatus status);
+ void receivedStderr();
+
+private:
+ QString m_scenelist;
+ QString m_dest;
+ int m_progress;
+ QProcess *m_renderProcess;
+ QString m_prog;
+ QString m_player;
+ QStringList m_args;
+ QDBusInterface *m_jobUiserver;
+};
+
+#endif