Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Farid Abdelnour
kdenlive
Commits
ddcc903a
Commit
ddcc903a
authored
Mar 14, 2012
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup: remove duplicate monitor code, allow fullscreen for record monitor
parent
31293326
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
316 additions
and
333 deletions
+316
-333
src/abstractmonitor.cpp
src/abstractmonitor.cpp
+93
-62
src/abstractmonitor.h
src/abstractmonitor.h
+30
-36
src/geometrywidget.cpp
src/geometrywidget.cpp
+0
-1
src/mainwindow.cpp
src/mainwindow.cpp
+10
-18
src/mainwindow.h
src/mainwindow.h
+0
-2
src/mltdevicecapture.cpp
src/mltdevicecapture.cpp
+25
-9
src/mltdevicecapture.h
src/mltdevicecapture.h
+8
-3
src/monitor.cpp
src/monitor.cpp
+26
-133
src/monitor.h
src/monitor.h
+1
-20
src/monitoreditwidget.cpp
src/monitoreditwidget.cpp
+6
-1
src/monitoreditwidget.h
src/monitoreditwidget.h
+1
-1
src/monitormanager.cpp
src/monitormanager.cpp
+16
-12
src/monitormanager.h
src/monitormanager.h
+3
-0
src/recmonitor.cpp
src/recmonitor.cpp
+57
-23
src/recmonitor.h
src/recmonitor.h
+6
-1
src/stopmotion/stopmotion.cpp
src/stopmotion/stopmotion.cpp
+25
-7
src/stopmotion/stopmotion.h
src/stopmotion/stopmotion.h
+9
-4
No files found.
src/abstractmonitor.cpp
View file @
ddcc903a
...
...
@@ -20,96 +20,127 @@
#include "abstractmonitor.h"
#include "kdenlivesettings.h"
#include "monitormanager.h"
#include <KDebug>
#include <QPaintEvent>
#include <QDesktopWidget>
VideoPreviewContainer
::
VideoPreviewContainer
(
QWidget
*
parent
)
:
QFrame
(
parent
),
m_dar
(
1.0
),
m_refresh
(
false
)
{
setFrameShape
(
QFrame
::
NoFrame
);
setFocusPolicy
(
Qt
::
ClickFocus
);
setAttribute
(
Qt
::
WA_PaintOnScreen
);
setAttribute
(
Qt
::
WA_OpaquePaintEvent
);
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
MinimumExpanding
);
connect
(
&
m_refreshTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
update
()));
m_refreshTimer
.
setSingleShot
(
false
);
m_refreshTimer
.
setInterval
(
200
);
}
VideoPreviewContainer
::~
VideoPreviewContainer
()
AbstractMonitor
::
AbstractMonitor
(
Kdenlive
::
MONITORID
id
,
MonitorManager
*
manager
,
QWidget
*
parent
)
:
QWidget
(
parent
),
m_id
(
id
),
m_monitorManager
(
manager
)
{}
bool
AbstractMonitor
::
isActive
()
const
{
qDeleteAll
(
m_imageQueue
);
return
m_monitorManager
->
isActive
(
m_id
);
}
//virtual
void
VideoPreviewContainer
::
resizeEvent
(
QResizeEvent
*
/*event*/
)
bool
AbstractMonitor
::
slotActivateMonitor
()
{
updateDisplayZone
(
);
return
m_monitorManager
->
activateMonitor
(
m_id
);
}
void
VideoPreviewContainer
::
setRatio
(
double
ratio
)
VideoContainer
::
VideoContainer
(
AbstractMonitor
*
monitor
,
QWidget
*
parent
)
:
QFrame
(
parent
)
,
m_monitor
(
monitor
)
{
m_dar
=
ratio
;
updateDisplayZone
();
setFrameShape
(
QFrame
::
NoFrame
);
setFocusPolicy
(
Qt
::
ClickFocus
);
setAttribute
(
Qt
::
WA_PaintOnScreen
);
setAttribute
(
Qt
::
WA_OpaquePaintEvent
);
//setEnabled(false);
setContentsMargins
(
0
,
0
,
0
,
0
);
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
MinimumExpanding
);
}
void
Video
Preview
Container
::
updateDisplayZone
(
)
// virtual
void
VideoContainer
::
mouseReleaseEvent
(
QMouseEvent
*
event
)
{
QRect
rect
=
this
->
frameRect
();
int
paintW
=
rect
.
height
()
*
m_dar
+
0.5
;
if
(
paintW
>
rect
.
width
())
{
int
paintH
=
rect
.
width
()
/
m_dar
+
0.5
;
int
diff
=
(
rect
.
height
()
-
paintH
)
/
2
;
rect
.
adjust
(
0
,
diff
,
0
,
0
);
rect
.
setHeight
(
paintH
);
}
else
{
int
diff
=
(
rect
.
width
()
-
paintW
)
/
2
;
rect
.
adjust
(
diff
,
0
,
0
,
0
);
rect
.
setWidth
(
paintW
);
if
(
event
->
button
()
!=
Qt
::
RightButton
)
{
if
(
m_monitor
->
isActive
())
{
m_monitor
->
slotPlay
();
}
}
m_displayRect
=
rect
;
m_refresh
=
true
;
}
void
VideoPreviewContainer
::
setImage
(
QImage
img
)
// virtual
void
VideoContainer
::
keyPressEvent
(
QKeyEvent
*
event
)
{
if
(
m_imageQueue
.
count
()
>
2
)
{
delete
m_imageQueue
.
takeLast
();
}
m_imageQueue
.
prepend
(
new
QImage
(
img
)
);
update
(
);
// Exit fullscreen with Esc key
if
(
event
->
key
()
==
Qt
::
Key_Escape
&&
isFullScreen
())
{
switchFullScreen
();
event
->
setAccepted
(
true
);
}
else
event
->
setAccepted
(
false
);
}
void
VideoPreviewContainer
::
stop
()
// virtual
void
VideoContainer
::
wheelEvent
(
QWheelEvent
*
event
)
{
//m_refreshTimer.stop();
qDeleteAll
(
m_imageQueue
);
m_imageQueue
.
clear
();
m_monitor
->
slotMouseSeek
(
event
->
delta
(),
event
->
modifiers
()
==
Qt
::
ControlModifier
);
event
->
accept
();
}
void
Video
Preview
Container
::
start
(
)
void
VideoContainer
::
mouseDoubleClickEvent
(
QMouseEvent
*
event
)
{
//m_refreshTimer.start();
if
(
!
KdenliveSettings
::
openglmonitors
())
switchFullScreen
();
event
->
accept
();
}
// virtual
void
VideoPreviewContainer
::
paintEvent
(
QPaintEvent
*
event
)
void
VideoContainer
::
switchFullScreen
()
{
if
(
m_imageQueue
.
isEmpty
())
return
;
QImage
*
img
=
m_imageQueue
.
takeFirst
();
QPainter
painter
(
this
);
if
(
m_refresh
)
{
painter
.
fillRect
(
event
->
rect
(),
QColor
(
KdenliveSettings
::
window_background
()));
m_refresh
=
false
;
// TODO: disable screensaver?
m_monitor
->
pause
();
Qt
::
WindowFlags
flags
=
windowFlags
();
if
(
!
isFullScreen
())
{
// Check if we ahave a multiple monitor setup
setUpdatesEnabled
(
false
);
#if QT_VERSION >= 0x040600
int
monitors
=
QApplication
::
desktop
()
->
screenCount
();
#else
int
monitors
=
QApplication
::
desktop
()
->
numScreens
();
#endif
if
(
monitors
>
1
)
{
QRect
screenres
;
// Move monitor widget to the second screen (one screen for Kdenlive, the other one for the Monitor widget
int
currentScreen
=
QApplication
::
desktop
()
->
screenNumber
(
this
);
if
(
currentScreen
<
monitors
-
1
)
screenres
=
QApplication
::
desktop
()
->
screenGeometry
(
currentScreen
+
1
);
else
screenres
=
QApplication
::
desktop
()
->
screenGeometry
(
currentScreen
-
1
);
move
(
QPoint
(
screenres
.
x
(),
screenres
.
y
()));
resize
(
screenres
.
width
(),
screenres
.
height
());
}
m_baseFlags
=
flags
&
(
Qt
::
Window
|
Qt
::
SubWindow
);
flags
|=
Qt
::
Window
;
flags
^=
Qt
::
SubWindow
;
setWindowFlags
(
flags
);
#ifdef Q_WS_X11
// This works around a bug with Compiz
// as the window must be visible before we can set the state
show
();
raise
();
setWindowState
(
windowState
()
|
Qt
::
WindowFullScreen
);
// set
#else
setWindowState
(
windowState
()
|
Qt
::
WindowFullScreen
);
// set
setUpdatesEnabled
(
true
);
show
();
#endif
setEnabled
(
true
);
}
else
{
setUpdatesEnabled
(
false
);
flags
^=
(
Qt
::
Window
|
Qt
::
SubWindow
);
//clear the flags...
flags
|=
m_baseFlags
;
//then we reset the flags (window and subwindow)
setWindowFlags
(
flags
);
setWindowState
(
windowState
()
^
Qt
::
WindowFullScreen
);
// reset
setUpdatesEnabled
(
true
);
setEnabled
(
false
);
show
();
}
painter
.
drawImage
(
m_displayRect
,
*
img
);
delete
img
;
m_monitor
->
unpause
();
}
src/abstractmonitor.h
View file @
ddcc903a
...
...
@@ -32,40 +32,7 @@
#include <stdint.h>
class
VideoPreviewContainer
:
public
QFrame
{
Q_OBJECT
public:
VideoPreviewContainer
(
QWidget
*
parent
=
0
);
~
VideoPreviewContainer
();
/** @brief Set the image to be displayed, will be put in the queue. */
void
setImage
(
QImage
img
);
/** @brief Start the display refresh timer. */
void
start
();
/** @brief Stop the display refresh timer. */
void
stop
();
/** @brief Set the display ratio for this display. */
void
setRatio
(
double
ratio
);
protected:
virtual
void
paintEvent
(
QPaintEvent
*/
*
event
*/
);
virtual
void
resizeEvent
(
QResizeEvent
*
event
);
private:
/** @brief The display aspect ratio for profile. */
double
m_dar
;
/** @brief When true, the whole widget surface will be repainted, useful when resizing widget. */
bool
m_refresh
;
/** @brief The rectangle defining the area for painting our image. */
QRect
m_displayRect
;
/** @brief The queue of images to be displayed. */
QList
<
QImage
*>
m_imageQueue
;
/** @brief We refresh the image with a timer, since this widget is only for preview during capture. */
QTimer
m_refreshTimer
;
/** @brief Re-calculate the display zone after a resize or aspect ratio change. */
void
updateDisplayZone
();
};
class
MonitorManager
;
class
AbstractRender
:
public
QObject
...
...
@@ -107,17 +74,44 @@ class AbstractMonitor : public QWidget
{
Q_OBJECT
public:
AbstractMonitor
(
Kdenlive
::
MONITORID
id
,
QWid
ge
t
*
parent
=
0
)
:
QWidget
(
parent
)
{
m_id
=
id
;}
;
AbstractMonitor
(
Kdenlive
::
MONITORID
id
,
MonitorMana
ge
r
*
manager
,
QWidget
*
parent
=
0
)
;
Kdenlive
::
MONITORID
id
()
{
return
m_id
;};
virtual
~
AbstractMonitor
()
{};
virtual
AbstractRender
*
abstractRender
()
=
0
;
virtual
void
pause
()
=
0
;
virtual
void
unpause
()
=
0
;
bool
isActive
()
const
;
public
slots
:
virtual
void
stop
()
=
0
;
virtual
void
start
()
=
0
;
virtual
void
slotPlay
()
=
0
;
virtual
void
slotMouseSeek
(
int
eventDelta
,
bool
fast
)
=
0
;
bool
slotActivateMonitor
();
virtual
void
slotSwitchFullScreen
()
=
0
;
protected:
Kdenlive
::
MONITORID
m_id
;
MonitorManager
*
m_monitorManager
;
};
class
VideoContainer
:
public
QFrame
{
Q_OBJECT
public:
VideoContainer
(
AbstractMonitor
*
monitor
,
QWidget
*
parent
=
0
);
void
switchFullScreen
();
protected:
virtual
void
mouseDoubleClickEvent
(
QMouseEvent
*
event
);
virtual
void
mouseReleaseEvent
(
QMouseEvent
*
event
);
void
keyPressEvent
(
QKeyEvent
*
event
);
virtual
void
wheelEvent
(
QWheelEvent
*
event
);
private:
Qt
::
WindowFlags
m_baseFlags
;
AbstractMonitor
*
m_monitor
;
};
#endif
src/geometrywidget.cpp
View file @
ddcc903a
...
...
@@ -573,7 +573,6 @@ void GeometryWidget::slotUpdateGeometry()
geom
->
insert
(
item2
);
}
}
emit
parameterChanged
();
}
...
...
src/mainwindow.cpp
View file @
ddcc903a
...
...
@@ -224,7 +224,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
// Connect the project list
connect
(
m_projectList
,
SIGNAL
(
clipSelected
(
DocClipBase
*
,
QPoint
,
bool
)),
m_clipMonitor
,
SLOT
(
slotSetClipProducer
(
DocClipBase
*
,
QPoint
,
bool
)));
connect
(
m_projectList
,
SIGNAL
(
raiseClipMonitor
()),
m_clipMonitor
,
SLOT
(
a
ctivateMonitor
()));
connect
(
m_projectList
,
SIGNAL
(
raiseClipMonitor
()),
m_clipMonitor
,
SLOT
(
slotA
ctivateMonitor
()));
connect
(
m_projectList
,
SIGNAL
(
loadingIsOver
()),
this
,
SLOT
(
slotElapsedTime
()));
connect
(
m_projectList
,
SIGNAL
(
displayMessage
(
const
QString
&
,
int
)),
this
,
SLOT
(
slotGotProgressInfo
(
const
QString
&
,
int
)));
connect
(
m_projectList
,
SIGNAL
(
updateRenderStatus
()),
this
,
SLOT
(
slotCheckRenderStatus
()));
...
...
@@ -566,8 +566,6 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
connect
(
m_projectMonitorDock
,
SIGNAL
(
visibilityChanged
(
bool
)),
m_projectMonitor
,
SLOT
(
refreshMonitor
(
bool
)));
connect
(
m_clipMonitorDock
,
SIGNAL
(
visibilityChanged
(
bool
)),
m_clipMonitor
,
SLOT
(
refreshMonitor
(
bool
)));
//connect(m_monitorManager, SIGNAL(checkColorScopes()), this, SLOT(slotUpdateColorScopes()));
//connect(m_monitorManager, SIGNAL(clearScopes()), this, SLOT(slotClearColorScopes()));
connect
(
m_effectList
,
SIGNAL
(
addEffect
(
const
QDomElement
)),
this
,
SLOT
(
slotAddEffect
(
const
QDomElement
)));
connect
(
m_effectList
,
SIGNAL
(
reloadEffects
()),
this
,
SLOT
(
slotReloadEffects
()));
...
...
@@ -1277,7 +1275,7 @@ void MainWindow::setupActions()
KAction
*
fullMon
=
collection
.
addAction
(
"monitor_fullscreen"
);
fullMon
->
setText
(
i18n
(
"Switch monitor fullscreen"
));
fullMon
->
setIcon
(
KIcon
(
"view-fullscreen"
));
connect
(
fullMon
,
SIGNAL
(
triggered
(
bool
)),
this
,
SLOT
(
slotSwitchFullscreen
()));
connect
(
fullMon
,
SIGNAL
(
triggered
(
bool
)),
m_monitorManager
,
SLOT
(
slotSwitchFullscreen
()));
KAction
*
insertTree
=
collection
.
addAction
(
"insert_project_tree"
);
insertTree
->
setText
(
i18n
(
"Insert zone in project tree"
));
...
...
@@ -2476,7 +2474,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //cha
disconnect
(
m_activeTimeline
->
projectView
(),
SIGNAL
(
showClipFrame
(
DocClipBase
*
,
QPoint
,
bool
,
const
int
)),
m_clipMonitor
,
SLOT
(
slotSetClipProducer
(
DocClipBase
*
,
QPoint
,
bool
,
const
int
)));
disconnect
(
m_projectList
,
SIGNAL
(
gotFilterJobResults
(
const
QString
&
,
int
,
int
,
const
QString
&
,
stringMap
)),
m_activeTimeline
->
projectView
(),
SLOT
(
slotGotFilterJobResults
(
const
QString
&
,
int
,
int
,
const
QString
&
,
stringMap
)));
disconnect
(
m_activeTimeline
,
SIGNAL
(
cursorMoved
()),
m_projectMonitor
,
SLOT
(
a
ctivateMonitor
()));
disconnect
(
m_activeTimeline
,
SIGNAL
(
cursorMoved
()),
m_projectMonitor
,
SLOT
(
slotA
ctivateMonitor
()));
disconnect
(
m_activeTimeline
,
SIGNAL
(
configTrack
(
int
)),
this
,
SLOT
(
slotConfigTrack
(
int
)));
disconnect
(
m_activeDocument
,
SIGNAL
(
docModified
(
bool
)),
this
,
SLOT
(
slotUpdateDocumentState
(
bool
)));
disconnect
(
m_effectStack
,
SIGNAL
(
updateEffect
(
ClipItem
*
,
int
,
QDomElement
,
QDomElement
,
int
)),
m_activeTimeline
->
projectView
(),
SLOT
(
slotUpdateClipEffect
(
ClipItem
*
,
int
,
QDomElement
,
QDomElement
,
int
)));
...
...
@@ -2488,7 +2486,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //cha
disconnect
(
m_effectStack
,
SIGNAL
(
displayMessage
(
const
QString
&
,
int
)),
this
,
SLOT
(
slotGotProgressInfo
(
const
QString
&
,
int
)));
disconnect
(
m_transitionConfig
,
SIGNAL
(
transitionUpdated
(
Transition
*
,
QDomElement
)),
m_activeTimeline
->
projectView
()
,
SLOT
(
slotTransitionUpdated
(
Transition
*
,
QDomElement
)));
disconnect
(
m_transitionConfig
,
SIGNAL
(
seekTimeline
(
int
)),
m_activeTimeline
->
projectView
()
,
SLOT
(
setCursorPos
(
int
)));
disconnect
(
m_activeTimeline
->
projectView
(),
SIGNAL
(
activateDocumentMonitor
()),
m_projectMonitor
,
SLOT
(
a
ctivateMonitor
()));
disconnect
(
m_activeTimeline
->
projectView
(),
SIGNAL
(
activateDocumentMonitor
()),
m_projectMonitor
,
SLOT
(
slotA
ctivateMonitor
()));
disconnect
(
m_activeTimeline
,
SIGNAL
(
zoneMoved
(
int
,
int
)),
this
,
SLOT
(
slotZoneMoved
(
int
,
int
)));
disconnect
(
m_projectList
,
SIGNAL
(
loadingIsOver
()),
m_activeTimeline
->
projectView
(),
SLOT
(
slotUpdateAllThumbs
()));
disconnect
(
m_projectList
,
SIGNAL
(
refreshClip
(
const
QString
&
)),
m_activeTimeline
->
projectView
(),
SLOT
(
slotRefreshThumbs
(
const
QString
&
)));
...
...
@@ -2567,7 +2565,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //cha
connect
(
m_effectStack
,
SIGNAL
(
reloadEffects
()),
this
,
SLOT
(
slotReloadEffects
()));
connect
(
m_effectStack
,
SIGNAL
(
displayMessage
(
const
QString
&
,
int
)),
this
,
SLOT
(
slotGotProgressInfo
(
const
QString
&
,
int
)));
connect
(
trackView
->
projectView
(),
SIGNAL
(
activateDocumentMonitor
()),
m_projectMonitor
,
SLOT
(
a
ctivateMonitor
()));
connect
(
trackView
->
projectView
(),
SIGNAL
(
activateDocumentMonitor
()),
m_projectMonitor
,
SLOT
(
slotA
ctivateMonitor
()));
connect
(
trackView
,
SIGNAL
(
zoneMoved
(
int
,
int
)),
this
,
SLOT
(
slotZoneMoved
(
int
,
int
)));
connect
(
m_projectList
,
SIGNAL
(
loadingIsOver
()),
trackView
->
projectView
(),
SLOT
(
slotUpdateAllThumbs
()));
trackView
->
projectView
()
->
setContextMenu
(
m_timelineContextMenu
,
m_timelineContextClipMenu
,
m_timelineContextTransitionMenu
,
m_clipTypeGroup
,
static_cast
<
QMenu
*>
(
factory
()
->
container
(
"marker_menu"
,
this
)));
...
...
@@ -2920,7 +2918,7 @@ void MainWindow::slotRemoveSpace()
void
MainWindow
::
slotInsertTrack
(
int
ix
)
{
m_projectMonitor
->
a
ctivateMonitor
();
m_projectMonitor
->
slotA
ctivateMonitor
();
if
(
m_activeTimeline
)
{
if
(
ix
==
-
1
)
ix
=
m_activeTimeline
->
projectView
()
->
selectedTrack
();
m_activeTimeline
->
projectView
()
->
slotInsertTrack
(
ix
);
...
...
@@ -2931,7 +2929,7 @@ void MainWindow::slotInsertTrack(int ix)
void
MainWindow
::
slotDeleteTrack
(
int
ix
)
{
m_projectMonitor
->
a
ctivateMonitor
();
m_projectMonitor
->
slotA
ctivateMonitor
();
if
(
m_activeTimeline
)
{
if
(
ix
==
-
1
)
ix
=
m_activeTimeline
->
projectView
()
->
selectedTrack
();
m_activeTimeline
->
projectView
()
->
slotDeleteTrack
(
ix
);
...
...
@@ -2942,7 +2940,7 @@ void MainWindow::slotDeleteTrack(int ix)
void
MainWindow
::
slotConfigTrack
(
int
ix
)
{
m_projectMonitor
->
a
ctivateMonitor
();
m_projectMonitor
->
slotA
ctivateMonitor
();
if
(
m_activeTimeline
)
m_activeTimeline
->
projectView
()
->
slotConfigTracks
(
ix
);
if
(
m_activeDocument
)
...
...
@@ -2951,7 +2949,7 @@ void MainWindow::slotConfigTrack(int ix)
void
MainWindow
::
slotSelectTrack
()
{
m_projectMonitor
->
a
ctivateMonitor
();
m_projectMonitor
->
slotA
ctivateMonitor
();
if
(
m_activeTimeline
)
{
m_activeTimeline
->
projectView
()
->
slotSelectClipsInTrack
();
}
...
...
@@ -2959,7 +2957,7 @@ void MainWindow::slotSelectTrack()
void
MainWindow
::
slotSelectAllTracks
()
{
m_projectMonitor
->
a
ctivateMonitor
();
m_projectMonitor
->
slotA
ctivateMonitor
();
if
(
m_activeTimeline
)
m_activeTimeline
->
projectView
()
->
slotSelectAllClips
();
}
...
...
@@ -4247,12 +4245,6 @@ void MainWindow::slotSwitchMonitors()
else
m_projectList
->
focusTree
();
}
void
MainWindow
::
slotSwitchFullscreen
()
{
if
(
m_projectMonitor
->
isActive
())
m_projectMonitor
->
slotSwitchFullScreen
();
else
m_clipMonitor
->
slotSwitchFullScreen
();
}
void
MainWindow
::
slotInsertZoneToTree
()
{
if
(
!
m_clipMonitor
->
isActive
()
||
m_clipMonitor
->
activeClip
()
==
NULL
)
return
;
...
...
src/mainwindow.h
View file @
ddcc903a
...
...
@@ -531,8 +531,6 @@ private slots:
/** @brief The monitor informs that it needs (or not) to have frames sent by the renderer. */
void
slotMonitorRequestRenderFrame
(
bool
request
);
/** @brief Switch current monitor to fullscreen. */
void
slotSwitchFullscreen
();
/** @brief Open the stopmotion dialog. */
void
slotOpenStopmotion
();
/** @brief Implements all the actions that are int he ActionsCollection. */
...
...
src/mltdevicecapture.cpp
View file @
ddcc903a
...
...
@@ -76,7 +76,7 @@ static void rec_consumer_frame_preview(mlt_consumer, MltDeviceCapture * self, ml
}
MltDeviceCapture
::
MltDeviceCapture
(
QString
profile
,
Video
Preview
Container
*
surface
,
QWidget
*
parent
)
:
MltDeviceCapture
::
MltDeviceCapture
(
QString
profile
,
VideoContainer
*
surface
,
QWidget
*
parent
)
:
AbstractRender
(
Kdenlive
::
recordMonitor
,
parent
),
doCapture
(
0
),
sendFrameForAnalysis
(
false
),
...
...
@@ -87,9 +87,9 @@ MltDeviceCapture::MltDeviceCapture(QString profile, VideoPreviewContainer *surfa
m_showFrameEvent
(
NULL
),
m_droppedFrames
(
0
),
m_livePreview
(
KdenliveSettings
::
enable_recording_preview
()),
m_captureDisplayWidget
(
surface
),
m_winid
((
int
)
surface
->
winId
())
{
m_captureDisplayWidget
=
surface
;
analyseAudio
=
KdenliveSettings
::
monitor_audio
();
if
(
profile
.
isEmpty
())
profile
=
KdenliveSettings
::
current_profile
();
buildConsumer
(
profile
);
...
...
@@ -163,12 +163,21 @@ void MltDeviceCapture::buildConsumer(const QString &profileName)
//m_mltConsumer->set("real_time", 0);
}
void
MltDeviceCapture
::
pause
()
{
if
(
m_mltConsumer
)
{
m_mltConsumer
->
set
(
"refresh"
,
0
);
//m_mltProducer->set_speed(0.0);
m_mltConsumer
->
purge
();
}
}
void
MltDeviceCapture
::
stop
()
{
m_droppedFramesTimer
.
stop
();
bool
isPlaylist
=
false
;
disconnect
(
this
,
SIGNAL
(
imageReady
(
QImage
)),
this
,
SIGNAL
(
frameUpdated
(
QImage
)));
m_captureDisplayWidget
->
stop
();
//
disconnect(this, SIGNAL(imageReady(QImage)), this, SIGNAL(frameUpdated(QImage)));
//
m_captureDisplayWidget->stop();
if
(
m_showFrameEvent
)
delete
m_showFrameEvent
;
m_showFrameEvent
=
NULL
;
...
...
@@ -215,9 +224,16 @@ void MltDeviceCapture::stop()
}
void
MltDeviceCapture
::
d
oRefresh
()
void
MltDeviceCapture
::
slotD
oRefresh
()
{
if
(
m_mltConsumer
)
m_mltConsumer
->
set
(
"refresh"
,
1
);
QMutexLocker
locker
(
&
m_mutex
);
if
(
!
m_mltProducer
)
return
;
if
(
m_mltConsumer
)
{
if
(
m_mltConsumer
->
is_stopped
())
m_mltConsumer
->
start
();
m_mltConsumer
->
purge
();
m_mltConsumer
->
set
(
"refresh"
,
1
);
}
}
...
...
@@ -308,7 +324,7 @@ bool MltDeviceCapture::slotStartPreview(const QString &producer, bool xmlFormat)
return
0
;
}
m_droppedFramesTimer
.
start
();
connect
(
this
,
SIGNAL
(
imageReady
(
QImage
)),
this
,
SIGNAL
(
frameUpdated
(
QImage
)));
//
connect(this, SIGNAL(imageReady(QImage)), this, SIGNAL(frameUpdated(QImage)));
return
1
;
}
...
...
@@ -343,7 +359,7 @@ void MltDeviceCapture::gotCapturedFrame(Mlt::Frame& frame)
//memcpy(image.bits(), data, width * height * 3);
QImage
image
((
uchar
*
)
data
,
width
,
height
,
QImage
::
Format_RGB888
);
m_captureDisplayWidget
->
setImage
(
image
);
//
m_captureDisplayWidget->setImage(image);
//TEST: is it better to process frame conversion ouside MLT???
/*
...
...
@@ -731,7 +747,7 @@ void MltDeviceCapture::uyvy2rgb(unsigned char *yuv_buffer, int width, int height
rgb_ptr
+=
3
;
}
//emit imageReady(image);
m_captureDisplayWidget
->
setImage
(
image
);
//
m_captureDisplayWidget->setImage(image);
emit
unblockPreview
();
//processingImage = false;
}
...
...
src/mltdevicecapture.h
View file @
ddcc903a
...
...
@@ -50,7 +50,7 @@ Q_OBJECT public:
/** @brief Build a MLT Renderer
* @param winid The parent widget identifier (required for SDL display). Set to 0 for OpenGL rendering
* @param profile The MLT profile used for the capture (default one will be used if empty). */
MltDeviceCapture
(
QString
profile
,
Video
Preview
Container
*
surface
,
QWidget
*
parent
=
0
);
MltDeviceCapture
(
QString
profile
,
VideoContainer
*
surface
,
QWidget
*
parent
=
0
);
/** @brief Destroy the MLT Renderer. */
~
MltDeviceCapture
();
...
...
@@ -80,7 +80,7 @@ Q_OBJECT public:
void
gotCapturedFrame
(
Mlt
::
Frame
&
frame
);
/** @brief Save current frame to file. */
void
captureFrame
(
const
QString
&
path
);
void
doRefresh
();
/** @brief This will add the video clip from path and add it in the overlay track. */
void
setOverlay
(
const
QString
&
path
);
...
...
@@ -92,6 +92,8 @@ Q_OBJECT public:
/** @brief True if we are processing an image (yuv > rgb) when recording. */
bool
processingImage
;
void
pause
();
private:
Mlt
::
Consumer
*
m_mltConsumer
;
...
...
@@ -106,7 +108,7 @@ private:
int
m_frameCount
;
/** @brief The surface onto which the captured frames should be painted. */
Video
Preview
Container
*
m_captureDisplayWidget
;
VideoContainer
*
m_captureDisplayWidget
;
/** @brief A human-readable description of this renderer. */
int
m_winid
;
...
...
@@ -116,6 +118,8 @@ private:
QString
m_capturePath
;
QTimer
m_droppedFramesTimer
;
QMutex
m_mutex
;
/** @brief Build the MLT Consumer object with initial settings.
* @param profileName The MLT profile to use for the consumer */
...
...
@@ -146,6 +150,7 @@ public slots:
/** @brief Stops the consumer. */
void
stop
();
void
slotDoRefresh
();
};
#endif
src/monitor.cpp
View file @
ddcc903a
...
...
@@ -44,9 +44,8 @@
Monitor
::
Monitor
(
Kdenlive
::
MONITORID
id
,
MonitorManager
*
manager
,
QString
profile
,
QWidget
*
parent
)
:
AbstractMonitor
(
id
,
parent
),
AbstractMonitor
(
id
,
manager
,
parent
),
render
(
NULL
),
m_monitorManager
(
manager
),
m_currentClip
(
NULL
),
m_ruler
(
new
SmallRuler
(
m_monitorManager
)),
m_overlay
(
NULL
),
...
...
@@ -66,8 +65,6 @@ Monitor::Monitor(Kdenlive::MONITORID id, MonitorManager *manager, QString profil
// Video widget holder
m_videoBox
=
new
VideoContainer
(
this
);
m_videoBox
->
setContentsMargins
(
0
,
0
,
0
,
0
);
m_videoBox
->
setSizePolicy
(
QSizePolicy
::
Preferred
,
QSizePolicy
::
Preferred
);
layout
->
addWidget
(
m_videoBox
,
10
);
layout
->
addStretch
();
...
...
@@ -471,7 +468,7 @@ void Monitor::mouseReleaseEvent(QMouseEvent * event)
if
(
m_dragStarted
&&
event
->
button
()
!=
Qt
::
RightButton
)
{
if
(
m_videoBox
->
geometry
().
contains
(
event
->
pos
())
&&
(
!
m_effectWidget
||
!
m_effectWidget
->
isVisible
()))
{
if
(
isActive
())
slotPlay
();
else
a
ctivateMonitor
();
else
slotA
ctivateMonitor
();
}
//else event->ignore(); //QWidget::mouseReleaseEvent(event);
m_dragStarted
=
false
;
}
...
...
@@ -598,16 +595,6 @@ void Monitor::slotExtractCurrentFrame()
}
}
bool
Monitor
::
isActive
()
const
{
return
m_monitorManager
->
isActive
(
m_id
);
}
bool
Monitor
::
activateMonitor
()
{
return
m_monitorManager
->
activateMonitor
(
m_id
);
}
void
Monitor
::
setTimePos
(
const
QString
&
pos
)
{
m_timePos
->
setValue
(
pos
);
...
...
@@ -622,7 +609,7 @@ void Monitor::slotSeek()
void
Monitor
::
slotSeek
(
int
pos
)
{
if
(
render
==
NULL
)
return
;
a
ctivateMonitor
();
slotA
ctivateMonitor
();
render
->
seekToFrame
(
pos
);
}
...
...
@@ -648,35 +635,35 @@ void Monitor::checkOverlay()
void
Monitor
::
slotStart
()
{
a
ctivateMonitor
();
slotA
ctivateMonitor
();
render
->
play
(
0
);
render
->
seekToFrame
(
0
);
}
void
Monitor
::
slotEnd
()
{
a
ctivateMonitor
();
slotA
ctivateMonitor
();
render
->
play
(
0
);
render
->
seekToFrame
(
render
->
getLength
());
}
void
Monitor
::
slotZoneSt