#include "clipmanager.h"
DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, uint id):
- m_id(id), m_description(QString()), m_refcount(0), m_projectThumbFrame(0), m_audioThumbCreated(false), m_duration(GenTime()), m_thumbProd(NULL), m_audioTimer(NULL) {
+ m_id(id), m_description(QString()), m_refcount(0), m_audioThumbCreated(false), m_duration(GenTime()), m_thumbProd(NULL), m_audioTimer(NULL), m_clipProducer(NULL) {
int type = xml.attribute("type").toInt();
m_clipType = (CLIPTYPE) type;
m_name = xml.attribute("name");
int out = xml.attribute("out").toInt();
if (out != 0) {
setDuration(GenTime(out, KdenliveSettings::project_fps()));
- //m_properties.insert("out", QString::number(out));
+ } else {
+ out = xml.attribute("duration").toInt();
+ if (out != 0) setDuration(GenTime(out, KdenliveSettings::project_fps()));
}
if (m_name.isEmpty()) m_name = url.fileName();
//kDebug() << "type is video" << (m_clipType == AV) << " " << m_clipType;
}
-
-
-DocClipBase::DocClipBase(const DocClipBase& clip) {
- m_id = clip.getId();
- m_clipType = clip.clipType();
- m_name = clip.name();
- m_duration = clip.duration();
- m_audioThumbCreated = clip.audioThumbCreated();
- m_properties = clip.properties();
-}
-
-DocClipBase & DocClipBase::operator=(const DocClipBase & clip) {
+/*DocClipBase & DocClipBase::operator=(const DocClipBase & clip) {
DocClipBase::operator=(clip);
m_id = clip.getId();
m_clipType = clip.clipType();
m_audioThumbCreated = clip.audioThumbCreated();
m_properties = clip.properties();
return *this;
-}
+}*/
DocClipBase::~DocClipBase() {
if (m_thumbProd) delete m_thumbProd;
+ if (m_clipProducer) delete m_clipProducer;
}
void DocClipBase::slotCreateAudioTimer() {
void DocClipBase::setClipType(CLIPTYPE type) {
m_clipType = type;
+ m_properties.insert("type", QString::number((int) type));
if (m_thumbProd && m_audioTimer == NULL && (m_clipType == AV || m_clipType == AUDIO))
slotCreateAudioTimer();
}
return KUrl();
}
-void DocClipBase::setProjectThumbFrame(const uint &ix) {
- m_projectThumbFrame = ix;
+void DocClipBase::setClipThumbFrame(const uint &ix) {
+ m_properties.insert("thumbnail", QString::number((int) ix));
}
-uint DocClipBase::getProjectThumbFrame() const {
- return m_projectThumbFrame;
+uint DocClipBase::getClipThumbFrame() const {
+ return (uint) m_properties.value("thumbnail").toInt();
}
const QString DocClipBase::description() const {
void DocClipBase::setDuration(GenTime dur) {
m_duration = dur;
+ m_properties.insert("duration", QString::number((int) dur.frames(KdenliveSettings::project_fps())));
}
const GenTime &DocClipBase::duration() const {
const GenTime &DocClipBase::maxDuration() const {
if (m_clipType == COLOR || m_clipType == IMAGE || m_clipType == TEXT || (m_clipType == SLIDESHOW && m_properties.value("loop") == "1")) {
- GenTime dur(10000, KdenliveSettings::project_fps());
+ const GenTime dur(10000, KdenliveSettings::project_fps());
return dur;
}
return m_duration;
node.normalize();
if (element.tagName() != "kdenliveclip") {
kWarning() <<
- "DocClipBase::createClip() element has unknown tagName : " <<
- element.tagName() << endl;
+ "DocClipBase::createClip() element has unknown tagName : " << element.tagName();
return 0;
}
n = n.nextSibling();
}
if (clip == 0) {
- kWarning() << "DocClipBase::createClip() unable to create clip" <<
- endl;
+ kWarning() << "DocClipBase::createClip() unable to create clip";
} else {
// setup DocClipBase specifics of the clip.
QMap <QString, QString> props;
}
-QDomDocument DocClipBase::generateSceneList(bool, bool) const {
-}
-
void DocClipBase::setThumbnail(const QPixmap & pixmap) {
m_thumbnail = pixmap;
}
}
if ((it != m_snapMarkers.end()) && ((*it).time() == time)) {
- kError() <<
- "trying to add Snap Marker that already exists, this will cause inconsistancies with undo/redo"
- << endl;
+ (*it).setComment(comment);
+ //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);
if (it != m_snapMarkers.end()) {
(*it).setComment(comment);
} else {
- kError() <<
- "trying to edit Snap Marker that does not already exists" << endl;
+ kError() << "trying to edit Snap Marker that does not already exists";
}
}
return QString::null;
}
+void DocClipBase::setProducer(Mlt::Producer *producer) {
+ m_clipProducer = producer;
+ if (m_thumbProd) m_thumbProd->setProducer(producer);
+}
+
+Mlt::Producer *DocClipBase::producer() {
+ return m_clipProducer;
+}
+
void DocClipBase::setProperties(QMap <QString, QString> properties) {
// changing clip type is not allowed
properties.remove("type");