Commit 946e64fd authored by Akhil K Gangadharan's avatar Akhil K Gangadharan

Remove V4L device handling for capture, add MediaCapture functionality

parent 45a56c0c
Pipeline #1117 failed with stage
in 14 minutes and 18 seconds
......@@ -141,7 +141,8 @@ Monitor::Monitor(Kdenlive::MonitorId id, MonitorManager *manager, QWidget *paren
, m_editMarker(nullptr)
, m_forceSizeFactor(0)
, m_lastMonitorSceneType(MonitorSceneDefault)
{
, m_capture(nullptr)
{
auto *layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
......@@ -369,6 +370,7 @@ Monitor::~Monitor()
delete m_videoWidget;
delete m_glWidget;
delete m_timePos;
delete m_capture;
}
void Monitor::setOffsetX(int x)
......@@ -1971,22 +1973,51 @@ void Monitor::slotSwitchRec(bool enable)
}
}
bool Monitor::startCapture(const QString &params, const QString &path, Mlt::Producer *p)
bool Monitor::startCapture(bool checkAudio, bool checkVideo, QUrl path)
{
// TODO
m_controller = nullptr;
m_capture = new MediaCapture(this);
m_capture->setOutputLocations(path, checkAudio, checkVideo);
if(checkAudio && checkVideo) {
m_capture->recordVideo();
}
else if(checkAudio) {
m_capture->recordAudioOnly();
}
else if (checkVideo) {
m_capture->recordVideoOnly();
}
/*
if (false) { // render->updateProducer(p)) {
m_glMonitor->reconfigureMulti(params, path, p->profile());
//m_glMonitor->reconfigureMulti(params, path, p->profile());
return true;
}
return false;
*/
return true;
}
bool Monitor::stopCapture()
bool Monitor::stopCapture(bool checkAudio, bool checkVideo)
{
m_glMonitor->stopCapture();
slotOpenClip(nullptr);
m_glMonitor->reconfigure(profile());
if(m_capture) {
if(checkAudio && checkVideo) {
m_capture->pauseVideo();
}
else if(checkAudio && !checkVideo) {
m_capture->pauseAudioOnly();
}
else if (checkVideo && !checkAudio) {
m_capture->pauseVideoOnly();
}
slotOpenClip(nullptr);
}
//TODO remove else
return true;
}
......@@ -2077,7 +2108,7 @@ void Monitor::panView(QPoint diff)
}
void Monitor::requestSeek(int pos)
{
{
m_glMonitor->seek(pos);
}
......@@ -2139,3 +2170,4 @@ void Monitor::setConsumerProperty(const QString &name, const QString &value)
{
m_glMonitor->setConsumerProperty(name, value);
}
......@@ -26,6 +26,7 @@
#include "gentime.h"
#include "scopes/sharedframe.h"
#include "timecodedisplay.h"
#include "capture/mediacapture.h"
#include <QDomElement>
#include <QElapsedTimer>
......@@ -136,8 +137,8 @@ public:
void switchDropFrames(bool drop);
void updateMonitorGamma();
void mute(bool, bool updateIconOnly = false) override;
bool startCapture(const QString &params, const QString &path, Mlt::Producer *p);
bool stopCapture();
bool startCapture(bool, bool, QUrl);
bool stopCapture(bool, bool);
void reparent();
/** @brief Returns the action displaying record toolbar */
QAction *recAction();
......@@ -162,6 +163,7 @@ public:
void slotZoomOut();
/** @brief Set a property on the MLT consumer */
void setConsumerProperty(const QString &name, const QString &value);
MediaCapture *m_capture;
protected:
void mousePressEvent(QMouseEvent *event) override;
......@@ -231,6 +233,7 @@ private:
MonitorAudioLevel *m_audioMeterWidget;
QElapsedTimer m_droppedTimer;
double m_displayedFps;
void adjustScrollBars(float horizontal, float vertical);
void loadQmlScene(MonitorSceneType type);
void updateQmlDisplay(int currentOverlay);
......@@ -328,7 +331,7 @@ public slots:
/** @brief Check current position to show relevant infos in qml view (markers, zone in/out, etc). */
void checkOverlay(int pos = -1);
void refreshMonitorIfActive(bool directUpdate = false) override;
signals:
void seekPosition(int);
/** @brief Request a timeline seeking if diff is true, position is a relative offset, otherwise an absolute position */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment