X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Frenderer.cpp;h=9ddfd753a69540cc9545ca7c18f83bb52ef1bc37;hb=548782dfe8b4ec1edc0c15f0062f5a976f1c6ee3;hp=b5b4c9a3e2c5da15fae1b93748137baa1392bfc7;hpb=2edebe5cd8671008c2f1d493a558808818b6ad8a;p=kdenlive diff --git a/src/renderer.cpp b/src/renderer.cpp index b5b4c9a3..9ddfd753 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -96,8 +96,8 @@ static void consumer_gl_frame_show(mlt_consumer, Render * self, mlt_frame frame_ Render::Render(const QString & rendererName, int winid, QString profile, QWidget *parent) : QObject(parent), m_isBlocked(0), - sendFrameForAnalysis(false), analyseAudio(KdenliveSettings::monitor_audio()), + sendFrameForAnalysis(false), m_name(rendererName), m_mltConsumer(NULL), m_mltProducer(NULL), @@ -355,6 +355,15 @@ void Render::seek(GenTime time) refresh(); } +void Render::seek(int time) +{ + if (!m_mltProducer) + return; + m_isBlocked = false; + m_mltProducer->seek(time); + refresh(); +} + //static /*QPixmap Render::frameThumbnail(Mlt::Frame *frame, int width, int height, bool border) { QPixmap pix(width, height); @@ -454,6 +463,10 @@ double Render::dar() const return m_mltProfile->dar(); } +double Render::sar() const +{ + return m_mltProfile->sar(); +} void Render::slotSplitView(bool doit) { @@ -520,7 +533,7 @@ void Render::slotSplitView(bool doit) } } -void Render::getFileProperties(const QDomElement xml, const QString &clipId, int imageHeight, bool replaceProducer) +void Render::getFileProperties(const QDomElement xml, const QString &clipId, int imageHeight, bool replaceProducer, bool selectClip) { QString path; if (xml.hasAttribute("proxy")) path = xml.attribute("proxy"); @@ -610,8 +623,12 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int } // setup length here as otherwise default length (currently 15000 frames in MLT) will be taken even if outpoint is larger - if (type == COLOR || type == TEXT || type == IMAGE || type == SLIDESHOW) - producer->set("length", xml.attribute("out").toInt() - xml.attribute("in").toInt() + 1); + if (type == COLOR || type == TEXT || type == IMAGE || type == SLIDESHOW) { + int length; + if (xml.hasAttribute("length")) length = xml.attribute("length").toInt(); + else length = xml.attribute("out").toInt() - xml.attribute("in").toInt(); + producer->set("length", length); + } if (xml.hasAttribute("out")) producer->set_in_and_out(xml.attribute("in").toInt(), xml.attribute("out").toInt()); @@ -621,9 +638,9 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int if (xml.hasAttribute("templatetext")) producer->set("templatetext", xml.attribute("templatetext").toUtf8().constData()); - if (!replaceProducer && xml.hasAttribute("file_hash")) { + if ((!replaceProducer && xml.hasAttribute("file_hash")) || xml.hasAttribute("proxy")) { // Clip already has all properties - emit replyGetFileProperties(clipId, producer, QMap < QString, QString >(), QMap < QString, QString >(), replaceProducer); + emit replyGetFileProperties(clipId, producer, QMap < QString, QString >(), QMap < QString, QString >(), replaceProducer, selectClip); return; } @@ -799,7 +816,7 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int metadataPropertyMap[ name.section('.', 0, -2)] = value; } producer->seek(0); - emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap, replaceProducer); + emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap, replaceProducer, selectClip); // FIXME: should delete this to avoid a leak... //delete producer; } @@ -893,6 +910,13 @@ int Render::setSceneList(QString playlist, int position) //kDebug() << "////// RENDER, SET SCENE LIST: " << playlist; + // Remove previous profile info + QDomDocument doc; + doc.setContent(playlist); + QDomElement profile = doc.documentElement().firstChildElement("profile"); + doc.documentElement().removeChild(profile); + playlist = doc.toString(); + if (m_mltConsumer) { if (!m_mltConsumer->is_stopped()) { m_mltConsumer->stop(); @@ -907,7 +931,6 @@ int Render::setSceneList(QString playlist, int position) m_mltProducer->set_speed(0); //if (KdenliveSettings::osdtimecode() && m_osdInfo) m_mltProducer->detach(*m_osdInfo); - Mlt::Service service(m_mltProducer->parent().get_service()); mlt_service_lock(service.get_service()); @@ -948,7 +971,6 @@ int Render::setSceneList(QString playlist, int position) } blockSignals(true); - // TODO: Better way to do this if (KdenliveSettings::projectloading_avformatnovalidate()) playlist.replace(">avformat", ">avformat-novalidate"); @@ -956,7 +978,6 @@ int Render::setSceneList(QString playlist, int position) playlist.replace(">avformat-novalidate", ">avformat"); m_mltProducer = new Mlt::Producer(*m_mltProfile, "xml-string", playlist.toUtf8().constData()); - if (!m_mltProducer || !m_mltProducer->is_valid()) { kDebug() << " WARNING - - - - -INVALID PLAYLIST: " << playlist.toUtf8().constData(); m_mltProducer = m_blackClip->cut(0, 50);