if (clip->isAudioOnly()) prod = clip->baseClip()->audioProducer(clipinfo.track);
else if (clip->isVideoOnly()) prod = clip->baseClip()->videoProducer();
else prod = clip->baseClip()->producer(clipinfo.track);
- m_document->renderer()->mltUpdateClipProducer((int)(m_document->tracksCount() - clipinfo.track), clipinfo.startPos.frames(m_document->fps()), prod);
+ if (m_document->renderer()->mltUpdateClipProducer((int)(m_document->tracksCount() - clipinfo.track), clipinfo.startPos.frames(m_document->fps()), prod) == false) {
+ // problem updating clip
+ emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", clipinfo.startPos.frames(m_document->fps()), clipinfo.track), ErrorMessage);
+ }
}
} else if (item->type() == TRANSITIONWIDGET) {
Transition *tr = static_cast <Transition *>(item);
if (clip->isAudioOnly()) prod = clip->baseClip()->audioProducer(clipinfo.track);
else if (clip->isVideoOnly()) prod = clip->baseClip()->videoProducer();
else prod = clip->baseClip()->producer(clipinfo.track);
- m_document->renderer()->mltUpdateClipProducer((int)(m_document->tracksCount() - clipinfo.track), clipinfo.startPos.frames(m_document->fps()), prod);
+ if (!m_document->renderer()->mltUpdateClipProducer((int)(m_document->tracksCount() - clipinfo.track), clipinfo.startPos.frames(m_document->fps()), prod)) {
+ emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", clipinfo.startPos.frames(m_document->fps()), clipinfo.track), ErrorMessage);
+ }
}
} else if (children.at(i)->type() == TRANSITIONWIDGET) {
Transition *tr = static_cast <Transition *>(children.at(i));
if (clip->clipProducer() == clipId) {
ItemInfo info = clip->info();
info.track = m_document->tracksCount() - clip->track();
- if (reload) m_document->renderer()->mltUpdateClip(info, clip->xml(), clip->baseClip()->producer());
+ if (reload && !m_document->renderer()->mltUpdateClip(info, clip->xml(), clip->baseClip()->producer())) {
+ emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", info.startPos.frames(m_document->fps()), info.track), ErrorMessage);
+ }
clip->refreshClip(true);
clip->update();
}
ClipItem *audioClip = getClipItemAt(start, info.track);
if (audioClip) {
clip->setVideoOnly(true);
- m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - track, start, clip->baseClip()->videoProducer());
- m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - info.track, start, clip->baseClip()->audioProducer(info.track));
+ if (m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - track, start, clip->baseClip()->videoProducer()) == false) {
+ emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", start, track), ErrorMessage);
+ }
+ if (m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - info.track, start, clip->baseClip()->audioProducer(info.track)) == false) {
+ emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", start, info.track), ErrorMessage);
+ }
audioClip->setSelected(true);
audioClip->setAudioOnly(true);
groupSelectedItems(false, true);
ItemInfo info = clip->info();
deleteClip(clp->info());
clip->setVideoOnly(false);
- m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - info.track, info.startPos.frames(m_document->fps()), clip->baseClip()->producer(info.track));
+ if (!m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - info.track, info.startPos.frames(m_document->fps()), clip->baseClip()->producer(info.track))) {
+ emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", info.startPos.frames(m_document->fps()), info.track), ErrorMessage);
+ }
break;
}
}
int start = pos.frames(m_document->fps());
clip->setVideoOnly(true);
clip->setAudioOnly(false);
- m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - track, start, clip->baseClip()->videoProducer());
+ if (m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - track, start, clip->baseClip()->videoProducer()) == false) {
+ emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", start, track), ErrorMessage);
+ }
} else if (audioOnly) {
int start = pos.frames(m_document->fps());
clip->setAudioOnly(true);
clip->setVideoOnly(false);
- m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - track, start, clip->baseClip()->audioProducer(track));
+ if (m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - track, start, clip->baseClip()->audioProducer(track)) == false) {
+ emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", start, track), ErrorMessage);
+ }
} else {
int start = pos.frames(m_document->fps());
clip->setAudioOnly(false);
clip->setVideoOnly(false);
- m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - track, start, clip->baseClip()->producer(track));
+ if (m_document->renderer()->mltUpdateClipProducer(m_document->tracksCount() - track, start, clip->baseClip()->producer(track)) == false) {
+ emit displayMessage(i18n("Cannot update clip (time: %1, track: %2)", start, track), ErrorMessage);
+ }
}
clip->update();
setDocumentModified();
kDebug() << "PLAYLIST NOT INITIALISED //////";
return -1;
}
+ if (prod == NULL) {
+ kDebug() << "Cannot insert clip without producer //////";
+ return -1;
+ }
Mlt::Producer parentProd(m_mltProducer->parent());
if (parentProd.get_producer() == NULL) {
kDebug() << "PLAYLIST BROKEN, CANNOT INSERT CLIP //////";
m_isBlocked = false;
}
-void Render::mltUpdateClip(ItemInfo info, QDomElement element, Mlt::Producer *prod)
+bool Render::mltUpdateClip(ItemInfo info, QDomElement element, Mlt::Producer *prod)
{
// TODO: optimize
+ if (prod == NULL) {
+ kDebug() << "Cannot update clip with null producer //////";
+ return false;
+ }
Mlt::Service service(m_mltProducer->parent().get_service());
if (service.type() != tractor_type) {
kWarning() << "// TRACTOR PROBLEM";
- return;
+ return false;
}
Mlt::Tractor tractor(service);
Mlt::Producer trackProducer(tractor.track(info.track));
ct++;
filter = sourceService.filter(ct);
}
- mltRemoveClip(info.track, info.startPos);
- mltInsertClip(info, element, prod);
+ if (!mltRemoveClip(info.track, info.startPos)) return false;
+ if (mltInsertClip(info, element, prod) == -1) return false;
if (!filtersList.isEmpty()) {
clipIndex = trackPlaylist.get_clip_index_at(startPos);
Mlt::Producer *destclip = trackPlaylist.get_clip(clipIndex);
for (int i = 0; i < filtersList.count(); i++)
destService.attach(*(filtersList.at(i)));
}
+ return true;
}
}
-void Render::mltUpdateClipProducer(int track, int pos, Mlt::Producer *prod)
+bool Render::mltUpdateClipProducer(int track, int pos, Mlt::Producer *prod)
{
if (prod == NULL || !prod->is_valid()) {
kDebug() << "// Warning, CLIP on track " << track << ", at: " << pos << " is invalid, cannot update it!!!";
- return;
+ return false;
}
kDebug() << "NEW PROD ID: " << prod->get("id");
m_isBlocked++;
Mlt::Service service(m_mltProducer->parent().get_service());
if (service.type() != tractor_type) {
kWarning() << "// TRACTOR PROBLEM";
- return;
+ return false;
}
mlt_service_lock(m_mltConsumer->get_service());
delete clipProducer;
mlt_service_unlock(m_mltConsumer->get_service());
m_isBlocked--;
- return;
+ return false;
}
Mlt::Producer *clip = prod->cut(clipProducer->get_in(), clipProducer->get_out());
-
+ if (!clip) return false;
// move all effects to the correct producer
mltPasteEffects(clipProducer, clip);
trackPlaylist.insert_at(pos, clip, 1);
delete clipProducer;
mlt_service_unlock(m_mltConsumer->get_service());
m_isBlocked--;
+ return true;
}
bool Render::mltMoveClip(int startTrack, int endTrack, int moveStart, int moveEnd, Mlt::Producer *prod)
/** Playlist manipulation */
int mltInsertClip(ItemInfo info, QDomElement element, Mlt::Producer *prod);
- void mltUpdateClip(ItemInfo info, QDomElement element, Mlt::Producer *prod);
+ bool mltUpdateClip(ItemInfo info, QDomElement element, Mlt::Producer *prod);
void mltCutClip(int track, GenTime position);
void mltInsertSpace(QMap <int, int> trackClipStartList, QMap <int, int> trackTransitionStartList, int track, const GenTime duration, const GenTime timeOffset);
int mltGetSpaceLength(const GenTime pos, int track, bool fromBlankStart);
void mltResizeTransparency(int oldStart, int newStart, int newEnd, int track, int id);
void mltInsertTrack(int ix, bool videoTrack);
void mltDeleteTrack(int ix);
- void mltUpdateClipProducer(int track, int pos, Mlt::Producer *prod);
+ bool mltUpdateClipProducer(int track, int pos, Mlt::Producer *prod);
/** Change speed of a clip in playlist. To do this, we create a new "framebuffer" producer.
This new producer must have its "resource" param set to: video.mpg?0.6 where video.mpg is the path