#include <QCryptographicHash>
-DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QString &id):
- m_id(id), m_description(QString()), m_refcount(0), m_audioThumbCreated(false), m_duration(GenTime()), m_thumbProd(NULL), m_audioTimer(NULL), m_properties(QMap <QString, QString> ()), audioFrameChache(QMap<int, QMap<int, QByteArray> > ()), m_baseTrackProducers(QList <Mlt::Producer *>()), m_snapMarkers(QList < CommentedTime > ()), m_videoOnlyProducer(NULL), m_audioTrackProducers(QList <Mlt::Producer *>())
+DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QString &id) :
+ QObject(),
+ m_audioFrameCache(),
+ m_refcount(0),
+ m_baseTrackProducers(),
+ m_audioTrackProducers(),
+ m_videoOnlyProducer(NULL),
+ m_snapMarkers(),
+ m_duration(),
+ m_audioTimer(NULL),
+ 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 (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());
}
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)
{
if (m_thumbProd) m_thumbProd->stopAudioThumbs();
if (m_audioTimer != NULL) m_audioTimer->stop();
- audioFrameChache.clear();
+ m_audioFrameCache.clear();
m_audioThumbCreated = false;
}
void DocClipBase::updateAudioThumbnail(QMap<int, QMap<int, QByteArray> > data)
{
//kDebug() << "CLIPBASE RECIEDVED AUDIO DATA*********************************************";
- audioFrameChache = data;
+ m_audioFrameCache = data;
m_audioThumbCreated = true;
emit gotAudioData();
}
{
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());
}
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)
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());
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");
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);
return true;
}
-
+bool DocClipBase::isPlaceHolder() const
+{
+ return m_placeHolder;
+}