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
c82ec8ae
Commit
c82ec8ae
authored
Sep 14, 2021
by
Jean-Baptiste Mardelle
Browse files
Ensure bin audio thumbnails are loaded on project open
parent
8efd44d7
Pipeline
#80555
passed with stage
in 9 minutes and 4 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/bin/projectclip.cpp
View file @
c82ec8ae
...
...
@@ -123,7 +123,9 @@ ProjectClip::ProjectClip(const QString &id, const QIcon &thumb, const std::share
// Generate clip thumbnail
ClipLoadTask
::
start
({
ObjectType
::
BinClip
,
m_binId
.
toInt
()},
QDomElement
(),
true
,
-
1
,
-
1
,
this
);
// Generate audio thumbnail
AudioLevelsTask
::
start
({
ObjectType
::
BinClip
,
m_binId
.
toInt
()},
this
,
false
);
if
(
m_clipType
==
ClipType
::
AV
||
m_clipType
==
ClipType
::
Audio
||
m_clipType
==
ClipType
::
Playlist
||
m_clipType
==
ClipType
::
Unknown
)
{
AudioLevelsTask
::
start
({
ObjectType
::
BinClip
,
m_binId
.
toInt
()},
this
,
false
);
}
}
}
...
...
@@ -532,7 +534,9 @@ bool ProjectClip::setProducer(std::shared_ptr<Mlt::Producer> producer)
getFileHash
();
// set parent again (some info need to be stored in producer)
updateParent
(
parentItem
().
lock
());
AudioLevelsTask
::
start
({
ObjectType
::
BinClip
,
m_binId
.
toInt
()},
this
,
false
);
if
(
m_clipType
==
ClipType
::
AV
||
m_clipType
==
ClipType
::
Audio
||
m_clipType
==
ClipType
::
Playlist
||
m_clipType
==
ClipType
::
Unknown
)
{
AudioLevelsTask
::
start
({
ObjectType
::
BinClip
,
m_binId
.
toInt
()},
this
,
false
);
}
pCore
->
bin
()
->
reloadMonitorIfActive
(
clipId
());
for
(
auto
&
p
:
m_audioProducers
)
{
m_effectStack
->
removeService
(
p
.
second
);
...
...
src/jobs/audiolevelstask.cpp
View file @
c82ec8ae
...
...
@@ -104,6 +104,7 @@ void AudioLevelsTask::run()
QMap
<
int
,
QString
>
streams
=
binClip
->
audioInfo
()
->
streams
();
QMap
<
int
,
int
>
audioChannels
=
binClip
->
audioInfo
()
->
streamChannels
();
QMapIterator
<
int
,
QString
>
st
(
streams
);
bool
audioCreated
=
false
;
while
(
st
.
hasNext
()
&&
!
m_isCanceled
)
{
st
.
next
();
int
stream
=
st
.
key
();
...
...
@@ -113,7 +114,6 @@ void AudioLevelsTask::run()
// Generate one thumb per stream
QString
cachePath
=
binClip
->
getAudioThumbPath
(
stream
);
QVector
<
uint8_t
>
mltLevels
;
qDebug
()
<<
" TESTING AUDIO CACHE : "
<<
cachePath
;
if
(
!
m_isForce
&&
QFile
::
exists
(
cachePath
))
{
// Audio thumb already exists
QImage
image
(
cachePath
);
...
...
@@ -223,7 +223,6 @@ void AudioLevelsTask::run()
//qDebug()<<"=== FINISHED PRODUCING AUDIO FOR: "<<key<<", SIZE: "<<levelsCopy->size();
m_progress
=
100
;
QMetaObject
::
invokeMethod
(
m_object
,
"updateJobProgress"
);
QMetaObject
::
invokeMethod
(
m_object
,
"updateAudioThumbnail"
);
// Put into an image for caching.
int
count
=
mltLevels
.
size
();
QImage
image
((
count
+
3
)
/
4
/
channels
,
channels
,
QImage
::
Format_ARGB32
);
...
...
@@ -243,8 +242,14 @@ void AudioLevelsTask::run()
image
.
setPixel
(
i
/
2
,
i
%
channels
,
p
);
}
image
.
save
(
cachePath
);
audioCreated
=
true
;
QMetaObject
::
invokeMethod
(
m_object
,
"updateAudioThumbnail"
);
}
}
if
(
!
audioCreated
)
{
// Audio was cached, ensure the bin thumbnail is loaded
QMetaObject
::
invokeMethod
(
m_object
,
"updateAudioThumbnail"
);
}
pCore
->
taskManager
.
taskDone
(
m_owner
.
second
,
this
);
QMetaObject
::
invokeMethod
(
m_object
,
"updateJobProgress"
);
}
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