Render::Render(const QString & rendererName, int winid, int extid, QWidget *parent) :
QObject(parent),
+ m_isBlocked(true),
m_name(rendererName),
m_mltConsumer(NULL),
m_mltProducer(NULL),
m_mltTextProducer(NULL),
- m_winid(winid),
- m_externalwinid(extid),
m_framePosition(0),
- m_isBlocked(true),
- m_blackClip(NULL),
- m_isSplitView(false),
m_isZoneMode(false),
- m_isLoopMode(false)
+ m_isLoopMode(false),
+ m_isSplitView(false),
+ m_blackClip(NULL),
+ m_winid(winid),
+ m_externalwinid(extid)
{
kDebug() << "////////// USING PROFILE: " << (char*)KdenliveSettings::current_profile().toUtf8().data();
refreshTimer = new QTimer(this);
m_mltConsumer->set("resize", 1);
m_mltConsumer->set("window_id", m_winid);
m_mltConsumer->set("terminate_on_pause", 1);
- m_mltConsumer->set("window_background", decodedString(KdenliveSettings::window_background().name()));
+ tmp = decodedString(KdenliveSettings::window_background().name());
+ m_mltConsumer->set("window_background", tmp);
+ delete [] tmp;
+ // FIXME: the event object returned by the listen gets leaked...
m_mltConsumer->listen("consumer-frame-show", this, (mlt_listener) consumer_frame_show);
m_mltConsumer->set("rescale", "nearest");
if (producer == NULL || producer->is_blank() || !producer->is_valid()) {
kDebug() << " / / / / / / / / ERROR / / / / // CANNOT LOAD PRODUCER: ";
emit removeInvalidClip(clipId);
+ delete producer;
return;
}
/*if (context->duration == AV_NOPTS_VALUE) {
kDebug() << " / / / / / / / /ERROR / / / CLIP HAS UNKNOWN DURATION";
emit removeInvalidClip(clipId);
+ delete producer;
return;
}*/
// Get the video_index
emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap, replaceProducer);
kDebug() << "REquested fuile info for: " << url.path();
if (frame) delete frame;
+ // FIXME: should delete this to avoid a leak...
//if (producer) delete producer;
}
{
if (m_winid == -1) return;
m_isBlocked = true;
+ qDeleteAll(m_slowmotionProducers.values());
m_slowmotionProducers.clear();
//kWarning() << "////// RENDER, SET SCENE LIST: " << playlist;
}
m_isBlocked = false;
blockSignals(false);
+ emit refreshDocumentProducers();
//kDebug()<<"// SETSCN LST, POS: "<<position;
//if (position != 0) emit rendererPosition(position);
}
/*
if (m_mltConsumer->start() == -1) {
KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install or your driver settings, please fix it."));
+ delete m_mltConsumer;
m_mltConsumer = NULL;
}
else {
kDebug() << "----- MONITOR: " << m_name << " WAS STOPPED";
if (m_mltConsumer->start() == -1) {
KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install or your driver settings, please fix it."));
+ delete m_mltConsumer;
m_mltConsumer = NULL;
return;
} else {
int ct = 0;
Mlt::Filter *filter = clipService.filter(ct);
while (filter) {
- if (filter->is_valid() && filter->get("kdenlive_id") != "") {
+ if (filter->is_valid() && strcmp(filter->get("kdenlive_id"), "")) {
// looks like there is no easy way to duplicate a filter,
// so we will create a new one and duplicate its properties
Mlt::Filter *dup = new Mlt::Filter(*m_mltProfile, filter->get("mlt_service"));
int ct = 0;
Mlt::Filter *filter = clipService.filter(ct);
while (filter) {
- if ((index == "-1" && filter->get("kdenlive_id") != "") || filter->get("kdenlive_ix") == index) {// && filter->get("kdenlive_id") == id) {
+ if ((index == "-1" && strcmp(filter->get("kdenlive_id"), "")) || filter->get("kdenlive_ix") == index) {// && filter->get("kdenlive_id") == id) {
if (clipService.detach(*filter) == 0) success = true;
kDebug() << " / / / DLEETED EFFECT: " << ct;
} else if (updateIndex) {
kDebug() << "////// LOOKING FOR CLIP TO MOVE, INDEX: " << clipIndex;
bool checkLength = false;
if (endTrack == startTrack) {
- //mlt_service_lock(service.get_service());
Mlt::Producer clipProducer(trackPlaylist.replace_with_blank(clipIndex));
if (!trackPlaylist.is_blank_at(moveEnd) || clipProducer.is_blank()) {
// error, destination is not empty
+ if (!trackPlaylist.is_blank_at(moveEnd)) trackPlaylist.insert_at(moveStart, clipProducer, 1);
//int ix = trackPlaylist.get_clip_index_at(moveEnd);
kDebug() << "// ERROR MOVING CLIP TO : " << moveEnd;
mlt_service_unlock(m_mltConsumer->get_service());
QString currentid = clipProducer.parent().get("id");
if (serv == "framebuffer" || currentid.endsWith("_video")) {
clip = &clipProducer;
- } else clip = prod->cut(clipProducer.get_in(), clipProducer.get_out());
+ } else {
+ if (prod == NULL) {
+ // Special case: prod is null when using placeholder clips.
+ // in that case, use the producer existing in playlist. Note that
+ // it will bypass the one producer per track logic and might cause
+ // Sound cracks if clip is moved so that it overlaps another copy of itself
+ clip = clipProducer.cut(clipProducer.get_in(), clipProducer.get_out());
+ } else clip = prod->cut(clipProducer.get_in(), clipProducer.get_out());
+ }
// move all effects to the correct producer
Mlt::Service clipService(clipProducer.get_service());
int trackNb = tractor.count();
for (int t = 1; t < trackNb; t++) {
- Mlt::Producer trackProducer(tractor.track(t));
+ Mlt::Producer *tt = tractor.track(t);
+ Mlt::Producer trackProducer(tt);
+ delete tt;
Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
int clipNb = trackPlaylist.count();
//kDebug() << "// PARSING SCENE TRACK: " << t << ", CLIPS: " << clipNb;
for (int i = 0; i < clipNb; i++) {
- Mlt::Producer *nprod = new Mlt::Producer(trackPlaylist.get_clip(i)->get_parent());
- if (nprod && !nprod->is_blank() && !ids.contains(nprod->get("id"))) {
- ids.append(nprod->get("id"));
- prods.append(nprod);
+ Mlt::Producer *c = trackPlaylist.get_clip(i);
+ Mlt::Producer *nprod = new Mlt::Producer(c->get_parent());
+ if (nprod) {
+ if (!nprod->is_blank() && !ids.contains(nprod->get("id"))) {
+ ids.append(nprod->get("id"));
+ prods.append(nprod);
+ } else delete nprod;
}
+ delete c;
}
}
return prods;
int trackNb = tractor.count();
for (int t = 1; t < trackNb; t++) {
- Mlt::Producer trackProducer(tractor.track(t));
+ Mlt::Producer *tt = tractor.track(t);
+ Mlt::Producer trackProducer(tt);
+ delete tt;
Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
int clipNb = trackPlaylist.count();
for (int i = 0; i < clipNb; i++) {
- Mlt::Producer *nprod = new Mlt::Producer(trackPlaylist.get_clip(i)->get_parent());
- if (nprod && !nprod->is_blank()) {
+ Mlt::Producer *c = trackPlaylist.get_clip(i);
+ Mlt::Producer *nprod = new Mlt::Producer(c->get_parent());
+ if (nprod) {
QString id = nprod->get("id");
- if (id.startsWith("slowmotion:")) {
+ if (id.startsWith("slowmotion:") && !nprod->is_blank()) {
// this is a slowmotion producer, add it to the list
QString url = QString::fromUtf8(nprod->get("resource"));
if (!m_slowmotionProducers.contains(url)) {
m_slowmotionProducers.insert(url, nprod);
}
- }
+ } else delete nprod;
}
+ delete c;
}
}
}