From: Jean-Baptiste Mardelle Date: Thu, 18 Jun 2009 06:41:26 +0000 (+0000) Subject: Add non realtime preview mode to Kdenlive (available from monitor context menu) X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=6e140f856eeee8a9fd21797b711e93c0846d88fe;p=kdenlive Add non realtime preview mode to Kdenlive (available from monitor context menu) svn path=/trunk/kdenlive/; revision=3567 --- diff --git a/src/monitor.cpp b/src/monitor.cpp index cafe772b..5daa2c77 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -186,7 +186,14 @@ void Monitor::setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMe showTips->setCheckable(true); connect(showTips, SIGNAL(toggled(bool)), this, SLOT(slotSwitchMonitorInfo(bool))); showTips->setChecked(KdenliveSettings::displayMonitorInfo()); + + QAction *dropFrames = m_contextMenu->addAction(KIcon(), i18n("Real time (drop frames)")); + dropFrames->setCheckable(true); + dropFrames->setChecked(true); + connect(dropFrames, SIGNAL(toggled(bool)), this, SLOT(slotSwitchDropFrames(bool))); + m_configMenu->addAction(showTips); + m_configMenu->addAction(dropFrames); } @@ -734,6 +741,11 @@ void Monitor::setClipZone(QPoint pos) m_currentClip->setZone(pos); } +void Monitor::slotSwitchDropFrames(bool show) +{ + render->setDropFrames(show); +} + void Monitor::slotSwitchMonitorInfo(bool show) { KdenliveSettings::setDisplayMonitorInfo(show); @@ -748,6 +760,7 @@ void Monitor::slotSwitchMonitorInfo(bool show) } } + MonitorRefresh::MonitorRefresh(QWidget* parent) : \ QWidget(parent), m_renderer(NULL) diff --git a/src/monitor.h b/src/monitor.h index fbe9ee83..accd3aac 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -125,6 +125,7 @@ private slots: void slotSeek(); void setClipZone(QPoint pos); void slotSwitchMonitorInfo(bool show); + void slotSwitchDropFrames(bool show); public slots: void slotOpenFile(const QString &); diff --git a/src/renderer.cpp b/src/renderer.cpp index 8b2afc74..affbff83 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -55,7 +55,7 @@ static void consumer_frame_show(mlt_consumer, Render * self, mlt_frame frame_ptr Render::Render(const QString & rendererName, int winid, int /* extid */, QWidget *parent) : QObject(parent), - m_isBlocked(1), + m_isBlocked(0), m_name(rendererName), m_mltConsumer(NULL), m_mltProducer(NULL), @@ -1222,7 +1222,7 @@ void Render::seekToFrame(int pos) void Render::askForRefresh() { // Use a Timer so that we don't refresh too much - m_refreshTimer->start(500); + m_refreshTimer->start(300); } void Render::doRefresh() @@ -1241,6 +1241,17 @@ void Render::refresh() } } +void Render::setDropFrames(bool show) +{ + if (m_mltConsumer) { + int dropFrames = 1; + if (show == false) dropFrames = 0; + m_mltConsumer->stop(); + m_mltConsumer->set("play.real_time", dropFrames); + m_mltConsumer->start(); + } +} + double Render::playSpeed() { if (m_mltProducer) return m_mltProducer->get_speed(); diff --git a/src/renderer.h b/src/renderer.h index 080e1294..ecbf6bc3 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -189,6 +189,7 @@ Q_OBJECT public: QList producersList(); void updatePreviewSettings(); + void setDropFrames(bool show); private: // Private attributes & methods /** The name of this renderer - useful to identify the renderes by what they do - e.g. background rendering, workspace monitor, etc... */