X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fdocclipbase.cpp;h=4c6ccad4eaa3370b2a8aae52294e5d43be37af38;hb=e19f8a27245266dcc6c76ecdcea6c1c827f04399;hp=9b6f09d3eb929c764b4576035a29d12aa46aea10;hpb=193f15aae98916a602801266a9d881566320d6b6;p=kdenlive diff --git a/src/docclipbase.cpp b/src/docclipbase.cpp index 9b6f09d3..4c6ccad4 100644 --- a/src/docclipbase.cpp +++ b/src/docclipbase.cpp @@ -34,25 +34,26 @@ #include DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QString &id) : - audioFrameChache(QMap > ()), - m_description(QString()), + QObject(), + m_audioFrameCache(), m_refcount(0), - m_baseTrackProducers(QList ()), - m_audioTrackProducers(QList ()), + m_baseTrackProducers(), + m_audioTrackProducers(), m_videoOnlyProducer(NULL), - m_snapMarkers(QList < CommentedTime > ()), - m_duration(GenTime()), + m_snapMarkers(), + m_duration(), m_audioTimer(NULL), m_thumbProd(NULL), m_audioThumbCreated(false), m_id(id), - m_properties(QMap ()) + 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 (unsigned int i = 0; i < attributes.count(); i++) { + for (int i = 0; i < attributes.count(); i++) { m_properties.insert(attributes.item(i).nodeName(), attributes.item(i).nodeValue()); } @@ -90,15 +91,17 @@ 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; } qDeleteAll(m_baseTrackProducers); m_baseTrackProducers.clear(); + qDeleteAll(m_audioTrackProducers); + m_audioTrackProducers.clear(); + delete m_videoOnlyProducer; + m_videoOnlyProducer = NULL; } void DocClipBase::setZone(QPoint zone) @@ -132,7 +135,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; } @@ -274,7 +277,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(); } @@ -283,7 +286,7 @@ QList < GenTime > DocClipBase::snapMarkers() const { QList < GenTime > markers; - for (uint count = 0; count < m_snapMarkers.count(); ++count) { + for (int count = 0; count < m_snapMarkers.count(); ++count) { markers.append(m_snapMarkers[count].time()); } @@ -405,6 +408,10 @@ void DocClipBase::deleteProducers() qDeleteAll(m_baseTrackProducers); m_baseTrackProducers.clear(); if (m_thumbProd) m_thumbProd->clearProducer(); + qDeleteAll(m_audioTrackProducers); + m_audioTrackProducers.clear(); + delete m_videoOnlyProducer; + m_videoOnlyProducer = NULL; } void DocClipBase::setProducer(Mlt::Producer *producer) @@ -506,8 +513,13 @@ 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")); + + // special case for placeholder clips + if (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()); @@ -570,14 +582,14 @@ void DocClipBase::slotRefreshProducer() int ct = 0; Mlt::Filter *filter = clipService.filter(ct); while (filter) { - if (filter->get("mlt_service") == "luma") { + if (strcmp(filter->get("mlt_service"), "luma") == 0) { break; } ct++; filter = clipService.filter(ct); } - if (filter && filter->get("mlt_service") == "luma") { + if (filter && strcmp(filter->get("mlt_service"), "luma") == 0) { filter->set("period", getProperty("ttl").toInt() - 1); filter->set("luma.out", getProperty("luma_duration").toInt()); QString resource = getProperty("luma_file"); @@ -609,7 +621,7 @@ void DocClipBase::slotRefreshProducer() int ct = 0; Mlt::Filter *filter = clipService.filter(0); while (filter) { - if (filter->get("mlt_service") == "luma") { + if (strcmp(filter->get("mlt_service"), "luma") == 0) { clipService.detach(*filter); } else ct++; filter = clipService.filter(ct); @@ -749,5 +761,8 @@ bool DocClipBase::slotGetAudioThumbs() return true; } - +bool DocClipBase::isPlaceHolder() const +{ + return m_placeHolder; +}