// special cases (middle click button or ctrl / shift click
if (event->button() == Qt::MidButton) {
- m_document->renderer()->switchPlay();
+ emit playMonitor();
m_blockRefresh = false;
m_operationMode = NONE;
return;
void doTrackLock(int, bool);
void updateClipMarkers(DocClipBase *);
void updateTrackHeaders();
+ void playMonitor();
};
#endif
m_timelineArea->addTab(trackView, KIcon("kdenlive"), doc->description());
if (!ok) {
// MLT is broken
- m_timelineArea->setEnabled(false);
- m_projectList->setEnabled(false);
- m_monitorManager->slotBlockMonitors();
+ //m_timelineArea->setEnabled(false);
+ //m_projectList->setEnabled(false);
slotPreferences(6);
return;
}
disconnect(m_activeTimeline->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
disconnect(m_activeTimeline->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), m_transitionConfig, SLOT(slotTransitionItemSelected(Transition*, int, QPoint, bool)));
disconnect(m_activeTimeline->projectView(), SIGNAL(transitionItemSelected(Transition*, int, QPoint, bool)), this, SLOT(slotActivateTransitionView(Transition *)));
+ disconnect(m_activeTimeline->projectView(), SIGNAL(playMonitor()), m_projectMonitor, SLOT(slotPlay()));
disconnect(m_zoomSlider, SIGNAL(valueChanged(int)), m_activeTimeline, SLOT(slotChangeZoom(int)));
disconnect(m_activeTimeline->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
disconnect(m_activeTimeline->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint, const int)));
connect(trackView->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
connect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, QPoint, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, QPoint, const int)));
+ connect(trackView->projectView(), SIGNAL(playMonitor()), m_projectMonitor, SLOT(slotPlay()));
connect(m_effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement, int)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement, int)));
connect(m_ruler, SIGNAL(seekRenderer(int)), this, SLOT(slotSeek(int)));
connect(render, SIGNAL(durationChanged(int)), this, SLOT(adjustRulerSize(int)));
- connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
connect(render, SIGNAL(rendererStopped(int)), this, SLOT(rendererStopped(int)));
- connect(render, SIGNAL(blockMonitors()), this, SIGNAL(blockMonitors()));
//render->createVideoXWindow(m_ui.video_frame->winId(), -1);
void Monitor::activateMonitor()
{
- if (!m_isActive) m_monitorManager->slotSwitchMonitors(); //m_monitorManager->activateMonitor(m_name);
+ if (!m_isActive) {
+ m_monitorManager->slotSwitchMonitors();
+ }
}
void Monitor::setTimePos(const QString &pos)
activateMonitor();
render->play(0);
render->seekToFrame(0);
- emit renderPosition(0);
+ //emit renderPosition(0);
}
void Monitor::slotEnd()
activateMonitor();
render->play(0);
render->seekToFrame(render->getLength());
- emit renderPosition(render->seekFramePosition());
+ //emit renderPosition(render->seekFramePosition());
}
void Monitor::slotZoneStart()
void Monitor::seekCursor(int pos)
{
activateMonitor();
- checkOverlay();
- if (m_frametimecode) m_timePos->setText(QString::number(pos));
- else m_timePos->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
- m_ruler->slotNewValue(pos);
+ if (m_ruler->slotNewValue(pos)) {
+ checkOverlay();
+ if (m_frametimecode) m_timePos->setText(QString::number(pos));
+ else m_timePos->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
+ }
}
void Monitor::rendererStopped(int pos)
return;
}
}
- m_ruler->slotNewValue(pos);
- checkOverlay();
- if (m_frametimecode) m_timePos->setText(QString::number(pos));
- else m_timePos->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
+ if (m_ruler->slotNewValue(pos)) {
+ checkOverlay();
+ if (m_frametimecode) m_timePos->setText(QString::number(pos));
+ else m_timePos->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
+ }
+ disconnect(m_playAction, SIGNAL(triggered()), this, SLOT(slotPlay()));
m_playAction->setChecked(false);
+ connect(m_playAction, SIGNAL(triggered()), this, SLOT(slotPlay()));
m_playAction->setIcon(m_playIcon);
}
void Monitor::stop()
{
m_isActive = false;
+ disconnect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
if (render) render->stop();
- //kDebug()<<"/// MONITOR RENDER STOP";
}
void Monitor::start()
{
m_isActive = true;
if (render) render->start();
- //kDebug()<<"/// MONITOR RENDER START";
+ connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
}
void Monitor::refreshMonitor(bool visible)
updateMarkers(clip);
if (render->setProducer(clip->producer(), position) == -1) {
// MLT CONSUMER is broken
- emit blockMonitors();
+ kdWarning() << "ERROR, Cannot start monitor";
}
} else if (position != -1) render->seek(GenTime(position, m_monitorManager->timecode().fps()));
if (!zone.isNull()) {
void adjustMonitorSize();
void zoneUpdated(QPoint);
void saveZone(Render *, QPoint);
- void blockMonitors();
};
#endif
{
m_clipMonitor = clipMonitor;
m_projectMonitor = projectMonitor;
- connect(m_clipMonitor, SIGNAL(blockMonitors()), this, SLOT(slotBlockMonitors()));
- connect(m_projectMonitor, SIGNAL(blockMonitors()), this, SLOT(slotBlockMonitors()));
}
void MonitorManager::activateMonitor(QString name)
//m_projectMonitor->refreshMonitor(true);
}
-void MonitorManager::slotBlockMonitors()
-{
- m_blocked = true;
- if (m_clipMonitor) {
- m_clipMonitor->blockSignals(true);
- m_clipMonitor->setEnabled(false);
- }
- if (m_projectMonitor) {
- m_projectMonitor->blockSignals(true);
- m_projectMonitor->setEnabled(false);
- }
-}
#include "monitormanager.moc"
void slotStart();
void slotEnd();
void slotResetProfiles();
- void slotBlockMonitors();
void slotSwitchMonitors();
private:
#endif
self->emitFrameNumber(mlt_frame_get_position(frame_ptr));
- if (frame.get_double("_speed") == 0.0) self->emitConsumerStopped();
- else if (frame.get_double("_speed") < 0.0 && mlt_frame_get_position(frame_ptr) <= 0) {
- self->pause();
- self->emitConsumerStopped();
+ if (frame.get_double("_speed") == 0.0) {
+ self->emitConsumerStopped();
+ } else if (frame.get_double("_speed") < 0.0 && mlt_frame_get_position(frame_ptr) <= 0) {
+ self->pause();
+ self->emitConsumerStopped();
}
}
int Render::resetProfile(const QString profileName)
{
- if (!m_mltConsumer) return 0;
- if (m_activeProfile == profileName) {
- kDebug() << "reset to same profile, nothing to do";
- return 1;
+ if (m_mltConsumer) {
+ QString videoDriver = KdenliveSettings::videodrivername();
+ QString currentDriver = m_mltConsumer->get("video_driver");
+ if (getenv("SDL_VIDEO_YUV_HWACCEL") != NULL && currentDriver == "x11") currentDriver = "x11_noaccel";
+ if (m_activeProfile == profileName && currentDriver == videoDriver) {
+ kDebug() << "reset to same profile, nothing to do";
+ return 1;
+ }
+
+ if (m_isSplitView) slotSplitView(false);
+ if (!m_mltConsumer->is_stopped()) m_mltConsumer->stop();
+ m_mltConsumer->purge();
+ delete m_mltConsumer;
+ m_mltConsumer = NULL;
}
- kDebug() << "// RESETTING PROFILE FROM: " << m_activeProfile << " TO: " << profileName; //KdenliveSettings::current_profile();
- if (m_isSplitView) slotSplitView(false);
- if (!m_mltConsumer->is_stopped()) m_mltConsumer->stop();
- m_mltConsumer->purge();
- delete m_mltConsumer;
- m_mltConsumer = NULL;
QString scene = sceneList();
int pos = 0;
double current_fps = m_mltProfile->fps();
m_fps = m_mltProducer->get_fps();
int error = connectPlaylist();
-
+
if (position != -1) {
m_mltProducer->seek(position);
emit rendererPosition(position);
kDebug() << "////// RENDER, SET SCENE LIST: " << playlist;
- if (m_mltConsumer == NULL) {
+ if (m_mltConsumer) {
+ if (!m_mltConsumer->is_stopped()) {
+ m_mltConsumer->stop();
+ }
+ m_mltConsumer->set("refresh", 0);
+ } else {
kWarning() << "/////// ERROR, TRYING TO USE NULL MLT CONSUMER";
- m_isBlocked = false;
- return -1;
- }
-
- if (!m_mltConsumer->is_stopped()) {
- m_mltConsumer->stop();
+ error = -1;
}
- m_mltConsumer->set("refresh", 0);
if (m_mltProducer) {
m_mltProducer->set_speed(0);
if (m_mltConsumer->start() == -1) {
// ARGH CONSUMER BROKEN!!!!
KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install or your driver settings, please fix it."));
- emit blockMonitors();
- delete m_mltProducer;
- m_mltProducer = NULL;
+ delete m_mltConsumer;
+ m_mltConsumer = NULL;
return -1;
}
emit durationChanged(m_mltProducer->get_playtime());
if (m_mltConsumer && m_mltConsumer->is_stopped()) {
kDebug() << "----- MONITOR: " << m_name << " WAS STOPPED";
if (m_mltConsumer->start() == -1) {
- KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install or your driver settings, please fix it."));
- emit blockMonitors();
- delete m_mltProducer;
- m_mltProducer = NULL;
+ //KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install or your driver settings, please fix it."));
+ kdWarning() << "/ / / / CANNOT START MONITOR";
} else {
kDebug() << "----- MONITOR: " << m_name << " REFRESH";
m_isBlocked = false;
m_isBlocked = true;
m_mltConsumer->set("refresh", 0);
m_mltProducer->set_speed(0.0);
+ /*
+ The 2 lines below create a flicker loop
emit rendererPosition(m_framePosition);
- m_mltProducer->seek(m_framePosition);
+ m_mltProducer->seek(m_framePosition);*/
m_mltConsumer->purge();
}
m_isBlocked = true;
m_mltConsumer->set("refresh", 0);
m_mltProducer->set_speed(0.0);
- emit rendererPosition(m_framePosition);
+ //emit rendererPosition(m_framePosition);
m_mltProducer->seek(m_framePosition);
m_mltConsumer->purge();
//kDebug()<<" ********* RENDER PAUSE: "<<m_mltProducer->get_speed();
m_mltConsumer->set("play.real_time", dropFrames);
#endif
if (m_mltConsumer->start() == -1) {
- emit blockMonitors();
- delete m_mltProducer;
- m_mltProducer = NULL;
+ kdWarning() << "ERROR, Cannot start monitor";
}
}
void rendererStopped(int);
void removeInvalidClip(const QString &, bool replaceProducer);
void refreshDocumentProducers();
- void blockMonitors();
/** Used on OS X - emitted when a frame's image is to be shown. */
void showImageSignal(QImage);
}
}
-void SmallRuler::slotNewValue(int value)
+bool SmallRuler::slotNewValue(int value)
{
m_cursorFramePosition = value;
int oldPos = m_cursorPosition;
m_cursorPosition = value * m_scale;
- if (oldPos == m_cursorPosition) return;
+ if (oldPos == m_cursorPosition) return false;
const int offset = 6;
const int x = qMin(oldPos, m_cursorPosition);
const int w = qAbs(oldPos - m_cursorPosition);
update(x - offset, 4, w + 2 * offset, 6);
+ return true;
}
//virtual
void updatePixmap();
public slots:
- void slotNewValue(int value);
+ bool slotNewValue(int value);
signals:
void seekRenderer(int);