]> git.sesse.net Git - kdenlive/blobdiff - src/projecttree/meltjob.cpp
Const'ref
[kdenlive] / src / projecttree / meltjob.cpp
index 1e97d8f400a6a232a95f4d4935965a3eda41efd0..7fbb258770a7488de4692eebd92e1d58e63cb83f 100644 (file)
@@ -35,7 +35,8 @@ static void consumer_frame_render(mlt_consumer, MeltJob * self, mlt_frame frame_
     self->emitFrameNumber((int) frame.get_position());
 }
 
-MeltJob::MeltJob(CLIPTYPE cType, const QString &id, QStringList parameters,  QMap <QString, QString>extraParams) : AbstractClipJob(MLTJOB, cType, id, parameters),
+MeltJob::MeltJob(CLIPTYPE cType, const QString &id, const QStringList &parameters,  const QMap <QString, QString>&extraParams)
+    : AbstractClipJob(MLTJOB, cType, id, parameters),
     addClipToProject(0),
     m_consumer(NULL),
     m_producer(NULL),
@@ -52,7 +53,7 @@ MeltJob::MeltJob(CLIPTYPE cType, const QString &id, QStringList parameters,  QMa
     if (consum.contains(':')) m_dest = consum.section(':', 1);
 }
 
-void MeltJob::setProducer(Mlt::Producer *producer, KUrl url)
+void MeltJob::setProducer(Mlt::Producer *producer, const KUrl &url)
 {
     m_url = QString::fromUtf8(producer->get("resource"));
     if (m_url == "<playlist>" || m_url == "<tractor>" || m_url == "<producer>")
@@ -110,9 +111,10 @@ void MeltJob::startJob()
        if (m_producer) m_length = m_producer->get_playtime();
     }
     if (!m_producer || !m_producer->is_valid()) {
-       return;
-       m_errorMessage.append(i18n("Invalid clip"));
+       // Clip was removed or something went wrong, Notify user?
+       //m_errorMessage.append(i18n("Invalid clip"));
         setStatus(JOBCRASHED);
+       return;
     }
     if (m_extra.contains("producer_profile")) {
        m_profile->from_producer(*m_producer);
@@ -180,20 +182,19 @@ void MeltJob::startJob()
        jobResults.insert(m_extra.value("key"), result);
     }
     if (!jobResults.isEmpty() && m_jobStatus != JOBABORTED) {
-       m_jobStatus = JOBDONE;
        emit gotFilterJobResults(m_clipId, startPos, track, jobResults, m_extra);
     }
-    if (m_jobStatus == JOBABORTED) m_jobStatus = JOBDONE;
+    if (m_jobStatus == JOBABORTED || m_jobStatus == JOBWORKING) m_jobStatus = JOBDONE;
 }
 
 
 MeltJob::~MeltJob()
 {
-    if (m_showFrameEvent) delete m_showFrameEvent;
-    if (m_filter) delete m_filter;
-    if (m_producer) delete m_producer;
-    if (m_consumer) delete m_consumer;
-    if (m_profile) delete m_profile;
+    delete m_showFrameEvent;
+    delete m_filter;
+    delete m_producer;
+    delete m_consumer;
+    delete m_profile;
 }
 
 const QString MeltJob::destination() const
@@ -241,3 +242,5 @@ void MeltJob::setStatus(CLIPJOBSTATUS status)
     if (status == JOBABORTED && m_consumer) m_consumer->stop();
 }
 
+
+#include "meltjob.moc"