]> git.sesse.net Git - kdenlive/blobdiff - src/renderer.cpp
cppcheck fixes, patch by Mikko Rapeli [23/27]
[kdenlive] / src / renderer.cpp
index 19c836e960f8319548605f91f94d9dd5613f8cf5..1b8d03247e0a166f2bd15a8f008aaa052812c81a 100644 (file)
@@ -51,6 +51,7 @@
 
 static void kdenlive_callback(void* /*ptr*/, int level, const char* fmt, va_list vl)
 {
+//     kDebug() << "log level" << level << QString().vsprintf(fmt, vl).simplified();
     if (level > MLT_LOG_ERROR) return;
     QString error;
     QApplication::postEvent(qApp->activeWindow(), new MltErrorEvent(error.vsprintf(fmt, vl).simplified()));
@@ -176,7 +177,7 @@ void Render::slotSwitchFullscreen()
     if (m_mltConsumer) m_mltConsumer->set("full_screen", 1);
 }
 
-void Render::buildConsumer(const QString profileName)
+void Render::buildConsumer(const QString &profileName)
 {
     delete m_blackClip;
     m_blackClip = NULL;
@@ -291,7 +292,7 @@ Mlt::Producer *Render::invalidProducer(const QString &id)
     return clip;
 }
 
-int Render::resetProfile(const QString profileName, bool dropSceneList)
+int Render::resetProfile(const QString &profileName, bool dropSceneList)
 {
     QString scene;
     if (!dropSceneList) scene = sceneList();
@@ -553,7 +554,7 @@ void Render::slotSplitView(bool doit)
     }
 }
 
-void Render::getFileProperties(const QDomElement xml, const QString &clipId, int imageHeight, bool replaceProducer, bool selectClip)
+void Render::getFileProperties(const QDomElement &xml, const QString &clipId, int imageHeight, bool replaceProducer, bool selectClip)
 {
     QString path;
     QLocale locale;
@@ -1051,11 +1052,9 @@ int Render::setSceneList(QString playlist, int position)
     }
 
     blockSignals(true);
-    // WARNING: disabled because it caused crashes (see Kdenlive bug #2205 and #2206) - jbm
-    /*if (KdenliveSettings::projectloading_avformatnovalidate())
-        playlist.replace(">avformat</property>", ">avformat-novalidate</property>");
-    else
-        playlist.replace(">avformat-novalidate</property>", ">avformat</property>");*/
+
+    m_locale = QLocale();
+
     m_mltProducer = new Mlt::Producer(*m_mltProfile, "xml-string", playlist.toUtf8().constData());
     if (!m_mltProducer || !m_mltProducer->is_valid()) {
         kDebug() << " WARNING - - - - -INVALID PLAYLIST: " << playlist.toUtf8().constData();
@@ -1474,13 +1473,13 @@ const QString & Render::rendererName() const
 
 void Render::emitFrameUpdated(Mlt::Frame& frame)
 {
-    mlt_image_format format = mlt_image_rgb24a;
+    mlt_image_format format = mlt_image_rgb24;
     int width = 0;
     int height = 0;
     const uchar* image = frame.get_image(format, width, height);
-    QImage qimage(width, height, QImage::Format_ARGB32);
-    memcpy(qimage.bits(), image, width * height * 4);
-    emit frameUpdated(qimage.rgbSwapped());
+    QImage qimage(width, height, QImage::Format_RGB888);
+    memcpy(qimage.bits(), image, width * height * 3);
+    emit frameUpdated(qimage);
 }
 
 void Render::emitFrameNumber(double position)
@@ -1905,7 +1904,7 @@ bool Render::mltRemoveClip(int track, GenTime position)
     return true;
 }
 
-int Render::mltGetSpaceLength(const GenTime pos, int track, bool fromBlankStart)
+int Render::mltGetSpaceLength(const GenTime &pos, int track, bool fromBlankStart)
 {
     if (!m_mltProducer) {
         kDebug() << "PLAYLIST NOT INITIALISED //////";
@@ -1952,7 +1951,7 @@ int Render::mltTrackDuration(int track)
     return trackProducer.get_playtime() - 1;
 }
 
-void Render::mltInsertSpace(QMap <int, int> trackClipStartList, QMap <int, int> trackTransitionStartList, int track, const GenTime duration, const GenTime timeOffset)
+void Render::mltInsertSpace(QMap <int, int> trackClipStartList, QMap <int, int> trackTransitionStartList, int track, const GenTime &duration, const GenTime &timeOffset)
 {
     if (!m_mltProducer) {
         kDebug() << "PLAYLIST NOT INITIALISED //////";
@@ -2119,7 +2118,7 @@ int Render::mltChangeClipSpeed(ItemInfo info, ItemInfo speedIndependantInfo, dou
         kWarning() << "// TRACTOR PROBLEM";
         return -1;
     }
-    
+
     //kDebug() << "Changing clip speed, set in and out: " << info.cropStart.frames(m_fps) << " to " << (info.endPos - info.startPos).frames(m_fps) - 1;
     Mlt::Tractor tractor(service);
     Mlt::Producer trackProducer(tractor.track(info.track));