Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
ba4adf7c
Commit
ba4adf7c
authored
Dec 04, 2019
by
Jean-Baptiste Mardelle
Browse files
Use QVector instead of QList to store audio thumbnails
parent
60694525
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/bin/projectclip.cpp
View file @
ba4adf7c
...
...
@@ -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
;
...
...
src/bin/projectclip.h
View file @
ba4adf7c
...
...
@@ -168,7 +168,7 @@ public:
/** Cache for every audio Frame with 10 Bytes */
/** format is frame -> channel ->bytes */
Q
List
<
double
>
audioFrameCache
;
Q
Vector
<
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
();
...
...
src/bin/projectitemmodel.cpp
View file @
ba4adf7c
...
...
@@ -351,7 +351,7 @@ std::shared_ptr<ProjectClip> ProjectItemModel::getClipByBinID(const QString &bin
return
nullptr
;
}
const
Q
List
<
double
>
ProjectItemModel
::
getAudioLevelsByBinID
(
const
QString
&
binId
)
const
Q
Vector
<
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
Q
List
<
double
>
();
return
Q
Vector
<
double
>
();
}
bool
ProjectItemModel
::
hasClip
(
const
QString
&
binId
)
...
...
src/bin/projectitemmodel.h
View file @
ba4adf7c
...
...
@@ -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
Q
List
<
double
>
getAudioLevelsByBinID
(
const
QString
&
binId
);
const
Q
Vector
<
double
>
getAudioLevelsByBinID
(
const
QString
&
binId
);
/** @brief Returns a list of clips using the given url */
QStringList
getClipByUrl
(
const
QFileInfo
&
url
)
const
;
...
...
src/jobs/audiothumbjob.cpp
View file @
ba4adf7c
...
...
@@ -374,7 +374,7 @@ bool AudioThumbJob::commitResult(Fun &undo, Fun &redo)
if
(
!
m_successful
)
{
return
false
;
}
Q
List
<
double
>
old
=
m_binClip
->
audioFrameCache
;
Q
Vector
<
double
>
old
=
m_binClip
->
audioFrameCache
;
QImage
oldImage
=
m_binClip
->
thumbnail
(
m_thumbSize
.
width
(),
m_thumbSize
.
height
()).
toImage
();
QImage
result
=
ThumbnailCache
::
get
()
->
getAudioThumbnail
(
m_clipId
);
...
...
src/jobs/audiothumbjob.hpp
View file @
ba4adf7c
...
...
@@ -72,6 +72,6 @@ private:
bool
m_done
{
false
},
m_successful
{
false
};
int
m_channels
,
m_frequency
,
m_lengthInFrames
,
m_audioStream
;
Q
List
<
double
>
m_audioLevels
;
Q
Vector
<
double
>
m_audioLevels
;
std
::
unique_ptr
<
QProcess
>
m_ffmpegProcess
;
};
src/timeline2/model/clipmodel.cpp
View file @
ba4adf7c
...
...
@@ -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
;
...
...
src/timeline2/model/clipmodel.hpp
View file @
ba4adf7c
...
...
@@ -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
;
...
...
src/timeline2/view/qml/timelineitems.cpp
View file @
ba4adf7c
...
...
@@ -203,7 +203,7 @@ signals:
void
audioChannelsChanged
();
private:
Q
List
<
double
>
m_audioLevels
;
Q
Vector
<
double
>
m_audioLevels
;
int
m_inPoint
;
int
m_outPoint
;
QString
m_binId
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment