Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
258
Issues
258
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Multimedia
Kdenlive
Commits
8cd00620
Commit
8cd00620
authored
Aug 08, 2019
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix revert speed clip reloading incorrectly
parent
a8afc9db
Pipeline
#6361
passed with stage
in 20 minutes and 1 second
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
src/timeline2/model/clipmodel.cpp
src/timeline2/model/clipmodel.cpp
+24
-15
No files found.
src/timeline2/model/clipmodel.cpp
View file @
8cd00620
...
...
@@ -392,15 +392,6 @@ void ClipModel::refreshProducerFromBin(PlaylistState::ClipState state, double sp
QWriteLocker
locker
(
&
m_lock
);
int
in
=
getIn
();
int
out
=
getOut
();
bool
revertSpeed
=
false
;
if
(
speed
<
0
)
{
if
(
m_speed
>
0
)
{
revertSpeed
=
true
;
}
}
else
if
(
m_speed
<
0
)
{
revertSpeed
=
true
;
}
if
(
!
qFuzzyCompare
(
speed
,
m_speed
)
&&
!
qFuzzyCompare
(
speed
,
0.
))
{
in
=
in
*
std
::
abs
(
m_speed
/
speed
);
out
=
in
+
getPlaytime
()
-
1
;
...
...
@@ -409,11 +400,6 @@ void ClipModel::refreshProducerFromBin(PlaylistState::ClipState state, double sp
m_speed
=
speed
;
qDebug
()
<<
"changing speed"
<<
in
<<
out
<<
m_speed
;
}
if
(
revertSpeed
)
{
int
duration
=
out
-
in
;
in
=
m_producer
->
get_length
()
*
std
::
fabs
(
m_speed
)
-
out
;
out
=
in
+
duration
;
}
std
::
shared_ptr
<
ProjectClip
>
binClip
=
pCore
->
projectItemModel
()
->
getClipByBinID
(
m_binClipId
);
std
::
shared_ptr
<
Mlt
::
Producer
>
binProducer
=
binClip
->
getTimelineProducer
(
m_currentTrackId
,
m_id
,
state
,
m_speed
);
m_producer
=
std
::
move
(
binProducer
);
...
...
@@ -447,9 +433,17 @@ bool ClipModel::useTimewarpProducer(double speed, bool changeDuration, Fun &undo
int
newDuration
=
int
(
double
(
oldDuration
)
*
std
::
abs
(
previousSpeed
/
speed
)
+
0.5
);
int
oldOut
=
getOut
();
int
oldIn
=
getIn
();
bool
revertSpeed
=
false
;
if
(
speed
<
0
)
{
if
(
previousSpeed
>
0
)
{
revertSpeed
=
true
;
}
}
else
if
(
previousSpeed
<
0
)
{
revertSpeed
=
true
;
}
auto
operation
=
useTimewarpProducer_lambda
(
speed
);
auto
reverse
=
useTimewarpProducer_lambda
(
previousSpeed
);
if
(
changeDuration
&&
oldOut
>=
newDuration
)
{
if
(
revertSpeed
||
(
changeDuration
&&
oldOut
>=
newDuration
)
)
{
// in that case, we are going to shrink the clip when changing the producer. We must undo that when reloading the old producer
reverse
=
[
reverse
,
oldIn
,
oldOut
,
this
]()
{
bool
res
=
reverse
();
...
...
@@ -459,6 +453,21 @@ bool ClipModel::useTimewarpProducer(double speed, bool changeDuration, Fun &undo
return
res
;
};
}
if
(
revertSpeed
)
{
int
in
=
getIn
();
int
out
=
getOut
();
int
duration
=
out
-
in
;
in
=
m_producer
->
get_length
()
*
std
::
fabs
(
m_speed
)
-
out
;
out
=
in
+
duration
;
operation
=
[
operation
,
in
,
out
,
this
]()
{
bool
res
=
operation
();
if
(
res
)
{
setInOut
(
in
,
out
);
}
return
res
;
};
}
if
(
operation
())
{
UPDATE_UNDO_REDO
(
operation
,
reverse
,
local_undo
,
local_redo
);
// When calculating duration, result can be a few frames longer than possible duration so adjust
...
...
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