m_audioFrameCache(),
m_refcount(0),
m_baseTrackProducers(),
- m_audioTrackProducers(),
m_videoTrackProducers(),
+ m_audioTrackProducers(),
m_snapMarkers(QList < CommentedTime >()),
m_duration(),
m_thumbProd(NULL),
}
}
+ if (xml.hasAttribute("analysisdata")) {
+ QStringList adata = xml.attribute("analysisdata").split('#', QString::SkipEmptyParts);
+ for (int i = 0; i < adata.count(); i++)
+ m_analysisdata.insert(adata.at(i).section('?', 0, 0), adata.at(i).section('?', 1, 1));
+ }
+
KUrl url = KUrl(xml.attribute("resource"));
if (!m_properties.contains("file_hash") && !url.isEmpty()) getFileHash(url.path());
}
clip.setAttribute("cutzones", cuts.join(";"));
}
+ QString adata;
+ if (!m_analysisdata.isEmpty()) {
+ QMapIterator<QString, QString> i(m_analysisdata);
+ while (i.hasNext()) {
+ i.next();
+ //WARNING: a ? and # separator is not a good idea
+ adata.append(i.key() + "?" + i.value() + "#");
+ }
+ }
+ clip.setAttribute("analysisdata", adata);
//kDebug() << "/// CLIP XML: " << doc.toString();
return doc.documentElement();
}
}
-void DocClipBase::addSnapMarker(const GenTime & time, QString comment)
+void DocClipBase::addSnapMarker(const CommentedTime marker)
{
QList < CommentedTime >::Iterator it = m_snapMarkers.begin();
for (it = m_snapMarkers.begin(); it != m_snapMarkers.end(); ++it) {
- if ((*it).time() >= time)
+ if ((*it).time() >= marker.time())
break;
}
- if ((it != m_snapMarkers.end()) && ((*it).time() == time)) {
- (*it).setComment(comment);
+ if ((it != m_snapMarkers.end()) && ((*it).time() == marker.time())) {
+ (*it).setComment(marker.comment());
+ (*it).setMarkerType(marker.markerType());
//kError() << "trying to add Snap Marker that already exists, this will cause inconsistancies with undo/redo";
} else {
- CommentedTime t(time, comment);
- m_snapMarkers.insert(it, t);
+ m_snapMarkers.insert(it, marker);
}
-
}
void DocClipBase::editSnapMarker(const GenTime & time, QString comment)
return duration();
}
-QString DocClipBase::markerComment(GenTime t)
+QString DocClipBase::markerComment(GenTime t) const
{
- QList < CommentedTime >::Iterator itt = m_snapMarkers.begin();
-
+ QList < CommentedTime >::ConstIterator itt = m_snapMarkers.begin();
while (itt != m_snapMarkers.end()) {
if ((*itt).time() == t)
return (*itt).comment();
return QString();
}
+CommentedTime DocClipBase::markerAt(GenTime t) const
+{
+ QList < CommentedTime >::ConstIterator itt = m_snapMarkers.begin();
+ while (itt != m_snapMarkers.end()) {
+ if ((*itt).time() == t)
+ return (*itt);
+ ++itt;
+ }
+ return CommentedTime();
+}
+
void DocClipBase::clearThumbProducer()
{
if (m_thumbProd) m_thumbProd->clearProducer();
else delete producer;
return;
} else if (id.endsWith("video")) {
- int pos = id.section('_', 0, 0).toInt();
+ int pos = 0;
+ // Keep compatibility with older projects where video only producers were not track specific
+ if (id.contains('_')) pos = id.section('_', 0, 0).toInt();
if (pos >= m_videoTrackProducers.count()) {
while (m_videoTrackProducers.count() - 1 < pos) {
m_videoTrackProducers.append(NULL);
if (m_properties.contains("duration")) prod->set("length", m_properties.value("duration").toInt());
if (m_properties.contains("out"))prod->set("out", m_properties.value("out").toInt());
}
+ if (m_clipType == AUDIO) {
+ prod->set("_audioclip", 1);
+ }
}
return prod;
}
return m_thumbProd->extractImage(frame, width, height);
}
+void DocClipBase::setAnalysisData(const QString &name, const QString &data)
+{
+ if (data.isEmpty()) m_analysisdata.remove(name);
+ else m_analysisdata.insert(name, data);
+}
+
+QMap <QString, QString> DocClipBase::analysisData() const
+{
+ return m_analysisdata;
+}