From: Jean-Baptiste Mardelle Date: Sat, 19 Jul 2008 10:01:20 +0000 (+0000) Subject: More efficient usage of MLT producers X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=4eb044ee62e1f0535557a1bb381520bf959629bb;p=kdenlive More efficient usage of MLT producers svn path=/branches/KDE4/; revision=2322 --- diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 0e48dfaf..2e7ba058 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -936,7 +936,7 @@ void CustomTrackView::dropEvent(QDropEvent * event) { info = m_dropItem->info(); info.track = m_tracksList.count() - m_dropItem->track(); // kDebug()<<"IIIIIIIIIIIIIIIIIIIIIIII TRAX CNT: "<track(); - m_document->renderer()->mltInsertClip(info, m_dropItem->xml()); + m_document->renderer()->mltInsertClip(info, m_dropItem->xml(), m_dropItem->baseClip()->producer()); m_document->setModified(true); } else QGraphicsView::dropEvent(event); m_dropItem = NULL; @@ -1130,7 +1130,7 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event) { new AddTimelineClipCommand(this, clip->xml(), clip->clipProducer(), item->info(), false, false, moveClips); ItemInfo info = item->info(); info.track = m_tracksList.count() - item->track(); - m_document->renderer()->mltInsertClip(info, clip->xml()); + m_document->renderer()->mltInsertClip(info, clip->xml(), clip->baseClip()->producer()); } else { Transition *tr = static_cast (item); ItemInfo transitionInfo = tr->info(); @@ -1301,7 +1301,7 @@ void CustomTrackView::addClip(QDomElement xml, int clipId, ItemInfo info) { baseclip->addReference(); m_document->updateClip(baseclip->getId()); info.track = m_tracksList.count() - info.track; - m_document->renderer()->mltInsertClip(info, xml); + m_document->renderer()->mltInsertClip(info, xml, baseclip->producer()); m_document->renderer()->doRefresh(); } @@ -1315,7 +1315,7 @@ void CustomTrackView::slotUpdateClip(int clipId) { clip->refreshClip(); ItemInfo info = clip->info(); info.track = m_tracksList.count() - clip->track(); - m_document->renderer()->mltUpdateClip(info, clip->xml()); + m_document->renderer()->mltUpdateClip(info, clip->xml(), clip->baseClip()->producer()); } } } diff --git a/src/docclipbase.cpp b/src/docclipbase.cpp index a380b8fa..3bb9dab3 100644 --- a/src/docclipbase.cpp +++ b/src/docclipbase.cpp @@ -23,7 +23,7 @@ #include "clipmanager.h" DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, uint id): - m_id(id), m_description(QString()), m_refcount(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"); @@ -51,18 +51,7 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, uint id): //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(); @@ -71,10 +60,11 @@ DocClipBase & DocClipBase::operator=(const DocClipBase & clip) { 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() { @@ -366,6 +356,15 @@ QString DocClipBase::markerComment(GenTime t) { 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 properties) { // changing clip type is not allowed properties.remove("type"); diff --git a/src/docclipbase.h b/src/docclipbase.h index 634a47b4..51ecdd03 100644 --- a/src/docclipbase.h +++ b/src/docclipbase.h @@ -42,7 +42,9 @@ class KdenliveDoc; class KThumb; class ClipManager; - +namespace Mlt { +class Producer; +}; class DocClipBase: public QObject { @@ -53,8 +55,7 @@ Q_OBJECT public: * and video. */ DocClipBase(ClipManager *clipManager, QDomElement xml, uint id); - DocClipBase(const DocClipBase& clip); - DocClipBase & operator=(const DocClipBase & clip); +// DocClipBase & operator=(const DocClipBase & clip); virtual ~ DocClipBase(); /** sets the name of this clip. */ @@ -105,6 +106,9 @@ Q_OBJECT public: return false; } + void setProducer(Mlt::Producer *producer); + Mlt::Producer *producer(); + /*virtual DocClipAVFile *toDocClipAVFile() { return 0; } @@ -190,7 +194,7 @@ private: // Private attributes /** The number of times this clip is used in the project - the number of references to this clip * that exist. */ uint m_refcount; - + Mlt::Producer *m_clipProducer; CLIPTYPE m_clipType; /** A list of snap markers; these markers are added to a clips snap-to points, and are displayed as necessary. */ diff --git a/src/kthumb.cpp b/src/kthumb.cpp index accd897f..a881ec60 100644 --- a/src/kthumb.cpp +++ b/src/kthumb.cpp @@ -132,7 +132,7 @@ void MyThread::run() { #define _G(y,u,v) (0x2568*(y) - 0x0c92*(v) - 0x1a1e*(u)) /0x2000 #define _B(y,u,v) (0x2568*(y) + 0x40cf*(v)) /0x2000 -KThumb::KThumb(ClipManager *clipManager, KUrl url, QObject * parent, const char *name): QObject(parent), m_clipManager(clipManager), m_url(url) { +KThumb::KThumb(ClipManager *clipManager, KUrl url, QObject * parent, const char *name): QObject(parent), m_clipManager(clipManager), m_url(url), m_producer(NULL) { m_profile = new Mlt::Profile((char*) KdenliveSettings::current_profile().data()); QCryptographicHash context(QCryptographicHash::Sha1); @@ -146,6 +146,10 @@ KThumb::~KThumb() { if (thumbProducer.isRunning()) thumbProducer.exit(); } +void KThumb::setProducer(Mlt::Producer *producer) { + m_producer = producer; +} + void KThumb::updateClipUrl(KUrl url) { m_url = url; } @@ -158,23 +162,24 @@ QPixmap KThumb::getImage(KUrl url, int width, int height) { void KThumb::extractImage(int frame, int frame2) { if (m_url.isEmpty()) return; - char *tmp = Render::decodedString(""); + if (m_producer == NULL) return; + /*char *tmp = Render::decodedString(""); Mlt::Producer producer(*m_profile, "westley-xml", tmp); - delete[] tmp; + delete[] tmp;*/ int twidth = (int)(KdenliveSettings::trackheight() * m_profile->dar()); - if (producer.is_blank()) { + if (m_producer->is_blank()) { QPixmap pix(twidth, KdenliveSettings::trackheight()); pix.fill(Qt::black); emit thumbReady(frame, pix); return; } if (frame != -1) { - QPixmap pix = getFrame(producer, frame, twidth, KdenliveSettings::trackheight()); + QPixmap pix = getFrame(*m_producer, frame, twidth, KdenliveSettings::trackheight()); emit thumbReady(frame, pix); } if (frame2 != -1) { - QPixmap pix = getFrame(producer, frame2, twidth , KdenliveSettings::trackheight()); + QPixmap pix = getFrame(*m_producer, frame2, twidth , KdenliveSettings::trackheight()); emit thumbReady(frame2, pix); } } diff --git a/src/kthumb.h b/src/kthumb.h index ffbd745d..65f80efd 100644 --- a/src/kthumb.h +++ b/src/kthumb.h @@ -74,6 +74,7 @@ Q_OBJECT public: KThumb(ClipManager *clipManager, KUrl url, QObject * parent = 0, const char *name = 0); ~KThumb(); + void setProducer(Mlt::Producer *producer); public slots: void extractImage(int frame, int frame2); @@ -96,6 +97,7 @@ private: KUrl m_url; QString m_thumbFile; Mlt::Profile *m_profile; + Mlt::Producer *m_producer; ClipManager *m_clipManager; signals: diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 2c9d015b..fc6955bc 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -83,6 +83,10 @@ #define ID_TIMELINE_POS 6 #define ID_TIMELINE_FORMAT 7 +namespace Mlt { +class Producer; +}; + EffectsList MainWindow::videoEffects; EffectsList MainWindow::audioEffects; EffectsList MainWindow::customEffects; @@ -381,7 +385,7 @@ void MainWindow::slotConnectMonitors() { connect(m_projectList, SIGNAL(showClipProperties(DocClipBase *)), this, SLOT(slotShowClipProperties(DocClipBase *))); connect(m_projectList, SIGNAL(getFileProperties(const QDomElement &, int)), m_clipMonitor->render, SLOT(getFileProperties(const QDomElement &, int))); connect(m_clipMonitor->render, SIGNAL(replyGetImage(int, int, const QPixmap &, int, int)), m_projectList, SLOT(slotReplyGetImage(int, int, const QPixmap &, int, int))); - connect(m_clipMonitor->render, SIGNAL(replyGetFileProperties(int, const QMap < QString, QString > &, const QMap < QString, QString > &)), m_projectList, SLOT(slotReplyGetFileProperties(int, const QMap < QString, QString > &, const QMap < QString, QString > &))); + connect(m_clipMonitor->render, SIGNAL(replyGetFileProperties(int, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &)), m_projectList, SLOT(slotReplyGetFileProperties(int, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &))); connect(m_clipMonitor, SIGNAL(refreshClipThumbnail(int)), m_projectList, SLOT(slotRefreshClipThumbnail(int))); } diff --git a/src/monitor.cpp b/src/monitor.cpp index e03be8a5..ac44012a 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -301,11 +301,7 @@ void Monitor::slotSetXml(DocClipBase *clip, const int position) { if (!clip) return; if (clip != m_currentClip) { m_currentClip = clip; - QDomDocument doc; - QDomElement westley = doc.createElement("westley"); - doc.appendChild(westley); - westley.appendChild(doc.importNode(m_currentClip->toXML(), true)); - render->setSceneList(doc, 0); + render->setProducer(clip->producer(), 0); m_ruler->slotNewValue(0); m_timePos->setText("00:00:00:00"); m_position = 0; diff --git a/src/projectlist.cpp b/src/projectlist.cpp index 879a7bbc..b9191ced 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -453,13 +453,14 @@ void ProjectList::slotRefreshClipThumbnail(ProjectItem *item) { } } -void ProjectList::slotReplyGetFileProperties(int clipId, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata) { +void ProjectList::slotReplyGetFileProperties(int clipId, Mlt::Producer *producer, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata) { ProjectItem *item = getItemById(clipId); if (item) { item->setProperties(properties, metadata); + item->referencedClip()->setProducer(producer); listView->setCurrentItem(item); emit receivedClipDuration(clipId, item->clipMaxDuration()); - } + } else kDebug() << "//////// COULD NOT FIND CLIP TO UPDATE PRPS..."; } void ProjectList::slotReplyGetImage(int clipId, int pos, const QPixmap &pix, int w, int h) { diff --git a/src/projectlist.h b/src/projectlist.h index 99a16114..31a16341 100644 --- a/src/projectlist.h +++ b/src/projectlist.h @@ -34,6 +34,10 @@ #include "definitions.h" #include "timecode.h" +namespace Mlt { +class Producer; +}; + class ProjectItem; class ProjectListView; class Render; @@ -108,7 +112,7 @@ public: public slots: void setDocument(KdenliveDoc *doc); void slotReplyGetImage(int clipId, int pos, const QPixmap &pix, int w, int h); - void slotReplyGetFileProperties(int clipId, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata); + void slotReplyGetFileProperties(int clipId, Mlt::Producer *producer, const QMap < QString, QString > &properties, const QMap < QString, QString > &metadata); void slotAddClip(DocClipBase *clip); void slotDeleteClip(int clipId); void slotUpdateClip(int id); diff --git a/src/renderer.cpp b/src/renderer.cpp index 17593582..cc0b15db 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -61,7 +61,7 @@ static void consumer_frame_show(mlt_consumer, Render * self, mlt_frame frame_ptr } } -Render::Render(const QString & rendererName, int winid, int extid, QWidget *parent): QObject(parent), m_name(rendererName), m_mltConsumer(NULL), m_mltProducer(NULL), m_mltTextProducer(NULL), m_winid(-1), m_framePosition(0), m_generateScenelist(false), m_isBlocked(true) { +Render::Render(const QString & rendererName, int winid, int extid, QWidget *parent): QObject(parent), m_name(rendererName), m_mltConsumer(NULL), m_mltProducer(NULL), m_mltTextProducer(NULL), m_winid(-1), m_framePosition(0), m_generateScenelist(false), m_isBlocked(true), m_blackClip(NULL) { kDebug() << "////////// USING PROFILE: " << (char *)KdenliveSettings::current_profile().toUtf8().data(); m_mltProfile = new Mlt::Profile((char*) KdenliveSettings::current_profile().data()); refreshTimer = new QTimer(this); @@ -89,6 +89,8 @@ Render::Render(const QString & rendererName, int winid, int extid, QWidget *pare m_mltConsumer->listen("consumer-frame-show", this, (mlt_listener) consumer_frame_show); Mlt::Producer *producer = new Mlt::Producer(*m_mltProfile , "westley-xml", ""); m_mltProducer = producer; + if (m_blackClip) delete m_blackClip; + m_blackClip = new Mlt::Producer(*m_mltProfile , "colour", "black"); m_mltConsumer->connect(*m_mltProducer); m_mltProducer->set_speed(0.0); @@ -121,7 +123,7 @@ void Render::closeMlt() { delete m_mltConsumer; if (m_mltProducer) delete m_mltProducer; - while (! m_producersList.isEmpty()) delete m_producersList.takeFirst(); + if (m_blackClip) delete m_blackClip; //delete m_osdInfo; } @@ -162,6 +164,8 @@ int Render::resetProfile(QString profile) { Mlt::Producer *producer = new Mlt::Producer(*m_mltProfile , "westley-xml", tmp); delete[] tmp; m_mltProducer = producer; + if (m_blackClip) delete m_blackClip; + m_blackClip = new Mlt::Producer(*m_mltProfile , "colour", "black"); m_mltProducer->optimise(); m_mltProducer->set_speed(0); connectPlaylist(); @@ -384,36 +388,34 @@ void Render::getFileProperties(const QDomElement &xml, int clipId) { QMap < QString, QString > metadataPropertyMap; KUrl url = KUrl(xml.attribute("resource", QString::null)); - bool newProducer = false; - - Mlt::Producer *producer = getProducerById(QString::number(clipId)); - if (producer == NULL) { - if (true /*url.isEmpty()*/) { - QDomDocument doc; - QDomElement westley = doc.createElement("westley"); - QDomElement play = doc.createElement("playlist"); - doc.appendChild(westley); - westley.appendChild(play); - play.appendChild(doc.importNode(xml, true)); - char *tmp = decodedString(doc.toString()); - producer = new Mlt::Producer(*m_mltProfile, "westley-xml", tmp); - delete[] tmp; - } else { - char *tmp = decodedString(url.path()); - producer = new Mlt::Producer(*m_mltProfile, tmp); - delete[] tmp; - } - - if (producer->is_blank()) { - kDebug() << " / / / / / / / /ERRROR / / / / // CANNOT LOAD PRODUCER: "; - return; - } - m_producersList.append(producer); - newProducer = true; + Mlt::Producer *producer; + if (xml.attribute("type").toInt() == COLOR) { + char *tmp = decodedString("colour:" + xml.attribute("colour")); + producer = new Mlt::Producer(*m_mltProfile, "fezzik", tmp); + producer->set_in_and_out(xml.attribute("in").toInt(), xml.attribute("out").toInt()); + delete[] tmp; + } else if (url.isEmpty()) { + QDomDocument doc; + QDomElement westley = doc.createElement("westley"); + QDomElement play = doc.createElement("playlist"); + doc.appendChild(westley); + westley.appendChild(play); + play.appendChild(doc.importNode(xml, true)); + kDebug() << "/ / / / /CLIP XML: " << doc.toString(); + char *tmp = decodedString(doc.toString()); + producer = new Mlt::Producer(*m_mltProfile, "westley-xml", tmp); + delete[] tmp; + } else { + char *tmp = decodedString(url.path()); + producer = new Mlt::Producer(*m_mltProfile, tmp); + if (!xml.attribute("out").isEmpty()) producer->set_in_and_out(xml.attribute("in").toInt(), xml.attribute("out").toInt()); + delete[] tmp; } - - - + if (producer->is_blank()) { + kDebug() << " / / / / / / / /ERRROR / / / / // CANNOT LOAD PRODUCER: "; + return; + } + producer->set("id", clipId); int frameNumber = xml.attribute("thumbnail", "0").toInt(); if (frameNumber != 0) producer->seek(frameNumber); mlt_properties properties = MLT_PRODUCER_PROPERTIES(producer->get_producer()); @@ -513,10 +515,10 @@ void Render::getFileProperties(const QDomElement &xml, int clipId) { metadataPropertyMap[ name.section(".", 0, -2)] = value; } - emit replyGetFileProperties(clipId, filePropertyMap, metadataPropertyMap); + emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap); kDebug() << "REquested fuile info for: " << url.path(); if (frame) delete frame; - if (!newProducer && producer) delete producer; + //if (producer) delete producer; } /** Create the producer from the Westley QDomDocument */ @@ -555,6 +557,40 @@ void Render::initSceneList() { setSceneList(doc, 0); } #endif + + + +/** Create the producer from the Westley QDomDocument */ +void Render::setProducer(Mlt::Producer *producer, int position) { + if (m_winid == -1) return; + m_generateScenelist = true; + + if (m_mltConsumer) { + m_mltConsumer->stop(); + } else return; + + if (m_mltProducer) { + m_mltProducer->set_speed(0); + delete m_mltProducer; + m_mltProducer = NULL; + emit stopped(); + } + if (producer) m_mltProducer = new Mlt::Producer(producer->get_producer()); + else m_mltProducer = new Mlt::Producer(); + if (!m_mltProducer || !m_mltProducer->is_valid()) kDebug() << " WARNING - - - - -INVALID PLAYLIST: "; + m_mltProducer->optimise(); + + m_fps = m_mltProducer->get_fps(); + connectPlaylist(); + if (position != 0) { + m_mltProducer->seek(position); + emit rendererPosition(position); + } + m_generateScenelist = false; +} + + + /** Create the producer from the Westley QDomDocument */ void Render::setSceneList(QDomDocument list, int position) { setSceneList(list.toString(), position); @@ -592,6 +628,8 @@ void Render::setSceneList(QString playlist, int position) { char *tmp = decodedString(playlist); m_mltProducer = new Mlt::Producer(*m_mltProfile, "westley-xml", tmp); delete[] tmp; + if (m_blackClip) delete m_blackClip; + m_blackClip = new Mlt::Producer(*m_mltProfile , "colour", "black"); if (!m_mltProducer || !m_mltProducer->is_valid()) kDebug() << " WARNING - - - - -INVALID PLAYLIST: " << tmp; m_mltProducer->optimise(); @@ -691,7 +729,6 @@ void Render::connectPlaylist() { m_mltConsumer->connect(*m_mltProducer); m_mltProducer->set_speed(0); m_mltConsumer->start(); - parsePlaylistForClips(); emit durationChanged(m_mltProducer->get_playtime()); //refresh(); /* @@ -1044,21 +1081,21 @@ void Render::mltCheckLength(bool reload) { while (dur > 14000) { info.startPos = GenTime(i * 14000, m_fps); info.endPos = info.startPos + GenTime(13999, m_fps); - mltInsertClip(info, black); + mltInsertClip(info, black, m_blackClip); dur = dur - 14000; i++; } if (dur > 0) { info.startPos = GenTime(i * 14000, m_fps); info.endPos = info.startPos + GenTime(dur, m_fps); - mltInsertClip(info, black); + mltInsertClip(info, black, m_blackClip); } m_mltProducer->set("out", duration); emit durationChanged((int)duration); } } -void Render::mltInsertClip(ItemInfo info, QDomElement element) { +void Render::mltInsertClip(ItemInfo info, QDomElement element, Mlt::Producer *prod) { if (!m_mltProducer) { kDebug() << "PLAYLIST NOT INITIALISED //////"; return; @@ -1075,8 +1112,7 @@ void Render::mltInsertClip(ItemInfo info, QDomElement element) { Mlt::Producer trackProducer(tractor.track(info.track)); Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service()); - Mlt::Producer *prod = getProducerById(element.attribute("id")); - if (prod == NULL) { + /*if (prod == NULL) { // clip was never used yet QDomDocument doc; doc.appendChild(doc.importNode(element, true)); @@ -1085,8 +1121,7 @@ void Render::mltInsertClip(ItemInfo info, QDomElement element) { char *tmp = decodedString(resource); prod = new Mlt::Producer(*m_mltProfile, "westley-xml", tmp); delete[] tmp; - m_producersList.append(prod); - } + }*/ Mlt::Producer *clip = prod->cut(info.cropStart.frames(m_fps), (info.endPos - info.startPos).frames(m_fps)); trackPlaylist.insert_at((int) info.startPos.frames(m_fps), *clip, 1); @@ -1098,41 +1133,6 @@ void Render::mltInsertClip(ItemInfo info, QDomElement element) { //tractor.refresh(); } -Mlt::Producer *Render::getProducerById(const QString &id) { - for (int i = 0; i < m_producersList.count(); i++) { - if (m_producersList.at(i)->get("id") == id) return m_producersList.at(i); - } - return NULL; -} - -void Render::parsePlaylistForClips() { - // clear current producers list - while (! m_producersList.isEmpty()) delete m_producersList.takeFirst(); - - //parse entire playlists to find all the different clips - Mlt::Producer parentProd(m_mltProducer->parent()); - if (parentProd.get_producer() == NULL) { - kDebug() << "PLAYLIST BROKEN, CANNOT INSERT CLIP //////"; - return; - } - Mlt::Service service(parentProd.get_service()); - if (service.type() != tractor_type) return; - Mlt::Tractor tractor(service); - mlt_service_lock(service.get_service()); - for (int i = 0; i < tractor.count(); i++) { - Mlt::Producer trackProducer(tractor.track(i)); - Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service()); - for (int j = 0; j < trackPlaylist.count(); j++) { - if (!trackPlaylist.is_blank(j)) { - Mlt::Producer *clip = trackPlaylist.get_clip(j); - if (clip) { - if (getProducerById(clip->get("id")) == NULL) - m_producersList.append(new Mlt::Producer(clip->get_parent())); - } - } - } - } -} void Render::mltCutClip(int track, GenTime position) { m_isBlocked = true; @@ -1148,10 +1148,10 @@ void Render::mltCutClip(int track, GenTime position) { m_isBlocked = false; } -void Render::mltUpdateClip(ItemInfo info, QDomElement element) { +void Render::mltUpdateClip(ItemInfo info, QDomElement element, Mlt::Producer *prod) { // TODO: optimize mltRemoveClip(info.track, info.startPos); - mltInsertClip(info, element); + mltInsertClip(info, element, prod); } diff --git a/src/renderer.h b/src/renderer.h index 324a20d2..75a6daed 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -91,6 +91,7 @@ Q_OBJECT public: be list. */ void setSceneList(QDomDocument list, int position = 0); void setSceneList(QString playlist, int position = 0); + void setProducer(Mlt::Producer *producer, int position); QString sceneList(); void saveSceneList(QString path, QDomElement kdenliveData = QDomElement()); @@ -147,8 +148,8 @@ Q_OBJECT public: const double dar() const; /** Playlist manipulation */ - void mltInsertClip(ItemInfo info, QDomElement element); - void mltUpdateClip(ItemInfo info, QDomElement element); + void mltInsertClip(ItemInfo info, QDomElement element, Mlt::Producer *prod); + void mltUpdateClip(ItemInfo info, QDomElement element, Mlt::Producer *prod); void mltCutClip(int track, GenTime position); void mltResizeClipEnd(int track, GenTime pos, GenTime in, GenTime out); void mltResizeClipStart(int track, GenTime pos, GenTime moveEnd, GenTime moveStart, GenTime in, GenTime out); @@ -180,9 +181,7 @@ private: // Private attributes & methods uint m_monitorId; bool m_generateScenelist; - QList m_producersList; - Mlt::Producer *getProducerById(const QString &id); - void parsePlaylistForClips(); + Mlt::Producer *m_blackClip; /** Holds the path to on screen display profile */ QString m_osdProfile; @@ -213,7 +212,7 @@ private slots: // Private slots signals: // Signals /** emitted when the renderer recieves a reply to a getFileProperties request. */ - void replyGetFileProperties(int clipId, const QMap < QString, QString > &, const QMap < QString, QString > &); + void replyGetFileProperties(int clipId, Mlt::Producer*, const QMap < QString, QString > &, const QMap < QString, QString > &); /** emitted when the renderer recieves a reply to a getImage request. */ void replyGetImage(int , int, const QPixmap &, int, int);