m_mltConsumer->set("resize", 1);
m_mltConsumer->set("window_id", m_winid);
m_mltConsumer->set("terminate_on_pause", 1);
+ m_mltConsumer->set("window_background", decodedString(KdenliveSettings::window_background().name()));
m_mltConsumer->listen("consumer-frame-show", this, (mlt_listener) consumer_frame_show);
m_mltConsumer->set("rescale", "nearest");
}
}
-void Render::getFileProperties(const QDomElement &xml, const QString &clipId) {
+void Render::getFileProperties(const QDomElement &xml, const QString &clipId, bool replaceProducer) {
int height = 50;
int width = (int)(height * m_mltProfile->dar());
QMap < QString, QString > filePropertyMap;
KUrl url = KUrl(xml.attribute("resource", QString::null));
Mlt::Producer *producer = NULL;
if (xml.attribute("type").toInt() == TEXT && !QFile::exists(url.path())) {
- emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap);
+ emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap, replaceProducer);
return;
}
if (xml.attribute("type").toInt() == COLOR) {
metadataPropertyMap[ name.section(".", 0, -2)] = value;
}
- emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap);
+ emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap, replaceProducer);
kDebug() << "REquested fuile info for: " << url.path();
if (frame) delete frame;
//if (producer) delete producer;
}
/** Create the producer from the Westley QDomDocument */
-QString Render::sceneList() {
+const QString Render::sceneList() {
QString playlist;
Mlt::Consumer westleyConsumer(*m_mltProfile , "westley:kdenlive_playlist");
m_mltProducer->optimise();
int newLength = 0;
Mlt::Service service(m_mltProducer->parent().get_service());
if (service.type() != tractor_type) kWarning() << "// TRACTOR PROBLEM";
- kDebug() << "Changing clip speed, set in and out: " << info.cropStart.frames(m_fps) << " to " << (info.endPos - info.startPos).frames(m_fps) - 1;
+ //kDebug() << "Changing clip speed, set in and out: " << info.cropStart.frames(m_fps) << " to " << (info.endPos - info.startPos).frames(m_fps) - 1;
Mlt::Tractor tractor(service);
Mlt::Producer trackProducer(tractor.track(info.track));
Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
int clipLength = trackPlaylist.clip_length(clipIndex);
Mlt::Producer clip(trackPlaylist.get_clip(clipIndex));
- QString serv = clip.parent().get("mlt_service");
- QString id = clip.parent().get("id");
- kDebug() << "CLIP SERVICE: " << clip.parent().get("mlt_service");
+ if (!clip.is_valid() || clip.is_blank()) {
+ // invalid clip
+ return -1;
+ }
+ Mlt::Producer clipparent = clip.parent();
+ if (!clipparent.is_valid() || clipparent.is_blank()) {
+ // invalid clip
+ return -1;
+ }
+ QString serv = clipparent.get("mlt_service");
+ QString id = clipparent.get("id");
+ //kDebug() << "CLIP SERVICE: " << serv;
if (serv == "avformat" && speed != 1.0) {
mlt_service_lock(service.get_service());
- QString url = clip.parent().get("resource");
+ QString url = clipparent.get("resource");
url.append("?" + QString::number(speed));
Mlt::Producer *slowprod = m_slowmotionProducers.value(url);
if (!slowprod || slowprod->get_producer() == NULL) {
} else if (serv == "framebuffer") {
mlt_service_lock(service.get_service());
- QString url = clip.parent().get("resource");
+ QString url = clipparent.get("resource");
url = url.section("?", 0, 0);
url.append("?" + QString::number(speed));
Mlt::Producer *slowprod = m_slowmotionProducers.value(url);
Mlt::Producer *cut;
if (clipIndex + 1 < trackPlaylist.count() && (info.startPos + newDuration).frames(m_fps) > blankEnd) {
GenTime maxLength = GenTime(blankEnd, m_fps) - info.startPos;
- cut = slowprod->cut((int)(info.cropStart.frames(m_fps)), (int)(info.cropStart.frames(m_fps) + maxLength.frames(m_fps) - 1));
+ cut = slowprod->cut((int)(info.cropStart.frames(m_fps) / speed), (int)(info.cropStart.frames(m_fps) / speed + maxLength.frames(m_fps) - 1));
} else cut = slowprod->cut((int)(info.cropStart.frames(m_fps) / speed), (int)((info.cropStart / speed + newDuration).frames(m_fps) - 1));
trackPlaylist.insert_at(startPos, *cut, 1);