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
4cc8006f
Commit
4cc8006f
authored
Mar 20, 2020
by
Jean-Baptiste Mardelle
Browse files
Refactor drop fps calculation, cleanup monitor markers & fps overlay
parent
d5251aa2
Changes
5
Hide whitespace changes
Inline
Side-by-side
data/pics/splash-background.png
View replaced file @
d5251aa2
View file @
4cc8006f
163 KB
|
W:
|
H:
449 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/monitor/monitor.cpp
View file @
4cc8006f
...
...
@@ -426,6 +426,11 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
// Load monitor overlay qml
loadQmlScene
(
MonitorSceneDefault
);
// Monitor dropped fps timer
m_droppedTimer
.
setInterval
(
1000
);
m_droppedTimer
.
setSingleShot
(
false
);
connect
(
&
m_droppedTimer
,
&
QTimer
::
timeout
,
this
,
&
Monitor
::
checkDrops
);
// Info message widget
m_infoMessage
=
new
KMessageWidget
(
this
);
layout
->
addWidget
(
m_infoMessage
);
...
...
@@ -1343,6 +1348,18 @@ void Monitor::slotSwitchPlay()
{
slotActivateMonitor
();
m_glMonitor
->
switchPlay
(
m_playAction
->
isActive
());
bool
showDropped
;
if
(
m_id
==
Kdenlive
::
ClipMonitor
)
{
showDropped
=
KdenliveSettings
::
displayClipMonitorInfo
()
&
0x20
;
}
else
{
showDropped
=
KdenliveSettings
::
displayProjectMonitorInfo
()
&
0x20
;
}
if
(
showDropped
)
{
m_glMonitor
->
resetDrops
();
m_droppedTimer
.
start
();
}
else
{
m_droppedTimer
.
stop
();
}
resetSpeedInfo
();
}
...
...
@@ -1726,31 +1743,20 @@ void Monitor::onFrameDisplayed(const SharedFrame &frame)
m_playAction
->
setActive
(
false
);
}
m_monitorManager
->
frameDisplayed
(
frame
);
checkDrops
(
m_glMonitor
->
droppedFrames
());
}
void
Monitor
::
checkDrops
(
int
dropped
)
void
Monitor
::
checkDrops
()
{
if
(
m_droppedTimer
.
isValid
())
{
if
(
m_droppedTimer
.
hasExpired
(
1000
))
{
m_droppedTimer
.
invalidate
();
double
fps
=
pCore
->
getCurrentFps
();
if
(
dropped
==
0
)
{
// No dropped frames since last check
m_qmlManager
->
setProperty
(
QStringLiteral
(
"dropped"
),
false
);
m_qmlManager
->
setProperty
(
QStringLiteral
(
"fps"
),
QString
::
number
(
fps
,
'g'
,
2
));
}
else
{
m_glMonitor
->
resetDrops
();
fps
-=
dropped
;
m_qmlManager
->
setProperty
(
QStringLiteral
(
"dropped"
),
true
);
m_qmlManager
->
setProperty
(
QStringLiteral
(
"fps"
),
QString
::
number
(
fps
,
'g'
,
2
));
m_droppedTimer
.
start
();
}
}
}
else
if
(
dropped
>
0
)
{
// Start m_dropTimer
int
dropped
=
m_glMonitor
->
droppedFrames
();
if
(
dropped
==
0
)
{
// No dropped frames since last check
m_qmlManager
->
setProperty
(
QStringLiteral
(
"dropped"
),
false
);
m_qmlManager
->
setProperty
(
QStringLiteral
(
"fps"
),
QString
::
number
(
pCore
->
getCurrentFps
(),
'g'
,
2
));
}
else
{
m_glMonitor
->
resetDrops
();
m_droppedTimer
.
start
();
dropped
=
pCore
->
getCurrentFps
()
-
dropped
;
m_qmlManager
->
setProperty
(
QStringLiteral
(
"dropped"
),
true
);
m_qmlManager
->
setProperty
(
QStringLiteral
(
"fps"
),
QString
::
number
(
dropped
,
'g'
,
2
));
}
}
...
...
@@ -2093,9 +2099,18 @@ void Monitor::updateQmlDisplay(int currentOverlay)
{
m_glMonitor
->
rootObject
()
->
setVisible
((
currentOverlay
&
0x01
)
!=
0
);
m_glMonitor
->
rootObject
()
->
setProperty
(
"showMarkers"
,
currentOverlay
&
0x04
);
m_glMonitor
->
rootObject
()
->
setProperty
(
"showFps"
,
currentOverlay
&
0x20
);
bool
showDropped
=
currentOverlay
&
0x20
;
m_glMonitor
->
rootObject
()
->
setProperty
(
"showFps"
,
showDropped
);
m_glMonitor
->
rootObject
()
->
setProperty
(
"showTimecode"
,
currentOverlay
&
0x02
);
m_glMonitor
->
rootObject
()
->
setProperty
(
"showAudiothumb"
,
currentOverlay
&
0x10
);
if
(
showDropped
)
{
if
(
!
m_droppedTimer
.
isActive
()
&&
m_playAction
->
isActive
())
{
m_glMonitor
->
resetDrops
();
m_droppedTimer
.
start
();
}
}
else
{
m_droppedTimer
.
stop
();
}
}
void
Monitor
::
clearDisplay
()
...
...
src/monitor/monitor.h
View file @
4cc8006f
...
...
@@ -27,7 +27,7 @@
#include
"scopes/sharedframe.h"
#include
"timecodedisplay.h"
#include
<Q
Elapsed
Timer>
#include
<QTimer>
#include
<QToolBar>
#include
<memory>
...
...
@@ -217,7 +217,7 @@ private:
int
m_offset
;
MonitorSceneType
m_lastMonitorSceneType
;
MonitorAudioLevel
*
m_audioMeterWidget
;
Q
Elapsed
Timer
m_droppedTimer
;
QTimer
m_droppedTimer
;
double
m_displayedFps
;
QLabel
*
m_scalingLabel
;
QLabel
*
m_speedLabel
;
...
...
@@ -226,8 +226,6 @@ private:
void
adjustScrollBars
(
float
horizontal
,
float
vertical
);
void
loadQmlScene
(
MonitorSceneType
type
);
void
updateQmlDisplay
(
int
currentOverlay
);
/** @brief Check and display dropped frames */
void
checkDrops
(
int
dropped
);
/** @brief Create temporary Mlt::Tractor holding a clip and it's effectless clone */
void
buildSplitEffect
(
Mlt
::
Producer
*
original
);
/** @brief Reset and hide speed info label */
...
...
@@ -271,6 +269,8 @@ private slots:
void
removeSnapPoint
(
int
pos
);
/** @brief Pause monitor and process seek */
void
processSeek
(
int
pos
);
/** @brief Check and display dropped frames */
void
checkDrops
();
public
slots
:
void
slotSetScreen
(
int
screenIndex
);
...
...
src/monitor/view/kdenliveclipmonitor.qml
View file @
4cc8006f
...
...
@@ -223,8 +223,7 @@ Item {
anchors
{
right
:
parent
.
right
bottom
:
parent
.
bottom
bottomMargin
:
(
audioThumb
.
stateVisible
&&
!
audioThumb
.
isAudioClip
)
?
audioThumb
.
height
:
0
rightMargin
:
4
bottomMargin
:
(
audioThumb
.
stateVisible
&&
!
audioThumb
.
isAudioClip
&&
audioThumb
.
visible
)
?
audioThumb
.
height
:
0
}
}
Label
{
...
...
@@ -235,15 +234,14 @@ Item {
color
:
"
#ffffff
"
padding
:
2
background
:
Rectangle
{
color
:
root
.
dropped
?
"
#99ff0000
"
:
"
#6600
00
00
"
color
:
root
.
dropped
?
"
#99ff0000
"
:
"
#6600
44
00
"
}
text
:
i18n
(
"
%1
fps
"
,
root
.
fps
)
text
:
i18n
(
"
%1fps
"
,
root
.
fps
)
visible
:
root
.
showFps
anchors
{
right
:
timecode
.
visible
?
timecode
.
left
:
parent
.
right
bottom
:
parent
.
bottom
bottomMargin
:
(
audioThumb
.
stateVisible
&&
!
audioThumb
.
isAudioClip
)
?
audioThumb
.
height
:
0
rightMargin
:
timecode
.
visible
?
0
:
4
}
}
Label
{
...
...
@@ -259,16 +257,8 @@ Item {
background
:
Rectangle
{
color
:
"
#228b22
"
}
height
:
marker
.
height
width
:
textMetricsIn
.
width
+
10
leftPadding
:
0
rightPadding
:
0
padding
:
4
horizontalAlignment
:
TextInput
.
AlignHCenter
TextMetrics
{
id
:
textMetricsIn
font
:
inPoint
.
font
text
:
inPoint
.
text
}
}
Label
{
id
:
outPoint
...
...
@@ -283,22 +273,15 @@ Item {
background
:
Rectangle
{
color
:
"
#ff4500
"
}
width
:
textMetricsOut
.
width
+
10
height
:
marker
.
height
leftPadding
:
0
rightPadding
:
0
padding
:
4
horizontalAlignment
:
TextInput
.
AlignHCenter
TextMetrics
{
id
:
textMetricsOut
font
:
outPoint
.
font
text
:
outPoint
.
text
}
}
TextField
{
id
:
marker
font
:
fixedFont
objectName
:
"
markertext
"
activeFocusOnPress
:
true
text
:
controller
.
markerComment
onEditingFinished
:
{
root
.
markerText
=
marker
.
displayText
marker
.
focus
=
false
...
...
@@ -309,20 +292,14 @@ Item {
bottom
:
parent
.
bottom
}
visible
:
root
.
showMarkers
&&
text
!=
""
text
:
controller
.
markerCommen
t
width
:
tex
tMetrics
.
width
+
10
horizontalAlignment
:
TextInput
.
AlignHCenter
height
:
inPoint
.
heigh
t
width
:
fon
tMetrics
.
boundingRect
(
displayText
).
width
+
10
horizontalAlignment
:
displayText
==
text
?
TextInput
.
AlignHCenter
:
TextInput
.
AlignLeft
background
:
Rectangle
{
color
:
"
#990000ff
"
}
color
:
"
white
"
padding
:
0
TextMetrics
{
id
:
textMetrics
font
:
marker
.
font
text
:
controller
.
markerComment
}
color
:
"
#ffffff
"
padding
:
0
maximumLength
:
20
}
}
...
...
@@ -330,7 +307,7 @@ Item {
Rectangle
{
// Audio or video only drag zone
x
:
2
y
:
inPoint
.
visible
?
inPoint
.
y
-
height
-
2
:
parent
.
height
-
height
-
2
y
:
inPoint
.
visible
||
outPoint
.
visible
||
marker
.
visible
?
parent
.
height
-
inPoint
.
height
-
height
-
2
:
parent
.
height
-
height
-
2
width
:
childrenRect
.
width
height
:
childrenRect
.
height
color
:
Qt
.
rgba
(
activePalette
.
highlight
.
r
,
activePalette
.
highlight
.
g
,
activePalette
.
highlight
.
b
,
0.7
)
...
...
src/monitor/view/kdenlivemonitor.qml
View file @
4cc8006f
...
...
@@ -131,7 +131,6 @@ Item {
anchors
{
right
:
parent
.
right
bottom
:
parent
.
bottom
rightMargin
:
4
}
}
Label
{
...
...
@@ -142,14 +141,13 @@ Item {
color
:
"
#ffffff
"
padding
:
2
background
:
Rectangle
{
color
:
root
.
dropped
?
"
#99ff0000
"
:
"
#6600
00
00
"
color
:
root
.
dropped
?
"
#99ff0000
"
:
"
#6600
44
00
"
}
text
:
i18n
(
"
%1
fps
"
,
root
.
fps
)
text
:
i18n
(
"
%1fps
"
,
root
.
fps
)
visible
:
root
.
showFps
anchors
{
right
:
timecode
.
visible
?
timecode
.
left
:
parent
.
right
bottom
:
parent
.
bottom
rightMargin
:
timecode
.
visible
?
0
:
4
}
}
Label
{
...
...
@@ -165,16 +163,8 @@ Item {
background
:
Rectangle
{
color
:
"
#228b22
"
}
height
:
marker
.
height
width
:
textMetricsIn
.
width
+
10
leftPadding
:
0
rightPadding
:
0
padding
:
5
horizontalAlignment
:
TextInput
.
AlignHCenter
TextMetrics
{
id
:
textMetricsIn
font
:
inPoint
.
font
text
:
inPoint
.
text
}
}
Label
{
id
:
outPoint
...
...
@@ -189,16 +179,8 @@ Item {
background
:
Rectangle
{
color
:
"
#ff4500
"
}
width
:
textMetricsOut
.
width
+
10
height
:
marker
.
height
leftPadding
:
0
rightPadding
:
0
padding
:
5
horizontalAlignment
:
TextInput
.
AlignHCenter
TextMetrics
{
id
:
textMetricsOut
font
:
outPoint
.
font
text
:
outPoint
.
text
}
}
TextField
{
id
:
marker
...
...
@@ -216,19 +198,14 @@ Item {
}
visible
:
root
.
showMarkers
&&
text
!=
""
text
:
controller
.
markerComment
width
:
textMetrics
.
width
+
10
horizontalAlignment
:
TextInput
.
AlignHCenter
height
:
inPoint
.
height
width
:
fontMetrics
.
boundingRect
(
displayText
).
width
+
10
horizontalAlignment
:
displayText
==
text
?
TextInput
.
AlignHCenter
:
TextInput
.
AlignLeft
background
:
Rectangle
{
color
:
"
#990000ff
"
}
color
:
"
white
"
padding
:
0
TextMetrics
{
id
:
textMetrics
font
:
marker
.
font
text
:
controller
.
markerComment
}
color
:
"
#ffffff
"
padding
:
0
maximumLength
:
25
}
}
...
...
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