return m_maxDuration;
}
-void AbstractClipItem::setMaxDuration(const GenTime &max)
-{
- m_maxDuration = max;
-}
-
QPainterPath AbstractClipItem::upperRectPart(QRectF br)
{
QPainterPath roundRectPathUpper;
virtual double fps() const;
virtual GenTime maxDuration() const;
virtual void setCropStart(GenTime pos);
- virtual void setMaxDuration(const GenTime &max);
protected:
int m_track;
int dur = m_tc.getFrameCount(m_view.clip_duration->text(), m_fps);
GenTime start(pos, m_fps);
GenTime duration(dur, m_fps);
- GenTime maxDuration = m_max == GenTime() ? start + m_clip->maxDuration() : qMin(m_max, start + m_clip->maxDuration());
- if (start + duration > maxDuration) {
+ GenTime maxDuration;
+ if (m_clip->maxDuration() == GenTime()) maxDuration = m_max;
+ else maxDuration = m_max == GenTime() ? start + m_clip->maxDuration() : qMin(m_max, start + m_clip->maxDuration());
+ if (maxDuration != GenTime() && start + duration > maxDuration) {
m_view.clip_duration->setText(m_tc.getTimecode(maxDuration - start, m_fps));
}
}
GenTime duration(dur, m_fps);
GenTime cropStart(crop, m_fps);
GenTime maxDuration = m_clip->maxDuration();
- if (cropStart + duration > maxDuration) {
+ if (maxDuration != GenTime() && cropStart + duration > maxDuration) {
m_view.crop_position->setText(m_tc.getTimecode(maxDuration - duration, m_fps));
}
}
{
int duration = m_tc.getFrameCount(m_view.clip_duration->text(), m_fps);
int crop = m_tc.getFrameCount(m_view.crop_position->text(), m_fps);
- if (duration + crop > m_clip->maxDuration().frames(m_fps)) return;
+ if (m_clip->maxDuration() != GenTime() && duration + crop > m_clip->maxDuration().frames(m_fps)) return;
duration ++;
m_view.clip_duration->setText(m_tc.getTimecode(GenTime(duration, m_fps), m_fps));
}
{
int crop = m_tc.getFrameCount(m_view.crop_position->text(), m_fps);
int duration = m_tc.getFrameCount(m_view.clip_duration->text(), m_fps);
- if (duration + crop > m_clip->maxDuration().frames(m_fps)) return;
+ if (m_clip->maxDuration() != GenTime() && duration + crop > m_clip->maxDuration().frames(m_fps)) return;
crop ++;
m_view.crop_position->setText(m_tc.getTimecode(GenTime(crop, m_fps), m_fps));
}
setAcceptDrops(true);
m_audioThumbReady = clip->audioThumbCreated();
- /*
- m_cropStart = xml.attribute("in", 0).toInt();
- m_maxDuration = xml.attribute("duration", 0).toInt();
- if (m_maxDuration == 0) m_maxDuration = xml.attribute("out", 0).toInt() - m_cropStart;
-
- if (duration != -1) m_cropDuration = duration;
- else m_cropDuration = m_maxDuration;*/
-
-
setFlags(QGraphicsItem::ItemClipsToShape | QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
setAcceptsHoverEvents(true);
connect(this , SIGNAL(prepareAudioThumb(double, int, int, int)) , this, SLOT(slotPrepareAudioThumb(double, int, int, int)));
if (checkDuration && (m_maxDuration != m_clip->maxDuration())) {
m_maxDuration = m_clip->maxDuration();
if (m_clipType != IMAGE && m_clipType != TEXT && m_clipType != COLOR) {
- if (m_cropStart + m_cropDuration > m_maxDuration) {
+ if (m_maxDuration != GenTime() && m_cropStart + m_cropDuration > m_maxDuration) {
// Clip duration changed, make sure to stay in correct range
if (m_cropStart > m_maxDuration) {
m_cropStart = GenTime();
void ClipItem::resizeEnd(int posx, double /*speed*/, bool updateKeyFrames)
{
const int max = (startPos() - cropStart() + maxDuration()).frames(m_fps);
- if (posx > max) posx = max;
+ 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 = (cropStart() + duration()).frames(m_fps);
void ClipProperties::slotCheckMaxLength()
{
+ if (m_clip->maxDuration() == GenTime()) return;
int duration = m_tc.getFrameCount(m_view.clip_duration->text(), m_fps);
if (duration > m_clip->maxDuration().frames(m_fps)) {
m_view.clip_duration->setText(m_tc.getTimecode(m_clip->maxDuration(), m_fps));
const GenTime DocClipBase::maxDuration() const
{
if (m_clipType == COLOR || m_clipType == IMAGE || m_clipType == TEXT || (m_clipType == SLIDESHOW && m_properties.value("loop") == "1")) {
- const GenTime dur(15000, KdenliveSettings::project_fps());
- return dur;
+ /*const GenTime dur(15000, KdenliveSettings::project_fps());
+ return dur;*/
+ return GenTime();
}
return m_duration;
}
return false;
}
int clipIndex = trackPlaylist.get_clip_index_at((int) info.startPos.frames(m_fps));
- kDebug() << "// SELECTED CLIP START: " << trackPlaylist.clip_start(clipIndex);
+ //kDebug() << "// SELECTED CLIP START: " << trackPlaylist.clip_start(clipIndex);
Mlt::Producer *clip = trackPlaylist.get_clip(clipIndex);
int previousStart = clip->get_in();
- int previousDuration = trackPlaylist.clip_length(clipIndex) - 1;
int newDuration = (int) clipDuration.frames(m_fps) - 1;
+ int diff = newDuration - trackPlaylist.clip_length(clipIndex) - 1;
+ if (newDuration > clip->get_length()) {
+ clip->parent().set("length", newDuration + 1);
+ clip->set("length", newDuration + 1);
+ }
trackPlaylist.resize_clip(clipIndex, previousStart, newDuration + previousStart);
trackPlaylist.consolidate_blanks(0);
// skip to next clip
clipIndex++;
- int diff = newDuration - previousDuration;
- kDebug() << "//////// RESIZE CLIP: " << clipIndex << "( pos: " << info.startPos.frames(25) << "), DIFF: " << diff << ", CURRENT DUR: " << previousDuration << ", NEW DUR: " << newDuration << ", IX: " << clipIndex << ", MAX: " << trackPlaylist.count();
+ //kDebug() << "//////// RESIZE CLIP: " << clipIndex << "( pos: " << info.startPos.frames(25) << "), DIFF: " << diff << ", CURRENT DUR: " << previousDuration << ", NEW DUR: " << newDuration << ", IX: " << clipIndex << ", MAX: " << trackPlaylist.count();
if (diff > 0) {
// clip was made longer, trim next blank if there is one.
if (clipIndex < trackPlaylist.count()) {