svn path=/trunk/kdenlive/; revision=5768
parameters.addParam("id", effectId);
// special case: the affine effect needs in / out points
parameters.addParam("id", effectId);
// special case: the affine effect needs in / out points
- if (effectId == "pan_zoom") {
- parameters.addParam("in", QString::number(cropStart().frames(m_fps)));
- parameters.addParam("out", QString::number((cropStart() + cropDuration()).frames(m_fps)));
- }
QDomNodeList params = effect.elementsByTagName("parameter");
int fade = 0;
QDomNodeList params = effect.elementsByTagName("parameter");
int fade = 0;
+ bool needInOutSync = false;
for (int i = 0; i < params.count(); i++) {
QDomElement e = params.item(i).toElement();
if (!e.isNull()) {
for (int i = 0; i < params.count(); i++) {
QDomElement e = params.item(i).toElement();
if (!e.isNull()) {
+ if (e.attribute("type") == "geometry" && !e.hasAttribute("fixed")) {
+ // Effects with a geometry parameter need to sync in / out with parent clip
+ needInOutSync = true;
+ }
if (e.attribute("type") == "simplekeyframe") {
QStringList values = e.attribute("keyframes").split(";", QString::SkipEmptyParts);
double factor = e.attribute("factor", "1").toDouble();
if (e.attribute("type") == "simplekeyframe") {
QStringList values = e.attribute("keyframes").split(";", QString::SkipEmptyParts);
double factor = e.attribute("factor", "1").toDouble();
+ if (needInOutSync) {
+ parameters.addParam("in", QString::number(cropStart().frames(m_fps)));
+ parameters.addParam("out", QString::number((cropStart() + cropDuration()).frames(m_fps) - 1));
+ parameters.addParam("_sync_in_out", "1");
+ }
m_effectNames = m_effectList.effectNames().join(" / ");
if (fade > 0) m_startFade = fade;
else if (fade < 0) m_endFade = -fade;
m_effectNames = m_effectList.effectNames().join(" / ");
if (fade > 0) m_startFade = fade;
else if (fade < 0) m_endFade = -fade;
QString id = effect.attribute("id");
int in = EffectsList::parameter(effect, "in").toInt();
int out = EffectsList::parameter(effect, "out").toInt();
QString id = effect.attribute("id");
int in = EffectsList::parameter(effect, "in").toInt();
int out = EffectsList::parameter(effect, "out").toInt();
- int clipEnd = (cropStart() + cropDuration()).frames(m_fps);
+ int clipEnd = (cropStart() + cropDuration()).frames(m_fps) - 1;
if (id == "fade_from_black" || id == "fadein") {
if (in != cropStart().frames(m_fps)) {
effects[i] = effect.cloneNode().toElement();
if (id == "fade_from_black" || id == "fadein") {
if (in != cropStart().frames(m_fps)) {
effects[i] = effect.cloneNode().toElement();
if (out != clipEnd) {
effects[i] = effect.cloneNode().toElement();
int diff = out - clipEnd;
if (out != clipEnd) {
effects[i] = effect.cloneNode().toElement();
int diff = out - clipEnd;
+ in = qMax(in - diff, (int) cropStart().frames(m_fps));
out -= diff;
EffectsList::setParameter(effect, "in", QString::number(in));
EffectsList::setParameter(effect, "out", QString::number(out));
out -= diff;
EffectsList::setParameter(effect, "in", QString::number(in));
EffectsList::setParameter(effect, "out", QString::number(out));
QDomNodeList params = effect.elementsByTagName("parameter");
for (int i = 0; i < params.count(); i++) {
QDomElement e = params.item(i).toElement();
QDomNodeList params = effect.elementsByTagName("parameter");
for (int i = 0; i < params.count(); i++) {
QDomElement e = params.item(i).toElement();
- //kDebug() << "/ / / /SENDING EFFECT PARAM: " << e.attribute("type") << ", NAME_ " << e.attribute("tag");
+ if (e.attribute("type") == "geometry" && !e.hasAttribute("fixed")) {
+ // effects with geometry param need in / out synced with the clip, request it...
+ parameters.addParam("_sync_in_out", "1");
+ }
if (e.attribute("type") == "simplekeyframe") {
QStringList values = e.attribute("keyframes").split(";", QString::SkipEmptyParts);
if (e.attribute("type") == "simplekeyframe") {
QStringList values = e.attribute("keyframes").split(";", QString::SkipEmptyParts);
if (!slowprod || slowprod->get_producer() == NULL) {
slowprod = new Mlt::Producer(*m_mltProfile, 0, ("framebuffer:" + url).toUtf8().constData());
if (strobe > 1) slowprod->set("strobe", strobe);
if (!slowprod || slowprod->get_producer() == NULL) {
slowprod = new Mlt::Producer(*m_mltProfile, 0, ("framebuffer:" + url).toUtf8().constData());
if (strobe > 1) slowprod->set("strobe", strobe);
- QString id = prod->get("id");
+ QString id = prod->parent().get("id");
if (id.contains('_')) id = id.section('_', 0, 0);
QString producerid = "slowmotion:" + id + ':' + QString::number(speed);
if (strobe > 1) producerid.append(':' + QString::number(strobe));
if (id.contains('_')) id = id.section('_', 0, 0);
QString producerid = "slowmotion:" + id + ':' + QString::number(speed);
if (strobe > 1) producerid.append(':' + QString::number(strobe));
return false;
}
params.removeParam("kdenlive_id");
return false;
}
params.removeParam("kdenlive_id");
+ if (params.hasParam("_sync_in_out")) {
+ // This effect must sync in / out with parent clip
+ params.removeParam("_sync_in_out");
+ filter->set_in_and_out(service.get_int("in"), service.get_int("out"));
+ }
for (int j = 0; j < params.count(); j++) {
filter->set((prefix + params.at(j).name()).toUtf8().constData(), params.at(j).value().toUtf8().constData());
for (int j = 0; j < params.count(); j++) {
filter->set((prefix + params.at(j).name()).toUtf8().constData(), params.at(j).value().toUtf8().constData());
filter->set("effect", effectArgs.simplified().toUtf8().constData());
}
filter->set("effect", effectArgs.simplified().toUtf8().constData());
}
- if (params.paramValue("id") == "pan_zoom") {
- filter->set_in_and_out(service.get_int("in"), service.get_int("out") + 1);
- }
-
// attach filter to the clip
service.attach(*filter);
}
// attach filter to the clip
service.attach(*filter);
}
QString prefix;
QString ser = filter->get("mlt_service");
if (ser == "region") prefix = "filter0.";
QString prefix;
QString ser = filter->get("mlt_service");
if (ser == "region") prefix = "filter0.";
+ if (params.hasParam("_sync_in_out")) {
+ // This effect must sync in / out with parent clip
+ params.removeParam("_sync_in_out");
+ filter->set_in_and_out(clip->get_in(), clip->get_out());
+ }
mlt_service_lock(service.get_service());
for (int j = 0; j < params.count(); j++) {
filter->set((prefix + params.at(j).name()).toUtf8().constData(), params.at(j).value().toUtf8().constData());
mlt_service_lock(service.get_service());
for (int j = 0; j < params.count(); j++) {
filter->set((prefix + params.at(j).name()).toUtf8().constData(), params.at(j).value().toUtf8().constData());
- }
-
- if (params.paramValue("id") == "pan_zoom")
- filter->set_in_and_out(clip->get_in(), clip->get_out() + 1);
delete clip;
mlt_service_unlock(service.get_service());
delete clip;
mlt_service_unlock(service.get_service());
kDebug() << "// Warning, CLIP on track " << track << ", at: " << pos << " is invalid, cannot update it!!!";
return false;
}
kDebug() << "// Warning, CLIP on track " << track << ", at: " << pos << " is invalid, cannot update it!!!";
return false;
}
- kDebug() << "NEW PROD ID: " << prod->get("id");
m_isBlocked++;
kDebug() << "// TRYING TO UPDATE CLIP at: " << pos << ", TK: " << track;
Mlt::Service service(m_mltProducer->parent().get_service());
m_isBlocked++;
kDebug() << "// TRYING TO UPDATE CLIP at: " << pos << ", TK: " << track;
Mlt::Service service(m_mltProducer->parent().get_service());
int clipNb = trackPlaylist.count();
for (int i = 0; i < clipNb; i++) {
Mlt::Producer *c = trackPlaylist.get_clip(i);
int clipNb = trackPlaylist.count();
for (int i = 0; i < clipNb; i++) {
Mlt::Producer *c = trackPlaylist.get_clip(i);
- Mlt::Producer *nprod = new Mlt::Producer(c->get_parent());
- if (nprod) {
- QString prodId = nprod->get("id");
- if (!prodId.startsWith("slowmotion") && !prodId.isEmpty() && !nprod->is_blank() && !ids.contains(prodId)) {
+ if (c == NULL) continue;
+ QString prodId = c->parent().get("id");
+ if (!c->is_blank() && !ids.contains(prodId) && !prodId.startsWith("slowmotion") && !prodId.isEmpty()) {
+ Mlt::Producer *nprod = new Mlt::Producer(c->get_parent());
+ if (nprod) {
ids.append(prodId);
prods.append(nprod);
ids.append(prodId);
prods.append(nprod);
Mlt::Producer *c = trackPlaylist.get_clip(i);
Mlt::Producer *nprod = new Mlt::Producer(c->get_parent());
if (nprod) {
Mlt::Producer *c = trackPlaylist.get_clip(i);
Mlt::Producer *nprod = new Mlt::Producer(c->get_parent());
if (nprod) {
- QString id = nprod->get("id");
+ QString id = nprod->parent().get("id");
if (id.startsWith("slowmotion:") && !nprod->is_blank()) {
// this is a slowmotion producer, add it to the list
QString url = QString::fromUtf8(nprod->get("resource"));
if (id.startsWith("slowmotion:") && !nprod->is_blank()) {
// this is a slowmotion producer, add it to the list
QString url = QString::fromUtf8(nprod->get("resource"));