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
1b9e0725
Commit
1b9e0725
authored
Oct 03, 2020
by
Jean-Baptiste Mardelle
Browse files
Add some checks to max audio level calculation
parent
3770fe80
Pipeline
#36298
failed with stage
in 60 minutes and 55 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/bin/projectclip.cpp
View file @
1b9e0725
...
...
@@ -220,17 +220,19 @@ void ProjectClip::updateAudioThumbnail()
#else
args
<<
QStringLiteral
(
"/dev/stdout"
);
#endif
qDebug
()
<<
"=== STARTING COMMAND: "
<<
args
;
QObject
::
connect
(
&
ffmpeg
,
&
QProcess
::
readyReadStandardOutput
,
[
&
ffmpeg
,
this
]()
{
QString
output
=
ffmpeg
.
readAllStandardOutput
();
if
(
output
.
contains
(
QLatin1String
(
"max_volume"
)))
{
qDebug
()
<<
"===== GOT FFFMPEG OUTPUT:
\n
"
<<
output
<<
"
\n
........................."
;
output
=
output
.
section
(
QLatin1String
(
"max_volume:"
),
1
).
simplified
();
output
=
output
.
section
(
QLatin1Char
(
' '
),
0
,
0
);
int
aMax
=
qMax
(
1
,
qAbs
(
qRound
(
output
.
toDouble
())));
qDebug
()
<<
"===== GOT CLIP AMAX: "
<<
aMax
;
qDebug
()
<<
"===== GOT CLIP FINAL AMAX: "
<<
aMax
;
setProducerProperty
(
QStringLiteral
(
"kdenlive:audio_max"
),
aMax
);
bool
ok
;
double
maxVolume
=
output
.
toDouble
(
&
ok
);
if
(
ok
)
{
int
aMax
=
qMax
(
1
,
qAbs
(
qRound
(
maxVolume
)));
setProducerProperty
(
QStringLiteral
(
"kdenlive:audio_max"
),
aMax
);
}
else
{
setProducerProperty
(
QStringLiteral
(
"kdenlive:audio_max"
),
-
1
);
}
}
});
ffmpeg
.
setProcessChannelMode
(
QProcess
::
MergedChannels
);
...
...
@@ -726,6 +728,7 @@ std::shared_ptr<Mlt::Producer> ProjectClip::getTimelineProducer(int trackId, int
// We need to get an video producer, if none exists
if
(
m_videoProducers
.
count
(
trackId
)
==
0
)
{
m_videoProducers
[
trackId
]
=
cloneProducer
(
true
);
// Let audio enabled so that we can use audio visualization filters ?
m_videoProducers
[
trackId
]
->
set
(
"set.test_audio"
,
1
);
m_videoProducers
[
trackId
]
->
set
(
"set.test_image"
,
0
);
m_effectStack
->
addService
(
m_videoProducers
[
trackId
]);
...
...
@@ -1404,6 +1407,7 @@ void ProjectClip::discardAudioThumb()
QFile
::
remove
(
audioThumbPath
);
}
}
resetProducerProperty
(
QStringLiteral
(
"kdenlive:audio_max"
));
m_audioThumbCreated
=
false
;
refreshAudioInfo
();
}
...
...
src/bin/projectitemmodel.cpp
View file @
1b9e0725
...
...
@@ -409,7 +409,8 @@ double ProjectItemModel::getAudioMaxLevel(const QString &binId)
for
(
const
auto
&
clip
:
m_allItems
)
{
auto
c
=
std
::
static_pointer_cast
<
AbstractProjectItem
>
(
clip
.
second
.
lock
());
if
(
c
->
itemType
()
==
AbstractProjectItem
::
ClipItem
&&
c
->
clipId
()
==
binId
)
{
return
qSqrt
(
std
::
static_pointer_cast
<
ProjectClip
>
(
c
)
->
getProducerIntProperty
(
QStringLiteral
(
"kdenlive:audio_max"
)));
int
volume
=
std
::
static_pointer_cast
<
ProjectClip
>
(
c
)
->
getProducerIntProperty
(
QStringLiteral
(
"kdenlive:audio_max"
));
return
volume
>
1
?
qSqrt
(
volume
)
:
volume
;
}
}
return
0
;
...
...
src/timeline2/view/qml/timelineitems.cpp
View file @
1b9e0725
...
...
@@ -166,7 +166,7 @@ public:
}
painter
->
setPen
(
pen
);
double
scaleFactor
=
255
;
if
(
m_audioMax
>
0
)
{
if
(
m_audioMax
>
1
)
{
scaleFactor
*=
m_audioMax
;
}
int
startPos
=
m_inPoint
/
indicesPrPixel
;
...
...
Write
Preview
Markdown
is supported
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