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
98485c67
Commit
98485c67
authored
Mar 04, 2022
by
Jean-Baptiste Mardelle
Browse files
Fix timeline audio thumbs sometimes not correcty updating
parent
814dbae1
Pipeline
#145033
passed with stage
in 5 minutes and 52 seconds
Changes
5
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
src/timeline2/view/qml/Clip.qml
View file @
98485c67
...
...
@@ -184,18 +184,15 @@ Rectangle {
}
onTimeScaleChanged
:
{
x
=
modelStart
*
timeScale
;
x
=
modelStart
*
clipRoot
.
timeScale
;
xIntegerOffset
=
Math
.
ceil
(
x
)
-
x
width
=
clipDuration
*
timeScale
;
width
=
clipDuration
*
clipRoot
.
timeScale
;
updateLabelOffset
()
if
(
!
clipRoot
.
hideClipViews
)
{
if
(
effectRow
.
item
&&
effectRow
.
item
.
kfrCanvas
)
{
effectRow
.
item
.
kfrCanvas
.
requestPaint
()
}
}
if
(
isAudio
&&
thumbsLoader
.
item
)
{
thumbsLoader
.
item
.
reload
(
1
)
}
}
onScrollXChanged
:
{
updateLabelOffset
()
...
...
@@ -206,7 +203,7 @@ Rectangle {
function
updateLabelOffset
()
{
labelRect
.
anchors
.
leftMargin
=
scrollX
>
modelStart
*
timeScale
?
scrollX
-
modelStart
*
timeScale
+
(
clipRoot
.
timeremap
?
labelRect
.
height
:
0
)
:
clipRoot
.
timeremap
?
labelRect
.
height
:
0
labelRect
.
anchors
.
leftMargin
=
scrollX
>
modelStart
*
clipRoot
.
timeScale
?
scrollX
-
modelStart
*
clipRoot
.
timeScale
+
(
clipRoot
.
timeremap
?
labelRect
.
height
:
0
)
:
clipRoot
.
timeremap
?
labelRect
.
height
:
0
}
/*border.color: (clipStatus === ClipStatus.StatusMissing || ClipStatus === ClipStatus.StatusWaiting || clipStatus === ClipStatus.StatusDeleting) ? "#ff0000" : selected ? root.selectionColor : grouped ? root.groupColor : borderColor
...
...
@@ -534,8 +531,8 @@ Rectangle {
width
:
1
height
:
container
.
height
x
:
clipRoot
.
speed
<
0
?
(
clipRoot
.
maxDuration
-
clipRoot
.
inPoint
)
*
timeScale
+
(
Math
.
round
(
model
.
frame
/
clipRoot
.
speed
))
*
timeScale
-
itemBorder
.
border
.
width
:
(
Math
.
round
(
model
.
frame
/
clipRoot
.
speed
)
-
clipRoot
.
inPoint
)
*
timeScale
-
itemBorder
.
border
.
width
;
?
(
clipRoot
.
maxDuration
-
clipRoot
.
inPoint
)
*
clipRoot
.
timeScale
+
(
Math
.
round
(
model
.
frame
/
clipRoot
.
speed
))
*
clipRoot
.
timeScale
-
itemBorder
.
border
.
width
:
(
Math
.
round
(
model
.
frame
/
clipRoot
.
speed
)
-
clipRoot
.
inPoint
)
*
clipRoot
.
timeScale
-
itemBorder
.
border
.
width
;
color
:
model
.
color
}
Rectangle
{
...
...
@@ -555,7 +552,7 @@ Rectangle {
hoverEnabled
:
true
onDoubleClicked
:
timeline
.
editMarker
(
clipRoot
.
clipId
,
model
.
frame
)
onClicked
:
proxy
.
position
=
clipRoot
.
modelStart
+
(
clipRoot
.
speed
<
0
?
(
clipRoot
.
maxDuration
-
clipRoot
.
inPoint
)
*
timeScale
+
(
Math
.
round
(
model
.
frame
/
clipRoot
.
speed
))
?
(
clipRoot
.
maxDuration
-
clipRoot
.
inPoint
)
*
clipRoot
.
timeScale
+
(
Math
.
round
(
model
.
frame
/
clipRoot
.
speed
))
:
(
Math
.
round
(
model
.
frame
/
clipRoot
.
speed
)
-
clipRoot
.
inPoint
))
}
}
...
...
@@ -563,7 +560,7 @@ Rectangle {
id
:
textMetrics
font
:
miniFont
text
:
model
.
comment
elide
:
r
oot
.
timeScale
>
1
?
Text
.
ElideNone
:
Text
.
ElideRight
elide
:
clipR
oot
.
timeScale
>
1
?
Text
.
ElideNone
:
Text
.
ElideRight
elideWidth
:
root
.
maxLabelWidth
}
Text
{
...
...
@@ -633,7 +630,7 @@ Rectangle {
}
onPositionChanged
:
{
if
(
mouse
.
buttons
===
Qt
.
LeftButton
)
{
var
currentFrame
=
Math
.
round
((
clipRoot
.
x
+
(
x
+
itemBorder
.
border
.
width
))
/
timeScale
)
var
currentFrame
=
Math
.
round
((
clipRoot
.
x
+
(
x
+
itemBorder
.
border
.
width
))
/
clipRoot
.
timeScale
)
var
currentClipPos
=
clipRoot
.
modelStart
var
delta
=
currentFrame
-
currentClipPos
if
(
delta
!==
0
)
{
...
...
@@ -764,7 +761,7 @@ Rectangle {
}
onPositionChanged
:
{
if
(
mouse
.
buttons
===
Qt
.
LeftButton
)
{
var
newDuration
=
Math
.
round
((
x
+
width
)
/
timeScale
)
var
newDuration
=
Math
.
round
((
x
+
width
)
/
clipRoot
.
timeScale
)
if
(
maxDuration
>
0
&&
(
newDuration
>
maxDuration
-
inPoint
)
&&
!
(
mouse
.
modifiers
&
Qt
.
ControlModifier
))
{
newDuration
=
maxDuration
-
inPoint
}
...
...
@@ -835,7 +832,7 @@ Rectangle {
// Green fade in triangle
id
:
fadeInTriangle
fillColor
:
'
green
'
width
:
Math
.
min
(
clipRoot
.
fadeIn
*
timeScale
,
container
.
width
)
width
:
Math
.
min
(
clipRoot
.
fadeIn
*
clipRoot
.
timeScale
,
container
.
width
)
height
:
parent
.
height
anchors.left
:
parent
.
left
anchors.top
:
parent
.
top
...
...
@@ -846,7 +843,7 @@ Rectangle {
// Red fade out triangle
id
:
fadeOutCanvas
fillColor
:
'
red
'
width
:
Math
.
min
(
clipRoot
.
fadeOut
*
timeScale
,
container
.
width
)
width
:
Math
.
min
(
clipRoot
.
fadeOut
*
clipRoot
.
timeScale
,
container
.
width
)
height
:
parent
.
height
anchors.right
:
parent
.
right
anchors.top
:
parent
.
top
...
...
@@ -1247,7 +1244,7 @@ Rectangle {
}
onPositionChanged
:
{
if
(
mouse
.
buttons
===
Qt
.
LeftButton
)
{
var
delta
=
clipRoot
.
clipDuration
-
Math
.
floor
((
x
+
width
/
2
-
itemBorder
.
border
.
width
)
/
timeScale
)
var
delta
=
clipRoot
.
clipDuration
-
Math
.
floor
((
x
+
width
/
2
-
itemBorder
.
border
.
width
)
/
clipRoot
.
timeScale
)
var
duration
=
Math
.
max
(
0
,
delta
)
duration
=
Math
.
min
(
duration
,
clipRoot
.
clipDuration
)
if
(
lastDuration
!=
duration
)
{
...
...
@@ -1343,7 +1340,7 @@ Rectangle {
}
onPositionChanged
:
{
if
(
mouse
.
buttons
===
Qt
.
LeftButton
)
{
var
delta
=
Math
.
round
((
x
+
width
/
2
)
/
timeScale
)
var
delta
=
Math
.
round
((
x
+
width
/
2
)
/
clipRoot
.
timeScale
)
var
duration
=
Math
.
max
(
0
,
delta
)
duration
=
Math
.
min
(
duration
,
clipRoot
.
clipDuration
-
1
)
if
(
duration
!=
clipRoot
.
fadeIn
)
{
...
...
@@ -1432,7 +1429,7 @@ Rectangle {
Rectangle
{
id
:
currentRegionMoved
color
:
parent
.
color
x
:
slipBackground
.
x
+
slipControler
.
inPoint
*
timeScale
+
itemBorder
.
border
.
width
x
:
slipBackground
.
x
+
slipControler
.
inPoint
*
clipRoot
.
timeScale
+
itemBorder
.
border
.
width
anchors.bottom
:
parent
.
bottom
height
:
parent
.
height
/
2
width
:
container
.
width
...
...
src/timeline2/view/qml/ClipAudioThumbs.qml
View file @
98485c67
...
...
@@ -16,6 +16,7 @@ Row {
property
int
totalChunks
:
0
property
bool
usesOffset
:
false
property
int
offset
:
-
1
property
real
timeScale
:
root
.
timeScale
anchors.fill
:
parent
Timer
{
...
...
@@ -37,6 +38,10 @@ Row {
waveTimer
.
start
()
}
onTimeScaleChanged
:
{
waveTimer
.
start
()
}
function
processReload
()
{
// This is needed to make the model have the correct count.
// Model as a property expression is not working in all cases.
...
...
@@ -51,8 +56,10 @@ Row {
waveform
.
usesOffset
=
true
updatedOffset
=
Math
.
max
(
0
,
Math
.
floor
(
clipRoot
.
scrollStart
/
waveform
.
maxWidth
-
2
))
if
(
updatedOffset
<
waveform
.
offset
||
updatedOffset
>
(
waveform
.
offset
+
5
)
||
total
!=
waveform
.
totalChunks
)
{
waveformRepeater
.
model
=
0
// Enforce repaint
//waveformRepeater.model = 0
}
else
{
// All required audio thumbs chunks are already painted
return
}
chunks
=
Math
.
min
(
10
,
total
-
updatedOffset
)
...
...
@@ -64,6 +71,9 @@ Row {
waveform
.
totalChunks
=
total
if
(
waveformRepeater
.
model
===
undefined
||
chunks
!==
waveformRepeater
.
model
)
{
waveformRepeater
.
model
=
chunks
}
else
{
// Enforce repaint
waveformRepeater
.
repaintNodes
=
!
waveformRepeater
.
repaintNodes
}
}
Item
{
...
...
@@ -73,6 +83,7 @@ Row {
Repeater
{
id
:
waveformRepeater
property
bool
repaintNodes
:
false
TimelineWaveform
{
width
:
waveform
.
maxWidth
<
waveform
.
width
?
(
index
+
waveform
.
offset
==
waveform
.
totalChunks
-
1
?
waveform
.
width
%
waveform
.
maxWidth
:
waveform
.
maxWidth
)
:
Math
.
round
(
waveform
.
width
)
height
:
waveform
.
height
...
...
@@ -82,15 +93,16 @@ Row {
audioStream
:
clipRoot
.
audioStream
isFirstChunk
:
index
+
waveform
.
offset
==
0
isOpaque
:
true
scaleFactor
:
timeline
.
scaleFactor
scaleFactor
:
waveform
.
timeScale
format
:
timeline
.
audioThumbFormat
normalize
:
timeline
.
audioThumbNormalize
speed
:
clipRoot
.
speed
waveInPoint
:
clipRoot
.
speed
<
0
?
(
Math
.
round
((
clipRoot
.
maxDuration
-
1
-
clipRoot
.
inPoint
)
*
Math
.
abs
(
clipRoot
.
speed
)
-
((
index
+
waveform
.
offset
)
*
waveform
.
maxWidth
/
timeline
.
scaleFactor
)
*
Math
.
abs
(
clipRoot
.
speed
))
*
clipRoot
.
audioChannels
)
:
(
Math
.
round
((
clipRoot
.
inPoint
+
((
index
+
waveform
.
offset
)
*
waveform
.
maxWidth
/
timeline
.
scaleFactor
))
*
clipRoot
.
speed
)
*
clipRoot
.
audioChannels
)
waveOutPoint
:
clipRoot
.
speed
<
0
?
(
waveInPoint
-
Math
.
ceil
(
width
/
timeline
.
scaleFactor
*
Math
.
abs
(
clipRoot
.
speed
))
*
clipRoot
.
audioChannels
)
:
(
waveInPoint
+
Math
.
round
(
width
/
timeline
.
scaleFactor
*
clipRoot
.
speed
)
*
clipRoot
.
audioChannels
)
waveInPoint
:
clipRoot
.
speed
<
0
?
(
Math
.
round
((
clipRoot
.
maxDuration
-
1
-
clipRoot
.
inPoint
)
*
Math
.
abs
(
clipRoot
.
speed
)
-
((
index
+
waveform
.
offset
)
*
waveform
.
maxWidth
/
waveform
.
timeScale
)
*
Math
.
abs
(
clipRoot
.
speed
))
*
clipRoot
.
audioChannels
)
:
(
Math
.
round
((
clipRoot
.
inPoint
+
((
index
+
waveform
.
offset
)
*
waveform
.
maxWidth
/
waveform
.
timeScale
))
*
clipRoot
.
speed
)
*
clipRoot
.
audioChannels
)
waveOutPoint
:
clipRoot
.
speed
<
0
?
(
waveInPoint
-
Math
.
ceil
(
width
/
waveform
.
timeScale
*
Math
.
abs
(
clipRoot
.
speed
))
*
clipRoot
.
audioChannels
)
:
(
waveInPoint
+
Math
.
round
(
width
/
waveform
.
timeScale
*
clipRoot
.
speed
)
*
clipRoot
.
audioChannels
)
fillColor0
:
clipRoot
.
color
fillColor1
:
root
.
thumbColor1
fillColor2
:
root
.
thumbColor2
enforceRepaint
:
waveformRepeater
.
repaintNodes
}
}
}
src/timeline2/view/qml/Track.qml
View file @
98485c67
...
...
@@ -14,7 +14,6 @@ Item{
property
alias
trackModel
:
trackModel
.
model
property
alias
rootIndex
:
trackModel
.
rootIndex
property
bool
isAudio
property
real
timeScale
:
1.0
property
bool
isLocked
:
false
property
int
trackInternalId
:
-
42
property
int
trackThumbsFormat
...
...
@@ -61,12 +60,6 @@ Item{
z
:
calculateZIndex
()
Loader
{
id
:
loader
Binding
{
target
:
loader
.
item
property
:
"
timeScale
"
value
:
trackRoot
.
timeScale
when
:
loader
.
status
==
Loader
.
Ready
&&
loader
.
item
}
Binding
{
target
:
loader
.
item
property
:
"
fakeTid
"
...
...
@@ -115,6 +108,12 @@ Item{
value
:
model
.
start
when
:
loader
.
status
==
Loader
.
Ready
&&
loader
.
item
}
Binding
{
target
:
loader
.
item
property
:
"
timeScale
"
value
:
root
.
timeScale
when
:
loader
.
status
==
Loader
.
Ready
&&
loader
.
item
}
Binding
{
target
:
loader
.
item
property
:
"
scrollX
"
...
...
@@ -316,7 +315,7 @@ Item{
// Store original speed
speedController
.
originalSpeed
=
clip
.
speed
}
clip
.
x
+=
clip
.
width
-
(
newDuration
*
trackR
oot
.
timeScale
)
clip
.
x
+=
clip
.
width
-
(
newDuration
*
r
oot
.
timeScale
)
clip
.
width
=
newDuration
*
root
.
timeScale
speedController
.
x
=
clip
.
x
+
clip
.
border
.
width
speedController
.
width
=
Math
.
max
(
0
,
clip
.
width
-
2
*
clip
.
border
.
width
)
...
...
@@ -393,7 +392,7 @@ Item{
}
speedController
.
x
=
clip
.
x
+
clip
.
border
.
width
newDuration
=
controller
.
requestItemSpeedChange
(
clip
.
clipId
,
newDuration
,
true
,
root
.
snapping
)
clip
.
width
=
newDuration
*
trackR
oot
.
timeScale
clip
.
width
=
newDuration
*
r
oot
.
timeScale
speedController
.
width
=
Math
.
max
(
0
,
clip
.
width
-
2
*
clip
.
border
.
width
)
speedController
.
lastValidDuration
=
newDuration
clip
.
speed
=
clip
.
originalDuration
*
speedController
.
originalSpeed
/
newDuration
...
...
src/timeline2/view/qml/timeline.qml
View file @
98485c67
This diff is collapsed.
Click to expand it.
src/timeline2/view/qml/timelineitems.cpp
View file @
98485c67
...
...
@@ -84,6 +84,7 @@ class TimelineWaveform : public QQuickPaintedItem
Q_PROPERTY
(
double
scaleFactor
MEMBER
m_scale
)
Q_PROPERTY
(
double
speed
MEMBER
m_speed
)
Q_PROPERTY
(
bool
format
MEMBER
m_format
NOTIFY
propertyChanged
)
Q_PROPERTY
(
bool
enforceRepaint
MEMBER
m_repaint
NOTIFY
propertyChanged
)
Q_PROPERTY
(
bool
normalize
MEMBER
m_normalize
NOTIFY
normalizeChanged
)
Q_PROPERTY
(
bool
isFirstChunk
MEMBER
m_firstChunk
)
Q_PROPERTY
(
bool
isOpaque
MEMBER
m_opaquePaint
)
...
...
@@ -91,6 +92,7 @@ class TimelineWaveform : public QQuickPaintedItem
public:
TimelineWaveform
(
QQuickItem
*
parent
=
nullptr
)
:
QQuickPaintedItem
(
parent
)
,
m_repaint
(
false
)
,
m_speed
(
1.
)
,
m_opaquePaint
(
false
)
{
...
...
@@ -271,6 +273,7 @@ private:
QColor
m_color
;
QColor
m_color2
;
bool
m_format
;
bool
m_repaint
;
bool
m_normalize
;
int
m_channels
;
int
m_precisionFactor
;
...
...
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