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
b9321c95
Commit
b9321c95
authored
Nov 20, 2019
by
Jean-Baptiste Mardelle
Browse files
Simplify monitor handling of audio clip, minor optimization of monitor bg drawing
parent
2ef7091e
Changes
10
Hide whitespace changes
Inline
Side-by-side
src/dialogs/kdenlivesettingsdialog.cpp
View file @
b9321c95
...
...
@@ -978,6 +978,7 @@ void KdenliveSettingsDialog::updateSettings()
if
(
m_configSdl
.
kcfg_window_background
->
color
()
!=
KdenliveSettings
::
window_background
())
{
KdenliveSettings
::
setWindow_background
(
m_configSdl
.
kcfg_window_background
->
color
());
emit
updateMonitorBg
();
resetProfile
=
true
;
}
...
...
src/dialogs/kdenlivesettingsdialog.h
View file @
b9321c95
...
...
@@ -139,6 +139,8 @@ signals:
void
audioThumbFormatChanged
();
/** @brief An important timeline property changed, prepare for a reset */
void
resetView
();
/** @brief Monitor background color changed, update monitors */
void
updateMonitorBg
();
};
#endif
src/mainwindow.cpp
View file @
b9321c95
...
...
@@ -2130,6 +2130,9 @@ void MainWindow::slotPreferences(int page, int option)
connect
(
dialog
,
&
KdenliveSettingsDialog
::
updateLibraryFolder
,
pCore
.
get
(),
&
Core
::
updateLibraryPath
);
connect
(
dialog
,
&
KdenliveSettingsDialog
::
audioThumbFormatChanged
,
m_timelineTabs
,
&
TimelineTabs
::
audioThumbFormatChanged
);
connect
(
dialog
,
&
KdenliveSettingsDialog
::
resetView
,
this
,
&
MainWindow
::
resetTimelineTracks
);
connect
(
dialog
,
&
KdenliveSettingsDialog
::
updateMonitorBg
,
[
&
]()
{
pCore
->
monitorManager
()
->
updateBgColor
();
});
dialog
->
show
();
if
(
page
!=
-
1
)
{
...
...
src/monitor/glwidget.cpp
View file @
b9321c95
...
...
@@ -74,6 +74,7 @@ GLWidget::GLWidget(int id, QObject *parent)
,
m_producer
(
nullptr
)
,
m_id
(
id
)
,
m_rulerHeight
(
QFontMetrics
(
QApplication
::
font
()).
lineSpacing
()
*
0.7
)
,
m_bgColor
(
KdenliveSettings
::
window_background
())
,
m_shader
(
nullptr
)
,
m_initSem
(
0
)
,
m_analyseSem
(
1
)
...
...
@@ -520,8 +521,7 @@ void GLWidget::paintGL()
f
->
glDepthMask
(
GL_FALSE
);
f
->
glViewport
(
0
,
(
m_rulerHeight
*
devicePixelRatio
()
*
0.5
+
0.5
),
width
,
height
);
check_error
(
f
);
QColor
color
(
KdenliveSettings
::
window_background
());
f
->
glClearColor
(
color
.
redF
(),
color
.
greenF
(),
color
.
blueF
(),
color
.
alphaF
());
f
->
glClearColor
(
m_bgColor
.
redF
(),
m_bgColor
.
greenF
(),
m_bgColor
.
blueF
(),
0
);
f
->
glClear
(
GL_COLOR_BUFFER_BIT
);
check_error
(
f
);
...
...
@@ -1183,11 +1183,7 @@ int GLWidget::reconfigure(bool reload)
delete
m_displayEvent
;
// C & D
if
(
m_proxy
->
property
(
"clipType"
).
toInt
()
==
ClipType
::
Audio
)
{
m_displayEvent
=
m_consumer
->
listen
(
"consumer-frame-show"
,
this
,
(
mlt_listener
)
on_audio_frame_show
);
m_sharedFrame
=
SharedFrame
();
m_texture
[
0
]
=
0
;
}
else
if
(
m_glslManager
)
{
if
(
m_glslManager
)
{
m_displayEvent
=
m_consumer
->
listen
(
"consumer-frame-show"
,
this
,
(
mlt_listener
)
on_gl_frame_show
);
}
else
{
// A & B
...
...
@@ -1418,24 +1414,9 @@ void GLWidget::updateTexture(GLuint yName, GLuint uName, GLuint vName)
// update();
}
// MLT consumer-frame-show event handler
void
GLWidget
::
on_audio_frame_show
(
mlt_consumer
,
void
*
self
,
mlt_frame
frame_ptr
)
{
Mlt
::
Frame
frame
(
frame_ptr
);
//qDebug()<<"== SHOWING FRAME: "<<frame.get_position();
if
(
frame
.
get_int
(
"rendered"
)
!=
0
)
{
auto
*
widget
=
static_cast
<
GLWidget
*>
(
self
);
int
timeout
=
(
widget
->
consumer
()
->
get_int
(
"real_time"
)
>
0
)
?
0
:
1000
;
if
((
widget
->
m_frameRenderer
!=
nullptr
)
&&
widget
->
m_frameRenderer
->
semaphore
()
->
tryAcquire
(
1
,
timeout
))
{
QMetaObject
::
invokeMethod
(
widget
->
m_frameRenderer
,
"showAudioFrame"
,
Qt
::
QueuedConnection
,
Q_ARG
(
Mlt
::
Frame
,
frame
));
}
}
}
void
GLWidget
::
on_frame_show
(
mlt_consumer
,
void
*
self
,
mlt_frame
frame_ptr
)
{
Mlt
::
Frame
frame
(
frame_ptr
);
//qDebug()<<"== SHOWING FRAME: "<<frame.get_position();
if
(
frame
.
get_int
(
"rendered"
)
!=
0
)
{
auto
*
widget
=
static_cast
<
GLWidget
*>
(
self
);
int
timeout
=
(
widget
->
consumer
()
->
get_int
(
"real_time"
)
>
0
)
?
0
:
1000
;
...
...
@@ -1538,14 +1519,6 @@ FrameRenderer::~FrameRenderer()
delete
m_gl32
;
}
void
FrameRenderer
::
showAudioFrame
(
Mlt
::
Frame
frame
)
{
// Save this frame for future use and to keep a reference to the GL Texture.
m_displayFrame
=
SharedFrame
(
frame
);
emit
frameDisplayed
(
m_displayFrame
);
m_semaphore
.
release
();
}
void
FrameRenderer
::
showFrame
(
Mlt
::
Frame
frame
)
{
int
width
=
0
;
...
...
src/monitor/glwidget.h
View file @
b9321c95
...
...
@@ -196,6 +196,7 @@ protected:
std
::
shared_ptr
<
Mlt
::
Producer
>
m_producer
;
int
m_id
;
int
m_rulerHeight
;
QColor
m_bgColor
;
private:
QRect
m_rect
;
...
...
@@ -232,7 +233,6 @@ private:
MonitorProxy
*
m_proxy
;
std
::
shared_ptr
<
Mlt
::
Producer
>
m_blackClip
;
static
void
on_frame_show
(
mlt_consumer
,
void
*
self
,
mlt_frame
frame
);
static
void
on_audio_frame_show
(
mlt_consumer
,
void
*
self
,
mlt_frame
frame
);
static
void
on_frame_render
(
mlt_consumer
,
GLWidget
*
widget
,
mlt_frame
frame
);
static
void
on_gl_frame_show
(
mlt_consumer
,
void
*
self
,
mlt_frame
frame_ptr
);
static
void
on_gl_nosync_frame_show
(
mlt_consumer
,
void
*
self
,
mlt_frame
frame_ptr
);
...
...
@@ -311,7 +311,6 @@ public:
QSemaphore
*
semaphore
()
{
return
&
m_semaphore
;
}
QOpenGLContext
*
context
()
const
{
return
m_context
;
}
Q_INVOKABLE
void
showFrame
(
Mlt
::
Frame
frame
);
Q_INVOKABLE
void
showAudioFrame
(
Mlt
::
Frame
frame
);
Q_INVOKABLE
void
showGLFrame
(
Mlt
::
Frame
frame
);
Q_INVOKABLE
void
showGLNoSyncFrame
(
Mlt
::
Frame
frame
);
...
...
src/monitor/monitor.cpp
View file @
b9321c95
...
...
@@ -2106,3 +2106,8 @@ void Monitor::purgeCache()
{
m_glMonitor
->
purgeCache
();
}
void
Monitor
::
updateBgColor
()
{
m_glMonitor
->
m_bgColor
=
KdenliveSettings
::
window_background
();
}
src/monitor/monitor.h
View file @
b9321c95
...
...
@@ -169,6 +169,7 @@ protected:
void
wheelEvent
(
QWheelEvent
*
event
)
override
;
void
mouseMoveEvent
(
QMouseEvent
*
event
)
override
;
virtual
QStringList
mimeTypes
()
const
;
void
updateBgColor
();
private:
std
::
shared_ptr
<
ProjectClip
>
m_controller
;
...
...
src/monitor/monitormanager.cpp
View file @
b9321c95
...
...
@@ -615,3 +615,13 @@ bool MonitorManager::isMultiTrack() const
}
return
false
;
}
void
MonitorManager
::
updateBgColor
()
{
if
(
m_projectMonitor
)
{
m_projectMonitor
->
updateBgColor
();
}
if
(
m_clipMonitor
)
{
m_clipMonitor
->
updateBgColor
();
}
}
src/monitor/monitormanager.h
View file @
b9321c95
...
...
@@ -108,6 +108,8 @@ public slots:
void
slotExtractCurrentFrame
();
/** @brief Export the current monitor's frame to image file and add it to the current project */
void
slotExtractCurrentFrameToProject
();
/** @brief Refresh monitor background color */
void
updateBgColor
();
private
slots
:
/** @brief Set MLT's consumer deinterlace method */
...
...
src/monitor/view/kdenliveclipmonitor.qml
View file @
b9321c95
...
...
@@ -130,27 +130,28 @@ Item {
Item
{
id
:
audioThumb
property
bool
stateVisible
:
(
clipMonitorRuler
.
containsMouse
||
thumbMouseArea
.
containsMouse
)
property
bool
isAudioClip
:
controller
.
clipType
==
ProducerType
.
Audio
anchors
{
left
:
parent
.
left
bottom
:
parent
.
bottom
}
height
:
controller
.
clipType
==
ProducerType
.
Audio
?
parent
.
height
:
parent
.
height
/
6
height
:
is
Audio
Clip
?
parent
.
height
:
parent
.
height
/
6
//font.pixelSize * 3
width
:
parent
.
width
visible
:
root
.
showAudiothumb
&&
(
controller
.
clipType
==
ProducerType
.
Audio
||
controller
.
clipType
==
ProducerType
.
AV
)
visible
:
root
.
showAudiothumb
&&
(
is
Audio
Clip
||
controller
.
clipType
==
ProducerType
.
AV
)
states
:
[
State
{
when
:
audioThumb
.
stateVisible
||
controller
.
clipType
==
ProducerType
.
Audio
;
State
{
when
:
audioThumb
.
stateVisible
||
is
Audio
Clip
;
PropertyChanges
{
target
:
audioThumb
;
opacity
:
1.0
}
},
State
{
when
:
!
audioThumb
.
stateVisible
&&
controller
.
clipType
!=
ProducerType
.
Audio
;
State
{
when
:
!
audioThumb
.
stateVisible
&&
is
Audio
Clip
;
PropertyChanges
{
target
:
audioThumb
;
opacity
:
0.0
}
}
]
transitions
:
[
Transition
{
NumberAnimation
{
property
:
"
opacity
"
;
duration
:
500
}
NumberAnimation
{
property
:
"
opacity
"
;
duration
:
isAudioClip
?
0
:
500
}
}
]
Rectangle
{
color
:
activePalette
.
base
opacity
:
0.6
opacity
:
isAudioClip
?
1
:
0.6
anchors.fill
:
parent
}
Rectangle
{
...
...
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