}
}
}
- if (fade > 0) m_startFade = fade;
- else if (fade < 0) m_endFade = -fade;
+ if (fade > 0)
+ m_startFade = fade;
+ else if (fade < 0)
+ m_endFade = -fade;
}
setSelectedEffect(0);
}
}
if (effect.attribute("tag") == "volume" || effect.attribute("tag") == "brightness") {
if (effect.attribute("id") == "fadeout" || effect.attribute("id") == "fade_to_black") {
- int end = (cropDuration() + cropStart()).frames(m_fps);
+ int end = (cropDuration() + cropStart()).frames(m_fps) - 1;
int start = end;
if (effect.attribute("id") == "fadeout") {
if (m_effectList.hasEffect(QString(), "fade_to_black") == -1) {
for (int j = 0; j < params.count(); j++) {
bool modified = false;
QDomElement e = params.item(j).toElement();
- if (!e.isNull() && (e.attribute("type") == "keyframe" || e.attribute("type") == "simplekeyframe")) {
+ if (e.isNull())
+ continue;
+ if (e.attribute("type") == "keyframe" || e.attribute("type") == "simplekeyframe") {
// parse keyframes and adjust values
const QStringList keyframes = e.attribute("keyframes").split(';', QString::SkipEmptyParts);
QMap <int, double> kfr;
double factor = e.attribute("factor", "1").toDouble();
if (factor != 1) {
for (int j = 0; j < values.count(); j++) {
- QString pos = values.at(j).section(":", 0, 0);
- double val = values.at(j).section(":", 1, 1).toDouble() / factor;
+ QString pos = values.at(j).section(':', 0, 0);
+ double val = values.at(j).section(':', 1, 1).toDouble() / factor;
values[j] = pos + "=" + QString::number(val);
}
}
}
}
+QList <int> ClipItem::updatePanZoom(int width, int height, int cut)
+{
+ QList <int> effectPositions;
+ for (int i = 0; i < m_effectList.count(); i++) {
+ QDomElement effect = m_effectList.at(i);
+ QDomNodeList params = effect.elementsByTagName("parameter");
+ for (int j = 0; j < params.count(); j++) {
+ QDomElement e = params.item(j).toElement();
+ if (e.isNull())
+ continue;
+ if (e.attribute("type") == "geometry" && !e.hasAttribute("fixed")) {
+ effectPositions << i;
+
+ int in = cropStart().frames(fps());
+ int out = in + cropDuration().frames(fps());
+ if (in < 0) {
+ out -= in;
+ in = 0;
+ }
+ int dur = out - in - 1;
+
+ effect.setAttribute("in", in);
+ effect.setAttribute("out", out);
+
+ Mlt::Geometry geometry(e.attribute("value").toUtf8().data(), dur, width, height);
+ Mlt::GeometryItem item;
+ bool endFrameAdded = false;
+ if (cut == 0) {
+ while (!geometry.next_key(&item, dur)) {
+ if (!endFrameAdded) {
+ // add keyframe at the end with interpolated value
+
+ // but only once ;)
+ endFrameAdded = true;
+
+ Mlt::GeometryItem endItem;
+ Mlt::GeometryItem interp;
+ geometry.fetch(&interp, dur - 1);
+ endItem.frame(dur - 1);
+ endItem.x(interp.x());
+ endItem.y(interp.y());
+ endItem.w(interp.w());
+ endItem.h(interp.h());
+ endItem.mix(interp.mix());
+ geometry.insert(&endItem);
+ }
+ geometry.remove(item.frame());
+ }
+ } else {
+ Mlt::Geometry origGeometry(e.attribute("value").toUtf8().data(), dur, width, height);
+ // remove keyframes before cut point
+ while (!geometry.prev_key(&item, cut - 1) && item.frame() < cut)
+ geometry.remove(item.frame());
+
+ // add a keyframe at new pos 0
+ origGeometry.fetch(&item, cut);
+ item.frame(0);
+ geometry.insert(&item);
+
+ // move exisiting keyframes by -cut
+ while (!origGeometry.next_key(&item, cut)) {
+ geometry.remove(item.frame());
+ origGeometry.remove(item.frame());
+ item.frame(item.frame() - cut);
+ geometry.insert(&item);
+ }
+
+ }
+
+ e.setAttribute("value", geometry.serialise());
+ }
+ }
+ }
+
+ return effectPositions;
+}
#include "clipitem.moc"