X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fstopmotion%2Fstopmotion.cpp;h=5611f2d41a10efbf511d0f9a23b04810dc532f7e;hb=ddcc903a2d2363bec128c1effd7a4f6c1e820f82;hp=e927d3ea26853b1e7c82d7d1f1844a9b1f50b897;hpb=b5e930a237a4f71ef89835a37eaf6cd1fe15d93e;p=kdenlive diff --git a/src/stopmotion/stopmotion.cpp b/src/stopmotion/stopmotion.cpp index e927d3ea..5611f2d4 100644 --- a/src/stopmotion/stopmotion.cpp +++ b/src/stopmotion/stopmotion.cpp @@ -16,13 +16,20 @@ ***************************************************************************/ #include "stopmotion.h" -#include "../blackmagic/devices.h" -#include "../v4l/v4lcapture.h" -#include "../slideshowclip.h" +#ifdef USE_BLACKMAGIC +#include "blackmagic/devices.h" +#endif +#ifdef USE_V4L +#include "v4l/v4lcapture.h" +#endif +#include "slideshowclip.h" +#include "profilesdialog.h" +#include "mltdevicecapture.h" +#include "recmonitor.h" +#include "monitormanager.h" #include "ui_smconfig_ui.h" #include "kdenlivesettings.h" - #include #include #include @@ -31,10 +38,6 @@ #include #include -#ifdef QIMAGEBLITZ -#include -#endif - #include #include #include @@ -90,20 +93,88 @@ void MyLabel::paintEvent(QPaintEvent* event) } -StopmotionWidget::StopmotionWidget(KUrl projectFolder, QList< QAction* > actions, QWidget* parent) : +StopmotionMonitor::StopmotionMonitor(MonitorManager *manager, QWidget *parent) : + AbstractMonitor(Kdenlive::stopmotionMonitor, manager, parent), + m_captureDevice(NULL) +{ +} + +StopmotionMonitor::~StopmotionMonitor() +{ +} + +void StopmotionMonitor::slotSwitchFullScreen() +{ +} + +void StopmotionMonitor::setRender(MltDeviceCapture *render) +{ + m_captureDevice = render; +} + +AbstractRender *StopmotionMonitor::abstractRender() +{ + return m_captureDevice; +} + +Kdenlive::MONITORID StopmotionMonitor::id() const +{ + return Kdenlive::stopmotionMonitor; +} + + +void StopmotionMonitor::stop() +{ + if (m_captureDevice) m_captureDevice->stop(); + emit stopCapture(); +} + +void StopmotionMonitor::start() +{ +} + +void StopmotionMonitor::pause() +{ +} + +void StopmotionMonitor::unpause() +{ +} + +void StopmotionMonitor::slotPlay() +{ +} + +void StopmotionMonitor::slotMouseSeek(int /*eventDelta*/, bool /*fast*/) +{ +} + +StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder, QList< QAction* > actions, QWidget* parent) : QDialog(parent) , Ui::Stopmotion_UI() , m_projectFolder(projectFolder) - , m_bmCapture(NULL) + , m_captureDevice(NULL) , m_sequenceFrame(0) , m_animatedIndex(-1) , m_animate(false) + , m_manager(manager) + , m_monitor(new StopmotionMonitor(manager, this)) { //setAttribute(Qt::WA_DeleteOnClose); + //HACK: the monitor widget is hidden, it is just used to control the capturedevice from monitormanager + m_monitor->setHidden(true); + connect(m_monitor, SIGNAL(stopCapture()), this, SLOT(slotStopCapture())); + m_manager->appendMonitor(m_monitor); 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))); + + QAction* mirror = new QAction(i18n("Mirror display"), this); + mirror->setCheckable(true); + //mirror->setChecked(KdenliveSettings::analyse_stopmotion()); + connect(mirror, SIGNAL(triggered(bool)), this, SLOT(slotSwitchMirror(bool))); + addActions(actions); setupUi(this); setWindowTitle(i18n("Stop Motion Capture")); @@ -113,13 +184,22 @@ StopmotionWidget::StopmotionWidget(KUrl projectFolder, QList< QAction* > actions m_captureAction = actions.at(0); connect(m_captureAction, SIGNAL(triggered()), this, SLOT(slotCaptureFrame())); + m_captureAction->setCheckable(true); + m_captureAction->setChecked(false); capture_button->setDefaultAction(m_captureAction); connect(actions.at(1), SIGNAL(triggered()), this, SLOT(slotSwitchLive())); + QAction *intervalCapture = new QAction(i18n("Interval capture"), this); + intervalCapture->setIcon(KIcon("chronometer")); + intervalCapture->setCheckable(true); + intervalCapture->setChecked(false); + capture_interval->setDefaultAction(intervalCapture); + preview_button->setIcon(KIcon("media-playback-start")); capture_button->setEnabled(false); + // Build config menu QMenu* confMenu = new QMenu; m_showOverlay = actions.at(2); @@ -127,22 +207,21 @@ StopmotionWidget::StopmotionWidget(KUrl projectFolder, QList< QAction* > actions overlay_button->setDefaultAction(m_showOverlay); //confMenu->addAction(m_showOverlay); -#ifdef QIMAGEBLITZ - m_effectIndex = KdenliveSettings::blitzeffect(); + m_effectIndex = KdenliveSettings::stopmotioneffect(); QMenu* effectsMenu = new QMenu(i18n("Overlay effect")); QActionGroup* effectGroup = new QActionGroup(this); QAction* noEffect = new QAction(i18n("No Effect"), effectGroup); - noEffect->setData(1); + noEffect->setData(0); QAction* contrastEffect = new QAction(i18n("Contrast"), effectGroup); - contrastEffect->setData(2); + contrastEffect->setData(1); QAction* edgeEffect = new QAction(i18n("Edge detect"), effectGroup); - edgeEffect->setData(3); + edgeEffect->setData(2); QAction* brightEffect = new QAction(i18n("Brighten"), effectGroup); - brightEffect->setData(4); + brightEffect->setData(3); QAction* invertEffect = new QAction(i18n("Invert"), effectGroup); - invertEffect->setData(5); + invertEffect->setData(4); QAction* thresEffect = new QAction(i18n("Threshold"), effectGroup); - thresEffect->setData(6); + thresEffect->setData(5); effectsMenu->addAction(noEffect); effectsMenu->addAction(contrastEffect); @@ -159,7 +238,6 @@ StopmotionWidget::StopmotionWidget(KUrl projectFolder, QList< QAction* > actions } connect(effectsMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotUpdateOverlayEffect(QAction*))); confMenu->addMenu(effectsMenu); -#endif QAction* showThumbs = new QAction(KIcon("image-x-generic"), i18n("Show sequence thumbnails"), this); showThumbs->setCheckable(true); @@ -176,36 +254,34 @@ StopmotionWidget::StopmotionWidget(KUrl projectFolder, QList< QAction* > actions confMenu->addAction(showThumbs); confMenu->addAction(removeCurrent); confMenu->addAction(analyse); + confMenu->addAction(mirror); confMenu->addAction(conf); config_button->setIcon(KIcon("configure")); config_button->setMenu(confMenu); - // Build capture menu - QMenu* capMenu = new QMenu; - m_intervalCapture = new QAction(KIcon("edit-redo"), i18n("Interval capture"), this); - m_intervalCapture->setCheckable(true); - m_intervalCapture->setChecked(false); - connect(m_intervalCapture, SIGNAL(triggered(bool)), this, SLOT(slotIntervalCapture(bool))); - capMenu->addAction(m_intervalCapture); - capture_button->setMenu(capMenu); - connect(sequence_name, SIGNAL(textChanged(const QString&)), this, SLOT(sequenceNameChanged(const QString&))); connect(sequence_name, SIGNAL(currentIndexChanged(int)), live_button, SLOT(setFocus())); - m_layout = new QVBoxLayout; - if (BMInterface::getBlackMagicDeviceList(capture_device, NULL)) { + // Video widget holder + QVBoxLayout *layout = new QVBoxLayout; + layout->setContentsMargins(0, 0, 0, 0); + layout->setSpacing(0); + m_videoBox = new VideoContainer(m_monitor); + m_videoBox->setLineWidth(4); + layout->addWidget(m_videoBox); + +#ifdef USE_BLACKMAGIC + if (BMInterface::getBlackMagicDeviceList(capture_device)) { // Found a BlackMagic device - m_bmCapture = new BmdCaptureHandler(m_layout); - connect(m_bmCapture, SIGNAL(gotMessage(const QString&)), this, SLOT(slotGotHDMIMessage(const QString&))); } +#endif if (QFile::exists(KdenliveSettings::video4vdevice())) { -#if !defined(Q_WS_MAC) && !defined(Q_OS_FREEBSD) - V4lCaptureHandler v4l(NULL); +#ifdef USE_V4L // Video 4 Linux device detection for (int i = 0; i < 10; i++) { QString path = "/dev/video" + QString::number(i); if (QFile::exists(path)) { - QStringList deviceInfo = v4l.getDeviceName(path); + QStringList deviceInfo = V4lCaptureHandler::getDeviceName(path); if (!deviceInfo.isEmpty()) { capture_device->addItem(deviceInfo.at(0), "v4l"); capture_device->setItemData(capture_device->count() - 1, path, Qt::UserRole + 1); @@ -214,29 +290,40 @@ StopmotionWidget::StopmotionWidget(KUrl projectFolder, QList< QAction* > actions } } } - - /*V4lCaptureHandler v4lhandler(NULL); - QStringList deviceInfo = v4lhandler.getDeviceName(KdenliveSettings::video4vdevice()); - capture_device->addItem(deviceInfo.at(0), "v4l"); - capture_device->setItemData(capture_device->count() - 1, deviceInfo.at(3), Qt::UserRole + 1);*/ - if (m_bmCapture == NULL) { - m_bmCapture = new V4lCaptureHandler(m_layout); - m_bmCapture->setDevice(capture_device->itemData(capture_device->currentIndex(), Qt::UserRole + 1).toString(), capture_device->itemData(capture_device->currentIndex(), Qt::UserRole + 2).toString()); - } -#endif +#endif /* USE_V4L */ } - 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(capture_device, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDeviceHandler())); + /*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); + } else live_button->setEnabled(false);*/ + m_frame_preview = new MyLabel(this); connect(m_frame_preview, SIGNAL(seek(bool)), this, SLOT(slotSeekFrame(bool))); connect(m_frame_preview, SIGNAL(switchToLive()), this, SLOT(slotSwitchLive())); - m_layout->addWidget(m_frame_preview); + layout->addWidget(m_frame_preview); m_frame_preview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - video_preview->setLayout(m_layout); + video_preview->setLayout(layout); + + //kDebug()<winId(); + + QString profilePath; + // Create MLT producer data + if (capture_device->itemData(capture_device->currentIndex()) == "v4l") { + // Capture using a video4linux device + profilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux"); + } + else { + // Decklink capture + profilePath = KdenliveSettings::current_profile(); + } + + m_captureDevice = new MltDeviceCapture(profilePath, m_videoBox, this); + m_captureDevice->sendFrameForAnalysis = KdenliveSettings::analyse_stopmotion(); + m_monitor->setRender(m_captureDevice); + connect(m_captureDevice, SIGNAL(frameSaved(const QString &)), this, SLOT(slotNewThumb(const QString &))); + live_button->setChecked(false); button_addsequence->setEnabled(false); connect(live_button, SIGNAL(toggled(bool)), this, SLOT(slotLive(bool))); @@ -251,21 +338,28 @@ StopmotionWidget::StopmotionWidget(KUrl projectFolder, QList< QAction* > actions frame_list->setHidden(!KdenliveSettings::showstopmotionthumbs()); parseExistingSequences(); QTimer::singleShot(500, this, SLOT(slotLive())); + connect(&m_intervalTimer, SIGNAL(timeout()), this, SLOT(slotCaptureFrame())); + m_intervalTimer.setSingleShot(true); + m_intervalTimer.setInterval(KdenliveSettings::captureinterval() * 1000); } StopmotionWidget::~StopmotionWidget() { - if (m_bmCapture) - m_bmCapture->stopPreview(); + m_manager->removeMonitor(m_monitor); + if (m_captureDevice) { + m_captureDevice->stop(); + delete m_captureDevice; + m_captureDevice = NULL; + } + + delete m_monitor; } void StopmotionWidget::slotUpdateOverlayEffect(QAction* act) { -#ifdef QIMAGEBLITZ if (act) m_effectIndex = act->data().toInt(); - KdenliveSettings::setBlitzeffect(m_effectIndex); - if (m_showOverlay->isChecked()) slotUpdateOverlay(); -#endif + KdenliveSettings::setStopmotioneffect(m_effectIndex); + slotUpdateOverlay(); } void StopmotionWidget::closeEvent(QCloseEvent* e) @@ -281,12 +375,21 @@ void StopmotionWidget::slotConfigure() ui.setupUi(&d); d.setWindowTitle(i18n("Configure Stop Motion")); ui.sm_interval->setValue(KdenliveSettings::captureinterval()); + ui.sm_interval->setSuffix(ki18np(" second", " seconds")); + ui.sm_notifytime->setSuffix(ki18np(" second", " seconds")); + ui.sm_notifytime->setValue(KdenliveSettings::sm_notifytime()); + connect(ui.sm_prenotify, SIGNAL(toggled(bool)), ui.sm_notifytime, SLOT(setEnabled(bool))); + ui.sm_prenotify->setChecked(KdenliveSettings::sm_prenotify()); ui.sm_loop->setChecked(KdenliveSettings::sm_loop()); ui.sm_framesplayback->setValue(KdenliveSettings::sm_framesplayback()); + if (d.exec() == QDialog::Accepted) { KdenliveSettings::setSm_loop(ui.sm_loop->isChecked()); KdenliveSettings::setCaptureinterval(ui.sm_interval->value()); KdenliveSettings::setSm_framesplayback(ui.sm_framesplayback->value()); + KdenliveSettings::setSm_notifytime(ui.sm_notifytime->value()); + KdenliveSettings::setSm_prenotify(ui.sm_prenotify->isChecked()); + m_intervalTimer.setInterval(KdenliveSettings::captureinterval() * 1000); } } @@ -303,22 +406,20 @@ void StopmotionWidget::slotShowThumbs(bool show) frame_list->setHidden(!show); } -void StopmotionWidget::slotIntervalCapture(bool capture) -{ - if (capture) slotCaptureFrame(); -} - -void StopmotionWidget::slotUpdateHandler() +void StopmotionWidget::slotUpdateDeviceHandler() { - QString data = capture_device->itemData(capture_device->currentIndex()).toString(); + slotLive(false); + delete m_captureDevice; + m_captureDevice = NULL; + /*QString data = capture_device->itemData(capture_device->currentIndex()).toString(); slotLive(false); if (m_bmCapture) { delete m_bmCapture; } m_layout->removeWidget(m_frame_preview); if (data == "v4l") { -#if !defined(Q_WS_MAC) && !defined(Q_OS_FREEBSD) +#ifdef USE_V4L m_bmCapture = new V4lCaptureHandler(m_layout); m_bmCapture->setDevice(capture_device->itemData(capture_device->currentIndex(), Qt::UserRole + 1).toString(), capture_device->itemData(capture_device->currentIndex(), Qt::UserRole + 2).toString()); #endif @@ -327,7 +428,7 @@ void StopmotionWidget::slotUpdateHandler() if (m_bmCapture) connect(m_bmCapture, SIGNAL(gotMessage(const QString&)), this, SLOT(slotGotHDMIMessage(const QString&))); } live_button->setEnabled(m_bmCapture != NULL); - m_layout->addWidget(m_frame_preview); + m_layout->addWidget(m_frame_preview);*/ } void StopmotionWidget::slotGotHDMIMessage(const QString& message) @@ -353,20 +454,94 @@ void StopmotionWidget::parseExistingSequences() void StopmotionWidget::slotSwitchLive() { setUpdatesEnabled(false); - if (m_frame_preview->isHidden()) { - if (m_bmCapture) m_bmCapture->hidePreview(true); + slotLive(!live_button->isChecked()); + /*if (m_frame_preview->isHidden()) { + //if (m_bmCapture) m_bmCapture->hidePreview(true); + m_videoBox->setHidden(true); m_frame_preview->setHidden(false); } else { m_frame_preview->setHidden(true); - if (m_bmCapture) m_bmCapture->hidePreview(false); + //if (m_bmCapture) m_bmCapture->hidePreview(false); + m_videoBox->setHidden(false); capture_button->setEnabled(true); - } + }*/ setUpdatesEnabled(true); } +void StopmotionWidget::slotStopCapture() +{ + slotLive(false); +} + void StopmotionWidget::slotLive(bool isOn) { live_button->blockSignals(true); + capture_button->setEnabled(false); + if (isOn) { + m_frame_preview->setHidden(true); + m_videoBox->setHidden(false); + QLocale locale; + + MltVideoProfile profile; + QString resource; + QString service; + QString profilePath; + // Create MLT producer data + if (capture_device->itemData(capture_device->currentIndex()) == "v4l") { + // Capture using a video4linux device + profilePath = KStandardDirs::locateLocal("appdata", "profiles/video4linux"); + profile = ProfilesDialog::getVideoProfile(profilePath); + service = "avformat-novalidate"; + QString devicePath = capture_device->itemData(capture_device->currentIndex(), Qt::UserRole + 1).toString(); + resource = QString("video4linux2:%1?width:%2&height:%3&frame_rate:%4").arg(devicePath).arg(profile.width).arg(profile.height).arg((double) profile.frame_rate_num / profile.frame_rate_den); + } + else { + // Decklink capture + profilePath = KdenliveSettings::current_profile(); + profile = ProfilesDialog::getVideoProfile(profilePath); + service = "decklink"; + resource = capture_device->itemData(capture_device->currentIndex(), Qt::UserRole + 1).toString(); + } + + if (m_captureDevice == NULL) { + m_captureDevice = new MltDeviceCapture(profilePath, m_videoBox, this); + m_captureDevice->sendFrameForAnalysis = KdenliveSettings::analyse_stopmotion(); + m_monitor->setRender(m_captureDevice); + connect(m_captureDevice, SIGNAL(frameSaved(const QString &)), this, SLOT(slotNewThumb(const QString &))); + } + + m_manager->activateMonitor(Kdenlive::stopmotionMonitor); + QString producer = createProducer(profile, service, resource); + if (m_captureDevice->slotStartPreview(producer, true)) { + if (m_showOverlay->isChecked()) { + reloadOverlay(); + slotUpdateOverlay(); + } + capture_button->setEnabled(true); + live_button->setChecked(true); + log_box->insertItem(-1, i18n("Playing %1x%2 (%3 fps)", profile.width, profile.height, locale.toString((double)profile.frame_rate_num/profile.frame_rate_den).rightJustified(2, '0'))); + log_box->setCurrentIndex(0); + } + else { + kDebug()<<"// problem starting stopmo"; + log_box->insertItem(-1, i18n("Failed to start device")); + log_box->setCurrentIndex(0); + } + } + else { + m_frame_preview->setHidden(false); + live_button->setChecked(false); + if (m_captureDevice) { + m_captureDevice->stop(); + m_videoBox->setHidden(true); + log_box->insertItem(-1, i18n("Stopped")); + log_box->setCurrentIndex(0); + //delete m_captureDevice; + //m_captureDevice = NULL; + } + } + + /* if (isOn && m_bmCapture) { //m_frame_preview->setImage(QImage()); m_frame_preview->setHidden(true); @@ -378,57 +553,66 @@ void StopmotionWidget::slotLive(bool isOn) m_frame_preview->setHidden(false); capture_button->setEnabled(false); live_button->setChecked(false); - } + }*/ live_button->blockSignals(false); } void StopmotionWidget::slotShowOverlay(bool isOn) { if (isOn) { - if (live_button->isChecked() && m_sequenceFrame > 0) { - slotUpdateOverlay(); - } - } else if (m_bmCapture) { - m_bmCapture->hideOverlay(); + // Overlay last frame of the sequence + reloadOverlay(); + slotUpdateOverlay(); + } + else { + // Remove overlay + m_captureDevice->setOverlay(QString()); } } -void StopmotionWidget::slotUpdateOverlay() +void StopmotionWidget::reloadOverlay() { - if (m_bmCapture == NULL) return; QString path = getPathForFrame(m_sequenceFrame - 1); - if (!QFile::exists(path)) return; - QImage img(path); - if (img.isNull()) { - QTimer::singleShot(1000, this, SLOT(slotUpdateOverlay())); + if (!QFile::exists(path)) { + log_box->insertItem(-1, i18n("No previous frame found")); + log_box->setCurrentIndex(0); return; } + m_captureDevice->setOverlay(path); +} + +void StopmotionWidget::slotUpdateOverlay() +{ + if (m_captureDevice == NULL) return; + + QString tag; + QStringList params; -#ifdef QIMAGEBLITZ - //img = Blitz::convolveEdge(img, 0, Blitz::Low); switch (m_effectIndex) { + case 1: + tag = "frei0r.contrast0r"; + params << "Contrast=1.2"; + break; case 2: - img = Blitz::contrast(img, true, 6); + tag = "charcoal"; + params << "x_scatter=4" << "y_scatter=4" << "scale=1" << "mix=0"; break; case 3: - img = Blitz::edge(img); + tag = "frei0r.brightness"; + params << "Brightness=0.7"; break; case 4: - img = Blitz::intensity(img, 0.5); + tag = "invert"; break; case 5: - Blitz::invert(img); - break; - case 6: - img = Blitz::threshold(img, 120, Blitz::Grayscale, qRgba(0, 0, 0, 0), qRgba(255, 0, 0, 255)); - //img = Blitz::flatten(img, QColor(255, 0, 0, 255), QColor(0, 0, 0, 0)); + tag = "threshold"; + params << "midpoint=125"; break; default: break; } -#endif - m_bmCapture->showOverlay(img); + m_captureDevice->setOverlayEffect(tag, params); } void StopmotionWidget::sequenceNameChanged(const QString& name) @@ -460,10 +644,13 @@ void StopmotionWidget::sequenceNameChanged(const QString& name) void StopmotionWidget::slotCaptureFrame() { - if (m_bmCapture == NULL) return; + if (m_captureDevice == NULL) return; if (sequence_name->currentText().isEmpty()) { QString seqName = QInputDialog::getText(this, i18n("Create New Sequence"), i18n("Enter sequence name")); - if (seqName.isEmpty()) return; + if (seqName.isEmpty()) { + m_captureAction->setChecked(false); + return; + } sequence_name->blockSignals(true); sequence_name->setItemText(sequence_name->currentIndex(), seqName); sequence_name->blockSignals(false); @@ -473,21 +660,36 @@ void StopmotionWidget::slotCaptureFrame() m_sequenceFrame = 0; } //capture_button->setEnabled(false); + if (m_intervalTimer.isActive()) { + // stop interval capture + m_intervalTimer.stop(); + return; + } QString currentPath = getPathForFrame(m_sequenceFrame); - m_bmCapture->captureFrame(currentPath); + m_captureDevice->captureFrame(currentPath); KNotification::event("FrameCaptured", i18n("Frame Captured"), QPixmap(), this); m_sequenceFrame++; button_addsequence->setEnabled(true); - if (m_intervalCapture->isChecked()) QTimer::singleShot(KdenliveSettings::captureinterval() * 1000, this, SLOT(slotCaptureFrame())); + if (capture_interval->isChecked()) { + if (KdenliveSettings::sm_prenotify()) QTimer::singleShot((KdenliveSettings::captureinterval() - KdenliveSettings::sm_notifytime()) * 1000, this, SLOT(slotPreNotify())); + m_intervalTimer.start(); + } + else m_captureAction->setChecked(false); +} + +void StopmotionWidget::slotPreNotify() +{ + if (m_captureAction->isChecked()) KNotification::event("ReadyToCapture", i18n("Going to Capture Frame"), QPixmap(), this); } -void StopmotionWidget::slotNewThumb(const QString path) +void StopmotionWidget::slotNewThumb(const QString &path) { if (!KdenliveSettings::showstopmotionthumbs()) return; m_filesList.append(path); - if (m_showOverlay->isChecked()) slotUpdateOverlay(); + if (m_showOverlay->isChecked()) reloadOverlay(); if (!m_future.isRunning()) m_future = QtConcurrent::run(this, &StopmotionWidget::slotPrepareThumbs); + } void StopmotionWidget::slotPrepareThumbs() @@ -538,7 +740,8 @@ void StopmotionWidget::slotShowFrame(const QString& path) capture_button->setEnabled(false); slotLive(false); if (!img.isNull()) { - if (m_bmCapture) m_bmCapture->hidePreview(true); + //m_videoBox->setHidden(true); + m_frame_preview->setImage(img); m_frame_preview->setHidden(false); m_frame_preview->update(); @@ -690,7 +893,36 @@ void StopmotionWidget::slotRemoveFrame() void StopmotionWidget::slotSwitchAnalyse(bool isOn) { KdenliveSettings::setAnalyse_stopmotion(isOn); - m_bmCapture->setAnalyse(isOn); + if (m_captureDevice) m_captureDevice->sendFrameForAnalysis = isOn; +} + +void StopmotionWidget::slotSwitchMirror(bool isOn) +{ + //KdenliveSettings::setAnalyse_stopmotion(isOn); + if (m_captureDevice) m_captureDevice->mirror(isOn); +} + + +const QString StopmotionWidget::createProducer(MltVideoProfile profile, const QString &service, const QString &resource) +{ + Q_UNUSED(profile) + + QString playlist = "producer100000pause" + resource + "" + service + ""; + + // overlay track + playlist.append(""); + + // video4linux track + playlist.append(""); + + playlist.append(""); + playlist.append(""); + playlist.append(""); + playlist.append(""); + + + return playlist; } +