}
-MltDeviceCapture::MltDeviceCapture(QString profile, VideoPreviewContainer *surface, QWidget *parent) :
- AbstractRender("capture", parent),
+MltDeviceCapture::MltDeviceCapture(QString profile, VideoSurface *surface, QWidget *parent) :
+ AbstractRender(Kdenlive::recordMonitor, parent),
doCapture(0),
sendFrameForAnalysis(false),
processingImage(false),
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);
//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;
}
-void MltDeviceCapture::doRefresh()
+void MltDeviceCapture::slotDoRefresh()
{
- 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);
+ }
}
}
*/
- mlt_image_format format = mlt_image_rgb24;
+ mlt_image_format format = mlt_image_rgb24a;
int width = 0;
int height = 0;
const uchar* image = frame.get_image(format, width, height);
- QImage qimage(width, height, QImage::Format_ARGB32);
- memcpy(qimage.bits(), image, width * height * 3);
+ QImage qimage(width, height, QImage::Format_ARGB32_Premultiplied);
+ memcpy(qimage.bits(), image, width * height * 4);
emit frameUpdated(qimage.rgbSwapped());
}
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;
}
//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???
/*
renderProps->set("mlt_profile", m_activeProfile.toUtf8().constData());
- QStringList paramList = params.split(" ", QString::SkipEmptyParts);
+ QStringList paramList = params.split(' ', QString::SkipEmptyParts);
char *tmp2;
for (int i = 0; i < paramList.count(); i++) {
- tmp = qstrdup(paramList.at(i).section("=", 0, 0).toUtf8().constData());
- QString value = paramList.at(i).section("=", 1, 1);
+ tmp = qstrdup(paramList.at(i).section('=', 0, 0).toUtf8().constData());
+ QString value = paramList.at(i).section('=', 1, 1);
if (value == "%threads") value = QString::number(QThread::idealThreadCount());
tmp2 = qstrdup(value.toUtf8().constData());
renderProps->set(tmp, tmp2);
delete[] tmp;
if (filter && filter->is_valid()) {
for (int j = 0; j < parameters.count(); j++) {
- filter->set(parameters.at(j).section("=", 0, 0).toUtf8().constData(), parameters.at(j).section("=", 1, 1).toUtf8().constData());
+ filter->set(parameters.at(j).section('=', 0, 0).toUtf8().constData(), parameters.at(j).section('=', 1, 1).toUtf8().constData());
}
trackService.attach(*filter);
}
rgb_ptr += 3;
}
//emit imageReady(image);
- m_captureDisplayWidget->setImage(image);
+ //m_captureDisplayWidget->setImage(image);
emit unblockPreview();
//processingImage = false;
}