return pix;
}
*/
-const int Render::renderWidth() const {
+int Render::renderWidth() const {
return (int)(m_mltProfile->height() * m_mltProfile->dar());
}
-const int Render::renderHeight() const {
+int Render::renderHeight() const {
return m_mltProfile->height();
}
return true;
}
-const double Render::dar() const {
+double Render::dar() const {
return m_mltProfile->dar();
}
}
void Render::getFileProperties(const QDomElement &xml, const QString &clipId, bool replaceProducer) {
- int height = 50;
- int width = (int)(height * m_mltProfile->dar());
- QMap < QString, QString > filePropertyMap;
- QMap < QString, QString > metadataPropertyMap;
-
KUrl url = KUrl(xml.attribute("resource", QString()));
Mlt::Producer *producer = NULL;
if (xml.attribute("type").toInt() == TEXT && !QFile::exists(url.path())) {
- emit replyGetFileProperties(clipId, producer, filePropertyMap, metadataPropertyMap, replaceProducer);
+ emit replyGetFileProperties(clipId, producer, QMap < QString, QString >(), QMap < QString, QString >(), replaceProducer);
return;
}
if (xml.attribute("type").toInt() == COLOR) {
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);
+ char *tmp = decodedString(url.path());
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 (producer == NULL || producer->is_blank() || !producer->is_valid()) {
return;
}
+ 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());
char *tmp = decodedString(clipId);
producer->set("id", tmp);
delete[] tmp;
+
+ int height = 50;
+ int width = (int)(height * m_mltProfile->dar());
+ QMap < QString, QString > filePropertyMap;
+ QMap < QString, QString > metadataPropertyMap;
+
int frameNumber = xml.attribute("thumbnail", "0").toInt();
if (frameNumber != 0) producer->seek(frameNumber);
westleyConsumer.start();
}
-const double Render::fps() const {
+double Render::fps() const {
return m_fps;
}
double blackDuration = Mlt::Producer(blackTrackPlaylist.get_producer()).get_playtime() - 1;
if (blackDuration != duration) {
- blackTrackPlaylist.remove_region(0, (int)blackDuration);
- int i = 0;
+ blackTrackPlaylist.clear();
int dur = (int)duration;
- QDomDocument doc;
- QDomElement black = doc.createElement("producer");
- black.setAttribute("mlt_service", "colour");
- black.setAttribute("colour", "black");
- black.setAttribute("id", "black");
- ItemInfo info;
- info.track = 0;
while (dur > 14000) {
- info.startPos = GenTime(i * 14000, m_fps);
- info.endPos = info.startPos + GenTime(13999, m_fps);
- mltInsertClip(info, black, m_blackClip);
+ blackTrackPlaylist.append(*m_blackClip, 0, 13999);
dur = dur - 14000;
- i++;
}
if (dur > 0) {
- info.startPos = GenTime(i * 14000, m_fps);
- info.endPos = info.startPos + GenTime(dur, m_fps);
- mltInsertClip(info, black, m_blackClip);
+ blackTrackPlaylist.append(*m_blackClip, 0, dur);
}
m_mltProducer->set("out", duration);
emit durationChanged((int)duration);
QString id = nprod->get("id");
if (id.startsWith("slowmotion:")) {
// this is a slowmotion producer, add it to the list
- QString url = QString::fromUtf8(nprod->get("resource"));
+ QString url = QString::fromUtf8(nprod->get("resource"));
if (!m_slowmotionProducers.contains(url)) {
m_slowmotionProducers.insert(url, nprod);
}