m_doc->setThumbsProgress(url, progress);
}
+QList <DocClipBase*> ClipManager::documentClipList() {
+ return m_clipList;
+}
void ClipManager::addClip(DocClipBase *clip) {
m_clipList.append(clip);
void slotDeleteClip(uint clipId);
void setThumbsProgress(KUrl url, int progress);
void checkAudioThumbs();
+ QList <DocClipBase*> documentClipList();
private: // Private attributes
/** the list of clips in the document */
doc.appendChild(tractor);
}
+ m_scenelist = m_document.toString();
if (m_fps == 30000.0 / 1001.0) m_timecode.setFormat(30, true);
else m_timecode.setFormat((int) m_fps);
}
void KdenliveDoc::setRenderer(Render *render) {
m_render = render;
- if (m_render) m_render->setSceneList(m_document);
+ if (m_render) m_render->setSceneList(m_scenelist);
}
Render *KdenliveDoc::renderer() {
return m_document.elementsByTagName("producer");
}
-void KdenliveDoc::setProducers(QDomElement doc) {
- QDomNode kdenlivedocument = m_document.elementsByTagName("kdenlivedoc").item(0);
-
- QDomNodeList list = m_document.elementsByTagName("producer");
- int ct = list.count();
- kDebug() << "DELETING CHILD PRODUCERS: " << ct;
- for (int i = ct; i > 0; i--) {
- kdenlivedocument.removeChild(list.item(i));
- }
-
- QDomNode n = doc.firstChild();
- ct = 0;
- while (!n.isNull()) {
- QDomElement e = n.toElement(); // try to convert the node to an element.
- if (!e.isNull() && e.tagName() == "producer") {
- kdenlivedocument.appendChild(m_document.importNode(e, true));
- ct++;
- }
- n = n.nextSibling();
- }
- kDebug() << "ADDING CHILD PRODS: " << ct << "\n";
- //kDebug()<<m_document.toString();
+void KdenliveDoc::backupMltPlaylist() {
+ if (m_render) m_scenelist = m_render->sceneList();
}
double KdenliveDoc::fps() {
int width();
int height();
KUrl url();
- void setProducers(QDomElement doc);
+ void backupMltPlaylist();
Timecode timecode();
QDomDocument toXml();
void setRenderer(Render *render);
QDomDocument generateSceneList();
ClipManager *m_clipManager;
MltVideoProfile m_profile;
+ QString m_scenelist;
public slots:
if (KdenliveSettings::normaliseaudiothumbs()) {
- Mlt::Filter m_convert(prof,"volume");
- m_convert.set("gain", "normalise");
- m_producer.attach(m_convert);
+ Mlt::Filter m_convert(prof, "volume");
+ m_convert.set("gain", "normalise");
+ m_producer.attach(m_convert);
}
//QApplication::postEvent(m_parent, new ProgressEvent(-1, (QEvent::Type)10005));
MainWindow::MainWindow(QWidget *parent)
: KXmlGuiWindow(parent),
- fileName(QString()), m_activeDocument(NULL), m_commandStack(NULL) {
+ fileName(QString()), m_activeDocument(NULL), m_activeTimeline(NULL), m_commandStack(NULL) {
parseProfiles();
m_timelineArea = new KTabWidget(this);
m_timelineArea->setHoverCloseButton(true);
kDebug() << "/////////////////// CONNECTING DOC TO PROJECT VIEW ////////////////";
if (m_activeDocument) {
if (m_activeDocument == doc) return;
- m_activeDocument->setProducers(m_projectList->producersList());
+ m_activeDocument->backupMltPlaylist();
+ if (m_activeTimeline) {
+ disconnect(m_projectMonitor, SIGNAL(renderPosition(int)), m_activeTimeline, SLOT(moveCursorPos(int)));
+ disconnect(m_projectMonitor, SIGNAL(durationChanged(int)), m_activeTimeline->projectView(), SLOT(setDuration(int)));
+ disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *)), m_projectList, SLOT(slotAddClip(DocClipBase *)));
+ disconnect(m_activeDocument, SIGNAL(signalDeleteProjectClip(int)), m_projectList, SLOT(slotDeleteClip(int)));
+ disconnect(m_activeDocument, SIGNAL(updateClipDisplay(int)), m_projectList, SLOT(slotUpdateClip(int)));
+ disconnect(m_activeDocument, SIGNAL(deletTimelineClip(int)), m_activeTimeline, SLOT(slotDeleteClip(int)));
+ disconnect(m_activeDocument, SIGNAL(thumbsProgress(KUrl, int)), this, SLOT(slotGotProgressInfo(KUrl, int)));
+ disconnect(m_activeTimeline, SIGNAL(clipItemSelected(ClipItem*)), effectStack, SLOT(slotClipItemSelected(ClipItem*)));
+ disconnect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement)));
+ disconnect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
+ disconnect(effectStack, SIGNAL(changeEffectState(ClipItem*, QDomElement, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, QDomElement, bool)));
+ disconnect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
+ }
m_activeDocument->setRenderer(NULL);
}
+ m_monitorManager->resetProfiles(doc->profilePath());
+ m_projectList->setDocument(doc);
+
connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
connect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
connect(effectStack, SIGNAL(changeEffectState(ClipItem*, QDomElement, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, QDomElement, bool)));
connect(effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
+ m_activeTimeline = trackView;
- m_projectList->setDocument(doc);
m_monitorManager->setTimecode(doc->timecode());
- m_monitorManager->resetProfiles(doc->profilePath());
doc->setRenderer(m_projectMonitor->render);
//m_undoView->setStack(0);
m_commandStack = doc->commandStack();
void setupActions();
QString fileName;
KdenliveDoc *m_activeDocument;
+ TrackView *m_activeTimeline;
MonitorManager *m_monitorManager;
QDockWidget *projectListDock;
//delete dia;
}
void ProjectList::setDocument(KdenliveDoc *doc) {
+ listView->clear();
+ QList <DocClipBase*> list = doc->clipManager()->documentClipList();
+ for (int i = 0; i < list.count(); i++) {
+ slotAddClip(list.at(i));
+ }
+
m_fps = doc->fps();
m_timecode = doc->timecode();
m_commandStack = doc->commandStack();
m_doc = doc;
- QDomNodeList prods = doc->producersList();
- int ct = prods.count();
- kDebug() << "//////////// SETTING DOC, FOUND CLIPS: " << prods.count();
- listView->clear();
- for (int i = 0; i < ct ; i++) {
- QDomElement e = prods.item(i).toElement();
- kDebug() << "// IMPORT: " << i << ", :" << e.attribute("id", "non") << ", NAME: " << e.attribute("name", "non");
- if (!e.isNull()) addProducer(e);
- }
+ /* QDomNodeList prods = doc->producersList();
+ int ct = prods.count();
+ kDebug() << "//////////// SETTING DOC, FOUND CLIPS: " << prods.count();
+ listView->clear();
+ for (int i = 0; i < ct ; i++) {
+ QDomElement e = prods.item(i).toElement();
+ kDebug() << "// IMPORT: " << i << ", :" << e.attribute("id", "non") << ", NAME: " << e.attribute("name", "non");
+ if (!e.isNull()) addProducer(e);
+ }*/
QTreeWidgetItem *first = listView->topLevelItem(0);
if (first) listView->setCurrentItem(first);
m_toolbar->setEnabled(true);
#include <KStandardDirs>
#include <KMessageBox>
#include <KLocale>
+#include <KTemporaryFile>
#include "renderer.h"
#include "kdenlivesettings.h"
}
}
-Render::Render(const QString & rendererName, int winid, int extid, QWidget *parent): QObject(parent), m_name(rendererName), m_mltConsumer(NULL), m_mltProducer(NULL), m_mltTextProducer(NULL), m_sceneList(QDomDocument()), m_winid(-1), m_framePosition(0), m_generateScenelist(false), m_isBlocked(true) {
- kDebug() << "////////// USING PROFILE: " << qstrdup(KdenliveSettings::current_profile().toUtf8());
- m_mltProfile = new Mlt::Profile((char*) qstrdup(KdenliveSettings::current_profile().toUtf8()));
+Render::Render(const QString & rendererName, int winid, int extid, QWidget *parent): QObject(parent), m_name(rendererName), m_mltConsumer(NULL), m_mltProducer(NULL), m_mltTextProducer(NULL), m_winid(-1), m_framePosition(0), m_generateScenelist(false), m_isBlocked(true) {
+ kDebug() << "////////// USING PROFILE: " << (char *)KdenliveSettings::current_profile().toUtf8().data();
+ m_mltProfile = new Mlt::Profile((char*) KdenliveSettings::current_profile().data());
refreshTimer = new QTimer(this);
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
if (!m_mltConsumer) return 0;
if (!m_mltConsumer->is_stopped()) m_mltConsumer->stop();
m_mltConsumer->set("refresh", 0);
+ m_mltConsumer->purge();
//TODO: we should also rebuild filters and delete existing m_mltProfile
- m_mltProfile = new Mlt::Profile((char*) qstrdup(profile.toUtf8()));
- kDebug() << " + + RESET CONSUMER WITH PROFILE: " << profile;
- mlt_properties properties = MLT_CONSUMER_PROPERTIES(m_mltConsumer->get_consumer());
- mlt_properties_set_data(properties, "profile", m_mltProfile->get_profile(), 0, 0, NULL);
+
+ //delete m_mltProfile;
+ //m_mltProfile = new Mlt::Profile("pal_dv");//(char*) qstrdup(profile.toUtf8()));
+ kDebug() << " ++++++++++ RESET CONSUMER WITH PROFILE: " << m_mltProfile->width();
+ // mlt_properties properties = MLT_CONSUMER_PROPERTIES(m_mltConsumer->get_consumer());
+ //mlt_profile prof = m_mltProfile->get_profile();
+ //mlt_properties_set_data(properties, "_profile", prof, 0, (mlt_destructor)mlt_profile_close, NULL);
+ //mlt_properties_set(properties, "profile", "hdv_1080_50i");
+ m_mltConsumer->set("profile", (char *) profile.data());
//apply_profile_properties( m_mltProfile, m_mltConsumer->get_consumer(), properties );
- refresh();
+ //refresh();
return 1;
}
char *t = new char[fn.length() + 1];
strcpy(t, (const char *)fn);*/
- return qstrdup(str.toUtf8().data()); //toLatin1
+ return (char *) qstrdup(str.toUtf8().data()); //toLatin1
}
//static
if (frame) delete frame;
}
-QDomDocument Render::sceneList() const {
- return m_sceneList;
-}
-
/** Create the producer from the Westley QDomDocument */
void Render::initSceneList() {
kDebug() << "-------- INIT SCENE LIST ------_";
setSceneList(doc, 0);
}
-
/** Create the producer from the Westley QDomDocument */
void Render::setSceneList(QDomDocument list, int position) {
+ setSceneList(list.toString(), position);
+}
+
+/** Create the producer from the Westley QDomDocument */
+void Render::setSceneList(QString playlist, int position) {
if (m_winid == -1) return;
m_generateScenelist = true;
- kWarning() << "////// RENDER, SET SCENE LIST";
+ kWarning() << "////// RENDER, SET SCENE LIST: " << playlist;
/*
if (m_mltProducer) {
m_mltProducer->set_speed(0.0);
-
//if (KdenliveSettings::osdtimecode() && m_osdInfo) m_mltProducer->detach(*m_osdInfo);
delete m_mltProducer;
emit stopped();
}
- char *tmp = decodedString(list.toString());
- //Mlt::Producer clip(profile, "westley-xml", tmp);
-
+ char *tmp = decodedString(playlist);
m_mltProducer = new Mlt::Producer(*m_mltProfile, "westley-xml", tmp);
delete[] tmp;
//m_mltProducer->optimise();
}
+/** Create the producer from the Westley QDomDocument */
+QString Render::sceneList() {
+ if (m_winid == -1) return QString();
+ KTemporaryFile temp;
+ QString result;
+
+ if (temp.open()) {
+ QString path = temp.fileName();
+ char *tmppath = decodedString("westley:" + path);
+ Mlt::Consumer westleyConsumer(*m_mltProfile , tmppath);
+ delete[] tmppath;
+ westleyConsumer.set("terminate_on_pause", 1);
+ Mlt::Producer prod(m_mltProducer->get_producer());
+ westleyConsumer.connect(prod);
+ westleyConsumer.start();
+
+ QFile file(path);
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
+ return QString();
+
+ QTextStream in(&file);
+ while (!in.atEnd()) {
+ result.append(in.readLine());
+ }
+ }
+ return result;
+}
+
+
const double Render::fps() const {
return m_fps;
}
/** Wraps the VEML command of the same name. Sets the current scene list to
be list. */
void setSceneList(QDomDocument list, int position = 0);
+ void setSceneList(QString playlist, int position = 0);
+ QString sceneList();
/** Wraps the VEML command of the same name. Tells the renderer to
play the current scene at the speed specified, relative to normal
/** Turn on or off on screen display */
void refreshDisplay();
- /** returns the current scenelist */
- QDomDocument sceneList() const;
int resetProfile(QString profile);
const double fps() const;
KUrl m_exportedFile;
int exportDuration, firstExportFrame, lastExportFrame;
- /** Holds the scenelist to be sent, if pending. */
- QDomDocument m_sceneList;
-
/** A human-readable description of this renderer. */
QString m_description;
int m_winid;