-void KdenliveDoc::convertDocument(double version) {
- // Opening a old Kdenlive document
- QDomNode westley = m_document.elementsByTagName("westley").at(1);
- QDomNode tractor = m_document.elementsByTagName("tractor").at(0);
- QDomNode kdenlivedoc = m_document.elementsByTagName("kdenlivedoc").at(0);
- QDomNode multitrack = m_document.elementsByTagName("multitrack").at(0);
- QDomNodeList playlists = m_document.elementsByTagName("playlist");
-
- QDomNode props = m_document.elementsByTagName("properties").at(0).toElement();
- QString profile = props.toElement().attribute("videoprofile");
- if (profile == "dv_wide") profile = "dv_pal_wide";
- if (!profile.isEmpty()) {
- setProfilePath(profile);
- } else setProfilePath("dv_pal");
-
- // move playlists outside of tractor and add the tracks instead
- int max = playlists.count();
- for (int i = 0; i < max; i++) {
- QDomNode n = playlists.at(i);
- westley.insertBefore(n, QDomNode());
- QDomElement pl = n.toElement();
- QDomElement track = m_document.createElement("track");
- QString trackType = pl.attribute("hide");
- if (!trackType.isEmpty()) track.setAttribute("hide", trackType);
- QString playlist_id = pl.attribute("id");
- if (playlist_id.isEmpty()) {
- playlist_id = "black_track";
- pl.setAttribute("id", playlist_id);
- }
- track.setAttribute("producer", playlist_id);
+int KdenliveDoc::setSceneList()
+{
+ m_render->resetProfile(KdenliveSettings::current_profile());
+ if (m_render->setSceneList(m_document.toString(), m_documentProperties.value("position").toInt()) == -1) {
+ // INVALID MLT Consumer, something is wrong
+ return -1;
+ }
+ m_documentProperties.remove("position");
+ // m_document xml is now useless, clear it
+ m_document.clear();
+ return 0;
+}
+
+QDomDocument KdenliveDoc::createEmptyDocument(int videotracks, int audiotracks)
+{
+ TrackInfo videoTrack;
+ videoTrack.type = VIDEOTRACK;
+ videoTrack.isMute = false;
+ videoTrack.isBlind = false;
+ videoTrack.isLocked = false;
+
+ TrackInfo audioTrack;
+ audioTrack.type = AUDIOTRACK;
+ audioTrack.isMute = false;
+ audioTrack.isBlind = true;
+ audioTrack.isLocked = false;
+
+ m_tracksList.clear();
+
+ for (int i = 0; i < audiotracks; i++) {
+ m_tracksList.append(audioTrack);
+ }
+ for (int i = 0; i < videotracks; i++) {
+ m_tracksList.append(videoTrack);
+ }
+ return createEmptyDocument(m_tracksList);
+}
+
+QDomDocument KdenliveDoc::createEmptyDocument(QList <TrackInfo> tracks)
+{
+ // Creating new document
+ QDomDocument doc;
+ QDomElement mlt = doc.createElement("mlt");
+ doc.appendChild(mlt);
+
+
+ // Create black producer
+ // For some unknown reason, we have to build the black producer here and not in renderer.cpp, otherwise
+ // the composite transitions with the black track are corrupted.
+ QDomElement blk = doc.createElement("producer");
+ blk.setAttribute("in", 0);
+ blk.setAttribute("out", 500);
+ blk.setAttribute("id", "black");
+
+ QDomElement property = doc.createElement("property");
+ property.setAttribute("name", "mlt_type");
+ QDomText value = doc.createTextNode("producer");
+ property.appendChild(value);
+ blk.appendChild(property);
+
+ property = doc.createElement("property");
+ property.setAttribute("name", "aspect_ratio");
+ value = doc.createTextNode(QString::number(0.0));
+ property.appendChild(value);
+ blk.appendChild(property);
+
+ property = doc.createElement("property");
+ property.setAttribute("name", "length");
+ value = doc.createTextNode(QString::number(15000));
+ property.appendChild(value);
+ blk.appendChild(property);
+
+ property = doc.createElement("property");
+ property.setAttribute("name", "eof");
+ value = doc.createTextNode("pause");
+ property.appendChild(value);
+ blk.appendChild(property);
+
+ property = doc.createElement("property");
+ property.setAttribute("name", "resource");
+ value = doc.createTextNode("black");
+ property.appendChild(value);
+ blk.appendChild(property);
+
+ property = doc.createElement("property");
+ property.setAttribute("name", "mlt_service");
+ value = doc.createTextNode("colour");
+ property.appendChild(value);
+ blk.appendChild(property);
+
+ mlt.appendChild(blk);
+
+
+ QDomElement tractor = doc.createElement("tractor");
+ tractor.setAttribute("id", "maintractor");
+ QDomElement multitrack = doc.createElement("multitrack");
+ QDomElement playlist = doc.createElement("playlist");
+ playlist.setAttribute("id", "black_track");
+ mlt.appendChild(playlist);
+
+ QDomElement blank0 = doc.createElement("entry");
+ blank0.setAttribute("in", "0");
+ blank0.setAttribute("out", "0");
+ blank0.setAttribute("producer", "black");
+ playlist.appendChild(blank0);
+
+ // create playlists
+ int total = tracks.count() + 1;
+
+ for (int i = 1; i < total; i++) {
+ QDomElement playlist = doc.createElement("playlist");
+ playlist.setAttribute("id", "playlist" + QString::number(i));
+ mlt.appendChild(playlist);
+ }
+
+ QDomElement track0 = doc.createElement("track");
+ track0.setAttribute("producer", "black_track");
+ tractor.appendChild(track0);
+
+ // create audio tracks
+ for (int i = 1; i < total; i++) {
+ QDomElement track = doc.createElement("track");
+ track.setAttribute("producer", "playlist" + QString::number(i));
+ if (tracks.at(i - 1).type == AUDIOTRACK)
+ track.setAttribute("hide", "video");
+ else if (tracks.at(i - 1).isBlind)
+ track.setAttribute("hide", "video");
+ if (tracks.at(i - 1).isMute)
+ track.setAttribute("hide", "audio");