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
58fd31a5
Commit
58fd31a5
authored
Sep 29, 2020
by
Jean-Baptiste Mardelle
Browse files
Add some extra checks for mixes
parent
18fae083
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/timeline2/model/timelinemodel.cpp
View file @
58fd31a5
...
...
@@ -4130,6 +4130,9 @@ bool TimelineModel::unplantComposition(int compoId)
bool
TimelineModel
::
checkConsistency
()
{
// We store all in/outs of clips to check snap points
std
::
map
<
int
,
int
>
snaps
;
for
(
const
auto
&
tck
:
m_iteratorTable
)
{
auto
track
=
(
*
tck
.
second
);
// Check parent/children link for tracks
...
...
@@ -4149,8 +4152,6 @@ bool TimelineModel::checkConsistency()
}
}
// We store all in/outs of clips to check snap points
std
::
map
<
int
,
int
>
snaps
;
// Check parent/children link for clips
for
(
const
auto
&
cp
:
m_allClips
)
{
auto
clip
=
(
cp
.
second
);
...
...
@@ -4167,6 +4168,9 @@ bool TimelineModel::checkConsistency()
if
(
getClipTrackId
(
cp
.
first
)
!=
-
1
)
{
snaps
[
clip
->
getPosition
()]
+=
1
;
snaps
[
clip
->
getPosition
()
+
clip
->
getPlaytime
()]
+=
1
;
if
(
clip
->
getMixDuration
()
>
0
)
{
snaps
[
clip
->
getPosition
()
+
clip
->
getMixDuration
()
-
clip
->
getMixCutPosition
()]
+=
1
;
}
}
if
(
!
clip
->
checkConsistency
())
{
qDebug
()
<<
"Consistency check failed for clip"
<<
cp
.
first
;
...
...
@@ -4190,9 +4194,15 @@ bool TimelineModel::checkConsistency()
snaps
[
clip
->
getPosition
()
+
clip
->
getPlaytime
()]
+=
1
;
}
}
// Check snaps
auto
stored_snaps
=
m_snaps
->
_snaps
();
if
(
snaps
.
size
()
!=
stored_snaps
.
size
())
{
for
(
auto
sn
:
stored_snaps
)
{
qDebug
()
<<
"==== GOT SNAP: "
<<
sn
.
first
;
}
qDebug
()
<<
"Wrong number of snaps: "
<<
snaps
.
size
()
<<
" == "
<<
stored_snaps
.
size
();
return
false
;
}
...
...
src/timeline2/model/trackmodel.cpp
View file @
58fd31a5
...
...
@@ -1000,6 +1000,48 @@ bool TrackModel::checkConsistency()
}
--
it
;
}
// Check Mixes
QScopedPointer
<
Mlt
::
Service
>
service
(
m_track
->
field
());
int
mixCount
=
0
;
qDebug
()
<<
"=== STARTING MIX CHECK ======"
;
while
(
service
!=
nullptr
&&
service
->
is_valid
())
{
if
(
service
->
type
()
==
transition_type
)
{
Mlt
::
Transition
t
((
mlt_transition
)
service
->
get_service
());
service
.
reset
(
service
->
producer
());
// Check that the mix has correct in/out
int
mainId
=
-
1
;
int
mixIn
=
t
.
get_in
();
for
(
auto
it
=
m_sameCompositions
.
begin
();
it
!=
m_sameCompositions
.
end
();
++
it
)
{
if
(
it
->
second
->
get_in
()
==
mixIn
)
{
// Found mix in list
mainId
=
it
->
first
;
break
;
}
}
if
(
mainId
==
-
1
)
{
qDebug
()
<<
"=== Incoherent mix found at: "
<<
mixIn
;
return
false
;
}
// Check in/out)
if
(
mixIn
!=
m_allClips
[
mainId
]
->
getPosition
())
{
qDebug
()
<<
"=== Mix not aligned with its master clip: "
<<
mainId
<<
", at: "
<<
m_allClips
[
mainId
]
->
getPosition
()
<<
", MIX at: "
<<
mixIn
;
return
false
;
}
int
secondClipId
=
m_mixList
.
key
(
mainId
);
if
(
t
.
get_out
()
!=
m_allClips
[
secondClipId
]
->
getPosition
()
+
m_allClips
[
secondClipId
]
->
getPlaytime
())
{
qDebug
()
<<
"=== Mix not aligned with its second clip: "
<<
secondClipId
<<
", end at: "
<<
m_allClips
[
secondClipId
]
->
getPosition
()
+
m_allClips
[
secondClipId
]
->
getPlaytime
()
<<
", MIX at: "
<<
t
.
get_out
();
return
false
;
}
mixCount
++
;
}
else
{
service
.
reset
(
service
->
producer
());
}
}
if
(
mixCount
!=
m_sameCompositions
.
size
()
||
m_sameCompositions
.
size
()
!=
m_mixList
.
count
())
{
// incoherent mix count
qDebug
()
<<
"=== INCORRECT mix count. Existing: "
<<
mixCount
<<
"; REGISTERED: "
<<
m_mixList
.
count
();
return
false
;
}
return
true
;
}
...
...
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