]> git.sesse.net Git - kdenlive/blobdiff - src/renderer.cpp
const modifiers are useless on integral return types [PATCH by Ray Lehtiniemi]
[kdenlive] / src / renderer.cpp
index 0f8f9312af1ceb65ccc3e029703416ef6b624891..79d24c2c8c87e0450a9033265e1fe2fa3c225c7b 100644 (file)
@@ -236,11 +236,11 @@ char *Render::decodedString(QString str) {
     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();
 }
 
@@ -393,7 +393,7 @@ bool Render::isValid(KUrl url) {
     return true;
 }
 
-const double Render::dar() const {
+double Render::dar() const {
     return m_mltProfile->dar();
 }
 
@@ -463,15 +463,10 @@ void Render::slotSplitView(bool doit) {
 }
 
 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) {
@@ -489,35 +484,9 @@ void Render::getFileProperties(const QDomElement &xml, const QString &clipId, bo
         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()) {
@@ -526,14 +495,36 @@ void Render::getFileProperties(const QDomElement &xml, const QString &clipId, bo
         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);
-    mlt_properties properties = MLT_PRODUCER_PROPERTIES(producer->get_producer());
 
     filePropertyMap["duration"] = QString::number(producer->get_playtime());
     //kDebug() << "///////  PRODUCER: " << url.path() << " IS: " << producer.get_playtime();
@@ -914,7 +905,7 @@ void Render::saveZone(KUrl url, QString desc, QPoint zone) {
     westleyConsumer.start();
 }
 
-const double Render::fps() const {
+double Render::fps() const {
     return m_fps;
 }
 
@@ -941,7 +932,7 @@ void Render::refreshDisplay() {
     if (!m_mltProducer) return;
     //m_mltConsumer->set("refresh", 0);
 
-    mlt_properties properties = MLT_PRODUCER_PROPERTIES(m_mltProducer->get_producer());
+    //mlt_properties properties = MLT_PRODUCER_PROPERTIES(m_mltProducer->get_producer());
     /*if (KdenliveSettings::osdtimecode()) {
         mlt_properties_set_int( properties, "meta.attr.timecode", 1);
         mlt_properties_set( properties, "meta.attr.timecode.markup", "#timecode#");
@@ -1222,8 +1213,8 @@ void Render::exportCurrentFrame(KUrl url, bool notify) {
         return;
     }
 
-    int height = 1080;//KdenliveSettings::defaultheight();
-    int width = 1940; //KdenliveSettings::displaywidth();
+    //int height = 1080;//KdenliveSettings::defaultheight();
+    //int width = 1940; //KdenliveSettings::displaywidth();
     //TODO: rewrite
     QPixmap pix; // = KThumb::getFrame(m_mltProducer, -1, width, height);
     /*
@@ -1276,27 +1267,14 @@ void Render::mltCheckLength() {
     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);
@@ -1577,7 +1555,7 @@ void Render::mltInsertSpace(QMap <int, int> trackClipStartList, QMap <int, int>
             Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
 
 
-            int clipNb = trackPlaylist.count();
+            //int clipNb = trackPlaylist.count();
             insertPos = trackClipStartList.value(trackNb - 1);
             if (insertPos != -1) {
                 insertPos += offset;
@@ -1834,7 +1812,7 @@ bool Render::mltAddEffect(int track, GenTime position, EffectsParameterList para
         char *endtag = decodedString(params.paramValue("endtag", "end"));
         kDebug() << "// ADDING KEYFRAME TAGS: " << starttag << ", " << endtag;
         int duration = clip->get_playtime();
-        double max = params.paramValue("max").toDouble();
+        //double max = params.paramValue("max").toDouble();
         double min = params.paramValue("min").toDouble();
         double factor = params.paramValue("factor", "1").toDouble();
         params.removeParam("starttag");
@@ -2388,7 +2366,6 @@ bool Render::mltMoveTransition(QString type, int startTrack, int newTrack, int n
 
     Mlt::Service service(m_mltProducer->parent().get_service());
     Mlt::Tractor tractor(service);
-    Mlt::Field *field = tractor.field();
 
     mlt_service_lock(service.get_service());
     m_mltConsumer->set("refresh", 0);
@@ -2445,7 +2422,6 @@ void Render::mltUpdateTransitionParams(QString type, int a_track, int b_track, G
     m_isBlocked = true;
     Mlt::Service service(m_mltProducer->parent().get_service());
     Mlt::Tractor tractor(service);
-    Mlt::Field *field = tractor.field();
 
     //m_mltConsumer->set("refresh", 0);
     mlt_service serv = m_mltProducer->parent().get_service();
@@ -2623,7 +2599,6 @@ void Render::mltDeleteTransparency(int pos, int track, int id) {
 void Render::mltResizeTransparency(int oldStart, int newStart, int newEnd, int track, int id) {
     Mlt::Service service(m_mltProducer->parent().get_service());
     Mlt::Tractor tractor(service);
-    Mlt::Field *field = tractor.field();
 
     mlt_service_lock(service.get_service());
     m_mltConsumer->set("refresh", 0);
@@ -2662,7 +2637,6 @@ void Render::mltResizeTransparency(int oldStart, int newStart, int newEnd, int t
 void Render::mltMoveTransparency(int startTime, int endTime, int startTrack, int endTrack, int id) {
     Mlt::Service service(m_mltProducer->parent().get_service());
     Mlt::Tractor tractor(service);
-    Mlt::Field *field = tractor.field();
 
     mlt_service_lock(service.get_service());
     m_mltConsumer->set("refresh", 0);
@@ -2791,7 +2765,7 @@ void Render::fillSlowMotionProducers() {
                 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);
                     }