Skip to content
GitLab
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
81d3e661
Commit
81d3e661
authored
Nov 18, 2022
by
Jean-Baptiste Mardelle
Browse files
Various fixes for spacer operation with subtitle track
parent
323ec2c2
Pipeline
#269984
passed with stage
in 8 minutes and 26 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/bin/model/subtitlemodel.cpp
View file @
81d3e661
...
...
@@ -1385,6 +1385,13 @@ int SubtitleModel::getBlankEnd(int pos) const
return
found
?
min
.
frames
(
pCore
->
getCurrentFps
())
:
0
;
}
int
SubtitleModel
::
getBlankSizeAtPos
(
int
frame
)
const
{
int
bkStart
=
getBlankStart
(
frame
);
int
bkEnd
=
getBlankEnd
(
frame
);
return
bkEnd
-
bkStart
;
}
int
SubtitleModel
::
getBlankStart
(
int
pos
)
const
{
GenTime
matchPos
(
pos
,
pCore
->
getCurrentFps
());
...
...
src/bin/model/subtitlemodel.hpp
View file @
81d3e661
...
...
@@ -136,6 +136,8 @@ public:
int
getBlankStart
(
int
pos
)
const
;
/** @brief Returns the position of the first subtitle after the blank at @position */
int
getBlankEnd
(
int
pos
)
const
;
/** @brief Returns the duration of the blank at @position */
int
getBlankSizeAtPos
(
int
frame
)
const
;
/** @brief If pos is blank, returns the position of the blank start. Otherwise returns the position of the next blank frame */
int
getNextBlankStart
(
int
pos
)
const
;
/** @brief Returns true is track is empty at pos */
...
...
src/timeline2/model/timelinefunctions.cpp
View file @
81d3e661
...
...
@@ -454,12 +454,23 @@ std::pair<int, int> TimelineFunctions::requestSpacerStartOperation(const std::sh
firstCid
=
it
.
value
();
}
}
if
(
timeline
->
getTrackById_const
(
it
.
key
())
->
isBlankAt
(
clipPos
-
1
))
{
if
(
spaceDuration
==
-
1
)
{
spaceDuration
=
timeline
->
getTrackById_const
(
it
.
key
())
->
getBlankSizeAtPos
(
clipPos
-
1
);
}
else
{
int
blank
=
timeline
->
getTrackById_const
(
it
.
key
())
->
getBlankSizeAtPos
(
clipPos
-
1
);
spaceDuration
=
qMin
(
blank
,
spaceDuration
);
if
(
timeline
->
isSubtitleTrack
(
it
.
key
()))
{
if
(
timeline
->
getSubtitleModel
()
->
isBlankAt
(
clipPos
-
1
))
{
if
(
spaceDuration
==
-
1
)
{
spaceDuration
=
timeline
->
getSubtitleModel
()
->
getBlankSizeAtPos
(
clipPos
-
1
);
}
else
{
int
blank
=
timeline
->
getSubtitleModel
()
->
getBlankSizeAtPos
(
clipPos
-
1
);
spaceDuration
=
qMin
(
blank
,
spaceDuration
);
}
}
}
else
{
if
(
timeline
->
getTrackById_const
(
it
.
key
())
->
isBlankAt
(
clipPos
-
1
))
{
if
(
spaceDuration
==
-
1
)
{
spaceDuration
=
timeline
->
getTrackById_const
(
it
.
key
())
->
getBlankSizeAtPos
(
clipPos
-
1
);
}
else
{
int
blank
=
timeline
->
getTrackById_const
(
it
.
key
())
->
getBlankSizeAtPos
(
clipPos
-
1
);
spaceDuration
=
qMin
(
blank
,
spaceDuration
);
}
}
}
if
(
relatedMaxSpace
.
contains
(
it
.
key
()))
{
...
...
src/timeline2/model/timelinemodel.cpp
View file @
81d3e661
...
...
@@ -263,6 +263,10 @@ int TimelineModel::getItemTrackId(int itemId) const
if
(
isComposition
(
itemId
))
{
return
getCompositionTrackId
(
itemId
);
}
if
(
isSubTitle
(
itemId
))
{
// TODO: fix when introducing multiple subtitle tracks
return
-
2
;
}
return
-
1
;
}
...
...
@@ -2114,7 +2118,7 @@ std::unordered_set<int> TimelineModel::getItemsInRange(int trackId, int start, i
Q_UNUSED
(
listCompositions
)
std
::
unordered_set
<
int
>
allClips
;
if (isSubtitleTrack(trackId)) {
if
(
isSubtitleTrack
(
trackId
)
||
trackId
==
-
1
)
{
// Subtitles
if
(
m_subtitleModel
)
{
std
::
unordered_set
<
int
>
subs
=
m_subtitleModel
->
getItemsInRange
(
start
,
end
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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