videoFrame->Release();
}
+void DeckLinkCaptureDelegate::setAnalyse(bool isOn)
+{
+ m_analyseFrame = isOn;
+}
+
HRESULT DeckLinkCaptureDelegate::VideoInputFrameArrived(IDeckLinkVideoInputFrame* videoFrame, IDeckLinkAudioInputPacket* audioFrame)
{
IDeckLinkVideoFrame* rightEyeFrame = NULL;
doCaptureFrame.clear();
QtConcurrent::run(this, &DeckLinkCaptureDelegate::slotProcessFrame);
}
+ if (m_analyseFrame) {
+ QImage image(videoFrame->GetWidth(), videoFrame->GetHeight(), QImage::Format_ARGB32_Premultiplied);
+ //convert from uyvy422 to rgba
+ CaptureHandler::uyvy2rgb((uchar *)frameBytes, (uchar *)image.bits(), videoFrame->GetWidth(), videoFrame->GetHeight());
+ emit gotFrame(image);
+ }
if (videoOutputFile != -1) {
videoFrame->GetBytes(&frameBytes);
}
delegate = new DeckLinkCaptureDelegate();
+ delegate->setAnalyse(m_analyseFrame);
connect(delegate, SIGNAL(gotTimeCode(ulong)), this, SIGNAL(gotTimeCode(ulong)));
+ connect(delegate, SIGNAL(gotFrame(QImage)), this, SIGNAL(gotFrame(QImage)));
connect(delegate, SIGNAL(gotMessage(const QString &)), this, SIGNAL(gotMessage(const QString &)));
connect(delegate, SIGNAL(frameSaved(const QString)), this, SIGNAL(frameSaved(const QString)));
deckLinkInput->SetCallback(delegate);
public:
DeckLinkCaptureDelegate();
virtual ~DeckLinkCaptureDelegate();
-
+ void setAnalyse(bool isOn);
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID /*iid*/, LPVOID */*ppv*/) {
return E_NOINTERFACE;
}
pthread_mutex_t m_mutex;
QList <IDeckLinkVideoInputFrame*> m_framesList;
QStringList m_framePath;
+ bool m_analyseFrame;
private slots:
void slotProcessFrame();
void gotTimeCode(ulong);
void gotMessage(const QString &);
void frameSaved(const QString);
+ void gotFrame(QImage);
};
class BmdCaptureHandler : public CaptureHandler
<label>Update parameters while monitor scene changes.</label>
<default>false</default>
</entry>
+ <entry name="analyse_stopmotion" type="Bool">
+ <label>Send stopmotion frames to scopes for live analysis.</label>
+ <default>false</default>
+ </entry>
<entry name="showstopmotionthumbs" type="Bool">
<label>Show sequence thumbnails in stopmotion widget.</label>
if (m_stopmotion == NULL) {
m_stopmotion = new StopmotionWidget(m_activeDocument->projectFolder(), m_stopmotion_actions->actions(), this);
connect(m_stopmotion, SIGNAL(addOrUpdateSequence(const QString)), m_projectList, SLOT(slotAddOrUpdateSequence(const QString)));
+ for (int i = 0; i < m_scopesList.count(); i++) {
+ // Check if we need the renderer to send a new frame for update
+ /*if (!m_scopesList.at(i)->widget()->visibleRegion().isEmpty() && !(static_cast<AbstractScopeWidget *>(m_scopesList.at(i)->widget())->autoRefreshEnabled())) request = true;*/
+ connect(m_stopmotion, SIGNAL(gotFrame(QImage)), static_cast<AbstractScopeWidget *>(m_scopesList.at(i)->widget()), SLOT(slotRenderZoneUpdated(QImage)));
+ //static_cast<AbstractScopeWidget *>(m_scopesList.at(i)->widget())->slotMonitorCapture();
+ }
}
m_stopmotion->show();
}
CaptureHandler::CaptureHandler(QVBoxLayout *lay, QWidget *parent):
m_layout(lay),
- m_parent(parent)
+ m_parent(parent),
+ m_analyseFrame(KdenliveSettings::analyse_stopmotion())
{
}
stopCapture();
}
+void CaptureHandler::setAnalyse(bool isOn)
+{
+ m_analyseFrame = isOn;
+}
+
void CaptureHandler::stopCapture()
{
}
virtual void hidePreview(bool hide) = 0;
virtual QStringList getDeviceName(QString input) = 0;
virtual void setDevice(const QString input, QString size = QString()) = 0;
+ void setAnalyse(bool isOn);
static void uyvy2rgb(unsigned char *yuv_buffer, unsigned char *rgb_buffer, int width, int height);
static void yuyv2rgb(unsigned char *yuv_buffer, unsigned char *rgb_buffer, int width, int height);
protected:
QVBoxLayout *m_layout;
QWidget *m_parent;
+ bool m_analyseFrame;
signals:
void gotTimeCode(ulong);
void gotMessage(const QString &);
void frameSaved(const QString);
+ void gotFrame(QImage);
};
}
-StopmotionWidget::StopmotionWidget(KUrl projectFolder, const QList< QAction * > actions, QWidget *parent) :
+StopmotionWidget::StopmotionWidget(KUrl projectFolder, QList< QAction * > actions, QWidget *parent) :
QDialog(parent)
, Ui::Stopmotion_UI()
, m_projectFolder(projectFolder)
, m_animatedIndex(-1)
{
//setAttribute(Qt::WA_DeleteOnClose);
+ QAction *analyse = new QAction(i18n("Send frames to color scopes"), this);
+ analyse->setCheckable(true);
+ analyse->setChecked(KdenliveSettings::analyse_stopmotion());
+ connect(analyse, SIGNAL(triggered(bool)), this, SLOT(slotSwitchAnalyse(bool)));
addActions(actions);
setupUi(this);
setWindowTitle(i18n("Stop Motion Capture"));
confMenu->addAction(showThumbs);
confMenu->addAction(capInterval);
confMenu->addAction(removeCurrent);
+ confMenu->addAction(analyse);
config_button->setIcon(KIcon("configure"));
config_button->setMenu(confMenu);
connect(capture_device, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateHandler()));
if (m_bmCapture) {
connect(m_bmCapture, SIGNAL(frameSaved(const QString)), this, SLOT(slotNewThumb(const QString)));
+ connect(m_bmCapture, SIGNAL(gotFrame(QImage)), this, SIGNAL(gotFrame(QImage)));
} else live_button->setEnabled(false);
m_frame_preview = new MyLabel(this);
connect(m_frame_preview, SIGNAL(seek(bool)), this, SLOT(slotSeekFrame(bool)));
delete item;
}
}
+
+void StopmotionWidget::slotSwitchAnalyse(bool isOn)
+{
+ KdenliveSettings::setAnalyse_stopmotion(isOn);
+ m_bmCapture->setAnalyse(isOn);
+}
+
+
* @param projectFolder The current project folder, where captured files will be stored.
* @param actions The actions for this widget that can have a keyboard shortcut.
* @param parent (optional) parent widget */
- StopmotionWidget(KUrl projectFolder, const QList< QAction * > actions, QWidget *parent = 0);
+ StopmotionWidget(KUrl projectFolder, QList< QAction * > actions, QWidget *parent = 0);
virtual ~StopmotionWidget();
protected:
/** @brief Delete current frame from disk. */
void slotRemoveFrame();
-
+ /** @brief Enable / disable frame analysis (in color scopes). */
+ void slotSwitchAnalyse(bool isOn);
signals:
/** @brief Ask to add sequence to current project. */
void addOrUpdateSequence(const QString);
void doCreateThumbs(QImage, int);
+ void gotFrame(QImage);
};
#endif
fswc_add_image_grey(&v4lsrc, qimg.bits());
break;
}
+ if (m_analyseFrame) {
+ emit gotFrame(qimg);
+ }
if (!m_captureFramePath.isEmpty()) {
qimg.save(m_captureFramePath);
emit frameSaved(m_captureFramePath);
private slots:
void slotUpdate();
+
};