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
8403633b
Commit
8403633b
authored
May 06, 2020
by
Jean-Baptiste Mardelle
Browse files
Fix error causing clip duplication in memory on project opening
parent
a495168a
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/bin/projectclip.cpp
View file @
8403633b
...
...
@@ -664,8 +664,7 @@ std::shared_ptr<Mlt::Producer> ProjectClip::getTimelineProducer(int trackId, int
return
std
::
shared_ptr
<
Mlt
::
Producer
>
(
warpProducer
->
cut
());
}
std
::
pair
<
std
::
shared_ptr
<
Mlt
::
Producer
>
,
bool
>
ProjectClip
::
giveMasterAndGetTimelineProducer
(
int
clipId
,
std
::
shared_ptr
<
Mlt
::
Producer
>
master
,
PlaylistState
::
ClipState
state
)
std
::
pair
<
std
::
shared_ptr
<
Mlt
::
Producer
>
,
bool
>
ProjectClip
::
giveMasterAndGetTimelineProducer
(
int
clipId
,
std
::
shared_ptr
<
Mlt
::
Producer
>
master
,
PlaylistState
::
ClipState
state
,
int
tid
)
{
int
in
=
master
->
get_in
();
int
out
=
master
->
get_out
();
...
...
@@ -703,16 +702,16 @@ std::pair<std::shared_ptr<Mlt::Producer>, bool> ProjectClip::giveMasterAndGetTim
return
{
master
,
true
};
}
if
(
state
==
PlaylistState
::
AudioOnly
)
{
m_audioProducers
[
clipI
d
]
=
std
::
make_shared
<
Mlt
::
Producer
>
(
&
master
->
parent
());
m_effectStack
->
loadService
(
m_audioProducers
[
clipI
d
]);
m_audioProducers
[
ti
d
]
=
std
::
make_shared
<
Mlt
::
Producer
>
(
&
master
->
parent
());
m_effectStack
->
loadService
(
m_audioProducers
[
ti
d
]);
return
{
master
,
true
};
}
if
(
state
==
PlaylistState
::
VideoOnly
)
{
// good, we found a master video producer, and we didn't have any
if
(
m_clipType
!=
ClipType
::
Color
&&
m_clipType
!=
ClipType
::
Image
&&
m_clipType
!=
ClipType
::
Text
)
{
// Color, image and text clips always use master producer in timeline
m_videoProducers
[
clipI
d
]
=
std
::
make_shared
<
Mlt
::
Producer
>
(
&
master
->
parent
());
m_effectStack
->
loadService
(
m_videoProducers
[
clipI
d
]);
m_videoProducers
[
ti
d
]
=
std
::
make_shared
<
Mlt
::
Producer
>
(
&
master
->
parent
());
m_effectStack
->
loadService
(
m_videoProducers
[
ti
d
]);
}
return
{
master
,
true
};
}
...
...
src/bin/projectclip.h
View file @
8403633b
...
...
@@ -209,8 +209,7 @@ public:
- if true, then the returned cut still possibly has effect on it. You need to rebuild the effectStack based on this
- if false, then the returned cut don't have effects anymore (it's a fresh one), so you need to reload effects from the old producer
*/
std
::
pair
<
std
::
shared_ptr
<
Mlt
::
Producer
>
,
bool
>
giveMasterAndGetTimelineProducer
(
int
clipId
,
std
::
shared_ptr
<
Mlt
::
Producer
>
master
,
PlaylistState
::
ClipState
state
);
std
::
pair
<
std
::
shared_ptr
<
Mlt
::
Producer
>
,
bool
>
giveMasterAndGetTimelineProducer
(
int
clipId
,
std
::
shared_ptr
<
Mlt
::
Producer
>
master
,
PlaylistState
::
ClipState
state
,
int
tid
);
std
::
shared_ptr
<
Mlt
::
Producer
>
cloneProducer
(
bool
removeEffects
=
false
);
static
std
::
shared_ptr
<
Mlt
::
Producer
>
cloneProducer
(
const
std
::
shared_ptr
<
Mlt
::
Producer
>
&
producer
);
...
...
src/timeline2/model/builders/meltBuilder.cpp
View file @
8403633b
...
...
@@ -328,7 +328,7 @@ bool constructTrackFromMelt(const std::shared_ptr<TimelineItemModel> &timeline,
int
cid
=
-
1
;
if
(
pCore
->
bin
()
->
getBinClip
(
binId
))
{
PlaylistState
::
ClipState
st
=
inferState
(
clip
,
audioTrack
);
cid
=
ClipModel
::
construct
(
timeline
,
binId
,
clip
,
st
);
cid
=
ClipModel
::
construct
(
timeline
,
binId
,
clip
,
st
,
tid
);
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 @
8403633b
...
...
@@ -97,7 +97,7 @@ void ClipModel::allSnaps(std::vector<int> &snaps)
}
int
ClipModel
::
construct
(
const
std
::
shared_ptr
<
TimelineModel
>
&
parent
,
const
QString
&
binClipId
,
const
std
::
shared_ptr
<
Mlt
::
Producer
>
&
producer
,
PlaylistState
::
ClipState
state
)
PlaylistState
::
ClipState
state
,
int
tid
)
{
// we hand the producer to the bin clip, and in return we get a cut to a good master producer
...
...
@@ -119,7 +119,7 @@ int ClipModel::construct(const std::shared_ptr<TimelineModel> &parent, const QSt
speed
=
producer
->
parent
().
get_double
(
"warp_speed"
);
warp_pitch
=
producer
->
parent
().
get_int
(
"warp_pitch"
);
}
auto
result
=
binClip
->
giveMasterAndGetTimelineProducer
(
id
,
producer
,
state
);
auto
result
=
binClip
->
giveMasterAndGetTimelineProducer
(
id
,
producer
,
state
,
tid
);
std
::
shared_ptr
<
ClipModel
>
clip
(
new
ClipModel
(
parent
,
result
.
first
,
binClipId
,
id
,
state
,
speed
));
if
(
warp_pitch
)
{
result
.
first
->
parent
().
set
(
"warp_pitch"
,
1
);
...
...
src/timeline2/model/clipmodel.hpp
View file @
8403633b
...
...
@@ -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
);
PlaylistState
::
ClipState
state
,
int
tid
);
/** @brief returns a property of the clip, or from it's parent if it's a cut
*/
...
...
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