X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fdocclipbase.cpp;h=b64517df6496cdd18477906d33089344e4c3c6eb;hb=676263c5c1287a6e89c18d8b67efba7e8ef33045;hp=be815389f5ce8794f902af2f2d4227ab812f48ef;hpb=c24047e6998a99571bcbef77c71525ab1474fcad;p=kdenlive diff --git a/src/docclipbase.cpp b/src/docclipbase.cpp index be815389..b64517df 100644 --- a/src/docclipbase.cpp +++ b/src/docclipbase.cpp @@ -29,14 +29,14 @@ #include "kthumb.h" #include "clipmanager.h" +#include #include #include DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QString &id) : QObject(), - audioFrameChache(), - m_description(), + m_audioFrameCache(), m_refcount(0), m_baseTrackProducers(), m_audioTrackProducers(), @@ -47,11 +47,12 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QStrin m_thumbProd(NULL), m_audioThumbCreated(false), m_id(id), + m_placeHolder(xml.hasAttribute("placeholder")), m_properties() { int type = xml.attribute("type").toInt(); m_clipType = (CLIPTYPE) type; - + if (m_placeHolder) xml.removeAttribute("placeholder"); QDomNamedNodeMap attributes = xml.attributes(); for (int i = 0; i < attributes.count(); i++) { m_properties.insert(attributes.item(i).nodeName(), attributes.item(i).nodeValue()); @@ -91,9 +92,7 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QStrin DocClipBase::~DocClipBase() { - if (m_thumbProd) { - delete m_thumbProd; - } + delete m_thumbProd; if (m_audioTimer) { m_audioTimer->stop(); delete m_audioTimer; @@ -102,7 +101,7 @@ DocClipBase::~DocClipBase() m_baseTrackProducers.clear(); qDeleteAll(m_audioTrackProducers); m_audioTrackProducers.clear(); - if (m_videoOnlyProducer) delete m_videoOnlyProducer; + delete m_videoOnlyProducer; m_videoOnlyProducer = NULL; } @@ -137,7 +136,7 @@ void DocClipBase::slotClearAudioCache() { if (m_thumbProd) m_thumbProd->stopAudioThumbs(); if (m_audioTimer != NULL) m_audioTimer->stop(); - audioFrameChache.clear(); + m_audioFrameCache.clear(); m_audioThumbCreated = false; } @@ -279,7 +278,7 @@ const QPixmap & DocClipBase::thumbnail() const void DocClipBase::updateAudioThumbnail(QMap > data) { //kDebug() << "CLIPBASE RECIEDVED AUDIO DATA*********************************************"; - audioFrameChache = data; + m_audioFrameCache = data; m_audioThumbCreated = true; emit gotAudioData(); } @@ -412,7 +411,7 @@ void DocClipBase::deleteProducers() if (m_thumbProd) m_thumbProd->clearProducer(); qDeleteAll(m_audioTrackProducers); m_audioTrackProducers.clear(); - if (m_videoOnlyProducer) delete m_videoOnlyProducer; + delete m_videoOnlyProducer; m_videoOnlyProducer = NULL; } @@ -515,8 +514,16 @@ Mlt::Producer *DocClipBase::producer(int track) int i; for (i = 0; i < m_baseTrackProducers.count(); i++) if (m_baseTrackProducers.at(i) != NULL) break; + if (i >= m_baseTrackProducers.count()) return NULL; - m_baseTrackProducers[track] = new Mlt::Producer(*m_baseTrackProducers.at(i)->profile(), m_baseTrackProducers.at(i)->get("resource")); + + if (KIO::NetAccess::exists(KUrl(m_baseTrackProducers.at(i)->get("resource")), KIO::NetAccess::SourceSide, 0)) + m_baseTrackProducers[track] = new Mlt::Producer(*m_baseTrackProducers.at(i)->profile(), m_baseTrackProducers.at(i)->get("resource")); + else { // special case for placeholder clips + m_baseTrackProducers[track] = NULL; + return NULL; + } + if (m_properties.contains("force_aspect_ratio")) m_baseTrackProducers[track]->set("force_aspect_ratio", m_properties.value("force_aspect_ratio").toDouble()); if (m_properties.contains("threads")) m_baseTrackProducers[track]->set("threads", m_properties.value("threads").toInt()); if (m_properties.contains("video_index")) m_baseTrackProducers[track]->set("video_index", m_properties.value("video_index").toInt()); @@ -758,5 +765,8 @@ bool DocClipBase::slotGetAudioThumbs() return true; } - +bool DocClipBase::isPlaceHolder() const +{ + return m_placeHolder; +}