"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/models/multitrackmodel.cpp" between
shotcut-20.09.01.tar.gz and shotcut-20.09.13.tar.gz

About: Shotcut is a cross-platform (Qt) advanced video editor.

multitrackmodel.cpp  (shotcut-20.09.01):multitrackmodel.cpp  (shotcut-20.09.13)
skipping to change at line 730 skipping to change at line 730
} else if (fromTrack == toTrack && (playlist.is_blank_at(positio n) || targetIndex == clipIndex) && } else if (fromTrack == toTrack && (playlist.is_blank_at(positio n) || targetIndex == clipIndex) &&
(playlist.is_blank_at(position + length - 1) || target IndexEnd == clipIndex)) { (playlist.is_blank_at(position + length - 1) || target IndexEnd == clipIndex)) {
// Reposition the clip within its current blank spot. // Reposition the clip within its current blank spot.
moveClipInBlank(playlist, toTrack, clipIndex, position, ripp le, rippleAllTracks); moveClipInBlank(playlist, toTrack, clipIndex, position, ripp le, rippleAllTracks);
emit modified(); emit modified();
} else { } else {
int clipPlaytime = clip.get_playtime(); int clipPlaytime = clip.get_playtime();
int clipStart = playlist.clip_start(clipIndex); int clipStart = playlist.clip_start(clipIndex);
// Remove clip // Remove clip
clearMixReferences(fromTrack, clipIndex);
beginRemoveRows(index(fromTrack), clipIndex, clipIndex); beginRemoveRows(index(fromTrack), clipIndex, clipIndex);
playlist.remove(clipIndex); playlist.remove(clipIndex);
endRemoveRows(); endRemoveRows();
consolidateBlanks(playlist, fromTrack); consolidateBlanks(playlist, fromTrack);
// Ripple delete on all unlocked tracks. // Ripple delete on all unlocked tracks.
if (clipPlaytime > 0 && rippleAllTracks) if (clipPlaytime > 0 && rippleAllTracks)
for (int j = 0; j < m_trackList.count(); ++j) { for (int j = 0; j < m_trackList.count(); ++j) {
if (j == fromTrack) if (j == fromTrack)
continue; continue;
skipping to change at line 851 skipping to change at line 852
// LOG_DEBUG() << "adjust item on right" << (targetIndex) << " to " << duration; // LOG_DEBUG() << "adjust item on right" << (targetIndex) << " to " << duration;
playlist.resize_clip(targetIndex, 0, duration - 1); playlist.resize_clip(targetIndex, 0, duration - 1);
QModelIndex modelIndex = createIndex(targetIndex, 0, trackIndex) ; QModelIndex modelIndex = createIndex(targetIndex, 0, trackIndex) ;
// Notify clip on right was adjusted. // Notify clip on right was adjusted.
QVector<int> roles; QVector<int> roles;
roles << DurationRole; roles << DurationRole;
emit dataChanged(modelIndex, modelIndex, roles); emit dataChanged(modelIndex, modelIndex, roles);
AudioLevelsTask::start(clip.parent(), this, modelIndex); AudioLevelsTask::start(clip.parent(), this, modelIndex);
} else { } else {
// LOG_DEBUG() << "remove item on right"; // LOG_DEBUG() << "remove item on right";
clearMixReferences(trackIndex, targetIndex);
beginRemoveRows(index(trackIndex), targetIndex, targetIndex); beginRemoveRows(index(trackIndex), targetIndex, targetIndex);
playlist.remove(targetIndex); playlist.remove(targetIndex);
endRemoveRows(); endRemoveRows();
} }
// Insert clip between subclips. // Insert clip between subclips.
int in = clip.get_in(); int in = clip.get_in();
int out = clip.get_out(); int out = clip.get_out();
clip.set_in_and_out(0, clip.get_length() - 1); clip.set_in_and_out(0, clip.get_length() - 1);
beginInsertRows(index(trackIndex), targetIndex, targetIndex); beginInsertRows(index(trackIndex), targetIndex, targetIndex);
playlist.insert(clip.parent(), targetIndex, in, out); playlist.insert(clip.parent(), targetIndex, in, out);
skipping to change at line 946 skipping to change at line 948
int length = clip.get_playtime(); int length = clip.get_playtime();
while (length > 0 && targetIndex < playlist.count()) { while (length > 0 && targetIndex < playlist.count()) {
if (playlist.clip_length(targetIndex) > length) { if (playlist.clip_length(targetIndex) > length) {
// LOG_DEBUG() << "split last item" << targetIndex; // LOG_DEBUG() << "split last item" << targetIndex;
splitClip(trackIndex, targetIndex, position + length); splitClip(trackIndex, targetIndex, position + length);
} }
// LOG_DEBUG() << "length" << length << "item length" << playlist .clip_length(targetIndex); // LOG_DEBUG() << "length" << length << "item length" << playlist .clip_length(targetIndex);
length -= playlist.clip_length(targetIndex); length -= playlist.clip_length(targetIndex);
// LOG_DEBUG() << "delete item" << targetIndex; // LOG_DEBUG() << "delete item" << targetIndex;
clearMixReferences(trackIndex, targetIndex);
beginRemoveRows(index(trackIndex), targetIndex, targetIndex); beginRemoveRows(index(trackIndex), targetIndex, targetIndex);
playlist.remove(targetIndex); playlist.remove(targetIndex);
endRemoveRows(); endRemoveRows();
} }
// Insert clip between subclips. // Insert clip between subclips.
int in = clip.get_in(); int in = clip.get_in();
int out = clip.get_out(); int out = clip.get_out();
clip.set_in_and_out(0, clip.get_length() - 1); clip.set_in_and_out(0, clip.get_length() - 1);
beginInsertRows(index(trackIndex), targetIndex, targetIndex); beginInsertRows(index(trackIndex), targetIndex, targetIndex);
skipping to change at line 1293 skipping to change at line 1296
beginRemoveRows(index(trackIndex), clipIndex + 1, clipIndex + 1); beginRemoveRows(index(trackIndex), clipIndex + 1, clipIndex + 1);
playlist.remove(clipIndex + 1); playlist.remove(clipIndex + 1);
endRemoveRows(); endRemoveRows();
adjustClipFilters(clip->parent(), in, out, 0, delta); adjustClipFilters(clip->parent(), in, out, 0, delta);
emit modified(); emit modified();
} }
} }
void MultitrackModel::overwriteFromPlaylist(Mlt::Playlist& from, int trackIndex,
int position)
{
int i = m_trackList.at(trackIndex).mlt_index;
QScopedPointer<Mlt::Producer> track(m_tractor->track(i));
if (track) {
Mlt::Playlist playlist(*track);
int targetIndex = playlist.get_clip_index_at(position);
if (targetIndex > 0) {
--targetIndex;
beginRemoveRows(index(trackIndex), targetIndex, targetIndex);
playlist.remove(targetIndex);
endRemoveRows();
}
if (targetIndex < playlist.count()) {
beginRemoveRows(index(trackIndex), targetIndex, targetIndex);
playlist.remove(targetIndex);
endRemoveRows();
}
if (targetIndex < playlist.count()) {
beginRemoveRows(index(trackIndex), targetIndex, targetIndex);
playlist.remove(targetIndex);
endRemoveRows();
}
if (from.count() > 0) {
beginInsertRows(index(trackIndex), targetIndex, targetIndex + from.c
ount() - 1);
for (int i = 0; i < from.count(); i++) {
QScopedPointer<Mlt::Producer> clip(from.get_clip(i));
if (clip->is_blank()) {
playlist.insert_blank(targetIndex, clip->get_out());
} else {
playlist.insert(*clip, targetIndex);
QModelIndex modelIndex = createIndex(targetIndex, 0, trackIn
dex);
AudioLevelsTask::start(clip->parent(), this, modelIndex);
}
++targetIndex;
}
endInsertRows();
}
consolidateBlanks(playlist, trackIndex);
emit modified();
emit seeked(position + playlist.get_playtime());
}
}
void MultitrackModel::fadeIn(int trackIndex, int clipIndex, int duration) void MultitrackModel::fadeIn(int trackIndex, int clipIndex, int duration)
{ {
int i = m_trackList.at(trackIndex).mlt_index; int i = m_trackList.at(trackIndex).mlt_index;
QScopedPointer<Mlt::Producer> track(m_tractor->track(i)); QScopedPointer<Mlt::Producer> track(m_tractor->track(i));
if (track) { if (track) {
Mlt::Playlist playlist(*track); Mlt::Playlist playlist(*track);
QScopedPointer<Mlt::ClipInfo> info(playlist.clip_info(clipIndex)); QScopedPointer<Mlt::ClipInfo> info(playlist.clip_info(clipIndex));
if (info && info->producer && info->producer->is_valid()) { if (info && info->producer && info->producer->is_valid()) {
bool isChanged = false; bool isChanged = false;
QScopedPointer<Mlt::Filter> filter; QScopedPointer<Mlt::Filter> filter;
skipping to change at line 1615 skipping to change at line 1573
else if (playlist.is_blank(clipIndex + 1) && targetIndex >= clipInde x) else if (playlist.is_blank(clipIndex + 1) && targetIndex >= clipInde x)
duration -= playlist.clip_length(clipIndex + 1); duration -= playlist.clip_length(clipIndex + 1);
// Adjust/insert blanks // Adjust/insert blanks
moveClipInBlank(playlist, trackIndex, clipIndex, position, ripple, r ippleAllTracks, duration); moveClipInBlank(playlist, trackIndex, clipIndex, position, ripple, r ippleAllTracks, duration);
targetIndex = playlist.get_clip_index_at(position); targetIndex = playlist.get_clip_index_at(position);
// Create mix // Create mix
beginInsertRows(index(trackIndex), targetIndex + 1, targetIndex + 1) ; beginInsertRows(index(trackIndex), targetIndex + 1, targetIndex + 1) ;
playlist.mix(targetIndex, duration); playlist.mix(targetIndex, duration);
QScopedPointer<Mlt::Producer> producer(playlist.get_clip(targetIndex Mlt::Producer producer(playlist.get_clip(targetIndex + 1));
+ 1)); if (producer.is_valid()) {
producer->parent().set(kShotcutTransitionProperty, kShotcutDefaultTr producer.parent().set(kShotcutTransitionProperty, kShotcutDefaul
ansition); tTransition);
}
endInsertRows(); endInsertRows();
// Add transitions // Add transitions
Mlt::Transition dissolve(MLT.profile(), Settings.playerGPU()? "movit .luma_mix" : "luma"); Mlt::Transition dissolve(MLT.profile(), Settings.playerGPU()? "movit .luma_mix" : "luma");
Mlt::Transition crossFade(MLT.profile(), "mix:-1"); Mlt::Transition crossFade(MLT.profile(), "mix:-1");
if (!Settings.playerGPU()) dissolve.set("alpha_over", 1); if (!Settings.playerGPU()) dissolve.set("alpha_over", 1);
playlist.mix_add(targetIndex + 1, &dissolve); playlist.mix_add(targetIndex + 1, &dissolve);
playlist.mix_add(targetIndex + 1, &crossFade); playlist.mix_add(targetIndex + 1, &crossFade);
// Notify ins and outs changed // Notify ins and outs changed
 End of changes. 5 change blocks. 
52 lines changed or deleted 8 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)