X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmltdevicecapture.cpp;h=e93e54190a5796e3287dbb41efbcf922155e7bb2;hb=b4a0ec0fffc1cbbf21d2ea9fc418885e3b34bce8;hp=b45acbb7c8c56043e6bb6c9a4f6e1ed766a546d4;hpb=c6f29109c54c160e9bbe7717be3def6f60609b94;p=kdenlive diff --git a/src/mltdevicecapture.cpp b/src/mltdevicecapture.cpp index b45acbb7..e93e5419 100644 --- a/src/mltdevicecapture.cpp +++ b/src/mltdevicecapture.cpp @@ -76,8 +76,8 @@ static void rec_consumer_frame_preview(mlt_consumer, MltDeviceCapture * self, ml } -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), @@ -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::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); + } } @@ -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; }