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
261
Issues
261
List
Boards
Labels
Service Desk
Milestones
Merge Requests
16
Merge Requests
16
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
2e3d964b
Commit
2e3d964b
authored
May 18, 2016
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More clever monitor refresh / timeline preview invalidate on timeline operations
parent
265281b7
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
294 additions
and
132 deletions
+294
-132
src/definitions.h
src/definitions.h
+1
-1
src/timeline/clipitem.cpp
src/timeline/clipitem.cpp
+5
-0
src/timeline/clipitem.h
src/timeline/clipitem.h
+3
-1
src/timeline/customtrackview.cpp
src/timeline/customtrackview.cpp
+245
-80
src/timeline/customtrackview.h
src/timeline/customtrackview.h
+1
-0
src/timeline/timeline.cpp
src/timeline/timeline.cpp
+0
-1
src/timeline/timelinecommands.cpp
src/timeline/timelinecommands.cpp
+22
-5
src/timeline/timelinecommands.h
src/timeline/timelinecommands.h
+17
-2
src/timeline/track.cpp
src/timeline/track.cpp
+0
-41
src/timeline/track.h
src/timeline/track.h
+0
-1
No files found.
src/definitions.h
View file @
2e3d964b
...
...
@@ -222,7 +222,7 @@ public:
bool
contains
(
GenTime
pos
)
const
{
if
(
startPos
==
endPos
)
return
true
;
return
(
pos
<
endPos
&&
pos
>
startPos
);
return
(
pos
<
=
endPos
&&
pos
>=
startPos
);
}
bool
operator
==
(
const
ItemInfo
&
a
)
{
...
...
src/timeline/clipitem.cpp
View file @
2e3d964b
...
...
@@ -1935,3 +1935,8 @@ void ClipItem::updateKeyframes(QDomElement effect)
}
m_keyframeView
.
loadKeyframes
(
locale
,
e
,
cropStart
().
frames
(
m_fps
),
cropDuration
().
frames
(
m_fps
));
}
bool
ClipItem
::
hasVisibleVideo
()
const
{
return
(
m_clipType
!=
Audio
&&
m_clipState
!=
PlaylistState
::
AudioOnly
&&
m_clipState
!=
PlaylistState
::
Disabled
);
}
src/timeline/clipitem.h
View file @
2e3d964b
...
...
@@ -188,12 +188,14 @@ public:
/** @brief Returns true of this clip needs a duplicate (MLT requires duplicate for clips with audio or we get clicks. */
bool
needsDuplicate
()
const
;
/** @brief Returns true
o
f this has audio. */
/** @brief Returns true
i
f this has audio. */
bool
isSplittable
()
const
;
/** @brief Returns some info useful for recreating this clip. */
PlaylistState
::
ClipState
clipState
()
const
;
PlaylistState
::
ClipState
originalState
()
const
;
/** @brief Returns true if this clip is currently displaying video. */
bool
hasVisibleVideo
()
const
;
protected:
void
dragEnterEvent
(
QGraphicsSceneDragDropEvent
*
event
);
...
...
src/timeline/customtrackview.cpp
View file @
2e3d964b
This diff is collapsed.
Click to expand it.
src/timeline/customtrackview.h
View file @
2e3d964b
...
...
@@ -210,6 +210,7 @@ public:
int
seekPosition
()
const
;
/** @brief Trigger a monitor refresh. */
void
monitorRefresh
(
QList
<
ItemInfo
>
range
,
bool
invalidateRange
=
false
);
void
monitorRefresh
(
bool
invalidateRange
=
false
);
/** @brief Trigger a monitor refresh if timeline cursor is inside range. */
void
monitorRefresh
(
ItemInfo
range
,
bool
invalidateRange
=
false
);
...
...
src/timeline/timeline.cpp
View file @
2e3d964b
...
...
@@ -319,7 +319,6 @@ int Timeline::getTracks() {
}
connect
(
tk
,
&
Track
::
newTrackDuration
,
this
,
&
Timeline
::
checkDuration
,
Qt
::
DirectConnection
);
connect
(
tk
,
SIGNAL
(
storeSlowMotion
(
QString
,
Mlt
::
Producer
*
)),
m_doc
->
renderer
(),
SLOT
(
storeSlowmotionProducer
(
QString
,
Mlt
::
Producer
*
)));
connect
(
tk
,
&
Track
::
invalidatePreview
,
this
,
&
Timeline
::
invalidatePreview
);
}
}
headers_container
->
setFixedWidth
(
headerWidth
);
...
...
src/timeline/timelinecommands.cpp
View file @
2e3d964b
...
...
@@ -62,7 +62,7 @@ void AddEffectCommand::redo()
m_view
->
deleteEffect
(
m_track
,
m_pos
,
m_effect
);
}
AddTimelineClipCommand
::
AddTimelineClipCommand
(
CustomTrackView
*
view
,
const
QString
&
clipId
,
const
ItemInfo
&
info
,
const
EffectsList
&
effects
,
PlaylistState
::
ClipState
state
,
bool
doIt
,
bool
doRemove
,
QUndoCommand
*
parent
)
:
AddTimelineClipCommand
::
AddTimelineClipCommand
(
CustomTrackView
*
view
,
const
QString
&
clipId
,
const
ItemInfo
&
info
,
const
EffectsList
&
effects
,
PlaylistState
::
ClipState
state
,
bool
doIt
,
bool
doRemove
,
bool
refreshMonitor
,
QUndoCommand
*
parent
)
:
QUndoCommand
(
parent
),
m_view
(
view
),
m_clipId
(
clipId
),
...
...
@@ -70,7 +70,8 @@ AddTimelineClipCommand::AddTimelineClipCommand(CustomTrackView *view, const QStr
m_effects
(
effects
),
m_state
(
state
),
m_doIt
(
doIt
),
m_remove
(
doRemove
)
m_remove
(
doRemove
),
m_refresh
(
refreshMonitor
)
{
if
(
!
m_remove
)
setText
(
i18n
(
"Add timeline clip"
));
else
setText
(
i18n
(
"Delete timeline clip"
));
...
...
@@ -720,7 +721,7 @@ void RebuildGroupCommand::redo()
m_view
->
rebuildGroup
(
m_childTrack
,
m_childPos
);
}
RefreshMonitorCommand
::
RefreshMonitorCommand
(
CustomTrackView
*
view
,
ItemInfo
info
,
bool
execute
,
bool
refreshOnUndo
,
QUndoCommand
*
parent
)
:
RefreshMonitorCommand
::
RefreshMonitorCommand
(
CustomTrackView
*
view
,
QList
<
ItemInfo
>
info
,
bool
execute
,
bool
refreshOnUndo
,
QUndoCommand
*
parent
)
:
QUndoCommand
(
parent
),
m_view
(
view
),
m_info
(
info
),
...
...
@@ -728,20 +729,36 @@ RefreshMonitorCommand::RefreshMonitorCommand(CustomTrackView *view, ItemInfo inf
m_execOnUndo
(
refreshOnUndo
)
{
}
RefreshMonitorCommand
::
RefreshMonitorCommand
(
CustomTrackView
*
view
,
ItemInfo
info
,
bool
execute
,
bool
refreshOnUndo
,
QUndoCommand
*
parent
)
:
QUndoCommand
(
parent
),
m_view
(
view
),
m_info
(
QList
<
ItemInfo
>
()
<<
info
),
m_exec
(
execute
),
m_execOnUndo
(
refreshOnUndo
)
{
}
// virtual
void
RefreshMonitorCommand
::
undo
()
{
if
(
m_execOnUndo
)
m_view
->
monitorRefresh
(
m_info
);
m_view
->
monitorRefresh
(
m_info
,
true
);
}
// virtual
void
RefreshMonitorCommand
::
redo
()
{
if
(
m_exec
&&
!
m_execOnUndo
)
m_view
->
monitorRefresh
(
m_info
);
m_view
->
monitorRefresh
(
m_info
,
true
);
m_exec
=
true
;
}
void
RefreshMonitorCommand
::
updateRange
(
QList
<
ItemInfo
>
info
)
{
m_info
.
clear
();
m_info
=
info
;
}
ResizeClipCommand
::
ResizeClipCommand
(
CustomTrackView
*
view
,
const
ItemInfo
&
start
,
const
ItemInfo
&
end
,
bool
doIt
,
bool
dontWorry
,
QUndoCommand
*
parent
)
:
QUndoCommand
(
parent
),
m_view
(
view
),
...
...
src/timeline/timelinecommands.h
View file @
2e3d964b
...
...
@@ -49,7 +49,19 @@ private:
class
AddTimelineClipCommand
:
public
QUndoCommand
{
public:
AddTimelineClipCommand
(
CustomTrackView
*
view
,
const
QString
&
clipId
,
const
ItemInfo
&
info
,
const
EffectsList
&
effects
,
PlaylistState
::
ClipState
state
,
bool
doIt
,
bool
doRemove
,
QUndoCommand
*
parent
=
0
);
/** @brief Add clip in timeline.
* @param view The parent view
* @param clipId The Bin clip id
* @param info The position where to add clip
* @param effects the clip's effectStack
* @param state the clip's playlist state
* @param doIt whether to execute command on first run
* @param doRemove Should the clip be deleted or added on execute
* @param refreshMonitor Should the monitor be refreshed on execute (false if this command is in a group and
* refresh is executed separately
* @param parent The parent command
* */
AddTimelineClipCommand
(
CustomTrackView
*
view
,
const
QString
&
clipId
,
const
ItemInfo
&
info
,
const
EffectsList
&
effects
,
PlaylistState
::
ClipState
state
,
bool
doIt
,
bool
doRemove
,
bool
refreshMonitor
,
QUndoCommand
*
parent
=
0
);
void
undo
();
void
redo
();
private:
...
...
@@ -60,6 +72,7 @@ private:
PlaylistState
::
ClipState
m_state
;
bool
m_doIt
;
bool
m_remove
;
bool
m_refresh
;
};
class
AddTrackCommand
:
public
QUndoCommand
...
...
@@ -385,12 +398,14 @@ private:
class
RefreshMonitorCommand
:
public
QUndoCommand
{
public:
RefreshMonitorCommand
(
CustomTrackView
*
view
,
QList
<
ItemInfo
>
info
,
bool
execute
,
bool
refreshOnUndo
,
QUndoCommand
*
parent
=
0
);
RefreshMonitorCommand
(
CustomTrackView
*
view
,
ItemInfo
info
,
bool
execute
,
bool
refreshOnUndo
,
QUndoCommand
*
parent
=
0
);
void
undo
();
void
redo
();
void
updateRange
(
QList
<
ItemInfo
>
info
);
private:
CustomTrackView
*
m_view
;
ItemInfo
m_info
;
QList
<
ItemInfo
>
m_info
;
bool
m_exec
;
bool
m_execOnUndo
;
};
...
...
src/timeline/track.cpp
View file @
2e3d964b
...
...
@@ -116,8 +116,6 @@ bool Track::doAdd(qreal t, Mlt::Producer *cut, TimelineMode::EditMode mode)
if
(
m_playlist
.
insert_at
(
pos
,
cut
,
1
)
==
m_playlist
.
count
()
-
1
)
{
emit
newTrackDuration
(
m_playlist
.
get_playtime
());
}
if
(
type
!=
AudioTrack
)
emit
invalidatePreview
(
pos
,
len
);
return
true
;
}
...
...
@@ -146,8 +144,6 @@ bool Track::move(qreal start, qreal end, TimelineMode::EditMode mode)
if
(
durationChanged
)
{
emit
newTrackDuration
(
m_playlist
.
get_playtime
());
}
if
(
type
!=
AudioTrack
)
emit
invalidatePreview
(
pos
,
clipProducer
->
get_playtime
());
return
result
;
}
...
...
@@ -169,10 +165,8 @@ bool Track::del(qreal t)
if
(
ix
==
m_playlist
.
count
()
-
1
)
{
durationChanged
=
true
;
}
int
length
=
0
;
Mlt
::
Producer
*
clip
=
m_playlist
.
replace_with_blank
(
ix
);
if
(
clip
)
{
length
=
clip
->
get_playtime
();
delete
clip
;
}
else
{
...
...
@@ -185,8 +179,6 @@ bool Track::del(qreal t)
if
(
durationChanged
)
{
emit
newTrackDuration
(
m_playlist
.
get_playtime
());
}
if
(
type
!=
AudioTrack
)
emit
invalidatePreview
(
pos
,
length
);
return
true
;
}
...
...
@@ -196,8 +188,6 @@ bool Track::del(qreal t, qreal dt)
m_playlist
.
insert_blank
(
m_playlist
.
remove_region
(
frame
(
t
),
frame
(
dt
)
+
1
),
frame
(
dt
));
m_playlist
.
consolidate_blanks
();
m_playlist
.
unlock
();
if
(
type
!=
AudioTrack
)
emit
invalidatePreview
(
frame
(
t
),
frame
(
dt
));
return
true
;
}
...
...
@@ -207,7 +197,6 @@ bool Track::resize(qreal t, qreal dt, bool end)
int
startFrame
=
frame
(
t
);
int
index
=
m_playlist
.
get_clip_index_at
(
startFrame
);
int
length
=
frame
(
dt
);
int
updateLength
=
length
;
QScopedPointer
<
Mlt
::
Producer
>
clip
(
m_playlist
.
get_clip
(
index
));
if
(
clip
==
NULL
||
clip
->
is_blank
())
{
qWarning
(
"Can't resize clip at %f"
,
t
);
...
...
@@ -246,12 +235,6 @@ bool Track::resize(qreal t, qreal dt, bool end)
m_playlist
.
unlock
();
// this is the last clip in track, check tracks length to adjust black track and project duration
emit
newTrackDuration
(
m_playlist
.
get_playtime
());
if
(
type
!=
AudioTrack
)
{
if
(
updateLength
>
0
)
emit
invalidatePreview
(
startFrame
,
updateLength
);
else
emit
invalidatePreview
(
startFrame
+
updateLength
,
-
updateLength
);
}
return
true
;
}
length
=
-
length
;
...
...
@@ -277,12 +260,6 @@ bool Track::resize(qreal t, qreal dt, bool end)
m_playlist
.
consolidate_blanks
();
m_playlist
.
unlock
();
if
(
type
!=
AudioTrack
)
{
if
(
updateLength
>
0
)
emit
invalidatePreview
(
startFrame
,
updateLength
);
else
emit
invalidatePreview
(
startFrame
+
updateLength
,
-
updateLength
);
}
return
true
;
}
...
...
@@ -366,7 +343,6 @@ bool Track::replaceAll(const QString &id, Mlt::Producer *original, Mlt::Producer
QString
service
=
original
->
parent
().
get
(
"mlt_service"
);
QString
idForTrack
=
original
->
parent
().
get
(
"id"
);
QLocale
locale
;
QList
<
QPoint
>
updateList
;
if
(
needsDuplicate
(
service
))
{
// We have to use the track clip duplication functions, because of audio glitches in MLT's multitrack
idForAudioTrack
=
idForTrack
+
QLatin1Char
(
'_'
)
+
m_playlist
.
get
(
"id"
)
+
"_audio"
;
...
...
@@ -385,9 +361,6 @@ bool Track::replaceAll(const QString &id, Mlt::Producer *original, Mlt::Producer
}
current
.
remove
(
0
,
1
);
Mlt
::
Producer
*
cut
=
NULL
;
if
(
type
!=
AudioTrack
)
{
updateList
<<
QPoint
(
m_playlist
.
clip_start
(
i
),
m_playlist
.
clip_length
(
i
));
}
if
(
current
.
startsWith
(
"slowmotion:"
+
id
+
":"
))
{
// Slowmotion producer, just update resource
Mlt
::
Producer
*
slowProd
=
newSlowMos
.
value
(
current
.
section
(
QStringLiteral
(
":"
),
2
));
...
...
@@ -436,9 +409,6 @@ bool Track::replaceAll(const QString &id, Mlt::Producer *original, Mlt::Producer
delete
cut
;
}
}
foreach
(
const
QPoint
&
pt
,
updateList
)
{
emit
invalidatePreview
(
pt
.
x
(),
pt
.
y
());
}
return
found
;
}
...
...
@@ -468,8 +438,6 @@ bool Track::replace(qreal t, Mlt::Producer *prod, PlaylistState::ClipState state
bool
ok
=
m_playlist
.
insert_at
(
frame
(
t
),
cut
,
1
)
>=
0
;
delete
cut
;
m_playlist
.
unlock
();
if
(
type
!=
AudioTrack
)
emit
invalidatePreview
(
frame
(
t
),
orig
->
get_playtime
());
return
ok
;
}
...
...
@@ -479,7 +447,6 @@ void Track::updateEffects(const QString &id, Mlt::Producer *original)
QString
idForVideoTrack
;
QString
service
=
original
->
parent
().
get
(
"mlt_service"
);
QString
idForTrack
=
original
->
parent
().
get
(
"id"
);
QList
<
QPoint
>
updateList
;
if
(
needsDuplicate
(
service
))
{
// We have to use the track clip duplication functions, because of audio glitches in MLT's multitrack
idForAudioTrack
=
idForTrack
+
QLatin1Char
(
'_'
)
+
m_playlist
.
get
(
"id"
)
+
"_audio"
;
...
...
@@ -495,24 +462,16 @@ void Track::updateEffects(const QString &id, Mlt::Producer *original)
if
(
current
.
startsWith
(
QLatin1String
(
"slowmotion:"
)))
{
if
(
current
.
section
(
QStringLiteral
(
":"
),
1
,
1
)
==
id
)
{
Clip
(
origin
).
replaceEffects
(
*
original
);
updateList
<<
QPoint
(
m_playlist
.
clip_start
(
i
),
m_playlist
.
clip_length
(
i
));
}
}
else
if
(
current
==
id
)
{
// we are directly using original producer, no need to update effects
updateList
<<
QPoint
(
m_playlist
.
clip_start
(
i
),
m_playlist
.
clip_length
(
i
));
continue
;
}
else
if
(
current
.
section
(
QStringLiteral
(
"_"
),
0
,
0
)
==
id
)
{
updateList
<<
QPoint
(
m_playlist
.
clip_start
(
i
),
m_playlist
.
clip_length
(
i
));
Clip
(
origin
).
replaceEffects
(
*
original
);
}
}
if
(
type
!=
AudioTrack
)
{
foreach
(
const
QPoint
&
pt
,
updateList
)
{
emit
invalidatePreview
(
pt
.
x
(),
pt
.
y
());
}
}
}
/*Mlt::Producer &Track::find(const QByteArray &name, const QByteArray &value, int startindex) {
...
...
src/timeline/track.h
View file @
2e3d964b
...
...
@@ -211,7 +211,6 @@ signals:
* @param duration is the new length */
void
newTrackDuration
(
int
duration
);
void
storeSlowMotion
(
const
QString
&
url
,
Mlt
::
Producer
*
prod
);
void
invalidatePreview
(
int
position
,
int
length
);
private:
/** Position in MLT's tractor */
...
...
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