X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fstopmotion%2Fstopmotion.cpp;h=b937eff3dbdd605a8b8b93dece083131b63ee7f3;hb=19e3ddc20b9a5ead144576dd06fc609e15950009;hp=1055d0c2d219815be59c517f1b905e9cb7f456e8;hpb=1e007c2d73386e714ed480aba390b827e181994a;p=kdenlive diff --git a/src/stopmotion/stopmotion.cpp b/src/stopmotion/stopmotion.cpp index 1055d0c2..b937eff3 100644 --- a/src/stopmotion/stopmotion.cpp +++ b/src/stopmotion/stopmotion.cpp @@ -16,19 +16,17 @@ ***************************************************************************/ #include "stopmotion.h" -#include "../blackmagic/devices.h" -#if !defined(Q_OS_FREEBSD) && !defined(Q_OS_KFREEBSD) -#include "../v4l/v4lcapture.h" +#ifdef USE_V4L +#include "v4l/v4lcapture.h" #endif -#include "../slideshowclip.h" -#include "../profilesdialog.h" -#include "../mltdevicecapture.h" -#include "../recmonitor.h" -#include "../monitormanager.h" +#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 @@ -92,16 +90,21 @@ void MyLabel::paintEvent(QPaintEvent* event) } -StopmotionMonitor::StopmotionMonitor(QWidget *parent) : - AbstractMonitor(parent), +StopmotionMonitor::StopmotionMonitor(MonitorManager *manager, QWidget *parent) : + AbstractMonitor(Kdenlive::stopmotionMonitor, manager, parent), m_captureDevice(NULL) { + createVideoSurface(); } StopmotionMonitor::~StopmotionMonitor() { } +void StopmotionMonitor::slotSwitchFullScreen() +{ +} + void StopmotionMonitor::setRender(MltDeviceCapture *render) { m_captureDevice = render; @@ -112,9 +115,9 @@ AbstractRender *StopmotionMonitor::abstractRender() return m_captureDevice; } -const QString StopmotionMonitor::name() const +Kdenlive::MONITORID StopmotionMonitor::id() const { - return QString("stopmotion"); + return Kdenlive::stopmotionMonitor; } @@ -128,6 +131,14 @@ void StopmotionMonitor::start() { } +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() @@ -137,7 +148,7 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder, , m_animatedIndex(-1) , m_animate(false) , m_manager(manager) - , m_monitor(new StopmotionMonitor(this)) + , 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 @@ -245,19 +256,15 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder, QVBoxLayout *layout = new QVBoxLayout; layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); - m_videoBox = new VideoPreviewContainer(); - m_videoBox->setContentsMargins(0, 0, 0, 0); - m_videoBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - //m_videoBox->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); - m_videoBox->setLineWidth(4); - layout->addWidget(m_videoBox); + m_monitor->videoBox->setLineWidth(4); + layout->addWidget(m_monitor->videoBox); - - if (BMInterface::getBlackMagicDeviceList(capture_device)) { + if (KdenliveSettings::decklink_device_found()) { // Found a BlackMagic device } + if (QFile::exists(KdenliveSettings::video4vdevice())) { -#if !defined(Q_WS_MAC) && !defined(Q_OS_FREEBSD) && !defined(Q_OS_KFREEBSD) +#ifdef USE_V4L // Video 4 Linux device detection for (int i = 0; i < 10; i++) { QString path = "/dev/video" + QString::number(i); @@ -271,12 +278,12 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder, } } } -#endif +#endif /* USE_V4L */ } 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(frameSaved(const QString &)), this, SLOT(slotNewThumb(const QString &))); connect(m_bmCapture, SIGNAL(gotFrame(QImage)), this, SIGNAL(gotFrame(QImage))); } else live_button->setEnabled(false);*/ @@ -300,10 +307,10 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder, profilePath = KdenliveSettings::current_profile(); } - m_captureDevice = new MltDeviceCapture(profilePath, m_videoBox, this); + m_captureDevice = new MltDeviceCapture(profilePath, m_monitor->videoSurface, this); m_captureDevice->sendFrameForAnalysis = KdenliveSettings::analyse_stopmotion(); m_monitor->setRender(m_captureDevice); - connect(m_captureDevice, SIGNAL(frameSaved(const QString)), this, SLOT(slotNewThumb(const QString))); + connect(m_captureDevice, SIGNAL(frameSaved(const QString &)), this, SLOT(slotNewThumb(const QString &))); live_button->setChecked(false); button_addsequence->setEnabled(false); @@ -400,7 +407,7 @@ void StopmotionWidget::slotUpdateDeviceHandler() } m_layout->removeWidget(m_frame_preview); if (data == "v4l") { -#if !defined(Q_WS_MAC) && !defined(Q_OS_FREEBSD) && !defined(Q_OS_KFREEBSD) +#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 @@ -427,8 +434,8 @@ void StopmotionWidget::parseExistingSequences() //dir.setNameFilters(filters); QStringList sequences = dir.entryList(filters, QDir::Files, QDir::Name); //kDebug()<<"PF: "<<<<", sm: "<addItem(sequencename.section("_", 0, -2)); + foreach(const QString &sequencename, sequences) { + sequence_name->addItem(sequencename.section('_', 0, -2)); } } @@ -460,7 +467,7 @@ void StopmotionWidget::slotLive(bool isOn) capture_button->setEnabled(false); if (isOn) { m_frame_preview->setHidden(true); - m_videoBox->setHidden(false); + m_monitor->videoBox->setHidden(false); QLocale locale; MltVideoProfile profile; @@ -485,13 +492,13 @@ void StopmotionWidget::slotLive(bool isOn) } if (m_captureDevice == NULL) { - m_captureDevice = new MltDeviceCapture(profilePath, m_videoBox, this); + m_captureDevice = new MltDeviceCapture(profilePath, m_monitor->videoSurface, this); m_captureDevice->sendFrameForAnalysis = KdenliveSettings::analyse_stopmotion(); m_monitor->setRender(m_captureDevice); - connect(m_captureDevice, SIGNAL(frameSaved(const QString)), this, SLOT(slotNewThumb(const QString))); + connect(m_captureDevice, SIGNAL(frameSaved(const QString &)), this, SLOT(slotNewThumb(const QString &))); } - m_manager->activateMonitor("stopmotion"); + m_manager->activateMonitor(Kdenlive::stopmotionMonitor); QString producer = createProducer(profile, service, resource); if (m_captureDevice->slotStartPreview(producer, true)) { if (m_showOverlay->isChecked()) { @@ -514,7 +521,7 @@ void StopmotionWidget::slotLive(bool isOn) live_button->setChecked(false); if (m_captureDevice) { m_captureDevice->stop(); - m_videoBox->setHidden(true); + m_monitor->videoBox->setHidden(true); log_box->insertItem(-1, i18n("Stopped")); log_box->setCurrentIndex(0); //delete m_captureDevice; @@ -664,7 +671,7 @@ void StopmotionWidget::slotPreNotify() } -void StopmotionWidget::slotNewThumb(const QString path) +void StopmotionWidget::slotNewThumb(const QString &path) { if (!KdenliveSettings::showstopmotionthumbs()) return; m_filesList.append(path); @@ -711,7 +718,7 @@ void StopmotionWidget::slotCreateThumbs(QImage img, int ix) QString StopmotionWidget::getPathForFrame(int ix, QString seqName) { if (seqName.isEmpty()) seqName = m_sequenceName; - return m_projectFolder.path(KUrl::AddTrailingSlash) + seqName + "_" + QString::number(ix).rightJustified(4, '0', false) + ".png"; + return m_projectFolder.path(KUrl::AddTrailingSlash) + seqName + '_' + QString::number(ix).rightJustified(4, '0', false) + ".png"; } void StopmotionWidget::slotShowFrame(const QString& path) @@ -883,8 +890,10 @@ void StopmotionWidget::slotSwitchMirror(bool isOn) if (m_captureDevice) m_captureDevice->mirror(isOn); } -const QString StopmotionWidget::createProducer(MltVideoProfile profile, const QString service, const QString resource) + +const QString StopmotionWidget::createProducer(MltVideoProfile profile, const QString &service, const QString &resource) { + Q_UNUSED(profile) QString playlist = "producer100000pause" + resource + "" + service + "";