#include "kdenlivesettings.h"
#include "kthumb.h"
#include "definitions.h"
+#include "slideshowclip.h"
#include <mlt++/Mlt.h>
#endif
self->emitFrameNumber(mlt_frame_get_position(frame_ptr));
- if (frame_ptr->convert_image)
+ if (self->sendFrameForAnalysis && frame_ptr->convert_image) {
self->emitFrameUpdated(frame);
+ }
if (frame.get_double("_speed") == 0.0) {
self->emitConsumerStopped();
} else if (frame.get_double("_speed") < 0.0 && mlt_frame_get_position(frame_ptr) <= 0) {
Render::Render(const QString & rendererName, int winid, int /* extid */, QString profile, QWidget *parent) :
QObject(parent),
m_isBlocked(0),
+ sendFrameForAnalysis(false),
m_name(rendererName),
m_mltConsumer(NULL),
m_mltProducer(NULL),
return pix;
}
*/
+int Render::frameRenderWidth() const
+{
+ return m_mltProfile->width();
+}
+
int Render::renderWidth() const
{
return (int)(m_mltProfile->height() * m_mltProfile->dar() + 0.5);
char *tmp = decodedString("kdenlivetitle:" + xml.attribute("resource"));
producer = new Mlt::Producer(*m_mltProfile, 0, tmp);
delete[] tmp;
- if (producer && xml.hasAttribute("xmldata")) {
+ if (producer && producer->is_valid() && xml.hasAttribute("xmldata")) {
tmp = decodedString(xml.attribute("xmldata"));
producer->set("xmldata", tmp);
delete[] tmp;
if (aindex != 0) producer->set("audio_index", aindex);
}
- // setup length here as otherwise default length (currently 15000 frames in MLT) will be taken although outpoint is larger
+ // setup length here as otherwise default length (currently 15000 frames in MLT) will be taken even if outpoint is larger
if (xml.attribute("type").toInt() == COLOR || xml.attribute("type").toInt() == TEXT
|| xml.attribute("type").toInt() == IMAGE || xml.attribute("type").toInt() == SLIDESHOW)
producer->set("length", xml.attribute("out").toInt() - xml.attribute("in").toInt() + 1);
Mlt::Frame *frame = producer->get_frame();
if (xml.attribute("type").toInt() == SLIDESHOW) {
- if (xml.hasAttribute("ttl")) producer->set("ttl", xml.attribute("ttl").toInt());
+ int ttl = xml.hasAttribute("ttl") ? xml.attribute("ttl").toInt() : 0;
+ if (ttl) producer->set("ttl", ttl);
+ if (!xml.attribute("animation").isEmpty()) {
+ Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, "affine");
+ if (filter && filter->is_valid()) {
+ int cycle = ttl;
+ QString geometry = SlideshowClip::animationToGeometry(xml.attribute("animation"), cycle);
+ if (!geometry.isEmpty()) {
+ if (xml.attribute("animation").contains("low-pass")) {
+ Mlt::Filter *blur = new Mlt::Filter(*m_mltProfile, "boxblur");
+ if (blur && blur->is_valid())
+ producer->attach(*blur);
+ }
+ filter->set("transition.geometry", geometry.toUtf8().data());
+ filter->set("transition.cycle", cycle);
+ producer->attach(*filter);
+ }
+ }
+ }
if (xml.attribute("fade") == "1") {
// user wants a fade effect to slideshow
Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, "luma");
if (filter && filter->is_valid()) {
- if (xml.hasAttribute("ttl")) filter->set("period", xml.attribute("ttl").toInt() - 1);
- if (xml.hasAttribute("luma_duration") && !xml.attribute("luma_duration").isEmpty()) filter->set("luma.out", xml.attribute("luma_duration").toInt());
+ if (ttl) filter->set("cycle", ttl);
+ if (xml.hasAttribute("luma_duration") && !xml.attribute("luma_duration").isEmpty()) filter->set("duration", xml.attribute("luma_duration").toInt());
if (xml.hasAttribute("luma_file") && !xml.attribute("luma_file").isEmpty()) {
char *tmp = decodedString(xml.attribute("luma_file"));
filter->set("luma.resource", tmp);
filter->set("luma.softness", (double) soft / 100.0);
}
}
- Mlt::Service clipService(producer->get_service());
- clipService.attach(*filter);
+ producer->attach(*filter);
}
}
if (xml.attribute("crop") == "1") {
int clipIndex = trackPlaylist.get_clip_index_at((int) info.startPos.frames(m_fps));
//kDebug() << "// SELECTED CLIP START: " << trackPlaylist.clip_start(clipIndex);
Mlt::Producer *clip = trackPlaylist.get_clip(clipIndex);
+
int previousStart = clip->get_in();
int newDuration = (int) clipDuration.frames(m_fps) - 1;
- int currentOut = (int)(info.cropStart + info.cropDuration).frames(m_fps) - 1;
int diff = newDuration - (trackPlaylist.clip_length(clipIndex) - 1);
+
+ int currentOut;
+ if (info.cropStart < GenTime())
+ currentOut = newDuration - info.cropStart.frames(m_fps);
+ else
+ currentOut = newDuration + previousStart;
if (currentOut > clip->get_length()) {
clip->parent().set("length", currentOut + 1);
clip->parent().set("out", currentOut);
clip->set("length", currentOut + 1);
}
+
/*if (newDuration > clip->get_out()) {
clip->parent().set_in_and_out(0, newDuration + 1);
clip->set_in_and_out(0, newDuration + 1);
}
int previousStart = clip->get_in();
int previousOut = clip->get_out();
- delete clip;
+
m_isBlocked = true;
previousStart += moveFrame;
if (previousStart < 0) {
previousOut -= previousStart;
previousStart = 0;
}
+
+ int length = previousOut + 1;
+ if (length > clip->get_length()) {
+ clip->parent().set("length", length + 1);
+ clip->parent().set("out", length);
+ clip->set("length", length + 1);
+ }
+ delete clip;
+
// kDebug() << "RESIZE, new start: " << previousStart << ", " << previousOut;
trackPlaylist.resize_clip(clipIndex, previousStart, previousOut);
- if (moveFrame > 0) trackPlaylist.insert_blank(clipIndex, moveFrame - 1);
- else {
+ if (moveFrame > 0) {
+ trackPlaylist.insert_blank(clipIndex, moveFrame - 1);
+ } else {
//int midpos = info.startPos.frames(m_fps) + moveFrame - 1;
int blankIndex = clipIndex - 1;
int blankLength = trackPlaylist.clip_length(blankIndex);
mltAddTransition(tag, a_track, b_track, in, out, xml, false);
}
- if (m_mltProducer->position() > in.frames(m_fps) && m_mltProducer->position() < out.frames(m_fps)) refresh();
+ if (m_mltProducer->position() >= in.frames(m_fps) && m_mltProducer->position() <= out.frames(m_fps)) refresh();
}
void Render::mltUpdateTransitionParams(QString type, int a_track, int b_track, GenTime in, GenTime out, QDomElement xml)
return doc.toString();
}
+
+void Render::sendFrameUpdate()
+{
+ if (m_mltProducer) {
+ Mlt::Frame * frame = m_mltProducer->get_frame();
+ emitFrameUpdated(*frame);
+ delete frame;
+ }
+}
+
+
#include "renderer.moc"