svn path=/trunk/kdenlive/; revision=3983
12 files changed:
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
}
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
}
-void AbstractClipItem::resizeStart(int posx, double speed)
+void AbstractClipItem::resizeStart(int posx)
{
GenTime durationDiff = GenTime(posx, m_fps) - m_info.startPos;
if (durationDiff == GenTime()) return;
{
GenTime durationDiff = GenTime(posx, m_fps) - m_info.startPos;
if (durationDiff == GenTime()) return;
}
//kDebug()<<"// DURATION DIFF: "<<durationDiff.frames(25)<<", POS: "<<pos().x();
m_info.startPos += durationDiff;
}
//kDebug()<<"// DURATION DIFF: "<<durationDiff.frames(25)<<", POS: "<<pos().x();
m_info.startPos += durationDiff;
- GenTime originalDiff = GenTime((int)(durationDiff.frames(m_fps) * speed), m_fps);
if (type() == AVWIDGET) {
m_info.cropStart += durationDiff;
if (type() == AVWIDGET) {
m_info.cropStart += durationDiff;
- m_info.originalcropStart += originalDiff;
- m_info.cropDuration = m_info.cropDuration - originalDiff;
-
+ m_info.cropDuration = m_info.cropDuration - durationDiff;
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
moveBy(durationDiff.frames(m_fps), 0);
//setPos(m_startPos.frames(m_fps), pos().y());
if ((int) scenePos().x() != posx) {
//kDebug()<<"////// WARNING, DIFF IN XPOS: "<<pos().x()<<" == "<<m_startPos.frames(m_fps);
GenTime diff = GenTime((int) pos().x() - posx, m_fps);
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
moveBy(durationDiff.frames(m_fps), 0);
//setPos(m_startPos.frames(m_fps), pos().y());
if ((int) scenePos().x() != posx) {
//kDebug()<<"////// WARNING, DIFF IN XPOS: "<<pos().x()<<" == "<<m_startPos.frames(m_fps);
GenTime diff = GenTime((int) pos().x() - posx, m_fps);
- GenTime originalDiff = GenTime((int)(diff.frames(m_fps) * speed), m_fps);
if (type() == AVWIDGET) {
m_info.cropStart += diff;
if (type() == AVWIDGET) {
m_info.cropStart += diff;
- m_info.originalcropStart += originalDiff;
- m_info.cropDuration = m_info.cropDuration - originalDiff;
+ m_info.cropDuration = m_info.cropDuration - diff;
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
//kDebug()<<"// NEW START: "<<m_startPos.frames(25)<<", NW DUR: "<<m_cropDuration.frames(25);
}
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
//kDebug()<<"// NEW START: "<<m_startPos.frames(25)<<", NW DUR: "<<m_cropDuration.frames(25);
}
-void AbstractClipItem::resizeEnd(int posx, double speed)
+void AbstractClipItem::resizeEnd(int posx)
{
GenTime durationDiff = GenTime(posx, m_fps) - endPos();
if (durationDiff == GenTime()) return;
{
GenTime durationDiff = GenTime(posx, m_fps) - endPos();
if (durationDiff == GenTime()) return;
durationDiff = GenTime() - (cropDuration() - GenTime(3, m_fps));
}
durationDiff = GenTime() - (cropDuration() - GenTime(3, m_fps));
}
- m_info.cropDuration += GenTime((int)(durationDiff.frames(m_fps) * speed), m_fps);
+ m_info.cropDuration += durationDiff;
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
if (durationDiff > GenTime()) {
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
if (durationDiff > GenTime()) {
kDebug() << "///////// CURRENT: " << startPos().frames(25) << "x" << endPos().frames(25) << ", RECT: " << rect() << "-" << pos();
kDebug() << "///////// COLLISION: " << ((AbstractClipItem *)item)->startPos().frames(25) << "x" << ((AbstractClipItem *)item)->endPos().frames(25) << ", RECT: " << ((AbstractClipItem *)item)->rect() << "-" << item->pos();*/
GenTime diff = ((AbstractClipItem *)item)->startPos() - GenTime(1, m_fps) - startPos();
kDebug() << "///////// CURRENT: " << startPos().frames(25) << "x" << endPos().frames(25) << ", RECT: " << rect() << "-" << pos();
kDebug() << "///////// COLLISION: " << ((AbstractClipItem *)item)->startPos().frames(25) << "x" << ((AbstractClipItem *)item)->endPos().frames(25) << ", RECT: " << ((AbstractClipItem *)item)->rect() << "-" << item->pos();*/
GenTime diff = ((AbstractClipItem *)item)->startPos() - GenTime(1, m_fps) - startPos();
- m_info.cropDuration = GenTime((int)(diff.frames(m_fps) * speed), m_fps);
+ m_info.cropDuration = diff;
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
break;
}
setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height());
break;
}
virtual int track() const ;
virtual GenTime cropStart() const ;
virtual GenTime cropDuration() const ;
virtual int track() const ;
virtual GenTime cropStart() const ;
virtual GenTime cropDuration() const ;
- virtual void resizeStart(int posx, double speed = 1.0);
- virtual void resizeEnd(int posx, double speed = 1.0);
+ virtual void resizeStart(int posx);
+ virtual void resizeEnd(int posx);
virtual double fps() const;
virtual void updateFps(double fps);
virtual GenTime maxDuration() const;
virtual double fps() const;
virtual void updateFps(double fps);
virtual GenTime maxDuration() const;
-ChangeSpeedCommand::ChangeSpeedCommand(CustomTrackView *view, ItemInfo info, double old_speed, double new_speed, int old_strobe, int new_strobe, const QString &clipId, QUndoCommand * parent) :
+ChangeSpeedCommand::ChangeSpeedCommand(CustomTrackView *view, ItemInfo info, ItemInfo speedIndependantInfo, double old_speed, double new_speed, int old_strobe, int new_strobe, const QString &clipId, QUndoCommand * parent) :
QUndoCommand(parent),
m_view(view),
m_clipInfo(info),
QUndoCommand(parent),
m_view(view),
m_clipInfo(info),
+ m_speedIndependantInfo(speedIndependantInfo),
m_clipId(clipId),
m_old_speed(old_speed),
m_new_speed(new_speed),
m_clipId(clipId),
m_old_speed(old_speed),
m_new_speed(new_speed),
// virtual
void ChangeSpeedCommand::undo()
{
// virtual
void ChangeSpeedCommand::undo()
{
- m_view->doChangeClipSpeed(m_clipInfo, m_old_speed, m_new_speed, m_old_strobe, m_clipId);
+ m_view->doChangeClipSpeed(m_clipInfo, m_speedIndependantInfo, m_old_speed, m_new_speed, m_old_strobe, m_clipId);
}
// virtual
void ChangeSpeedCommand::redo()
{
}
// virtual
void ChangeSpeedCommand::redo()
{
- m_view->doChangeClipSpeed(m_clipInfo, m_new_speed, m_old_speed, m_new_strobe, m_clipId);
+ m_view->doChangeClipSpeed(m_clipInfo, m_speedIndependantInfo, m_new_speed, m_old_speed, m_new_strobe, m_clipId);
class ChangeSpeedCommand : public QUndoCommand
{
public:
class ChangeSpeedCommand : public QUndoCommand
{
public:
- ChangeSpeedCommand(CustomTrackView *view, ItemInfo info, double old_speed, double new_speed, int old_strobe, int new_strobe, const QString &clipId, QUndoCommand * parent = 0);
+ ChangeSpeedCommand(CustomTrackView *view, ItemInfo info, ItemInfo speedIndependantInfo, double old_speed, double new_speed, int old_strobe, int new_strobe, const QString &clipId, QUndoCommand * parent = 0);
virtual void undo();
virtual void redo();
private:
CustomTrackView *m_view;
ItemInfo m_clipInfo;
virtual void undo();
virtual void redo();
private:
CustomTrackView *m_view;
ItemInfo m_clipInfo;
+ ItemInfo m_speedIndependantInfo;
QString m_clipId;
double m_old_speed;
double m_new_speed;
QString m_clipId;
double m_old_speed;
double m_new_speed;
setZValue(2);
setRect(0, 0, (info.endPos - info.startPos).frames(fps) - 0.02, (double)(KdenliveSettings::trackheight() - 2));
setPos(info.startPos.frames(fps), (double)(info.track * KdenliveSettings::trackheight()) + 1);
setZValue(2);
setRect(0, 0, (info.endPos - info.startPos).frames(fps) - 0.02, (double)(KdenliveSettings::trackheight() - 2));
setPos(info.startPos.frames(fps), (double)(info.track * KdenliveSettings::trackheight()) + 1);
+
+ // set speed independant info
+ m_speedIndependantInfo = m_info;
+ m_speedIndependantInfo.cropStart = GenTime((int)(m_info.cropStart.frames(m_fps) * m_speed), m_fps);
+ m_speedIndependantInfo.cropDuration = GenTime((int)(m_info.cropDuration.frames(m_fps) * m_speed), m_fps);
+
m_videoPix = KIcon("kdenlive-show-video").pixmap(QSize(16, 16));
m_audioPix = KIcon("kdenlive-show-audio").pixmap(QSize(16, 16));
m_videoPix = KIcon("kdenlive-show-video").pixmap(QSize(16, 16));
m_audioPix = KIcon("kdenlive-show-audio").pixmap(QSize(16, 16));
-void ClipItem::resizeStart(int posx, double /*speed*/)
+void ClipItem::resizeStart(int posx)
{
const int min = (startPos() - cropStart()).frames(m_fps);
if (posx < min) posx = min;
if (posx == startPos().frames(m_fps)) return;
const int previous = cropStart().frames(m_fps);
{
const int min = (startPos() - cropStart()).frames(m_fps);
if (posx < min) posx = min;
if (posx == startPos().frames(m_fps)) return;
const int previous = cropStart().frames(m_fps);
- AbstractClipItem::resizeStart(posx, m_speed);
+ AbstractClipItem::resizeStart(posx);
+
+ // set speed independant info
+ m_speedIndependantInfo = m_info;
+ m_speedIndependantInfo.cropStart = GenTime((int)(m_info.cropStart.frames(m_fps) * m_speed), m_fps);
+ m_speedIndependantInfo.cropDuration = GenTime((int)(m_info.cropDuration.frames(m_fps) * m_speed), m_fps);
+
if ((int) cropStart().frames(m_fps) != previous) {
if (m_hasThumbs && KdenliveSettings::videothumbnails()) {
/*connect(m_clip->thumbProducer(), SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));*/
if ((int) cropStart().frames(m_fps) != previous) {
if (m_hasThumbs && KdenliveSettings::videothumbnails()) {
/*connect(m_clip->thumbProducer(), SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));*/
-void ClipItem::resizeEnd(int posx, double /*speed*/)
+void ClipItem::resizeEnd(int posx)
{
const int max = (startPos() - cropStart() + maxDuration()).frames(m_fps);
if (posx > max && maxDuration() != GenTime()) posx = max;
if (posx == endPos().frames(m_fps)) return;
//kDebug() << "// NEW POS: " << posx << ", OLD END: " << endPos().frames(m_fps);
const int previous = cropDuration().frames(m_fps);
{
const int max = (startPos() - cropStart() + maxDuration()).frames(m_fps);
if (posx > max && maxDuration() != GenTime()) posx = max;
if (posx == endPos().frames(m_fps)) return;
//kDebug() << "// NEW POS: " << posx << ", OLD END: " << endPos().frames(m_fps);
const int previous = cropDuration().frames(m_fps);
- AbstractClipItem::resizeEnd(posx, m_speed);
+ AbstractClipItem::resizeEnd(posx);
+
+ // set speed independant info
+ m_speedIndependantInfo = m_info;
+ m_speedIndependantInfo.cropStart = GenTime((int)(m_info.cropStart.frames(m_fps) * m_speed), m_fps);
+ m_speedIndependantInfo.cropDuration = GenTime((int)(m_info.cropDuration.frames(m_fps) * m_speed), m_fps);
+
if ((int) cropDuration().frames(m_fps) != previous) {
if (m_hasThumbs && KdenliveSettings::videothumbnails()) {
/*connect(m_clip->thumbProducer(), SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));*/
if ((int) cropDuration().frames(m_fps) != previous) {
if (m_hasThumbs && KdenliveSettings::videothumbnails()) {
/*connect(m_clip->thumbProducer(), SIGNAL(thumbReady(int, QPixmap)), this, SLOT(slotThumbReady(int, QPixmap)));*/
m_strobe = strobe;
if (m_speed == 1.0) m_clipName = baseClip()->name();
else m_clipName = baseClip()->name() + " - " + QString::number(speed * 100, 'f', 0) + '%';
m_strobe = strobe;
if (m_speed == 1.0) m_clipName = baseClip()->name();
else m_clipName = baseClip()->name() + " - " + QString::number(speed * 100, 'f', 0) + '%';
+ m_info.cropStart = GenTime((int)(m_speedIndependantInfo.cropStart.frames(m_fps) / m_speed + 0.5), m_fps);
+ m_info.cropDuration = GenTime((int)(m_speedIndependantInfo.cropDuration.frames(m_fps) / m_speed + 0.5), m_fps);
return GenTime((int)(m_maxDuration.frames(m_fps) / m_speed + 0.5), m_fps);
}
return GenTime((int)(m_maxDuration.frames(m_fps) / m_speed + 0.5), m_fps);
}
-GenTime ClipItem::cropStart() const
+GenTime ClipItem::speedIndependantCropStart() const
- return GenTime((int)(m_info.originalcropStart.frames(m_fps) / m_speed + 0.5), m_fps);
+ return m_speedIndependantInfo.cropStart;
-GenTime ClipItem::cropDuration() const
+GenTime ClipItem::speedIndependantCropDuration() const
- return GenTime((int)(m_info.cropDuration.frames(m_fps) / m_speed + 0.5), m_fps);
+ return m_speedIndependantInfo.cropDuration;
-GenTime ClipItem::endPos() const
+
+const ItemInfo ClipItem::speedIndependantInfo() const
- return m_info.startPos + cropDuration();
+ return m_speedIndependantInfo;
const QStyleOptionGraphicsItem *option,
QWidget *);
virtual int type() const;
const QStyleOptionGraphicsItem *option,
QWidget *);
virtual int type() const;
- void resizeStart(int posx, double speed = 1.0);
- void resizeEnd(int posx, double speed = 1.0);
+ void resizeStart(int posx);
+ void resizeEnd(int posx);
OPERATIONTYPE operationMode(QPointF pos);
const QString clipProducer() const;
int clipType() const;
OPERATIONTYPE operationMode(QPointF pos);
const QString clipProducer() const;
int clipType() const;
double speed() const;
int strobe() const;
GenTime maxDuration() const;
double speed() const;
int strobe() const;
GenTime maxDuration() const;
- GenTime cropStart() const;
- GenTime endPos() const;
- GenTime cropDuration() const;
+ GenTime speedIndependantCropStart() const;
+ GenTime speedIndependantCropDuration() const;
+ const ItemInfo speedIndependantInfo() const;
int hasEffect(const QString &tag, const QString &id) const;
bool checkKeyFrames();
QPixmap startThumb() const;
int hasEffect(const QString &tag, const QString &id) const;
bool checkKeyFrames();
QPixmap startThumb() const;
private:
DocClipBase *m_clip;
private:
DocClipBase *m_clip;
+ ItemInfo m_speedIndependantInfo;
QString m_producer;
CLIPTYPE m_clipType;
QString m_clipName;
QString m_producer;
CLIPTYPE m_clipType;
QString m_clipName;
info.cropStart = GenTime(list.at(1).toInt(), m_document->fps());
info.endPos = GenTime(list.at(2).toInt() - list.at(1).toInt(), m_document->fps());
info.cropDuration = info.endPos - info.startPos;
info.cropStart = GenTime(list.at(1).toInt(), m_document->fps());
info.endPos = GenTime(list.at(2).toInt() - list.at(1).toInt(), m_document->fps());
info.cropDuration = info.endPos - info.startPos;
- info.originalcropStart = info.cropStart;
info.track = 0;
// Check if clip can be inserted at that position
info.track = 0;
// Check if clip can be inserted at that position
emit displayMessage(i18n("Problem adding effect to clip"), ErrorMessage);
return;
}
emit displayMessage(i18n("Problem adding effect to clip"), ErrorMessage);
return;
}
- ItemInfo info = clip->info();
double speed = EffectsList::parameter(effect, "speed").toDouble() / 100.0;
int strobe = EffectsList::parameter(effect, "strobe").toInt();
if (strobe == 0) strobe = 1;
double speed = EffectsList::parameter(effect, "speed").toDouble() / 100.0;
int strobe = EffectsList::parameter(effect, "strobe").toInt();
if (strobe == 0) strobe = 1;
- doChangeClipSpeed(info, speed, 1.0, strobe, clip->baseClip()->getId());
+ doChangeClipSpeed(clip->info(), clip->speedIndependantInfo(), speed, 1.0, strobe, clip->baseClip()->getId());
EffectsParameterList params = clip->addEffect(effect);
m_document->renderer()->mltAddEffect(track, pos, params);
if (clip->isSelected()) emit clipItemSelected(clip);
EffectsParameterList params = clip->addEffect(effect);
m_document->renderer()->mltAddEffect(track, pos, params);
if (clip->isSelected()) emit clipItemSelected(clip);
if (effect.attribute("id") == "speed") {
ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), m_document->tracksCount() - track);
if (clip) {
if (effect.attribute("id") == "speed") {
ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), m_document->tracksCount() - track);
if (clip) {
- ItemInfo info = clip->info();
- doChangeClipSpeed(info, 1.0, clip->speed(), 1, clip->baseClip()->getId());
+ doChangeClipSpeed(clip->info(), clip->speedIndependantInfo(), 1.0, clip->speed(), 1, clip->baseClip()->getId());
clip->deleteEffect(index);
emit clipItemSelected(clip);
m_document->renderer()->mltRemoveEffect(track, pos, index, true);
clip->deleteEffect(index);
emit clipItemSelected(clip);
m_document->renderer()->mltRemoveEffect(track, pos, index, true);
if (clip) {
// Special case: speed effect
if (effect.attribute("id") == "speed") {
if (clip) {
// Special case: speed effect
if (effect.attribute("id") == "speed") {
- ItemInfo info = clip->info();
- if (effect.attribute("disabled") == "1") doChangeClipSpeed(info, 1.0, clip->speed(), 1, clip->baseClip()->getId());
+ if (effect.attribute("disabled") == "1") doChangeClipSpeed(clip->info(), clip->speedIndependantInfo(), 1.0, clip->speed(), 1, clip->baseClip()->getId());
else {
double speed = EffectsList::parameter(effect, "speed").toDouble() / 100.0;
int strobe = EffectsList::parameter(effect, "strobe").toInt();
if (strobe == 0) strobe = 1;
else {
double speed = EffectsList::parameter(effect, "speed").toDouble() / 100.0;
int strobe = EffectsList::parameter(effect, "strobe").toInt();
if (strobe == 0) strobe = 1;
- doChangeClipSpeed(info, speed, clip->speed(), strobe, clip->baseClip()->getId());
+ doChangeClipSpeed(clip->info(), clip->speedIndependantInfo(), speed, clip->speed(), strobe, clip->baseClip()->getId());
}
clip->setEffectAt(ix, effect);
if (ix == clip->selectedEffectIndex()) {
}
clip->setEffectAt(ix, effect);
if (ix == clip->selectedEffectIndex()) {
newPos.endPos = info.endPos;
newPos.cropStart = item->info().cropStart + (cutTime - info.startPos);
newPos.track = info.track;
newPos.endPos = info.endPos;
newPos.cropStart = item->info().cropStart + (cutTime - info.startPos);
newPos.track = info.track;
- newPos.cropDuration = GenTime((int)((newPos.endPos - newPos.startPos).frames(m_document->fps()) * speed), m_document->fps());
- newPos.originalcropStart = GenTime((int)(newPos.cropStart .frames(m_document->fps()) * speed), m_document->fps());
+ newPos.cropDuration = newPos.endPos - newPos.startPos;
ClipItem *dup = item->clone(newPos);
ClipItem *dup = item->clone(newPos);
QDomElement oldeffect = item->effectAt(ix);
dup->deleteEffect(oldeffect.attribute("kdenlive_ix"));
}
QDomElement oldeffect = item->effectAt(ix);
dup->deleteEffect(oldeffect.attribute("kdenlive_ix"));
}
- item->resizeEnd(cutPos, false);
+ item->resizeEnd(cutPos);
scene()->addItem(dup);
if (item->checkKeyFrames()) slotRefreshEffects(item);
if (dup->checkKeyFrames()) slotRefreshEffects(dup);
scene()->addItem(dup);
if (item->checkKeyFrames()) slotRefreshEffects(item);
if (dup->checkKeyFrames()) slotRefreshEffects(dup);
else delete changeSelected;
}
else delete changeSelected;
}
-void CustomTrackView::doChangeClipSpeed(ItemInfo info, const double speed, const double oldspeed, int strobe, const QString &id)
+void CustomTrackView::doChangeClipSpeed(ItemInfo info, ItemInfo speedIndependantInfo, const double speed, const double oldspeed, int strobe, const QString &id)
{
DocClipBase *baseclip = m_document->clipManager()->getClipById(id);
ClipItem *item = getClipItemAt((int) info.startPos.frames(m_document->fps()), info.track);
{
DocClipBase *baseclip = m_document->clipManager()->getClipById(id);
ClipItem *item = getClipItemAt((int) info.startPos.frames(m_document->fps()), info.track);
return;
}
info.track = m_document->tracksCount() - item->track();
return;
}
info.track = m_document->tracksCount() - item->track();
- int endPos = m_document->renderer()->mltChangeClipSpeed(info, speed, oldspeed, strobe, baseclip->producer());
+ int endPos = m_document->renderer()->mltChangeClipSpeed(info, speedIndependantInfo, speed, oldspeed, strobe, baseclip->producer());
if (endPos >= 0) {
item->setSpeed(speed, strobe);
item->updateRectGeometry();
if (endPos >= 0) {
item->setSpeed(speed, strobe);
item->updateRectGeometry();
- if (item->cropDuration().frames(m_document->fps()) > endPos)
- item->AbstractClipItem::resizeEnd(info.startPos.frames(m_document->fps()) + endPos, speed);
+ if (item->cropDuration().frames(m_document->fps()) != endPos) {
+ item->resizeEnd((int) info.startPos.frames(m_document->fps()) + endPos - 1);
+ }
updatePositionEffects(item, info);
setDocumentModified();
} else emit displayMessage(i18n("Invalid clip"), ErrorMessage);
updatePositionEffects(item, info);
setDocumentModified();
} else emit displayMessage(i18n("Invalid clip"), ErrorMessage);
ItemInfo startInfo = clip->info();
ItemInfo endInfo = clip->info();
endInfo.endPos = GenTime(m_cursorPos, m_document->fps());
ItemInfo startInfo = clip->info();
ItemInfo endInfo = clip->info();
endInfo.endPos = GenTime(m_cursorPos, m_document->fps());
- CLIPTYPE type = (CLIPTYPE) static_cast <ClipItem *> (clip)->clipType();
+ CLIPTYPE type = (CLIPTYPE) static_cast <ClipItem *>(clip)->clipType();
if (endInfo.endPos <= startInfo.startPos || (type != IMAGE && type != COLOR && type != TEXT && endInfo.endPos > startInfo.startPos + clip->maxDuration() - startInfo.cropStart)) {
// Check for invalid resize
emit displayMessage(i18n("Invalid action"), ErrorMessage);
if (endInfo.endPos <= startInfo.startPos || (type != IMAGE && type != COLOR && type != TEXT && endInfo.endPos > startInfo.startPos + clip->maxDuration() - startInfo.cropStart)) {
// Check for invalid resize
emit displayMessage(i18n("Invalid action"), ErrorMessage);
} else if (endInfo.endPos > startInfo.endPos) {
int length = m_document->renderer()->mltGetSpaceLength(startInfo.endPos, m_document->tracksCount() - startInfo.track, false);
if ((clip->type() == TRANSITIONWIDGET && itemCollision(clip, endInfo) == true) || (clip->type() == AVWIDGET && length != -1 && length < (endInfo.endPos - startInfo.endPos).frames(m_document->fps()))) {
} else if (endInfo.endPos > startInfo.endPos) {
int length = m_document->renderer()->mltGetSpaceLength(startInfo.endPos, m_document->tracksCount() - startInfo.track, false);
if ((clip->type() == TRANSITIONWIDGET && itemCollision(clip, endInfo) == true) || (clip->type() == AVWIDGET && length != -1 && length < (endInfo.endPos - startInfo.endPos).frames(m_document->fps()))) {
- kDebug()<<" RESIZE ERROR, BLNK: "<<length<<", RESIZE: "<<(endInfo.endPos - startInfo.endPos).frames(m_document->fps());
+ kDebug() << " RESIZE ERROR, BLNK: " << length << ", RESIZE: " << (endInfo.endPos - startInfo.endPos).frames(m_document->fps());
emit displayMessage(i18n("Invalid action"), ErrorMessage);
return;
}
emit displayMessage(i18n("Invalid action"), ErrorMessage);
return;
}
void clipStart();
void clipEnd();
void changeClipSpeed();
void clipStart();
void clipEnd();
void changeClipSpeed();
- void doChangeClipSpeed(ItemInfo info, const double speed, const double oldspeed, int strobe, const QString &id);
+ void doChangeClipSpeed(ItemInfo info, ItemInfo speedIndependantInfo, const double speed, const double oldspeed, int strobe, const QString &id);
void setDocumentModified();
void setInPoint();
void setOutPoint();
void setDocumentModified();
void setInPoint();
void setOutPoint();
GenTime startPos;
/** endPos is the duration where the clip ends on the track */
GenTime endPos;
GenTime startPos;
/** endPos is the duration where the clip ends on the track */
GenTime endPos;
- /** originalcropStart is the position where the sub-clip starts, relative to the clip's 0 position. Doe not depend on speed */
- GenTime originalcropStart;
- /** cropStart is the position where the sub-clip starts, depend on effects (speed,...) */
+ /** cropStart is the position where the sub-clip starts, relative to the clip's 0 position */
- /** cropDuration is the duration of the clip, does not depend on speed */
+ /** cropDuration is the duration of the clip */
GenTime cropDuration;
int track;
};
GenTime cropDuration;
int track;
};
-int Render::mltChangeClipSpeed(ItemInfo info, double speed, double oldspeed, int strobe, Mlt::Producer *prod)
+int Render::mltChangeClipSpeed(ItemInfo info, ItemInfo speedIndependantInfo, double speed, double oldspeed, int strobe, Mlt::Producer *prod)
{
m_isBlocked = true;
int newLength = 0;
{
m_isBlocked = true;
int newLength = 0;
int blankEnd = trackPlaylist.clip_start(clipIndex) + trackPlaylist.clip_length(clipIndex);
Mlt::Producer *cut;
int blankEnd = trackPlaylist.clip_start(clipIndex) + trackPlaylist.clip_length(clipIndex);
Mlt::Producer *cut;
- GenTime duration = info.cropDuration;
- int originalStart = (int)(info.originalcropStart.frames(m_fps));
- if (clipIndex + 1 < trackPlaylist.count() && (info.startPos + info.cropDuration).frames(m_fps) > blankEnd) {
+ int originalStart = (int)(speedIndependantInfo.cropStart.frames(m_fps));
+ if (clipIndex + 1 < trackPlaylist.count() && (info.startPos + speedIndependantInfo.cropDuration).frames(m_fps) > blankEnd) {
GenTime maxLength = GenTime(blankEnd, m_fps) - info.startPos;
cut = prod->cut(originalStart, (int)(originalStart + maxLength.frames(m_fps) - 1));
GenTime maxLength = GenTime(blankEnd, m_fps) - info.startPos;
cut = prod->cut(originalStart, (int)(originalStart + maxLength.frames(m_fps) - 1));
- } else cut = prod->cut(originalStart, (int)(originalStart + info.cropDuration.frames(m_fps)) - 1);
+ } else cut = prod->cut(originalStart, (int)(originalStart + speedIndependantInfo.cropDuration.frames(m_fps)) - 1);
// move all effects to the correct producer
mltPasteEffects(clip, cut);
// move all effects to the correct producer
mltPasteEffects(clip, cut);
Mlt::Producer *clip = trackPlaylist.replace_with_blank(clipIndex);
trackPlaylist.consolidate_blanks(0);
Mlt::Producer *clip = trackPlaylist.replace_with_blank(clipIndex);
trackPlaylist.consolidate_blanks(0);
- GenTime duration = info.cropDuration / speed;
- int originalStart = (int)(info.originalcropStart.frames(m_fps) / speed);
+ GenTime duration = speedIndependantInfo.cropDuration / speed;
+ int originalStart = (int)(speedIndependantInfo.cropStart.frames(m_fps) / speed);
// Check that the blank space is long enough for our new duration
clipIndex = trackPlaylist.get_clip_index_at(startPos);
// Check that the blank space is long enough for our new duration
clipIndex = trackPlaylist.get_clip_index_at(startPos);
to the clip and 0.6 is the speed in percents. The newly created producer will have it's
"id" parameter set to: "slowmotion:parentid:speed", where parentid is the id of the original clip
in the ClipManager list and speed is the current speed */
to the clip and 0.6 is the speed in percents. The newly created producer will have it's
"id" parameter set to: "slowmotion:parentid:speed", where parentid is the id of the original clip
in the ClipManager list and speed is the current speed */
- int mltChangeClipSpeed(ItemInfo info, double speed, double oldspeed, int strobe, Mlt::Producer *prod);
+ int mltChangeClipSpeed(ItemInfo info, ItemInfo speedIndependantInfo, double speed, double oldspeed, int strobe, Mlt::Producer *prod);
const QList <Mlt::Producer *> producersList();
void updatePreviewSettings();
const QList <Mlt::Producer *> producersList();
void updatePreviewSettings();
clipinfo.startPos = GenTime(position, m_doc->fps());
clipinfo.endPos = clipinfo.startPos + GenTime(out - in + 1, m_doc->fps());
clipinfo.cropStart = GenTime(in, m_doc->fps());
clipinfo.startPos = GenTime(position, m_doc->fps());
clipinfo.endPos = clipinfo.startPos + GenTime(out - in + 1, m_doc->fps());
clipinfo.cropStart = GenTime(in, m_doc->fps());
- clipinfo.cropDuration = GenTime((int)((clipinfo.endPos - clipinfo.startPos).frames(m_doc->fps()) * speed + 0.5), m_doc->fps());
- clipinfo.originalcropStart = GenTime((int)((clipinfo.cropStart).frames(m_doc->fps()) * speed + 0.5), m_doc->fps());
+ clipinfo.cropDuration = clipinfo.endPos - clipinfo.startPos;
clipinfo.track = ix;
//kDebug() << "// INSERTING CLIP: " << in << "x" << out << ", track: " << ix << ", ID: " << id << ", SCALE: " << m_scale << ", FPS: " << m_doc->fps();
clipinfo.track = ix;
//kDebug() << "// INSERTING CLIP: " << in << "x" << out << ", track: " << ix << ", ID: " << id << ", SCALE: " << m_scale << ", FPS: " << m_doc->fps();