]> git.sesse.net Git - kdenlive/blobdiff - src/docclipbase.cpp
- Fix build on FreeBSD.
[kdenlive] / src / docclipbase.cpp
index b0a5ed18392618c321d5492aabd9a0654c72382d..fc4c12c078109a44f44041693cca814d4f1eaa61 100644 (file)
@@ -429,14 +429,8 @@ QString DocClipBase::markerComment(GenTime t)
     return QString();
 }
 
-void DocClipBase::clearProducers()
-{
-    m_baseTrackProducers.clear();
-}
-
 void DocClipBase::deleteProducers(bool clearThumbCreator)
 {
-    kDebug() << "// CLIP KILL PRODS ct: " << m_baseTrackProducers.count();
     if (clearThumbCreator && m_thumbProd) m_thumbProd->clearProducer();
     /*kDebug()<<"// CLIP KILL PRODS ct: "<<m_baseTrackProducers.count();
     int max = m_baseTrackProducers.count();
@@ -657,7 +651,6 @@ const char *DocClipBase::producerProperty(const char *name) const
 void DocClipBase::slotRefreshProducer()
 {
     if (m_baseTrackProducers.count() == 0) return;
-    kDebug() << "////////////   REFRESH CLIP !!!!!!!!!!!!!!!!";
     if (m_clipType == SLIDESHOW) {
         /*Mlt::Producer producer(*(m_clipProducer->profile()), getProperty("resource").toUtf8().data());
         delete m_clipProducer;
@@ -863,7 +856,11 @@ QString DocClipBase::getClipHash() const
     if (m_clipType == SLIDESHOW) hash = QCryptographicHash::hash(m_properties.value("resource").toAscii().data(), QCryptographicHash::Md5).toHex();
     else if (m_clipType == COLOR) hash = QCryptographicHash::hash(m_properties.value("colour").toAscii().data(), QCryptographicHash::Md5).toHex();
     else if (m_clipType == TEXT) hash = QCryptographicHash::hash(QString("title" + getId() + m_properties.value("xmldata")).toUtf8().data(), QCryptographicHash::Md5).toHex();
-    else hash = m_properties.value("file_hash");
+    else {
+        if (m_properties.contains("file_hash")) hash = m_properties.value("file_hash");
+        else hash = getHash(fileURL().path());
+        
+    }
     return hash;
 }
 
@@ -967,6 +964,16 @@ void DocClipBase::setProperty(const QString &key, const QString &value)
             resetProducerProperty("set.force_full_luma");
         } else setProducerProperty("set.force_full_luma", value.toInt());
     }
+    else if (key == "proxy") {
+        // If value is "-", that means user manually disabled proxy on this clip
+        if (value.isEmpty() || value == "-") {
+            // reset proxy
+            emit abortProxy(m_id);
+        }
+        else {
+            emit createProxy(m_id);
+        }
+    }
 }
 
 QMap <QString, QString> DocClipBase::properties() const
@@ -1081,36 +1088,5 @@ bool DocClipBase::hasAudioCodec(const QString &codec) const
     return prod->get(property) == codec;
 }
 
-void DocClipBase::generateProxy(KUrl proxyFolder)
-{
-    if (m_proxyThread.isRunning()) return;
-    QStringList parameters;
-    parameters << "-i" << m_properties.value("resource");
-    QString params = KdenliveSettings::proxyparams().simplified();
-    foreach(QString s, params.split(' '))
-    parameters << s;
-    // Make sure we don't block when proxy file already exists
-    parameters << "-y";
-    if (m_properties.value("file_hash").isEmpty()) getFileHash(m_properties.value("resource"));
-    QString proxydir=proxyFolder.path( KUrl::AddTrailingSlash) + "proxy/";
-    KStandardDirs::makeDir(proxydir);
-    QString path = proxydir + m_properties.value("file_hash") + ".avi";
-    setProperty("proxy", path.toUtf8().data());
-    if (QFile::exists(path)) {
-        emit proxyReady(m_id, true);
-        return;
-    }
-    parameters << path;
-    m_proxyThread = QtConcurrent::run(this, &DocClipBase::slotGenerateProxy, parameters);
-}
 
-void DocClipBase::slotGenerateProxy(QStringList parameters)
-{
-    int result = QProcess::execute("ffmpeg", parameters);
-    if (result == 0) emit proxyReady(m_id, true);
-    else {
-        resetProducerProperty("proxy");
-        emit proxyReady(m_id, false);
-    }
-}