]> git.sesse.net Git - kdenlive/commitdiff
QString::toStdString() replaced by QString::toLocal8Bit() as KDE4
authorSimon A. Eugster <simon.eu@gmail.com>
Tue, 14 Feb 2012 18:22:32 +0000 (19:22 +0100)
committerSimon A. Eugster <simon.eu@gmail.com>
Tue, 14 Feb 2012 18:22:32 +0000 (19:22 +0100)
disables STL support with QT_NO_STL.

Also, changed delete to delete[].

src/lib/audio/audioCorrelation.cpp
src/lib/audio/audioCorrelation.h
src/lib/audio/audioCorrelationInfo.cpp
src/lib/audio/audioEnvelope.cpp
src/lib/audio/audioInfo.cpp
src/lib/audio/audioStreamInfo.cpp
testingArea/audioOffset.cpp

index 9a807c80c28e7593964a975058ae7703968d798d..0a308c1c8368e1af7bb208aa12a9d54d282e8026 100644 (file)
@@ -22,6 +22,10 @@ AudioCorrelation::AudioCorrelation(AudioEnvelope *mainTrackEnvelope) :
 
 AudioCorrelation::~AudioCorrelation()
 {
+    delete m_mainTrackEnvelope;
+    foreach (AudioEnvelope *envelope, m_children) {
+        delete envelope;
+    }
 }
 
 int AudioCorrelation::addChild(AudioEnvelope *envelope)
index 1f943687c568a74425d8d551b4943e830e407737..d5b04024e118d0291b60f3446715dd1ac79b1752 100644 (file)
@@ -27,10 +27,14 @@ class AudioCorrelationInfo;
 class AudioCorrelation
 {
 public:
+    /// AudioCorrelation will take ownership of mainTrackEnvelope
     AudioCorrelation(AudioEnvelope *mainTrackEnvelope);
     ~AudioCorrelation();
 
-    /// \return The child's index
+    /**
+      This object will take ownership of the passed envelope.
+      \return The child's index
+      */
     int addChild(AudioEnvelope *envelope);
 
     const AudioCorrelationInfo *info(int childIndex) const;
index b43809095bbf8a8476f38ce12225c1b8e8561ccd..97f4a200f434df5f48649bb1941c70f27bc371d7 100644 (file)
@@ -21,7 +21,7 @@ AudioCorrelationInfo::AudioCorrelationInfo(int mainSize, int subSize) :
 
 AudioCorrelationInfo::~AudioCorrelationInfo()
 {
-    delete m_correlationVector;
+    delete[] m_correlationVector;
 }
 
 int AudioCorrelationInfo::size() const
index 5f1bbc5d776239c33d2f3f6e0d882f03d01e010a..3968f6228818d64c3546af47cea2207b62114d18 100644 (file)
@@ -29,7 +29,7 @@ AudioEnvelope::AudioEnvelope(Mlt::Producer *producer) :
 AudioEnvelope::~AudioEnvelope()
 {
     if (m_envelope != NULL) {
-        delete m_envelope;
+        delete[] m_envelope;
     }
     delete m_info;
 }
index f35a8a9f7ecb3f92d1b93bba3490ccaa96dc966b..c467a96aa59d4393d2fff5bb6f55e3adcc85ba2f 100644 (file)
@@ -11,6 +11,7 @@
 #include "audioInfo.h"
 
 #include "audioStreamInfo.h"
+#include <QString>
 #include <iostream>
 #include <cstdlib>
 
@@ -22,9 +23,9 @@ AudioInfo::AudioInfo(Mlt::Producer *producer)
     // Get the number of streams and add the information of each of them if it is an audio stream.
     int streams = atoi(producer->get("meta.media.nb_streams"));
     for (int i = 0; i < streams; i++) {
-        std::string propertyName = QString("meta.media.%1.stream.type").arg(i).toStdString();
+        QByteArray propertyName = QString("meta.media.%1.stream.type").arg(i).toLocal8Bit();
 
-        if (strcmp("audio", producer->get(propertyName.c_str())) == 0) {
+        if (strcmp("audio", producer->get(propertyName.data())) == 0) {
             m_list << new AudioStreamInfo(producer, i);
         }
 
index 0c27822cf23a9ac0a4ddf65374f1abb8999d72f4..c4706527bd4778c788e968f63d21ac71d2cd2583 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "audioStreamInfo.h"
 
+#include <QString>
 #include <iostream>
 #include <cstdlib>
 
@@ -17,25 +18,25 @@ AudioStreamInfo::AudioStreamInfo(Mlt::Producer *producer, int audioStreamIndex)
     m_audioStreamIndex(audioStreamIndex)
 {
 
-    std::string key;
+    QByteArray key;
 
-    key = QString("meta.media.%1.codec.sample_fmt").arg(audioStreamIndex).toStdString();
-    m_samplingFormat = QString(producer->get(key.c_str()));
+    key = QString("meta.media.%1.codec.sample_fmt").arg(audioStreamIndex).toLocal8Bit();
+    m_samplingFormat = QString(producer->get(key.data()));
 
-    key = QString("meta.media.%1.codec.sample_rate").arg(audioStreamIndex).toStdString();
-    m_samplingRate = atoi(producer->get(key.c_str()));
+    key = QString("meta.media.%1.codec.sample_rate").arg(audioStreamIndex).toLocal8Bit();
+    m_samplingRate = atoi(producer->get(key.data()));
 
-    key = QString("meta.media.%1.codec.bit_rate").arg(audioStreamIndex).toStdString();
-    m_bitRate = atoi(producer->get(key.c_str()));
+    key = QString("meta.media.%1.codec.bit_rate").arg(audioStreamIndex).toLocal8Bit();
+    m_bitRate = atoi(producer->get(key.data()));
 
-    key = QString("meta.media.%1.codec.channels").arg(audioStreamIndex).toStdString();
-    m_channels = atoi(producer->get(key.c_str()));
+    key = QString("meta.media.%1.codec.channels").arg(audioStreamIndex).toLocal8Bit();
+    m_channels = atoi(producer->get(key.data()));
 
-    key = QString("meta.media.%1.codec.name").arg(audioStreamIndex).toStdString();
-    m_codecName = QString(producer->get(key.c_str()));
+    key = QString("meta.media.%1.codec.name").arg(audioStreamIndex).toLocal8Bit();
+    m_codecName = QString(producer->get(key.data()));
 
-    key = QString("meta.media.%1.codec.long_name").arg(audioStreamIndex).toStdString();
-    m_codecLongName = QString(producer->get(key.c_str()));
+    key = QString("meta.media.%1.codec.long_name").arg(audioStreamIndex).toLocal8Bit();
+    m_codecLongName = QString(producer->get(key.data()));
 }
 AudioStreamInfo::~AudioStreamInfo()
 {
@@ -57,7 +58,7 @@ const QString& AudioStreamInfo::codecName(bool longName) const
 void AudioStreamInfo::dumpInfo() const
 {
     std::cout << "Info for audio stream " << m_audioStreamIndex << std::endl
-              << "\tCodec: " << m_codecLongName.toStdString() << " (" << m_codecName.toStdString() << ")" << std::endl
+              << "\tCodec: " << m_codecLongName.toLocal8Bit().data() << " (" << m_codecName.toLocal8Bit().data() << ")" << std::endl
               << "\tChannels: " << m_channels << std::endl
               << "\tSampling rate: " << m_samplingRate << std::endl
               << "\tBit rate: " << m_bitRate << std::endl
index 8629cb8a745332996b277c7ff7f4e6e5e5386573..0de3b70229f505d115ba38ff1f808897cd958d97 100644 (file)
@@ -117,15 +117,15 @@ int main(int argc, char *argv[])
 
 
     // Build the audio envelopes for the correlation
-    AudioEnvelope envelopeMain(&prodMain);
-    envelopeMain.loadEnvelope();
-    envelopeMain.loadStdDev();
-    envelopeMain.dumpInfo();
+    AudioEnvelope *envelopeMain = new AudioEnvelope(&prodMain);
+    envelopeMain->loadEnvelope();
+    envelopeMain->loadStdDev();
+    envelopeMain->dumpInfo();
 
-    AudioEnvelope envelopeSub(&prodSub);
-    envelopeSub.loadEnvelope();
-    envelopeSub.loadStdDev();
-    envelopeSub.dumpInfo();
+    AudioEnvelope *envelopeSub = new AudioEnvelope(&prodSub);
+    envelopeSub->loadEnvelope();
+    envelopeSub->loadStdDev();
+    envelopeSub->dumpInfo();
 
 
 
@@ -133,8 +133,8 @@ int main(int argc, char *argv[])
 
 
     // Calculate the correlation and hereby the audio shift
-    AudioCorrelation corr(&envelopeMain);
-    int index = corr.addChild(&envelopeSub);
+    AudioCorrelation corr(envelopeMain);
+    int index = corr.addChild(envelopeSub);
 
     int shift = corr.getShift(index);
     std::cout << fileSub << " should be shifted by " << shift << " frames" << std::endl
@@ -147,13 +147,13 @@ int main(int argc, char *argv[])
         QString outImg;
         outImg = QString("envelope-main-%1.png")
                 .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd-hh:mm:ss"));
-        envelopeMain.drawEnvelope().save(outImg);
+        envelopeMain->drawEnvelope().save(outImg);
         std::cout << "Saved volume envelope as "
                   << QFileInfo(outImg).absoluteFilePath().toStdString()
                   << std::endl;
         outImg = QString("envelope-sub-%1.png")
                 .arg(QDateTime::currentDateTime().toString("yyyy-MM-dd-hh:mm:ss"));
-        envelopeSub.drawEnvelope().save(outImg);
+        envelopeSub->drawEnvelope().save(outImg);
         std::cout << "Saved volume envelope as "
                   << QFileInfo(outImg).absoluteFilePath().toStdString()
                   << std::endl;