]> git.sesse.net Git - kdenlive/commitdiff
Some more cleanup in monitors, improve capture fullscreen
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 14 Mar 2012 21:38:36 +0000 (22:38 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 14 Mar 2012 21:38:36 +0000 (22:38 +0100)
12 files changed:
src/abstractmonitor.cpp
src/abstractmonitor.h
src/mltdevicecapture.cpp
src/mltdevicecapture.h
src/monitor.cpp
src/monitor.h
src/recmonitor.cpp
src/recmonitor.h
src/renderer.cpp
src/renderer.h
src/stopmotion/stopmotion.cpp
src/stopmotion/stopmotion.h

index 02ed9a99ddc9304ade7c0e3035acac75f44c53d0..c41569cc69e713f2abce332438f92791070a25cc 100644 (file)
 
 #include <QPaintEvent>
 #include <QDesktopWidget>
+#include <QVBoxLayout>
 
 
 AbstractMonitor::AbstractMonitor(Kdenlive::MONITORID id, MonitorManager *manager, QWidget *parent): 
     QWidget(parent),
     m_id(id),
+    videoSurface(NULL),
     m_monitorManager(manager)
-{}
+{
+    videoBox = new VideoContainer(this);
+}
+
+
+AbstractMonitor::~AbstractMonitor()
+{
+    if (videoSurface)
+       delete videoSurface;
+}
+
+void AbstractMonitor::createVideoSurface()
+{
+    QVBoxLayout *lay = new QVBoxLayout;
+    lay->setContentsMargins(0, 0, 0, 0);
+    videoSurface = new VideoSurface;
+    lay->addWidget(videoSurface);
+    videoBox->setLayout(lay);
+}
 
 bool AbstractMonitor::isActive() const
 {
@@ -50,8 +70,6 @@ VideoContainer::VideoContainer(AbstractMonitor* monitor, QWidget *parent) :
 {
     setFrameShape(QFrame::NoFrame);
     setFocusPolicy(Qt::ClickFocus);
-    setAttribute(Qt::WA_PaintOnScreen);
-    setAttribute(Qt::WA_OpaquePaintEvent);
     //setEnabled(false);
     setContentsMargins(0, 0, 0, 0);
     setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
@@ -94,7 +112,6 @@ void VideoContainer::mouseDoubleClickEvent(QMouseEvent * event)
 void VideoContainer::switchFullScreen()
 {
     // TODO: disable screensaver?
-    m_monitor->pause();
     Qt::WindowFlags flags = windowFlags();
     if (!isFullScreen()) {
         // Check if we ahave a multiple monitor setup
@@ -142,5 +159,24 @@ void VideoContainer::switchFullScreen()
         setEnabled(false);
         show();
     }
-    m_monitor->unpause();
 }
+
+VideoSurface::VideoSurface(QWidget* parent) :
+    QWidget(parent)
+{
+    // MonitorRefresh is used as container for the SDL display (it's window id is passed to SDL)
+    setAttribute(Qt::WA_PaintOnScreen);
+    setAttribute(Qt::WA_OpaquePaintEvent);
+    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
+    setAttribute(Qt::WA_NoSystemBackground);
+    setUpdatesEnabled(false);
+}
+
+void VideoSurface::paintEvent(QPaintEvent *event)
+{
+    Q_UNUSED(event);
+    //WARNING: This might trigger unnecessary refreshes from MLT's producer, but without this,
+    // as soon as monitor is covered by a popup menu or another window, image is corrupted.
+    emit refreshMonitor();
+}
+
index 33154d40d969dad3dfad2921a3af32766aa255fe..58fc10931cfdf3486f7e84a9c1112857ee47d926 100644 (file)
@@ -33,7 +33,7 @@
 #include <stdint.h>
 
 class MonitorManager;
-
+class VideoContainer;
 
 class AbstractRender: public QObject
 {
@@ -70,17 +70,35 @@ signals:
     void audioSamplesSignal(QVector<int16_t>,int,int,int);
 };
 
+
+
+class VideoSurface : public QWidget
+{
+    Q_OBJECT
+public:
+    VideoSurface(QWidget *parent = 0);
+    
+signals:
+    void refreshMonitor();
+
+protected:
+    virtual void paintEvent ( QPaintEvent * event );
+};
+
+
 class AbstractMonitor : public QWidget
 {
     Q_OBJECT
 public:
     AbstractMonitor(Kdenlive::MONITORID id, MonitorManager *manager, QWidget *parent = 0);
     Kdenlive::MONITORID id() {return m_id;};
-    virtual ~AbstractMonitor() {};
+    virtual ~AbstractMonitor();
     virtual AbstractRender *abstractRender() = 0;
-    virtual void pause() = 0;
-    virtual void unpause() = 0;
     bool isActive() const;
+    VideoContainer *videoBox;
+    VideoSurface *videoSurface;
+    void createVideoSurface();
+    
     
 public slots:
     virtual void stop() = 0;
@@ -113,5 +131,4 @@ private:
     AbstractMonitor *m_monitor;
 };
 
-
 #endif
index 419878bd6a203532885297a7293fc64cb9926d1d..e93e54190a5796e3287dbb41efbcf922155e7bb2 100644 (file)
@@ -76,7 +76,7 @@ static void rec_consumer_frame_preview(mlt_consumer, MltDeviceCapture * self, ml
 }
 
 
-MltDeviceCapture::MltDeviceCapture(QString profile, VideoContainer *surface, QWidget *parent) :
+MltDeviceCapture::MltDeviceCapture(QString profile, VideoSurface *surface, QWidget *parent) :
     AbstractRender(Kdenlive::recordMonitor, parent),
     doCapture(0),
     sendFrameForAnalysis(false),
index 27c5234636f11bf563180c67ad053d6f6f64141c..b0004a31519c86c0b630394bd6779a39b207616b 100644 (file)
@@ -50,7 +50,7 @@ Q_OBJECT public:
     /** @brief Build a MLT Renderer
      *  @param winid The parent widget identifier (required for SDL display). Set to 0 for OpenGL rendering
      *  @param profile The MLT profile used for the capture (default one will be used if empty). */
-    MltDeviceCapture(QString profile, VideoContainer *surface, QWidget *parent = 0);
+    MltDeviceCapture(QString profile, VideoSurface *surface, QWidget *parent = 0);
 
     /** @brief Destroy the MLT Renderer. */
     ~MltDeviceCapture();
@@ -108,7 +108,7 @@ private:
     int m_frameCount;
 
     /** @brief The surface onto which the captured frames should be painted. */
-    VideoContainer *m_captureDisplayWidget;
+    VideoSurface *m_captureDisplayWidget;
 
     /** @brief A human-readable description of this renderer. */
     int m_winid;
index 9dc2aa3383e769672629166643714dcf157a4b31..3a69d0f7e13926566876ab9f1aa7fe5a303c0504 100644 (file)
@@ -52,7 +52,6 @@ Monitor::Monitor(Kdenlive::MONITORID id, MonitorManager *manager, QString profil
     m_scale(1),
     m_length(0),
     m_dragStarted(false),
-    m_monitorRefresh(NULL),
     m_contextMenu(NULL),
     m_effectWidget(NULL),
     m_selectedClip(NULL),
@@ -64,8 +63,7 @@ Monitor::Monitor(Kdenlive::MONITORID id, MonitorManager *manager, QString profil
     layout->setSpacing(0);
 
     // Video widget holder
-    m_videoBox = new VideoContainer(this);
-    layout->addWidget(m_videoBox, 10);
+    layout->addWidget(videoBox, 10);
     layout->addStretch();
 
     // Get base size for icons
@@ -149,27 +147,25 @@ Monitor::Monitor(Kdenlive::MONITORID id, MonitorManager *manager, QString profil
 
     bool monitorCreated = false;
 #ifdef Q_WS_MAC
-    createOpenGlWidget(m_videoBox, profile);
+    createOpenGlWidget(videoBox, profile);
     monitorCreated = true;
     //m_glWidget->setFixedSize(width, height);
 #elif defined(USE_OPENGL)
     if (KdenliveSettings::openglmonitors()) {
-        monitorCreated = createOpenGlWidget(m_videoBox, profile);
+        monitorCreated = createOpenGlWidget(videoBox, profile);
     }
 #endif
-    QVBoxLayout *lay = new QVBoxLayout;
-    lay->setContentsMargins(0, 0, 0, 0);
     if (!monitorCreated) {
-        m_monitorRefresh = new MonitorRefresh;
-        lay->addWidget(m_monitorRefresh);
-        m_videoBox->setLayout(lay);
-        render = new Render(m_id, (int) m_monitorRefresh->winId(), profile, this);
-        m_monitorRefresh->setRenderer(render);
+       createVideoSurface();
+        render = new Render(m_id, (int) videoSurface->winId(), profile, this);
+       connect(videoSurface, SIGNAL(refreshMonitor()), render, SLOT(doRefresh()));
     }
 #ifdef USE_OPENGL
     else if (m_glWidget) {
+       QVBoxLayout *lay = new QVBoxLayout;
+       lay->setContentsMargins(0, 0, 0, 0);
         lay->addWidget(m_glWidget);
-        m_videoBox->setLayout(lay);
+        videoBox->setLayout(lay);
     }
 #endif
 
@@ -187,12 +183,12 @@ Monitor::Monitor(Kdenlive::MONITORID id, MonitorManager *manager, QString profil
         connect(m_ruler, SIGNAL(zoneChanged(QPoint)), this, SLOT(setClipZone(QPoint)));
     }
 
-    if (m_monitorRefresh) m_monitorRefresh->show();
+    if (videoSurface) videoSurface->show();
 
     if (id == Kdenlive::projectMonitor) {
-        m_effectWidget = new MonitorEditWidget(render, m_videoBox);
+        m_effectWidget = new MonitorEditWidget(render, videoBox);
         m_toolbar->addAction(m_effectWidget->getVisibilityAction());
-        lay->addWidget(m_effectWidget);
+        videoBox->layout()->addWidget(m_effectWidget);
         m_effectWidget->hide();
     }
 
@@ -213,13 +209,12 @@ Monitor::~Monitor()
     delete m_overlay;
     if (m_effectWidget)
         delete m_effectWidget;
-    delete m_monitorRefresh;
     delete render;
 }
 
 QWidget *Monitor::container()
 {
-    return m_videoBox;
+    return videoBox;
 }
 
 #ifdef USE_OPENGL
@@ -315,7 +310,7 @@ void Monitor::slotSetSizeOneToOne()
         height = height * 0.8;
     }
     kDebug() << "// MONITOR; set SIZE: " << width << ", " << height;
-    m_videoBox->setFixedSize(width, height);
+    videoBox->setFixedSize(width, height);
     updateGeometry();
     adjustSize();
     //m_ui.video_frame->setMinimumSize(0, 0);
@@ -335,7 +330,7 @@ void Monitor::slotSetSizeOneToTwo()
         height = height * 0.8;
     }
     kDebug() << "// MONITOR; set SIZE: " << width << ", " << height;
-    m_videoBox->setFixedSize(width, height);
+    videoBox->setFixedSize(width, height);
     updateGeometry();
     adjustSize();
     //m_ui.video_frame->setMinimumSize(0, 0);
@@ -344,7 +339,7 @@ void Monitor::slotSetSizeOneToTwo()
 
 void Monitor::resetSize()
 {
-    m_videoBox->setMinimumSize(0, 0);
+    videoBox->setMinimumSize(0, 0);
 }
 
 DocClipBase *Monitor::activeClip()
@@ -441,7 +436,7 @@ void Monitor::slotSetZoneEnd()
 void Monitor::mousePressEvent(QMouseEvent * event)
 {
     if (event->button() != Qt::RightButton) {
-        if (m_videoBox->geometry().contains(event->pos()) && (!m_overlay || !m_overlay->underMouse())) {
+        if (videoBox->geometry().contains(event->pos()) && (!m_overlay || !m_overlay->underMouse())) {
             m_dragStarted = true;
             m_DragStartPosition = event->pos();
         }
@@ -456,17 +451,16 @@ void Monitor::resizeEvent(QResizeEvent *event)
     if (render && isVisible() && isActive()) render->doRefresh();
 }
 
-
 void Monitor::slotSwitchFullScreen()
 {
-    m_videoBox->switchFullScreen();
+    videoBox->switchFullScreen();
 }
 
 // virtual
 void Monitor::mouseReleaseEvent(QMouseEvent * event)
 {
     if (m_dragStarted && event->button() != Qt::RightButton) {
-        if (m_videoBox->geometry().contains(event->pos()) && (!m_effectWidget || !m_effectWidget->isVisible())) {
+        if (videoBox->geometry().contains(event->pos()) && (!m_effectWidget || !m_effectWidget->isVisible())) {
             if (isActive()) slotPlay();
             else slotActivateMonitor();
         } //else event->ignore(); //QWidget::mouseReleaseEvent(event);
@@ -541,7 +535,7 @@ void Monitor::wheelEvent(QWheelEvent * event)
 void Monitor::mouseDoubleClickEvent(QMouseEvent * event)
 {
     if (!KdenliveSettings::openglmonitors()) {
-        m_videoBox->switchFullScreen();
+        videoBox->switchFullScreen();
         event->accept();
     }
 }
@@ -616,21 +610,24 @@ void Monitor::slotSeek(int pos)
 void Monitor::checkOverlay()
 {
     if (m_overlay == NULL) return;
+    QString overlayText;
     int pos = m_ruler->position();
     QPoint zone = m_ruler->zone();
     if (pos == zone.x())
-        m_overlay->setOverlayText(i18n("In Point"));
+        overlayText = i18n("In Point");
     else if (pos == zone.y())
-        m_overlay->setOverlayText(i18n("Out Point"));
+        overlayText = i18n("Out Point");
     else {
         if (m_currentClip) {
-            QString markerComment = m_currentClip->markerComment(GenTime(pos, m_monitorManager->timecode().fps()));
-            if (markerComment.isEmpty())
-                m_overlay->setHidden(true);
-            else
-                m_overlay->setOverlayText(markerComment, false);
-        } else m_overlay->setHidden(true);
+            overlayText = m_currentClip->markerComment(GenTime(pos, m_monitorManager->timecode().fps()));
+           if (!overlayText.isEmpty()) {
+               m_overlay->setOverlayText(overlayText, false);
+               return;
+           }
+       }
     }
+    if (m_overlay->isVisible() && overlayText.isEmpty()) m_overlay->setOverlayText(QString(), false);
+    else m_overlay->setOverlayText(overlayText);
 }
 
 void Monitor::slotStart()
@@ -734,8 +731,8 @@ void Monitor::stop()
 
 void Monitor::start()
 {
-    if (!isVisible()) return;
-    if (render) render->start();
+    if (!isVisible() || !isActive()) return;
+    if (render) render->doRefresh();// start();
 }
 
 void Monitor::refreshMonitor(bool visible)
@@ -913,7 +910,7 @@ void Monitor::slotSwitchMonitorInfo(bool show)
     KdenliveSettings::setDisplayMonitorInfo(show);
     if (show) {
         if (m_overlay) return;
-        if (m_monitorRefresh == NULL) {
+        if (videoSurface == NULL) {
             // Using OpenGL display
 #ifdef USE_OPENGL
             if (m_glWidget->layout()) delete m_glWidget->layout();
@@ -925,13 +922,13 @@ void Monitor::slotSwitchMonitorInfo(bool show)
             m_glWidget->setLayout(layout);
 #endif
         } else {
-            if (m_monitorRefresh->layout()) delete m_monitorRefresh->layout();
+            if (videoSurface->layout()) delete videoSurface->layout();
             m_overlay = new Overlay();
             connect(m_overlay, SIGNAL(editMarker()), this, SLOT(slotEditMarker()));
             QVBoxLayout *layout = new QVBoxLayout;
             layout->addStretch(10);
             layout->addWidget(m_overlay);
-            m_monitorRefresh->setLayout(layout);
+            videoSurface->setLayout(layout);
             m_overlay->raise();
             m_overlay->setHidden(true);
         }
@@ -992,8 +989,8 @@ void Monitor::slotSetSelectedClip(Transition* item)
 void Monitor::slotEffectScene(bool show)
 {
     if (m_id == Kdenlive::projectMonitor) {
-        if (m_monitorRefresh) {
-            m_monitorRefresh->setVisible(!show);
+        if (videoSurface) {
+            videoSurface->setVisible(!show);
         } else {
 #ifdef USE_OPENGL
             m_glWidget->setVisible(!show);
@@ -1005,7 +1002,7 @@ void Monitor::slotEffectScene(bool show)
         if (show) {
             m_effectWidget->getScene()->slotZoomFit();
         }
-        m_videoBox->setEnabled(show);
+        videoBox->setEnabled(show);
         render->doRefresh();
     }
 }
@@ -1054,22 +1051,6 @@ void Monitor::reloadProducer(const QString &id)
         slotSetClipProducer(m_currentClip, m_currentClip->zone(), true);
 }
 
-MonitorRefresh::MonitorRefresh(QWidget* parent) :
-    QWidget(parent)
-    , m_renderer(NULL)
-{
-    // MonitorRefresh is used as container for the SDL display (it's window id is passed to SDL)
-    setAttribute(Qt::WA_PaintOnScreen);
-    setAttribute(Qt::WA_OpaquePaintEvent);
-    setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
-    //setAttribute(Qt::WA_NoSystemBackground);
-}
-
-void MonitorRefresh::setRenderer(Render* render)
-{
-    m_renderer = render;
-}
-
 
 Overlay::Overlay(QWidget* parent) :
     QLabel(parent)
@@ -1102,16 +1083,23 @@ void Overlay::mouseDoubleClickEvent ( QMouseEvent * event )
 
 void Overlay::setOverlayText(const QString &text, bool isZone)
 {
+    if (text.isEmpty()) {
+       QPalette p;
+       p.setColor(QPalette::Base, KdenliveSettings::window_background());
+       setPalette(p);
+       setText(QString());
+       repaint();
+       setHidden(true);
+       return;
+    }
     setHidden(true);
-    m_isZone = isZone;
     QPalette p;
     p.setColor(QPalette::Text, Qt::white);
-    if (m_isZone) p.setColor(QPalette::Base, QColor(200, 0, 0));
+    if (isZone) p.setColor(QPalette::Base, QColor(200, 0, 0));
     else p.setColor(QPalette::Base, QColor(0, 0, 200));
     setPalette(p);
     setText(' ' + text + ' ');
     setHidden(false);
-    update();
 }
 
 
index 3ea5da5a58df1b3db144cf8fd48326ddc0c40419..0fe6d50ae7ddcfc07be0c67117dcb3935d7e4424 100644 (file)
@@ -49,17 +49,6 @@ class Monitor;
 class MonitorManager;
 
 
-class MonitorRefresh : public QWidget
-{
-    Q_OBJECT
-public:
-    MonitorRefresh(QWidget *parent = 0);
-    void setRenderer(Render* render);
-
-private:
-    Render *m_renderer;
-};
-
 class Overlay : public QLabel
 {
     Q_OBJECT
@@ -67,9 +56,6 @@ public:
     Overlay(QWidget* parent = 0);
     void setOverlayText(const QString &, bool isZone = true);
 
-private:
-    bool m_isZone;
-
 protected:
     virtual void mouseDoubleClickEvent ( QMouseEvent * event );
     virtual void mousePressEvent ( QMouseEvent * event );
@@ -132,7 +118,6 @@ private:
     double m_scale;
     int m_length;
     bool m_dragStarted;
-    MonitorRefresh *m_monitorRefresh;
     KIcon m_playIcon;
     KIcon m_pauseIcon;
     TimecodeDisplay *m_timePos;
index c24adfaef6679139686f508b3583f7d6c3d24c46..474cf1146ff78b3ae8940916b488e0179f6c8946 100644 (file)
@@ -61,9 +61,9 @@ RecMonitor::RecMonitor(Kdenlive::MONITORID name, MonitorManager *manager, QWidge
     QVBoxLayout *l = new QVBoxLayout;
     l->setContentsMargins(0, 0, 0, 0);
     l->setSpacing(0);
-    m_videoBox = new VideoContainer(this);
-    l->addWidget(m_videoBox, 10);
+    l->addWidget(videoBox, 10);
     video_frame->setLayout(l);
+    createVideoSurface();
 
     QToolBar *toolbar = new QToolBar(this);
     QHBoxLayout *layout = new QHBoxLayout;
@@ -142,7 +142,7 @@ RecMonitor::RecMonitor(Kdenlive::MONITORID name, MonitorManager *manager, QWidge
     QString videoDriver = KdenliveSettings::videodrivername();
 #if QT_VERSION >= 0x040600
     QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
-    env.insert("SDL_WINDOWID", QString::number(m_videoBox->winId()));
+    env.insert("SDL_WINDOWID", QString::number(videoSurface->winId()));
     if (!videoDriver.isEmpty()) {
         if (videoDriver == "x11_noaccel") {
             env.insert("SDL_VIDEO_YUV_HWACCEL", "0");
@@ -152,7 +152,7 @@ RecMonitor::RecMonitor(Kdenlive::MONITORID name, MonitorManager *manager, QWidge
     m_displayProcess->setProcessEnvironment(env);
 #else
     QStringList env = QProcess::systemEnvironment();
-    env << "SDL_WINDOWID=" + QString::number(m_videoBox->winId());
+    env << "SDL_WINDOWID=" + QString::number(videoSurface->winId());
     if (!videoDriver.isEmpty()) {
         if (videoDriver == "x11_noaccel") {
             env << "SDL_VIDEO_YUV_HWACCEL=0";
@@ -163,7 +163,7 @@ RecMonitor::RecMonitor(Kdenlive::MONITORID name, MonitorManager *manager, QWidge
 #endif
     setenv("SDL_VIDEO_ALLOW_SCREENSAVER", "1", 1);
 
-    kDebug() << "/////// BUILDING MONITOR, ID: " << m_videoBox->winId();
+    kDebug() << "/////// BUILDING MONITOR, ID: " << videoSurface->winId();
     slotVideoDeviceChanged(device_selector->currentIndex());
     m_previewSettings->setChecked(KdenliveSettings::enable_recording_preview());
     connect(m_previewSettings, SIGNAL(triggered(bool)), this, SLOT(slotChangeRecordingPreview(bool)));
@@ -179,15 +179,15 @@ RecMonitor::~RecMonitor()
 
 void RecMonitor::mouseDoubleClickEvent(QMouseEvent * event)
 {
-    if (!KdenliveSettings::openglmonitors() && m_videoBox && m_videoBox->isVisible()) {
-        m_videoBox->switchFullScreen();
+    if (!KdenliveSettings::openglmonitors() && videoBox && videoBox->isVisible()) {
+        videoBox->switchFullScreen();
         event->accept();
     }
 }
 
 void RecMonitor::slotSwitchFullScreen()
 {
-    m_videoBox->switchFullScreen();
+    videoBox->switchFullScreen();
 }
 
 void RecMonitor::stop()
@@ -241,8 +241,8 @@ void RecMonitor::slotVideoDeviceChanged(int ix)
     }
 
     // The m_videoBox container has to be shown once before the MLT consumer is build, or preview will fail
-    m_videoBox->setHidden(ix != VIDEO4LINUX && ix != BLACKMAGIC);
-    m_videoBox->setHidden(true);
+    videoBox->setHidden(ix != VIDEO4LINUX && ix != BLACKMAGIC);
+    videoBox->setHidden(true);
     switch (ix) {
     case SCREENGRAB:
         m_discAction->setEnabled(false);
@@ -384,7 +384,7 @@ void RecMonitor::slotStopCapture()
 {
     // stop capture
     if (!m_isCapturing && !m_isPlaying) return;
-    m_videoBox->setHidden(true);
+    videoBox->setHidden(true);
     rec_audio->setEnabled(true);
     rec_video->setEnabled(true);
     switch (device_selector->currentIndex()) {
@@ -440,6 +440,7 @@ void RecMonitor::slotStartPreview(bool play)
         }
         return;
     }
+    slotActivateMonitor();
     if (m_isPlaying) return;
     m_captureArgs.clear();
     m_displayArgs.clear();
@@ -450,7 +451,7 @@ void RecMonitor::slotStartPreview(bool play)
     QString producer;
     QStringList dvargs = KdenliveSettings::dvgrabextra().simplified().split(" ", QString::SkipEmptyParts);
     int ix = device_selector->currentIndex();
-    m_videoBox->setHidden(ix != VIDEO4LINUX && ix != BLACKMAGIC);
+    videoBox->setHidden(ix != VIDEO4LINUX && ix != BLACKMAGIC);
     switch (ix) {
     case FIREWIRE:
         switch (KdenliveSettings::firewireformat()) {
@@ -496,7 +497,6 @@ void RecMonitor::slotStartPreview(bool play)
         break;
     case VIDEO4LINUX:
         path = KStandardDirs::locateLocal("appdata", "profiles/video4linux");
-        slotActivateMonitor();
         buildMltDevice(path);
         profile = ProfilesDialog::getVideoProfile(path);
         producer = getV4lXmlPlaylist(profile);
@@ -505,7 +505,7 @@ void RecMonitor::slotStartPreview(bool play)
         if (!m_captureDevice->slotStartPreview(producer, true)) {
             // v4l capture failed to start
             video_frame->setText(i18n("Failed to start Video4Linux,\ncheck your parameters..."));
-            m_videoBox->setHidden(true);
+            videoBox->setHidden(true);
 
         } else {
             m_playAction->setEnabled(false);
@@ -522,7 +522,7 @@ void RecMonitor::slotStartPreview(bool play)
         if (!m_captureDevice->slotStartPreview(producer)) {
             // v4l capture failed to start
             video_frame->setText(i18n("Failed to start Decklink,\ncheck your parameters..."));
-            m_videoBox->setHidden(true);
+            videoBox->setHidden(true);
 
         } else {
             m_playAction->setEnabled(false);
@@ -642,7 +642,7 @@ void RecMonitor::slotRecord()
             if (!rec_video->isChecked()) showPreview = false;
 
             if (m_captureDevice->slotStartCapture(v4lparameters, m_captureFile.path(), playlist, showPreview)) {
-                m_videoBox->setHidden(false);
+                videoBox->setHidden(false);
                 m_isCapturing = true;
                 m_recAction->setEnabled(false);
                 m_stopAction->setEnabled(true);
@@ -650,7 +650,7 @@ void RecMonitor::slotRecord()
             }
             else {
                 video_frame->setText(i18n("Failed to start Video4Linux,\ncheck your parameters..."));
-                m_videoBox->setHidden(true);
+                videoBox->setHidden(true);
                 m_isCapturing = false;
             }
             break;
@@ -665,7 +665,7 @@ void RecMonitor::slotRecord()
             playlist = QString("<producer id=\"producer0\" in=\"0\" out=\"99999\"><property name=\"mlt_type\">producer</property><property name=\"length\">100000</property><property name=\"eof\">pause</property><property name=\"resource\">%1</property><property name=\"mlt_service\">decklink</property></producer>").arg(KdenliveSettings::decklink_capturedevice());
 
             if (m_captureDevice->slotStartCapture(KdenliveSettings::decklink_parameters(), m_captureFile.path(), QString("decklink:%1").arg(KdenliveSettings::decklink_capturedevice()), m_previewSettings->isChecked(), false)) {
-                m_videoBox->setHidden(false);
+                videoBox->setHidden(false);
                 m_isCapturing = true;
                 slotSetInfoMessage(i18n("Capturing to %1", m_captureFile.fileName()));
                 m_recAction->setEnabled(false);
@@ -675,7 +675,7 @@ void RecMonitor::slotRecord()
             else {
                 video_frame->setText(i18n("Failed to start Decklink,\ncheck your parameters..."));
                 slotSetInfoMessage(i18n("Failed to start capture"));
-                m_videoBox->setHidden(true);
+                videoBox->setHidden(true);
                 m_isCapturing = false;
             }
             break;
@@ -918,8 +918,8 @@ void RecMonitor::refreshRecMonitor(bool visible)
 
 void RecMonitor::slotPlay()
 {
-    if (m_isPlaying) slotStopCapture();
-    else slotStartPreview(true);
+    /*if (m_isPlaying) slotStopCapture();
+    else slotStartPreview(true);*/
 }
 
 void RecMonitor::slotReadDvgrabInfo()
@@ -951,7 +951,7 @@ void RecMonitor::buildMltDevice(const QString &path)
 {
     if (m_captureDevice == NULL) {
        m_monitorManager->updateScopeSource();
-        m_captureDevice = new MltDeviceCapture(path, m_videoBox, this);
+        m_captureDevice = new MltDeviceCapture(path, videoSurface, this);
         connect(m_captureDevice, SIGNAL(droppedFrames(int)), this, SLOT(slotDroppedFrames(int)));
         m_captureDevice->sendFrameForAnalysis = m_analyse;
         m_monitorManager->updateScopeSource();
@@ -963,22 +963,6 @@ void RecMonitor::slotChangeRecordingPreview(bool enable)
     KdenliveSettings::setEnable_recording_preview(enable);
 }
 
-void RecMonitor::pause()
-{
-    if (m_isCapturing) return;
-    slotStopCapture();
-    if (m_captureDevice) {
-       m_monitorManager->clearScopeSource();
-       delete m_captureDevice;
-       m_captureDevice = NULL;
-    }
-}
-
-void RecMonitor::unpause()
-{
-    if (m_isCapturing) return;
-    slotStartPreview(true);
-}
 
 void RecMonitor::slotMouseSeek(int /*eventDelta*/, bool /*fast*/)
 {
index 8fc2f7bdf2b5a3fbea911b9e8d62c4dff1954f06..aeb1029019af80e1a3c171c830a57e6320171f0c 100644 (file)
@@ -57,8 +57,6 @@ public:
 
     AbstractRender *abstractRender();
     void analyseFrames(bool analyse);
-    void pause();
-    void unpause();
     enum CAPTUREDEVICE {FIREWIRE = 0, VIDEO4LINUX = 1, SCREENGRAB = 2, BLACKMAGIC = 3};
 
 protected:
index 0593bc50a845b2d02447f04a2fbeef54c9b208eb..e7842aabe78b81e2c7287fe290c850de6d2ee788 100644 (file)
@@ -125,7 +125,7 @@ Render::Render(Kdenlive::MONITORID rendererName, int winid, QString profile, QWi
     m_mltConsumer->connect(*m_mltProducer);
     m_mltProducer->set_speed(0.0);
     m_refreshTimer.setSingleShot(true);
-    m_refreshTimer.setInterval(50);
+    m_refreshTimer.setInterval(70);
     connect(&m_refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
 }
 
index 9a7c54f3b0cfb3f4e63530e3f9d30ec185441ed6..b2ca2676c4e6446a16be89802a6b8befd7382320 100644 (file)
@@ -170,8 +170,6 @@ Q_OBJECT public:
     /** @brief Returns the aspect ratio of the consumer. */
     double consumerRatio() const;
 
-    void doRefresh();
-
     /** @brief Saves current producer frame as an image. */
     void exportCurrentFrame(KUrl url, bool notify);
 
@@ -431,6 +429,8 @@ public slots:
     void slotSwitchFullscreen();
     void slotSetVolume(int volume);
     void seekToFrame(int pos);
+    /** @brief Starts a timer to query for a refresh. */
+    void doRefresh();
 };
 
 #endif
index 5611f2d41a10efbf511d0f9a23b04810dc532f7e..1201eca687f838f40b4f977a69a812c4b5f12d3f 100644 (file)
@@ -133,14 +133,6 @@ void StopmotionMonitor::start()
 {
 }
 
-void StopmotionMonitor::pause()
-{
-}
-
-void StopmotionMonitor::unpause()
-{
-}
-
 void StopmotionMonitor::slotPlay()
 {
 }
@@ -266,9 +258,8 @@ StopmotionWidget::StopmotionWidget(MonitorManager *manager, KUrl projectFolder,
     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);
+    m_monitor->videoBox->setLineWidth(4);
+    layout->addWidget(m_monitor->videoBox);
 
 #ifdef USE_BLACKMAGIC
     if (BMInterface::getBlackMagicDeviceList(capture_device)) {
@@ -319,7 +310,7 @@ 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 &)));
@@ -479,7 +470,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;
@@ -504,7 +495,7 @@ 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 &)));
@@ -533,7 +524,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;
index 32fe04e784ca29a949f3c9ef0b14af71e2cce79a..124b11670abbb1d3e18c4deed6678d4105a0d6b7 100644 (file)
@@ -67,8 +67,6 @@ public:
     AbstractRender *abstractRender();
     Kdenlive::MONITORID id() const;
     void setRender(MltDeviceCapture *render);
-    void pause();
-    void unpause();
 
 private:
     MltDeviceCapture *m_captureDevice;