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
0e5b1d7e
Commit
0e5b1d7e
authored
Sep 06, 2019
by
Jean-Baptiste Mardelle
Browse files
Another fix for speed effect
parent
c03ccad4
Pipeline
#7482
passed with stage
in 21 minutes and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/clipmodel.cpp
View file @
0e5b1d7e
...
...
@@ -431,7 +431,7 @@ bool ClipModel::useTimewarpProducer(double speed, bool changeDuration, Fun &undo
std
::
function
<
bool
(
void
)
>
local_redo
=
[]()
{
return
true
;
};
double
previousSpeed
=
getSpeed
();
int
oldDuration
=
getPlaytime
();
int
newDuration
=
int
(
double
(
oldDuration
)
*
std
::
abs
(
previousS
peed
/
speed
)
+
0.5
);
int
newDuration
=
qRound
(
oldDuration
*
std
::
f
abs
(
m_s
peed
/
speed
));
int
oldOut
=
getOut
();
int
oldIn
=
getIn
();
bool
revertSpeed
=
false
;
...
...
@@ -457,13 +457,13 @@ bool ClipModel::useTimewarpProducer(double speed, bool changeDuration, Fun &undo
if
(
revertSpeed
)
{
int
in
=
getIn
();
int
out
=
getOut
();
int
duration
=
out
-
in
;
in
=
qMax
(
0
,
(
int
)((
m_producer
->
get_length
()
*
std
::
fabs
(
m_speed
/
speed
))
-
1
-
(
out
*
std
::
fabs
(
m_speed
/
speed
))));
in
=
qMax
(
0
,
qRound
((
m_producer
->
get_length
()
-
1
-
out
)
*
std
::
fabs
(
m_speed
/
speed
)
+
0.5
));
out
=
in
+
newDuration
;
operation
=
[
operation
,
in
,
out
,
this
]()
{
bool
res
=
operation
();
if
(
res
)
{
setInOut
(
in
,
out
);
}
else
{
}
return
res
;
};
...
...
@@ -473,10 +473,14 @@ bool ClipModel::useTimewarpProducer(double speed, bool changeDuration, Fun &undo
UPDATE_UNDO_REDO
(
operation
,
reverse
,
local_undo
,
local_redo
);
// When calculating duration, result can be a few frames longer than possible duration so adjust
if
(
changeDuration
)
{
bool
res
=
requestResize
(
qMin
(
newDuration
,
getMaxDuration
()),
true
,
local_undo
,
local_redo
,
true
);
if
(
!
res
)
{
local_undo
();
return
false
;
int
requestedDuration
=
qMin
(
newDuration
,
getMaxDuration
()
-
getIn
());
if
(
requestedDuration
!=
getPlaytime
())
{
bool
res
=
requestResize
(
requestedDuration
,
true
,
local_undo
,
local_redo
,
true
);
if
(
!
res
)
{
qDebug
()
<<
"==== CLIP WARP UPDATE DURATION FAILED!!!!"
;
local_undo
();
return
false
;
}
}
}
adjustEffectLength
(
false
,
oldIn
,
getIn
(),
oldOut
-
oldIn
,
m_producer
->
get_playtime
(),
0
,
local_undo
,
local_redo
,
true
);
...
...
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