effectslistwidget.cpp
titledocument.cpp
transition.cpp
+ renderjob.cpp
)
kde4_add_kcfg_files(kdenlive_SRCS GENERATE_MOC kdenlivesettings.kcfgc )
</Menu>
<Menu name="project" ><text>Project</text>
+ <Action name="project_render" />
<Action name="project_settings" />
</Menu>
#include <KStatusBar>
#include <kstandarddirs.h>
#include <KUrlRequesterDialog>
+#include <KTemporaryFile>
+#include <kuiserverjobtracker.h>
#include <mlt++/Mlt.h>
#include "profilesdialog.h"
#include "projectsettings.h"
#include "events.h"
+#include "renderjob.h"
#define ID_STATUS_MSG 1
#define ID_EDITMODE_MSG 2
actionCollection()->addAction("project_settings", projectAction);
connect(projectAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProjectSettings()));
+ KAction* projectRender = new KAction(this);
+ projectRender->setText(i18n("Render Project"));
+ projectRender->setIcon(KIcon("document-new"));
+ actionCollection()->addAction("project_render", projectRender);
+ connect(projectRender, SIGNAL(triggered(bool)), this, SLOT(slotRenderProject()));
+
KAction* monitorPlay = new KAction(this);
monitorPlay->setText(i18n("Play"));
monitorPlay->setIcon(KIcon("media-playback-start"));
delete w;
}
+void MainWindow::slotRenderProject() {
+ KUrl exportFile = KUrl(KFileDialog::getSaveFileName());
+ if (exportFile.isEmpty()) return;
+ KTemporaryFile temp;
+ 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();
+ }
+}
void MainWindow::slotUpdateMousePosition(int pos) {
if (m_activeDocument)
void slotGotProgressInfo(KUrl url, int progress);
void slotSwitchVideoThumbs();
void slotSwitchAudioThumbs();
+ void slotRenderProject();
};
#endif
render->resetProfile(prof);
}
+void Monitor::saveSceneList(QString path) {
+ if (render == NULL) return;
+ render->saveSceneList(path);
+}
#include "monitor.moc"
void start();
void activateMonitor();
void slotPlay();
+ void saveSceneList(QString path);
signals:
void renderPosition(int);
//TODO: we should also rebuild filters and delete existing m_mltProfile
//delete m_mltProfile;
- //m_mltProfile = new Mlt::Profile("pal_dv");//(char*) qstrdup(profile.toUtf8()));
+ m_mltProfile = new Mlt::Profile((char*) profile.toUtf8().data());
kDebug() << " ++++++++++ RESET CONSUMER WITH PROFILE: " << m_mltProfile->width();
// mlt_properties properties = MLT_CONSUMER_PROPERTIES(m_mltConsumer->get_consumer());
//mlt_profile prof = m_mltProfile->get_profile();
//mlt_properties_set_data(properties, "_profile", prof, 0, (mlt_destructor)mlt_profile_close, NULL);
//mlt_properties_set(properties, "profile", "hdv_1080_50i");
- m_mltConsumer->set("profile", (char *) profile.data());
+ m_mltConsumer->set("profile", (char *) profile.toUtf8().data());
//apply_profile_properties( m_mltProfile, m_mltConsumer->get_consumer(), properties );
//refresh();
return 1;
char *tmp = decodedString(playlist);
m_mltProducer = new Mlt::Producer(*m_mltProfile, "westley-xml", tmp);
delete[] tmp;
+ if (!m_mltProducer || !m_mltProducer->is_valid()) kDebug() << " WARNING - - - - -INVALIDÂ PLAYLIST: " << tmp;
//m_mltProducer->optimise();
if (position != 0) m_mltProducer->seek(position);
}*/
m_fps = m_mltProducer->get_fps();
-
emit durationChanged(m_mltProducer->get_playtime());
//m_connectTimer->start( 500 );
connectPlaylist();
QString result;
if (temp.open()) {
- QString path = temp.fileName();
- char *tmppath = decodedString("westley:" + path);
- Mlt::Consumer westleyConsumer(*m_mltProfile , tmppath);
- delete[] tmppath;
- westleyConsumer.set("terminate_on_pause", 1);
- Mlt::Producer prod(m_mltProducer->get_producer());
- westleyConsumer.connect(prod);
- westleyConsumer.start();
-
- QFile file(path);
+ saveSceneList(temp.fileName());
+ QFile file(temp.fileName());
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
return QString();
return result;
}
+void Render::saveSceneList(QString path) {
+ char *tmppath = decodedString("westley:" + path);
+ Mlt::Consumer westleyConsumer(*m_mltProfile , tmppath);
+ delete[] tmppath;
+ westleyConsumer.set("terminate_on_pause", 1);
+ Mlt::Producer prod(m_mltProducer->get_producer());
+ westleyConsumer.connect(prod);
+ westleyConsumer.start();
+}
+
const double Render::fps() const {
return m_fps;
refresh();
}
-void Render::render(const KUrl & url) {
- QDomDocument doc;
- QDomElement elem = doc.createElement("render");
- elem.setAttribute("filename", url.path());
- doc.appendChild(elem);
-}
void Render::sendSeekCommand(GenTime time) {
if (!m_mltProducer)
void setSceneList(QDomDocument list, int position = 0);
void setSceneList(QString playlist, int position = 0);
QString sceneList();
+ void saveSceneList(QString path);
/** Wraps the VEML command of the same name. Tells the renderer to
play the current scene at the speed specified, relative to normal
void play(double speed, const GenTime & startTime);
void play(double speed, const GenTime & startTime,
const GenTime & stopTime);
- /** Wraps the VEML command of the same name - render the currently
- specified sceneList - set with setSceneList() - to the document
- name specified. */
- void render(const KUrl & url);
/** Returns the description of this renderer */
QString description();
--- /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 <KDebug>
+#include <KLocale>
+#include <kuiserverjobtracker.h>
+
+#include "renderjob.h"
+#include "timecode.h"
+#include "kdenlivesettings.h"
+
+
+
+RenderJob::RenderJob(KUrl scenelist, KUrl dest) : KJob(), m_scenelist(scenelist), m_dest(dest), m_progress(0) {
+ m_renderProcess = new KProcess;
+ *m_renderProcess << "inigo" << scenelist.path() << "-consumer" << "avformat:" + m_dest.path() << "progress=1";
+ connect(m_renderProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(slotIsOver(int, QProcess::ExitStatus)));
+ connect(m_renderProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(receivedStderr()));
+ connect(m_renderProcess, SIGNAL(readyReadStandardError()), this, SLOT(receivedStderr()));
+ m_renderProcess->setOutputChannelMode(KProcess::OnlyStderrChannel);
+ m_renderProcess->start();
+
+}
+
+
+RenderJob::~RenderJob() {
+}
+
+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;
+ update();
+ }
+}
+
+void RenderJob::start() {
+ registerJob(this);
+}
+
+void RenderJob::registerJob(KJob *job) {
+ KIO::getJobTracker()->registerJob(job);
+ emit description(this, "Rendering " + m_dest.fileName(),
+ qMakePair(QString("source"), m_scenelist.path()),
+ qMakePair(QString("destination"), m_dest.path()));
+}
+
+void RenderJob::unregisterJob(KJob *job) {
+ KIO::getJobTracker()->unregisterJob(job);
+}
+
+
+unsigned long RenderJob::percent() const {
+ return m_progress;
+}
+
+void RenderJob::update() {
+ setPercent(percent());
+}
+
+void RenderJob::slotIsOver(int exitcode, QProcess::ExitStatus status) {
+ emitResult();
+ KIO::getJobTracker()->unregisterJob(this);
+}
+
+#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 <KJob>
+#include <KUrl>
+#include <KProcess>
+#include <kio/job.h>
+#include <kio/filejob.h>
+
+#include "gentime.h"
+#include "definitions.h"
+#include "docclipbase.h"
+
+class RenderJob : public KJob {
+ Q_OBJECT
+public:
+ RenderJob(KUrl scenelist, KUrl dest);
+ ~RenderJob();
+
+ void registerJob(KJob *);
+ void unregisterJob(KJob *);
+
+ void start();
+ unsigned long percent() const;
+
+private slots:
+ void update();
+ void slotIsOver(int exitcode, QProcess::ExitStatus status);
+ void receivedStderr();
+
+private:
+ KUrl m_scenelist;
+ KUrl m_dest;
+ int m_progress;
+ KProcess *m_renderProcess;
+};
+
+#endif