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
255
Issues
255
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
c69bc854
Commit
c69bc854
authored
Sep 23, 2020
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correctly load and save mix cut position
parent
827c2a6e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
20 deletions
+24
-20
src/timeline2/model/builders/meltBuilder.cpp
src/timeline2/model/builders/meltBuilder.cpp
+5
-13
src/timeline2/model/clipmodel.cpp
src/timeline2/model/clipmodel.cpp
+1
-2
src/timeline2/model/clipmodel.hpp
src/timeline2/model/clipmodel.hpp
+1
-1
src/timeline2/model/timelinemodel.cpp
src/timeline2/model/timelinemodel.cpp
+4
-4
src/timeline2/model/trackmodel.cpp
src/timeline2/model/trackmodel.cpp
+11
-0
src/timeline2/model/trackmodel.hpp
src/timeline2/model/trackmodel.hpp
+2
-0
No files found.
src/timeline2/model/builders/meltBuilder.cpp
View file @
c69bc854
...
...
@@ -48,7 +48,7 @@ static QStringList m_errorMessage;
bool
constructTrackFromMelt
(
const
std
::
shared_ptr
<
TimelineItemModel
>
&
timeline
,
int
tid
,
Mlt
::
Tractor
&
track
,
const
std
::
unordered_map
<
QString
,
QString
>
&
binIdCorresp
,
Fun
&
undo
,
Fun
&
redo
,
bool
audioTrack
,
QString
originalDecimalPoint
,
QProgressDialog
*
progressDialog
=
nullptr
);
bool
constructTrackFromMelt
(
const
std
::
shared_ptr
<
TimelineItemModel
>
&
timeline
,
int
tid
,
Mlt
::
Playlist
&
track
,
const
std
::
unordered_map
<
QString
,
QString
>
&
binIdCorresp
,
Fun
&
undo
,
Fun
&
redo
,
bool
audioTrack
,
QString
originalDecimalPoint
,
int
playlist
,
Q
Map
<
int
,
int
>
mixList
,
Q
ProgressDialog
*
progressDialog
=
nullptr
);
const
std
::
unordered_map
<
QString
,
QString
>
&
binIdCorresp
,
Fun
&
undo
,
Fun
&
redo
,
bool
audioTrack
,
QString
originalDecimalPoint
,
int
playlist
,
QProgressDialog
*
progressDialog
=
nullptr
);
bool
constructTimelineFromMelt
(
const
std
::
shared_ptr
<
TimelineItemModel
>
&
timeline
,
Mlt
::
Tractor
tractor
,
QProgressDialog
*
progressDialog
,
QString
originalDecimalPoint
)
{
...
...
@@ -127,7 +127,7 @@ bool constructTimelineFromMelt(const std::shared_ptr<TimelineItemModel> &timelin
timeline
->
setTrackProperty
(
tid
,
QStringLiteral
(
"hide"
),
QString
::
number
(
muteState
));
}
ok
=
ok
&&
constructTrackFromMelt
(
timeline
,
tid
,
local_playlist
,
binIdCorresp
,
undo
,
redo
,
audioTrack
,
originalDecimalPoint
,
0
,
{},
progressDialog
);
ok
=
ok
&&
constructTrackFromMelt
(
timeline
,
tid
,
local_playlist
,
binIdCorresp
,
undo
,
redo
,
audioTrack
,
originalDecimalPoint
,
0
,
progressDialog
);
if
(
local_playlist
.
get_int
(
"kdenlive:locked_track"
)
>
0
)
{
lockedTracksIndexes
<<
tid
;
}
...
...
@@ -229,11 +229,9 @@ bool constructTrackFromMelt(const std::shared_ptr<TimelineItemModel> &timeline,
// Check same track transitions
QScopedPointer
<
Mlt
::
Service
>
service
(
track
.
field
());
QList
<
Mlt
::
Transition
*>
compositions
;
QMap
<
int
,
int
>
mixList
;
while
((
service
!=
nullptr
)
&&
service
->
is_valid
())
{
if
(
service
->
type
()
==
transition_type
)
{
Mlt
::
Transition
t
((
mlt_transition
)
service
->
get_service
());
mixList
.
insert
(
t
.
get_in
(),
t
.
get_out
());
QString
id
(
t
.
get
(
"kdenlive_id"
));
compositions
<<
new
Mlt
::
Transition
(
t
);
if
(
id
.
isEmpty
())
{
...
...
@@ -250,7 +248,7 @@ bool constructTrackFromMelt(const std::shared_ptr<TimelineItemModel> &timeline,
return
false
;
}
Mlt
::
Playlist
playlist
(
*
sub_track
);
constructTrackFromMelt
(
timeline
,
tid
,
playlist
,
binIdCorresp
,
undo
,
redo
,
audioTrack
,
originalDecimalPoint
,
i
,
mixList
,
progressDialog
);
constructTrackFromMelt
(
timeline
,
tid
,
playlist
,
binIdCorresp
,
undo
,
redo
,
audioTrack
,
originalDecimalPoint
,
i
,
progressDialog
);
if
(
i
==
0
)
{
// Pass track properties
int
height
=
track
.
get_int
(
"kdenlive:trackheight"
);
...
...
@@ -314,10 +312,9 @@ PlaylistState::ClipState inferState(const std::shared_ptr<Mlt::Producer> &prod,
}
// namespace
bool
constructTrackFromMelt
(
const
std
::
shared_ptr
<
TimelineItemModel
>
&
timeline
,
int
tid
,
Mlt
::
Playlist
&
track
,
const
std
::
unordered_map
<
QString
,
QString
>
&
binIdCorresp
,
Fun
&
undo
,
Fun
&
redo
,
bool
audioTrack
,
QString
originalDecimalPoint
,
int
playlist
,
Q
Map
<
int
,
int
>
mixList
,
Q
ProgressDialog
*
progressDialog
)
const
std
::
unordered_map
<
QString
,
QString
>
&
binIdCorresp
,
Fun
&
undo
,
Fun
&
redo
,
bool
audioTrack
,
QString
originalDecimalPoint
,
int
playlist
,
QProgressDialog
*
progressDialog
)
{
int
max
=
track
.
count
();
qDebug
()
<<
"=====GOT MIXLIST FOR TID:
\n
"
<<
mixList
<<
"
\n\n
______________________________________________________"
;
for
(
int
i
=
0
;
i
<
max
;
i
++
)
{
if
(
track
.
is_blank
(
i
))
{
continue
;
...
...
@@ -368,12 +365,7 @@ bool constructTrackFromMelt(const std::shared_ptr<TimelineItemModel> &timeline,
if
(
pCore
->
bin
()
->
getBinClip
(
binId
))
{
PlaylistState
::
ClipState
st
=
inferState
(
clip
,
audioTrack
);
qDebug
()
<<
"==== INSERTING CLIP IN PLAYLIST: "
<<
playlist
<<
"
\n
8888888888888888888888"
;
int
mixDuration
=
0
;
if
(
mixList
.
contains
(
position
))
{
// Clip has a mix
mixDuration
=
mixList
.
value
(
position
)
-
position
;
}
cid
=
ClipModel
::
construct
(
timeline
,
binId
,
clip
,
st
,
tid
,
originalDecimalPoint
,
playlist
,
mixDuration
);
cid
=
ClipModel
::
construct
(
timeline
,
binId
,
clip
,
st
,
tid
,
originalDecimalPoint
,
playlist
);
ok
=
timeline
->
requestClipMove
(
cid
,
tid
,
position
,
true
,
true
,
false
,
true
,
undo
,
redo
);
}
else
{
qDebug
()
<<
"// Cannot find bin clip: "
<<
binId
<<
" - "
<<
clip
->
get
(
"id"
);
...
...
src/timeline2/model/clipmodel.cpp
View file @
c69bc854
...
...
@@ -102,7 +102,7 @@ void ClipModel::allSnaps(std::vector<int> &snaps, int offset)
}
int
ClipModel
::
construct
(
const
std
::
shared_ptr
<
TimelineModel
>
&
parent
,
const
QString
&
binClipId
,
const
std
::
shared_ptr
<
Mlt
::
Producer
>
&
producer
,
PlaylistState
::
ClipState
state
,
int
tid
,
QString
originalDecimalPoint
,
int
playlist
,
int
mixDuration
)
PlaylistState
::
ClipState
state
,
int
tid
,
QString
originalDecimalPoint
,
int
playlist
)
{
// we hand the producer to the bin clip, and in return we get a cut to a good master producer
...
...
@@ -131,7 +131,6 @@ int ClipModel::construct(const std::shared_ptr<TimelineModel> &parent, const QSt
}
clip
->
setClipState_lambda
(
state
)();
clip
->
setSubPlaylistIndex
(
playlist
);
clip
->
setMixDuration
(
mixDuration
);
parent
->
registerClip
(
clip
);
clip
->
m_effectStack
->
importEffects
(
producer
,
state
,
result
.
second
,
originalDecimalPoint
);
clip
->
m_clipMarkerModel
->
setReferenceModel
(
binClip
->
getMarkerModel
(),
speed
);
...
...
src/timeline2/model/clipmodel.hpp
View file @
c69bc854
...
...
@@ -65,7 +65,7 @@ public:
Note that there is no guarantee that this producer is actually going to be used. It might be discarded.
*/
static
int
construct
(
const
std
::
shared_ptr
<
TimelineModel
>
&
parent
,
const
QString
&
binClipId
,
const
std
::
shared_ptr
<
Mlt
::
Producer
>
&
producer
,
PlaylistState
::
ClipState
state
,
int
tid
,
QString
originalDecimalPoint
,
int
playlist
=
0
,
int
mixDuration
=
0
);
PlaylistState
::
ClipState
state
,
int
tid
,
QString
originalDecimalPoint
,
int
playlist
=
0
);
/** @brief returns a property of the clip, or from it's parent if it's a cut
*/
...
...
src/timeline2/model/timelinemodel.cpp
View file @
c69bc854
...
...
@@ -2719,13 +2719,13 @@ int TimelineModel::requestItemResize(int itemId, int size, bool right, bool logU
adjust_mix
=
[
this
,
tid
,
mixData
,
currentMixCut
,
itemId
]()
{
MixInfo
secondMixData
=
getTrackById_const
(
tid
)
->
getMixInfo
(
itemId
).
second
;
int
offset
=
mixData
.
second
.
firstClipInOut
.
second
-
secondMixData
.
firstClipInOut
.
second
;
m_allClips
[
secondMixData
.
secondClipId
]
->
setMixDuration
(
secondMixData
.
firstClipInOut
.
second
-
secondMixData
.
secondClipInOut
.
first
,
currentMixCut
-
offset
);
getTrackById_const
(
tid
)
->
setMixDuration
(
secondMixData
.
secondClipId
,
secondMixData
.
firstClipInOut
.
second
-
secondMixData
.
secondClipInOut
.
first
,
currentMixCut
-
offset
);
QModelIndex
ix
=
makeClipIndexFromID
(
secondMixData
.
secondClipId
);
emit
dataChanged
(
ix
,
ix
,
{
TimelineModel
::
MixRole
,
TimelineModel
::
MixCutRole
});
return
true
;
};
Fun
adjust_mix_undo
=
[
this
,
mixData
,
currentMixCut
,
currentMixDuration
]()
{
m_allClips
[
mixData
.
second
.
secondClipId
]
->
setMixDuration
(
currentMixDuration
,
currentMixCut
);
Fun
adjust_mix_undo
=
[
this
,
tid
,
mixData
,
currentMixCut
,
currentMixDuration
]()
{
getTrackById_const
(
tid
)
->
setMixDuration
(
mixData
.
second
.
secondClipId
,
currentMixDuration
,
currentMixCut
);
QModelIndex
ix
=
makeClipIndexFromID
(
mixData
.
second
.
secondClipId
);
emit
dataChanged
(
ix
,
ix
,
{
TimelineModel
::
MixRole
,
TimelineModel
::
MixCutRole
});
return
true
;
...
...
@@ -2921,7 +2921,7 @@ bool TimelineModel::requestItemResize(int itemId, int size, bool right, bool log
std
::
pair
<
MixInfo
,
MixInfo
>
mixData
=
getTrackById_const
(
tid
)
->
getMixInfo
(
itemId
);
// We have a mix at clip start
int
mixDuration
=
mixData
.
first
.
firstClipInOut
.
second
-
(
mixData
.
first
.
secondClipInOut
.
second
-
size
);
m_allClips
[
itemId
]
->
setMixDuration
(
qMax
(
1
,
mixDuration
),
m_allClips
[
itemId
]
->
getMixCutPosition
());
getTrackById_const
(
tid
)
->
setMixDuration
(
itemId
,
qMax
(
1
,
mixDuration
),
m_allClips
[
itemId
]
->
getMixCutPosition
());
QModelIndex
ix
=
makeClipIndexFromID
(
itemId
);
emit
dataChanged
(
ix
,
ix
,
{
TimelineModel
::
MixRole
,
TimelineModel
::
MixCutRole
});
}
...
...
src/timeline2/model/trackmodel.cpp
View file @
c69bc854
...
...
@@ -1503,6 +1503,7 @@ bool TrackModel::requestRemoveMix(std::pair<int, int> clipIds, Fun &undo, Fun &r
if
(
isAudioTrack
())
{
std
::
shared_ptr
<
Mlt
::
Transition
>
t
(
new
Mlt
::
Transition
(
*
ptr
->
getProfile
(),
"mix"
));
t
->
set_in_and_out
(
mixPosition
,
mixPosition
+
mixDuration
);
t
->
set
(
"kdenlive:mixcut"
,
mixCutPos
);
if
(
src_track
==
0
)
{
t
->
set
(
"reverse"
,
1
);
}
...
...
@@ -1511,6 +1512,7 @@ bool TrackModel::requestRemoveMix(std::pair<int, int> clipIds, Fun &undo, Fun &r
}
else
{
std
::
shared_ptr
<
Mlt
::
Transition
>
t
(
new
Mlt
::
Transition
(
*
ptr
->
getProfile
(),
"luma"
));
t
->
set_in_and_out
(
mixPosition
,
mixPosition
+
mixDuration
);
t
->
set
(
"kdenlive:mixcut"
,
mixCutPos
);
if
(
src_track
==
0
)
{
t
->
set
(
"reverse"
,
1
);
}
...
...
@@ -1707,6 +1709,7 @@ bool TrackModel::requestClipMix(std::pair<int, int> clipIds, int mixDuration, bo
if
(
isAudioTrack
())
{
std
::
shared_ptr
<
Mlt
::
Transition
>
t
(
new
Mlt
::
Transition
(
*
ptr
->
getProfile
(),
"mix"
));
t
->
set_in_and_out
(
mixPosition
,
mixPosition
+
mixDuration
);
t
->
set
(
"kdenlive:mixcut"
,
secondClipCut
);
if
(
dest_track
==
0
)
{
t
->
set
(
"reverse"
,
1
);
}
...
...
@@ -1715,6 +1718,7 @@ bool TrackModel::requestClipMix(std::pair<int, int> clipIds, int mixDuration, bo
}
else
{
std
::
shared_ptr
<
Mlt
::
Transition
>
t
(
new
Mlt
::
Transition
(
*
ptr
->
getProfile
(),
"luma"
));
t
->
set_in_and_out
(
mixPosition
,
mixPosition
+
mixDuration
);
t
->
set
(
"kdenlive:mixcut"
,
secondClipCut
);
if
(
dest_track
==
0
)
{
t
->
set
(
"reverse"
,
1
);
}
...
...
@@ -1937,6 +1941,12 @@ bool TrackModel::createMix(std::pair<int, int> clipIds, std::pair<int, int> mixD
return
false
;
}
void
TrackModel
::
setMixDuration
(
int
cid
,
int
mixDuration
,
int
mixCut
)
{
m_allClips
[
cid
]
->
setMixDuration
(
mixDuration
,
mixCut
);
m_sameCompositions
[
cid
]
->
set
(
"kdenlive:mixcut"
,
mixCut
);
}
void
TrackModel
::
syncronizeMixes
(
bool
finalMove
)
{
QList
<
int
>
toDelete
;
...
...
@@ -2027,5 +2037,6 @@ bool TrackModel::loadMix(Mlt::Transition &t)
std
::
shared_ptr
<
Mlt
::
Transition
>
tr
(
&
t
);
m_sameCompositions
[
cid2
]
=
tr
;
m_mixList
.
insert
(
cid1
,
cid2
);
setMixDuration
(
cid2
,
t
.
get_length
()
-
1
,
t
.
get_int
(
"kdenlive:mixcut"
));
return
true
;
}
src/timeline2/model/trackmodel.hpp
View file @
c69bc854
...
...
@@ -136,6 +136,8 @@ public:
bool
switchPlaylist
(
int
clipId
,
int
position
,
int
sourcePlaylist
,
int
destPlaylist
);
/** @brief Load a same track transition from project */
bool
loadMix
(
Mlt
::
Transition
&
t
);
/** @brief Set mix duration and mix cut pos on a clip */
void
setMixDuration
(
int
cid
,
int
mixDuration
,
int
mixCut
);
protected:
/* @brief This will lock the track: it will no longer allow insertion/deletion/resize of items
...
...
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