Commit 885fb4d0 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Workaround timeline crash caused by now fixed MLT issue (could be triggered by...

Workaround timeline crash caused by now fixed MLT issue (could be triggered by editing a title clip):
https://github.com/mltframework/mlt/commit/bf2749ab998446f13ba20c8cbc33a8c4d1c36963
parent b34d0c0b
......@@ -947,7 +947,6 @@ void Timeline::reloadTrack(ItemInfo info, bool includeLastFrame)
int Timeline::loadTrack(int ix, int offset, Mlt::Playlist &playlist, int start, int end, bool updateReferences) {
// parse track
Mlt::ClipInfo *info = new Mlt::ClipInfo();
double fps = m_doc->fps();
if (end == -1)
end = playlist.count();
......@@ -957,7 +956,8 @@ int Timeline::loadTrack(int ix, int offset, Mlt::Playlist &playlist, int start,
if (playlist.is_blank(i)) {
continue;
}
playlist.clip_info(i, info);
// TODO: playlist::clip_info(i, info) crashes on MLT < 6.6.0, so use variant until MLT 6.6.x is required
QScopedPointer <Mlt::ClipInfo>info(playlist.clip_info(i));
Mlt::Producer *clip = info->cut;
// Found a clip
QString idString = info->producer->get("id");
......@@ -1034,7 +1034,6 @@ int Timeline::loadTrack(int ix, int offset, Mlt::Playlist &playlist, int start,
// parse clip effects
getEffects(*clip, item);
}
delete info;
return playlist.get_length();
}
......
......@@ -349,7 +349,6 @@ QList <ItemInfo> Track::replaceAll(const QString &id, Mlt::Producer *original, M
Mlt::Producer *trackProducer = NULL;
Mlt::Producer *audioTrackProducer = NULL;
QList <ItemInfo> replaced;
Mlt::ClipInfo *info = new Mlt::ClipInfo();
for (int i = 0; i < m_playlist.count(); i++) {
if (m_playlist.is_blank(i)) continue;
QScopedPointer<Mlt::Producer> p(m_playlist.get_clip(i));
......@@ -360,10 +359,9 @@ QList <ItemInfo> Track::replaceAll(const QString &id, Mlt::Producer *original, M
continue;
}
// master clip used, only notify for update
m_playlist.clip_info(i, info);
ItemInfo cInfo;
cInfo.startPos = GenTime(info->start, fps());
cInfo.endPos = GenTime(info->start + info->frame_count, fps());
cInfo.startPos = GenTime(m_playlist.clip_start(i), fps());
cInfo.endPos = cInfo.startPos + GenTime(m_playlist.clip_length(i), fps());
cInfo.track = m_index;
replaced << cInfo;
continue;
......@@ -419,7 +417,9 @@ QList <ItemInfo> Track::replaceAll(const QString &id, Mlt::Producer *original, M
}
if (cut) {
Clip(*cut).addEffects(*p);
m_playlist.clip_info(i, info);
ItemInfo cInfo;
cInfo.startPos = GenTime(m_playlist.clip_start(i), fps());
cInfo.endPos = cInfo.startPos + GenTime(m_playlist.clip_length(i), fps());
m_playlist.remove(i);
m_playlist.insert(*cut, i);
m_playlist.consolidate_blanks();
......@@ -428,15 +428,11 @@ QList <ItemInfo> Track::replaceAll(const QString &id, Mlt::Producer *original, M
// Video is hidden for this track, nothing visible
continue;
}
ItemInfo cInfo;
cInfo.startPos = GenTime(info->start, fps());
cInfo.endPos = GenTime(info->start + info->frame_count, fps());
cInfo.track = m_index;
replaced << cInfo;
}
}
delete trackProducer;
delete info;
delete audioTrackProducer;
return replaced;
}
......@@ -988,12 +984,12 @@ QList <QPoint> Track::visibleClips()
return clips;
}
QPoint current;
Mlt::ClipInfo *info = new Mlt::ClipInfo();
for (int i = 0; i < m_playlist.count(); i++) {
if (m_playlist.is_blank(i)) continue;
// get producer, check if it has video
m_playlist.clip_info(i, info);
// TODO: playlist::clip_info(i, info) crashes on MLT < 6.6.0, so use variant until MLT 6.6.x is required
QScopedPointer <Mlt::ClipInfo>info(m_playlist.clip_info(i));
Mlt::Producer *clip = info->producer;
QString service = clip->get("mlt_service");
if (service.contains(QStringLiteral("avformat"))) {
......@@ -1018,7 +1014,6 @@ QList <QPoint> Track::visibleClips()
}
if (!current.isNull())
clips << current;
delete info;
return clips;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment