]> git.sesse.net Git - kdenlive/blobdiff - renderer/kdenlive_render.cpp
When starting kuiserver, revert to Mads' thread trick since my last change did not...
[kdenlive] / renderer / kdenlive_render.cpp
index 77e3beea297e9a49ec0ce44d4ca8fe1572beed25..d9b7e92284e42d3427d1b475d36a5f370d86b357 100644 (file)
@@ -1,63 +1,85 @@
-/****************************************************************************
-**
-** 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.
-**
-****************************************************************************/
-
+/***************************************************************************
+ *   Copyright (C) 2008 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 <stdio.h>
 #include <QCoreApplication>
 #include <QStringList>
 #include <QString>
+#include <QtDebug>
 
 #include "renderjob.h"
 
-int main(int argc, char **argv)
-{
+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();
+    QStringList preargs;
+    int in = -1;
+    int out = -1;
+    if (!args.isEmpty()) args.takeFirst();
+    if (args.count() >= 4) {
+        bool erase = false;
+        if (args.at(0) == "-erase") {
+            erase = true;
+            args.takeFirst();
+        }
+        if (args.at(0).startsWith("in=")) {
+            in = args.at(0).section('=', -1).toInt();
+            args.takeFirst();
+        }
+        if (args.at(0).startsWith("out=")) {
+            out = args.at(0).section('=', -1).toInt();
+            args.takeFirst();
+        }
+        if (args.at(0).startsWith("preargs=")) {
+            QString a = args.at(0).section('=', 1);
+           preargs = a.split(" ", QString::SkipEmptyParts);
+            args.takeFirst();
+        }
+        QString render = args.at(0);
+        args.takeFirst();
+        QString profile = args.at(0);
+        args.takeFirst();
+        QString rendermodule = 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, profile, rendermodule, player, src, dest, preargs, args, in, out);
+        job->start();
+       qDebug()<<"//STARTING RENDERING: "<<erase<<","<<render<<","<<profile<<","<<rendermodule<<","<<player<<","<<src<<","<<dest<<","<<preargs<<","<<args<<","<<in<<","<<out;
+        app.exec();
+    } else {
+        fprintf(stderr, "Kdenlive video renderer for MLT.\nUsage: "
+                "kdenlive_render [-erase] [in=pos] [out=pos] [render] [profile] [rendermodule] [player] [src] [dest] [[arg1] [arg2] ...]\n"
+                "  -erase: if that parameter is present, src file will be erased at the end\n"
+                "  in=pos: start rendering at frame pos\n"
+                "  out=pos: end rendering at frame pos\n"
+                "  render: path to inigo render\n"
+                "  profile: the MLT video profile\n"
+                "  rendermodule: the MLT consumer used for rendering, usually it is avformat\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");
+    }
 }