static void consumer_frame_show(mlt_consumer, Render * self, mlt_frame frame_ptr)
{
- // detect if the producer has finished playing. Is there a better way to do it ?
+ // detect if the producer has finished playing. Is there a better way to do it?
if (self->m_isBlocked) return;
if (mlt_properties_get_double(MLT_FRAME_PROPERTIES(frame_ptr), "_speed") == 0.0) {
self->emitConsumerStopped();
}
}
-Render::Render(const QString & rendererName, int winid, int extid, QWidget *parent) :
+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_framePosition(0),
m_isZoneMode(false),
m_isLoopMode(false),
m_isSplitView(false),
m_blackClip(NULL),
- m_winid(winid),
- m_externalwinid(extid)
+ m_winid(winid)
{
kDebug() << "////////// USING PROFILE: " << (char*)KdenliveSettings::current_profile().toUtf8().data();
- refreshTimer = new QTimer(this);
- connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
+ m_refreshTimer = new QTimer(this);
+ connect(m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
/*if (rendererName == "project") m_monitorId = 10000;
else m_monitorId = 10001;*/
- osdTimer = new QTimer(this);
- connect(osdTimer, SIGNAL(timeout()), this, SLOT(slotOsdTimeout()));
-
- m_osdProfile = KStandardDirs::locate("data", "kdenlive/profiles/metadata.properties");
+ m_osdTimer = new QTimer(this);
+ connect(m_osdTimer, SIGNAL(timeout()), this, SLOT(slotOsdTimeout()));
buildConsumer();
void Render::closeMlt()
{
- delete osdTimer;
- delete refreshTimer;
- if (m_mltConsumer)
- delete m_mltConsumer;
- if (m_mltProducer)
- delete m_mltProducer;
- if (m_blackClip) delete m_blackClip;
+ delete m_osdTimer;
+ delete m_refreshTimer;
+ delete m_mltConsumer;
+ delete m_mltProducer;
+ delete m_blackClip;
//delete m_osdInfo;
}
m_activeProfile = KdenliveSettings::current_profile();
tmp = decodedString(m_activeProfile);
setenv("MLT_PROFILE", tmp, 1);
- if (m_blackClip) delete m_blackClip;
+ delete m_blackClip;
m_blackClip = NULL;
m_mltProfile = new Mlt::Profile(tmp);
if (producer == NULL || producer->is_blank() || !producer->is_valid()) {
kDebug() << " / / / / / / / / ERROR / / / / // CANNOT LOAD PRODUCER: ";
- emit removeInvalidClip(clipId);
+ emit removeInvalidClip(clipId, replaceProducer);
delete producer;
return;
}
emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap, replaceProducer);
kDebug() << "REquested fuile info for: " << url.path();
- if (frame) delete frame;
+ delete frame;
// FIXME: should delete this to avoid a leak...
- //if (producer) delete producer;
+ //delete producer;
}
blockSignals(true);
char *tmp = decodedString(playlist);
m_mltProducer = new Mlt::Producer(*m_mltProfile, "westley-xml", tmp);
- delete[] tmp;
if (!m_mltProducer || !m_mltProducer->is_valid()) {
kDebug() << " WARNING - - - - -INVALID PLAYLIST: " << tmp;
+ m_mltProducer = m_blackClip->cut(0, 50);
}
+ delete[] tmp;
+
m_mltProducer->optimise();
/*if (KdenliveSettings::osdtimecode()) {
if (m_mltProducer->attach(*m_osdInfo) == 1) kDebug()<<"////// error attaching filter";
}*/
refresh();
- osdTimer->setSingleShot(2500);
+ m_osdTimer->setSingleShot(2500);
}
void Render::slotOsdTimeout()
void Render::askForRefresh()
{
// Use a Timer so that we don't refresh too much
- refreshTimer->start(200);
+ m_refreshTimer->start(200);
}
void Render::doRefresh()
{
if (!m_mltProducer || m_isBlocked)
return;
- refreshTimer->stop();
+ m_refreshTimer->stop();
if (m_mltConsumer) {
m_mltConsumer->set("refresh", 1);
}
Mlt::Tractor tractor(service);
int trackNb = tractor.count();
- double duration = 0;
- double trackDuration;
+ int duration = 0;
+ int trackDuration;
if (trackNb == 1) {
Mlt::Producer trackProducer(tractor.track(0));
duration = trackProducer.get_playtime() - 1;
m_mltProducer->set("out", duration);
- emit durationChanged((int) duration);
+ emit durationChanged(duration);
return;
}
while (trackNb > 1) {
}
Mlt::Producer blackTrackProducer(tractor.track(0));
- double blackDuration = blackTrackProducer.get_playtime() - 1;
+ int blackDuration = blackTrackProducer.get_playtime() - 1;
if (blackDuration != duration) {
Mlt::Playlist blackTrackPlaylist((mlt_playlist) blackTrackProducer.get_service());
blackTrackPlaylist.clear();
- int dur = (int)duration;
+ int dur = duration;
while (dur > 14000) {
blackTrackPlaylist.append(*m_blackClip, 0, 13999);
dur = dur - 14000;
blackTrackPlaylist.append(*m_blackClip, 0, dur);
}
m_mltProducer->set("out", duration);
- emit durationChanged((int)duration);
+ emit durationChanged(duration);
}
}
int ct = 0;
Mlt::Filter *filter = clipService.filter(ct);
while (filter) {
- if (filter->is_valid() && strcmp(filter->get("kdenlive_id"), "")) {
+ // Only duplicate Kdenlive filters, and skip the fade in effects
+ if (filter->is_valid() && strcmp(filter->get("kdenlive_id"), "") && strcmp(filter->get("kdenlive_id"), "fadein") && strcmp(filter->get("kdenlive_id"), "fade_from_black")) {
// 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"));
Mlt::Tractor tractor(service);
- Mlt::Playlist playlist;// = new Mlt::Playlist();
+ Mlt::Playlist playlist;
int ct = tractor.count();
- // kDebug() << "// TRACK INSERT: " << ix << ", MAX: " << ct;
+ if (ix > ct) {
+ kDebug() << "// ERROR, TRYING TO insert TRACK " << ix << ", max: " << ct;
+ ix = ct;
+ }
+
int pos = ix;
if (pos < ct) {
Mlt::Producer *prodToMove = new Mlt::Producer(tractor.track(pos));