Use QVector instead of QList to store audio thumbnails

parent 60694525
......@@ -193,7 +193,7 @@ QString ProjectClip::getXmlProperty(const QDomElement &producer, const QString &
return value;
}
void ProjectClip::updateAudioThumbnail(QList<double> audioLevels)
void ProjectClip::updateAudioThumbnail(const QVector<double> audioLevels)
{
audioFrameCache = audioLevels;
m_audioThumbCreated = true;
......
......@@ -168,7 +168,7 @@ public:
/** Cache for every audio Frame with 10 Bytes */
/** format is frame -> channel ->bytes */
QList<double> audioFrameCache;
QVector<double> audioFrameCache;
bool audioThumbCreated() const;
void setWaitingStatus(const QString &id);
......@@ -244,7 +244,7 @@ protected:
public slots:
/* @brief Store the audio thumbnails once computed. Note that the parameter is a value and not a reference, fill free to use it as a sink (use std::move to
* avoid copy). */
void updateAudioThumbnail(QList<double> audioLevels);
void updateAudioThumbnail(const QVector<double> audioLevels);
/** @brief Delete the proxy file */
void deleteProxy();
......
......@@ -351,7 +351,7 @@ std::shared_ptr<ProjectClip> ProjectItemModel::getClipByBinID(const QString &bin
return nullptr;
}
const QList<double> ProjectItemModel::getAudioLevelsByBinID(const QString &binId)
const QVector<double> ProjectItemModel::getAudioLevelsByBinID(const QString &binId)
{
READ_LOCK();
if (binId.contains(QLatin1Char('_'))) {
......@@ -363,7 +363,7 @@ const QList<double> ProjectItemModel::getAudioLevelsByBinID(const QString &binId
return std::static_pointer_cast<ProjectClip>(c)->audioFrameCache;
}
}
return QList<double>();
return QVector<double>();
}
bool ProjectItemModel::hasClip(const QString &binId)
......
......@@ -68,7 +68,7 @@ public:
/** @brief Returns a clip from the hierarchy, given its id */
std::shared_ptr<ProjectClip> getClipByBinID(const QString &binId);
/** @brief Returns audio levels for a clip from its id */
const QList <double>getAudioLevelsByBinID(const QString &binId);
const QVector <double>getAudioLevelsByBinID(const QString &binId);
/** @brief Returns a list of clips using the given url */
QStringList getClipByUrl(const QFileInfo &url) const;
......
......@@ -374,7 +374,7 @@ bool AudioThumbJob::commitResult(Fun &undo, Fun &redo)
if (!m_successful) {
return false;
}
QList <double>old = m_binClip->audioFrameCache;
QVector <double>old = m_binClip->audioFrameCache;
QImage oldImage = m_binClip->thumbnail(m_thumbSize.width(), m_thumbSize.height()).toImage();
QImage result = ThumbnailCache::get()->getAudioThumbnail(m_clipId);
......
......@@ -72,6 +72,6 @@ private:
bool m_done{false}, m_successful{false};
int m_channels, m_frequency, m_lengthInFrames, m_audioStream;
QList <double>m_audioLevels;
QVector <double>m_audioLevels;
std::unique_ptr<QProcess> m_ffmpegProcess;
};
......@@ -517,16 +517,6 @@ Fun ClipModel::useTimewarpProducer_lambda(double speed)
};
}
QVariant ClipModel::getAudioWaveform()
{
READ_LOCK();
std::shared_ptr<ProjectClip> binClip = pCore->projectItemModel()->getClipByBinID(m_binClipId);
if (binClip) {
return QVariant::fromValue(binClip->audioFrameCache);
}
return QVariant();
}
const QString &ClipModel::binId() const
{
return m_binClipId;
......
......@@ -113,9 +113,6 @@ public:
*/
int getPlaytime() const override;
/** @brief Returns audio cache data from bin clip to display audio thumbs */
QVariant getAudioWaveform();
/** @brief Returns the bin clip's id */
const QString &binId() const;
......
......@@ -203,7 +203,7 @@ signals:
void audioChannelsChanged();
private:
QList<double> m_audioLevels;
QVector<double> m_audioLevels;
int m_inPoint;
int m_outPoint;
QString m_binId;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment