Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Use detached rendering process, render progress is shown in KDE's Job Viewer.

svn path=/branches/KDE4/; revision=2029
parent 56e7f309
......@@ -48,32 +48,36 @@
#include "renderjob.h"
int main(int argc, char **argv)
{
int main(int argc, char **argv) {
QCoreApplication app(argc, argv);
QStringList args = app.arguments();
if (!args.isEmpty()) args.takeFirst();
if (args.count() >= 4) {
QString render = args.at(0);
args.takeFirst();
QString player = args.at(0);
args.takeFirst();
QString src = args.at(0);
args.takeFirst();
QString dest = args.at(0);
args.takeFirst();
RenderJob *job = new RenderJob(render, player, src, dest, args);
job->start();
app.exec();
}
else {
fprintf(stderr, "Kdenlive video renderer for MLT.\nUsage: "
"kdenlive_render [renderer] [player] [src] [dest] [[arg1] [arg2] ...]\n"
" render: path to inigo rendrer\n"
" player: path to video player to play when rendering is over, use '-' to disable playing\n"
" src: source file (usually westley playlist)\n"
" dest: destination file\n"
" args: space separated libavformat arguments\n");
bool erase = false;
if (args.at(0) == "-erase") {
erase = true;
args.takeFirst();
}
QString render = args.at(0);
args.takeFirst();
QString player = args.at(0);
args.takeFirst();
QString src = args.at(0);
args.takeFirst();
QString dest = args.at(0);
args.takeFirst();
RenderJob *job = new RenderJob(erase, render, player, src, dest, args);
job->start();
app.exec();
} else {
fprintf(stderr, "Kdenlive video renderer for MLT.\nUsage: "
"kdenlive_render [-erase] [renderer] [player] [src] [dest] [[arg1] [arg2] ...]\n"
" -erase: if that parameter is present, src file will be erased at the end\n"
" render: path to inigo rendrer\n"
" player: path to video player to play when rendering is over, use '-' to disable playing\n"
" src: source file (usually westley playlist)\n"
" dest: destination file\n"
" args: space separated libavformat arguments\n");
}
}
......@@ -24,14 +24,15 @@
static QDBusConnection connection(QLatin1String(""));
RenderJob::RenderJob(QString renderer, QString player, QString scenelist, QString dest, QStringList args) : QObject() {
RenderJob::RenderJob(bool erase, QString renderer, QString player, QString scenelist, QString dest, QStringList args) : QObject() {
m_scenelist = scenelist;
m_dest = dest;
m_player = player;
m_progress = 0;
m_erase = erase;
m_renderProcess = new QProcess;
m_prog = renderer;
m_args << scenelist << "-consumer" << "avformat:" + m_dest << "progress=1"<<args;
m_args << scenelist << "-consumer" << "avformat:" + m_dest << "progress=1" << args;
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);
......@@ -49,7 +50,7 @@ void RenderJob::receivedStderr() {
int pro = result.toInt();
if (pro > m_progress) {
m_progress = pro;
QDBusReply<QString> reply = m_jobUiserver->call("setPercent", (uint) m_progress);
QDBusReply<QString> reply = m_jobUiserver->call("setPercent", (uint) m_progress);
}
}
......@@ -65,10 +66,14 @@ void RenderJob::start() {
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);
if (m_erase) {
QFile f(m_scenelist);
f.remove();
}
if (m_player != "-") {
QStringList args;
args << m_dest;
QProcess::startDetached(m_player, args);
}
exit(1);
}
......
......@@ -28,7 +28,7 @@
class RenderJob : public QObject {
Q_OBJECT
public:
RenderJob(QString renderer, QString player, QString scenelist, QString dest, QStringList args);
RenderJob(bool erase, QString renderer, QString player, QString scenelist, QString dest, QStringList args);
~RenderJob();
void start();
......@@ -44,6 +44,7 @@ private:
QString m_prog;
QString m_player;
QStringList m_args;
bool m_erase;
QDBusInterface *m_jobUiserver;
};
......
......@@ -159,7 +159,7 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event) {
if (opMode == MOVE) {
setCursor(Qt::OpenHandCursor);
} else if (opMode == RESIZESTART) {
setCursor(KCursor("left_side", Qt::SizeHorCursor));
setCursor(KCursor("left_side", Qt::SizeHorCursor));
kDebug() << "******** RESIZE CLIP START; WIDTH: " << size;
if (m_visualTip == NULL) {
QPolygon polygon;
......@@ -186,7 +186,7 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event) {
m_animationTimer->start();
}
} else if (opMode == RESIZEEND) {
setCursor(KCursor("right_side", Qt::SizeHorCursor));
setCursor(KCursor("right_side", Qt::SizeHorCursor));
if (m_visualTip == NULL) {
QPolygon polygon;
polygon << QPoint(clip->rect().x() + clip->rect().width(), clip->rect().y() + clip->rect().height() / 2 - size * 2);
......@@ -337,7 +337,7 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event) {
emit clipItemSelected(m_dragItem);
m_clickPoint = mapToScene(event->pos()).x() - m_dragItem->startPos().frames(m_document->fps()) * m_scale;
m_operationMode = m_dragItem->operationMode(item->mapFromScene(mapToScene(event->pos())), m_scale);
if (m_operationMode == MOVE) setCursor(Qt::ClosedHandCursor);
if (m_operationMode == MOVE) setCursor(Qt::ClosedHandCursor);
if (m_operationMode == MOVE || m_operationMode == RESIZESTART)
m_startPos = QPointF(m_dragItem->startPos().frames(m_document->fps()), m_dragItem->track());
else if (m_operationMode == RESIZEEND)
......
......@@ -58,9 +58,9 @@
#define ID_STATUS_MSG 1
#define ID_EDITMODE_MSG 2
#define ID_TIMELINE_MSG 3
#define ID_TIMELINE_BUTTONS 4
#define ID_TIMELINE_POS 5
#define ID_TIMELINE_FORMAT 6
#define ID_TIMELINE_BUTTONS 5
#define ID_TIMELINE_POS 6
#define ID_TIMELINE_FORMAT 7
MainWindow::MainWindow(QWidget *parent)
: KXmlGuiWindow(parent),
......@@ -476,12 +476,14 @@ void MainWindow::slotRenderProject() {
KUrl exportFile = KUrl(KFileDialog::getSaveFileName());
if (exportFile.isEmpty()) return;
KTemporaryFile temp;
temp.setAutoRemove(false);
temp.setSuffix(".westley");
if (temp.open()) {
kDebug() << "/////// STARTING EXPORT: " << temp.fileName() << ", TO: " << exportFile.path();
m_projectMonitor->saveSceneList(temp.fileName());
RenderJob *rj = new RenderJob(KUrl(temp.fileName()), exportFile);
rj->start();
QStringList args;
args << "-erase" << "inigo" << "kmplayer" << temp.fileName() << exportFile.path();
QProcess::startDetached("kdenlive_render", args);
}
}
......
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