producer->set("id", tmp);
delete[] tmp;
+ if (!replaceProducer && xml.hasAttribute("file_hash")) {
+ // Clip already has all properties
+ emit replyGetFileProperties(clipId, producer, QMap < QString, QString >(), QMap < QString, QString >(), replaceProducer);
+ return;
+ }
+
int height = 50;
int width = (int)(height * m_mltProfile->dar());
QMap < QString, QString > filePropertyMap;
/** Create the producer from the MLT XML QDomDocument */
-void Render::setProducer(Mlt::Producer *producer, int position)
+int Render::setProducer(Mlt::Producer *producer, int position)
{
- if (m_winid == -1) return;
+ if (m_winid == -1) return -1;
if (m_mltConsumer) {
m_mltConsumer->stop();
- } else return;
+ } else return -1;
m_mltConsumer->purge();
if (!m_mltProducer || !m_mltProducer->is_valid()) kDebug() << " WARNING - - - - -INVALID PLAYLIST: ";
m_fps = m_mltProducer->get_fps();
- connectPlaylist();
+ int error = connectPlaylist();
if (position != -1) {
m_mltProducer->seek(position);
emit rendererPosition(position);
}
m_isBlocked = false;
+ return error;
}
/** Create the producer from the MLT XML QDomDocument */
-void Render::setSceneList(QDomDocument list, int position)
+int Render::setSceneList(QDomDocument list, int position)
{
- setSceneList(list.toString(), position);
+ return setSceneList(list.toString(), position);
}
/** Create the producer from the MLT XML QDomDocument */
-void Render::setSceneList(QString playlist, int position)
+int Render::setSceneList(QString playlist, int position)
{
- if (m_winid == -1) return;
+ if (m_winid == -1) return -1;
m_isBlocked = true;
+ int error;
qDeleteAll(m_slowmotionProducers.values());
m_slowmotionProducers.clear();
if (m_mltConsumer == NULL) {
kWarning() << "/////// ERROR, TRYING TO USE NULL MLT CONSUMER";
m_isBlocked = false;
- return;
+ return -1;
}
if (!m_mltConsumer->is_stopped()) {
}
kDebug() << "// NEW SCENE LIST DURATION SET TO: " << m_mltProducer->get_playtime();
- connectPlaylist();
+ error = connectPlaylist();
fillSlowMotionProducers();
m_isBlocked = false;
blockSignals(false);
emit refreshDocumentProducers();
+ return error;
//kDebug()<<"// SETSCN LST, POS: "<<position;
//if (position != 0) emit rendererPosition(position);
}
return m_fps;
}
-void Render::connectPlaylist()
+int Render::connectPlaylist()
{
- if (!m_mltConsumer) return;
+ if (!m_mltConsumer) return -1;
//m_mltConsumer->set("refresh", "0");
m_mltConsumer->connect(*m_mltProducer);
m_mltProducer->set_speed(0);
- m_mltConsumer->start();
+ if (m_mltConsumer->start() == -1) {
+ // ARGH CONSUMER BROKEN!!!!
+ 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."));
+ emit blockMonitors();
+ delete m_mltProducer;
+ m_mltProducer = NULL;
+ return -1;
+ }
emit durationChanged(m_mltProducer->get_playtime());
+ return 0;
//refresh();
- /*
- 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 {
- refresh();
- }*/
}
void Render::refreshDisplay()
kDebug() << "----- BROKEN MONITOR: " << m_name << ", RESTART";
return;
}
-
if (m_mltConsumer && m_mltConsumer->is_stopped()) {
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;
+ emit blockMonitors();
+ delete m_mltProducer;
+ m_mltProducer = NULL;
} else {
kDebug() << "----- MONITOR: " << m_name << " REFRESH";
m_isBlocked = false;
void Render::stop()
{
+ if (m_mltProducer == NULL) return;
if (m_mltConsumer && !m_mltConsumer->is_stopped()) {
kDebug() << "///////////// RENDER STOPPED: " << m_name;
m_isBlocked = true;
if (show == false) dropFrames = 0;
m_mltConsumer->stop();
m_mltConsumer->set("play.real_time", dropFrames);
- m_mltConsumer->start();
+ if (m_mltConsumer->start() == -1) {
+ emit blockMonitors();
+ delete m_mltProducer;
+ m_mltProducer = NULL;
+ }
+
}
}
Mlt::Filter *dup = new Mlt::Filter(*m_mltProfile, filter->get("mlt_service"));
if (dup && dup->is_valid()) {
Mlt::Properties entries(filter->get_properties());
- for (int i = 0;i < entries.count();i++) {
+ for (int i = 0; i < entries.count(); i++) {
dup->set(entries.get_name(i), entries.get(i));
}
dupService.attach(*dup);
m_mltConsumer->set("refresh", 1);
}
+
+void Render::mltPasteEffects(Mlt::Producer *source, Mlt::Producer *dest)
+{
+ Mlt::Service sourceService(source->get_service());
+ Mlt::Service destService(dest->get_service());
+
+ // move all effects to the correct producer
+ int ct = 0;
+ Mlt::Filter *filter = sourceService.filter(ct);
+ while (filter) {
+ if (filter->get("kdenlive_ix") != 0) {
+ sourceService.detach(*filter);
+ destService.attach(*filter);
+ } else ct++;
+ filter = sourceService.filter(ct);
+ }
+}
+
int Render::mltChangeClipSpeed(ItemInfo info, double speed, double oldspeed, Mlt::Producer *prod)
{
m_isBlocked = true;
delete clip;
return -1;
}
- delete clip;
+
QString serv = clipparent.get("mlt_service");
QString id = clipparent.get("id");
//kDebug() << "CLIP SERVICE: " << serv;
GenTime maxLength = GenTime(blankEnd, m_fps) - info.startPos;
cut = slowprod->cut((int)(info.cropStart.frames(m_fps) / speed), (int)(info.cropStart.frames(m_fps) / speed + maxLength.frames(m_fps) - 1));
} else cut = slowprod->cut((int)(info.cropStart.frames(m_fps) / speed), (int)((info.cropStart.frames(m_fps) + clipLength) / speed - 1));
+
+ // move all effects to the correct producer
+ mltPasteEffects(clip, cut);
+
trackPlaylist.insert_at(startPos, *cut, 1);
clipIndex = trackPlaylist.get_clip_index_at(startPos);
newLength = trackPlaylist.clip_length(clipIndex);
GenTime maxLength = GenTime(blankEnd, m_fps) - info.startPos;
cut = prod->cut((int)(info.cropStart.frames(m_fps)), (int)(info.cropStart.frames(m_fps) + maxLength.frames(m_fps) - 1));
} else cut = prod->cut((int)(info.cropStart.frames(m_fps)), (int)((info.cropStart + newDuration).frames(m_fps)) - 1);
+
+ // move all effects to the correct producer
+ mltPasteEffects(clip, cut);
+
trackPlaylist.insert_at(startPos, *cut, 1);
clipIndex = trackPlaylist.get_clip_index_at(startPos);
newLength = trackPlaylist.clip_length(clipIndex);
cut = slowprod->cut((int)(info.cropStart.frames(m_fps) / speed), (int)(info.cropStart.frames(m_fps) / speed + maxLength.frames(m_fps) - 1));
} else cut = slowprod->cut((int)(info.cropStart.frames(m_fps) / speed), (int)((info.cropStart / speed + newDuration).frames(m_fps) - 1));
+ // move all effects to the correct producer
+ mltPasteEffects(clip, cut);
+
trackPlaylist.insert_at(startPos, *cut, 1);
clipIndex = trackPlaylist.get_clip_index_at(startPos);
newLength = trackPlaylist.clip_length(clipIndex);
mlt_service_unlock(service.get_service());
}
+
+ delete clip;
if (clipIndex + 1 == trackPlaylist.count()) mltCheckLength();
m_isBlocked = false;
return newLength;
Mlt::Producer *clip = prod->cut(clipProducer.get_in(), clipProducer.get_out());
// move all effects to the correct producer
- Mlt::Service clipService(clipProducer.get_service());
- Mlt::Service newClipService(clip->get_service());
-
- int ct = 0;
- Mlt::Filter *filter = clipService.filter(ct);
- while (filter) {
- if (filter->get("kdenlive_ix") != 0) {
- clipService.detach(*filter);
- newClipService.attach(*filter);
- } else ct++;
- filter = clipService.filter(ct);
- }
+ mltPasteEffects(&clipProducer, clip);
trackPlaylist.insert_at(pos, clip, 1);
mlt_service_unlock(m_mltConsumer->get_service());
mlt_service_lock(service.get_service());
Mlt::Producer trackProducer(tractor.track(startTrack));
Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
- int clipIndex = trackPlaylist.get_clip_index_at(moveStart + 1);
+ int clipIndex = trackPlaylist.get_clip_index_at(moveStart);
kDebug() << "////// LOOKING FOR CLIP TO MOVE, INDEX: " << clipIndex;
bool checkLength = false;
if (endTrack == startTrack) {
}
// move all effects to the correct producer
- Mlt::Service clipService(clipProducer.get_service());
- Mlt::Service newClipService(clip->get_service());
-
- int ct = 0;
- Mlt::Filter *filter = clipService.filter(ct);
- while (filter) {
- if (filter->get("kdenlive_ix") != 0) {
- clipService.detach(*filter);
- newClipService.attach(*filter);
- } else ct++;
- filter = clipService.filter(ct);
- }
+ mltPasteEffects(&clipProducer, clip);
int newIndex = destTrackPlaylist.insert_at(moveEnd, clip, 1);
destTrackPlaylist.consolidate_blanks(0);
{
QDomNodeList attribs = xml.elementsByTagName("parameter");
QMap<QString, QString> map;
- for (int i = 0;i < attribs.count();i++) {
+ for (int i = 0; i < attribs.count(); i++) {
QDomElement e = attribs.item(i).toElement();
QString name = e.attribute("name");
//kDebug()<<"-- TRANSITION PARAM: "<<name<<" = "<< e.attribute("name")<<" / " << e.attribute("value");
if (values.size() > 0)
txtNeu << (int)values[0].toDouble();
int i = 0;
- for (i = 0;i < separators.size() && i + 1 < values.size();i++) {
+ for (i = 0; i < separators.size() && i + 1 < values.size(); i++) {
txtNeu << separators[i];
txtNeu << (int)(values[i+1].toDouble());
}
QList <Mlt::Producer *> Render::producersList()
{
QList <Mlt::Producer *> prods;
+ if (m_mltProducer == NULL) return prods;
Mlt::Service service(m_mltProducer->parent().get_service());
if (service.type() != tractor_type) return prods;
Mlt::Tractor tractor(service);
void Render::fillSlowMotionProducers()
{
+ if (m_mltProducer == NULL) return;
Mlt::Service service(m_mltProducer->parent().get_service());
if (service.type() != tractor_type) return;