+ KUrl url = KUrl(xml.attribute("resource", QString::null));
+ Mlt::Producer *producer = NULL;
+ if (xml.attribute("type").toInt() == TEXT && !QFile::exists(url.path())) {
+ emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap);
+ return;
+ }
+ if (xml.attribute("type").toInt() == COLOR) {
+ char *tmp = decodedString("colour:" + xml.attribute("colour"));
+ producer = new Mlt::Producer(*m_mltProfile, "fezzik", tmp);
+ delete[] tmp;
+ } else if (url.isEmpty()) {
+ QDomDocument doc;
+ QDomElement westley = doc.createElement("westley");
+ QDomElement play = doc.createElement("playlist");
+ doc.appendChild(westley);
+ westley.appendChild(play);
+ play.appendChild(doc.importNode(xml, true));
+ char *tmp = decodedString(doc.toString());
+ producer = new Mlt::Producer(*m_mltProfile, "westley-xml", tmp);
+ delete[] tmp;
+ } else {
+ QString urlpath = url.path();
+ /*if (urlpath.contains(':')) {
+ if (!urlpath.startsWith("file:")) urlpath.prepend("file:");
+ char *tmp = decodedString(urlpath);
+ producer = new Mlt::Producer(*m_mltProfile, "avformat", tmp);
+ delete[] tmp;
+ }
+ else {*/
+ char *tmp = decodedString(urlpath);
+ producer = new Mlt::Producer(*m_mltProfile, tmp);
+ delete[] tmp;
+
+ if (xml.hasAttribute("force_aspect_ratio")) {
+ double aspect = xml.attribute("force_aspect_ratio").toDouble();
+ if (aspect > 0) producer->set("force_aspect_ratio", aspect);
+ }
+ if (xml.hasAttribute("threads")) {
+ int threads = xml.attribute("threads").toInt();
+ if (threads != 1) producer->set("threads", threads);
+ }
+ if (xml.hasAttribute("video_index")) {
+ int vindex = xml.attribute("video_index").toInt();
+ if (vindex != 0) producer->set("video_index", vindex);
+ }
+ if (xml.hasAttribute("audio_index")) {
+ int aindex = xml.attribute("audio_index").toInt();
+ if (aindex != 0) producer->set("audio_index", aindex);
+ }
+ //}
+ }
+ if (xml.hasAttribute("out")) producer->set_in_and_out(xml.attribute("in").toInt(), xml.attribute("out").toInt());
+
+ if (producer->is_blank()) {
+ kDebug() << " / / / / / / / /ERRROR / / / / // CANNOT LOAD PRODUCER: ";
+ emit removeInvalidClip(clipId);
+ return;
+ }
+ char *tmp = decodedString(clipId);
+ producer->set("id", tmp);
+ delete[] tmp;
+ int frameNumber = xml.attribute("thumbnail", "0").toInt();
+ if (frameNumber != 0) producer->seek(frameNumber);
+ mlt_properties properties = MLT_PRODUCER_PROPERTIES(producer->get_producer());
+
+ filePropertyMap["duration"] = QString::number(producer->get_playtime());
+ //kDebug() << "/////// PRODUCER: " << url.path() << " IS: " << producer.get_playtime();
+
+ Mlt::Frame *frame = producer->get_frame();
+
+ if (xml.attribute("type").toInt() == SLIDESHOW) {
+ if (xml.hasAttribute("ttl")) producer->set("ttl", xml.attribute("ttl").toInt());
+ if (xml.attribute("fade") == "1") {
+ // user wants a fade effect to slideshow
+ Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, "luma");
+ if (xml.hasAttribute("ttl")) filter->set("period", xml.attribute("ttl").toInt() - 1);
+ if (xml.hasAttribute("luma_duration") && !xml.attribute("luma_duration").isEmpty()) filter->set("luma.out", xml.attribute("luma_duration").toInt());
+ if (xml.hasAttribute("luma_file") && !xml.attribute("luma_file").isEmpty()) {
+ char *tmp = decodedString(xml.attribute("luma_file"));
+ filter->set("luma.resource", tmp);
+ delete[] tmp;
+ if (xml.hasAttribute("softness")) {
+ int soft = xml.attribute("softness").toInt();
+ filter->set("luma.softness", (double) soft / 100.0);
+ }
+ }
+ Mlt::Service clipService(producer->get_service());
+ clipService.attach(*filter);
+ }
+ }
+