aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <[email protected]>2015-11-25 11:43:32 +0100
committerJean-Baptiste Mardelle <[email protected]>2015-11-25 11:43:32 +0100
commitb0e9dfb4fc3e4b987f2b164944b275151dd56045 (patch)
tree45e0beebf4118a0aba40eaaa92034ad614f27b1f
parent914d00d50fc008c57d495fc76fb45f02930cd62c (diff)
Improve latency when editing effects / transitions
-rw-r--r--data/kdenlivemonitoreffectscene.qml10
-rw-r--r--src/renderer.cpp27
-rw-r--r--src/renderer.h2
-rw-r--r--src/timeline/customtrackview.cpp2
4 files changed, 32 insertions, 9 deletions
diff --git a/data/kdenlivemonitoreffectscene.qml b/data/kdenlivemonitoreffectscene.qml
index 7cda68c..43378eb 100644
--- a/data/kdenlivemonitoreffectscene.qml
+++ b/data/kdenlivemonitoreffectscene.qml
@@ -150,10 +150,10 @@ Item {
framesize.width = (framerect.width - (mouseX - oldMouseX)) / root.scale;
framesize.y = (framerect.y + (mouseY - oldMouseY) - frame.y) / root.scale;
framesize.height = (framerect.height - (mouseY - oldMouseY)) / root.scale;
+ root.effectChanged()
}
}
onReleased: {
- root.effectChanged()
effectsize.visible = false
}
}
@@ -198,10 +198,10 @@ Item {
framesize.width = (framerect.width + (mouseX - oldMouseX)) / root.scale;
framesize.y = (framerect.y + (mouseY - oldMouseY) - frame.y) / root.scale;
framesize.height = (framerect.height - (mouseY - oldMouseY)) / root.scale;
+ root.effectChanged()
}
}
onReleased: {
- root.effectChanged()
effectsize.visible = false
}
}
@@ -235,10 +235,10 @@ Item {
framesize.x = (framerect.x + (mouseX - oldMouseX) - frame.x) / root.scale;
framesize.width = (framerect.width - (mouseX - oldMouseX)) / root.scale;
framesize.height = (framerect.height + (mouseY - oldMouseY)) / root.scale;
+ root.effectChanged()
}
}
onReleased: {
- root.effectChanged()
effectsize.visible = false
}
}
@@ -271,10 +271,10 @@ Item {
if (pressed) {
framesize.width = (framerect.width + (mouseX - oldMouseX)) / root.scale;
framesize.height = (framerect.height + (mouseY - oldMouseY)) / root.scale;
+ root.effectChanged()
}
}
onReleased: {
- root.effectChanged()
effectsize.visible = false
}
}
@@ -314,10 +314,10 @@ Item {
if (pressed) {
framesize.x = (framerect.x + (mouseX - oldMouseX) - frame.x) / root.scale;
framesize.y = (framerect.y + (mouseY - oldMouseY) - frame.y) / root.scale;
+ root.effectChanged()
}
}
onReleased: {
- root.effectChanged()
effectpos.visible = false
}
}
diff --git a/src/renderer.cpp b/src/renderer.cpp
index aeab5fc..6acca9b 100644
--- a/src/renderer.cpp
+++ b/src/renderer.cpp
@@ -72,7 +72,8 @@ Render::Render(Kdenlive::MonitorId rendererName, BinController *binController, G
m_isLoopMode(false),
m_isSplitView(false),
m_blackClip(NULL),
- m_isActive(false)
+ m_isActive(false),
+ m_isRefreshing(false)
{
qRegisterMetaType<stringMap> ("stringMap");
analyseAudio = KdenliveSettings::monitor_audio();
@@ -168,6 +169,7 @@ void Render::seek(int time)
m_mltConsumer->purge();
m_mltProducer->seek(time);
if (!externalConsumer) {
+ m_isRefreshing = true;
m_mltConsumer->set("refresh", 1);
}
}
@@ -306,6 +308,7 @@ void Render::slotSplitView(bool doit)
screen++;
}
}
+ m_isRefreshing = true;
m_mltConsumer->set("refresh", 1);
} else {
mlt_service serv = m_mltProducer->parent().get_service();
@@ -327,6 +330,7 @@ void Render::slotSplitView(bool doit)
properties = MLT_SERVICE_PROPERTIES(nextservice);
mlt_type = mlt_properties_get(properties, "mlt_type");
resource = mlt_properties_get(properties, "mlt_service");
+ m_isRefreshing = true;
m_mltConsumer->set("refresh", 1);
}
}
@@ -1170,6 +1174,7 @@ void Render::startConsumer() {
m_mltConsumer = NULL;
return;
}
+ m_isRefreshing = true;
m_mltConsumer->set("refresh", 1);
m_isActive = true;
}
@@ -1452,6 +1457,7 @@ void Render::start()
qWarning() << "/ / / / CANNOT START MONITOR";
} else {
m_mltConsumer->purge();
+ m_isRefreshing = true;
m_mltConsumer->set("refresh", 1);
}
}
@@ -1471,6 +1477,7 @@ void Render::stop()
m_mltConsumer->purge();
if (!m_mltConsumer->is_stopped()) m_mltConsumer->stop();
}
+ m_isRefreshing = false;
}
void Render::stop(const GenTime & startTime)
@@ -1487,6 +1494,7 @@ void Render::stop(const GenTime & startTime)
if (m_mltConsumer) {
m_mltConsumer->purge();
}
+ m_isRefreshing = false;
}
void Render::pause()
@@ -1523,6 +1531,7 @@ void Render::switchPlay(bool play)
m_mltConsumer->stop();
}
m_mltConsumer->start();
+ m_isRefreshing = true;
m_mltConsumer->set("refresh", 1);
} else {
m_mltConsumer->set("buffer", 0);
@@ -1546,7 +1555,10 @@ void Render::play(double speed)
if (m_mltConsumer->is_stopped() && speed != 0) {
m_mltConsumer->start();
}
- if (current_speed == 0 && speed != 0) m_mltConsumer->set("refresh", 1);
+ if (current_speed == 0 && speed != 0) {
+ m_isRefreshing = true;
+ m_mltConsumer->set("refresh", 1);
+ }
}
void Render::play(const GenTime & startTime)
@@ -1556,6 +1568,7 @@ void Render::play(const GenTime & startTime)
return;
m_mltProducer->seek((int)(startTime.frames(m_fps)));
m_mltProducer->set_speed(1.0);
+ m_isRefreshing = true;
m_mltConsumer->set("refresh", 1);
}
@@ -1579,6 +1592,7 @@ bool Render::playZone(const GenTime & startTime, const GenTime & stopTime)
m_mltProducer->seek((int)(startTime.frames(m_fps)));
m_mltProducer->set_speed(1.0);
if (m_mltConsumer->is_stopped()) m_mltConsumer->start();
+ m_isRefreshing = true;
m_mltConsumer->set("refresh", 1);
m_isZoneMode = true;
return true;
@@ -1622,7 +1636,8 @@ void Render::refreshIfActive()
void Render::doRefresh()
{
if (m_mltProducer && (playSpeed() == 0) && m_isActive) {
- refresh(); //m_refreshTimer.start();
+ if (m_isRefreshing) m_refreshTimer.start();
+ else refresh();
}
}
@@ -1633,8 +1648,10 @@ void Render::refresh()
if (!m_mltProducer || !m_isActive)
return;
if (m_mltConsumer) {
+ m_isRefreshing = true;
if (m_mltConsumer->is_stopped()) m_mltConsumer->start();
m_mltConsumer->purge();
+ m_isRefreshing = true;
m_mltConsumer->set("refresh", 1);
//m_mltConsumer->purge();
}
@@ -1731,6 +1748,8 @@ void Render::checkFrameNumber(int pos)
m_mltConsumer->set("refresh", 1);
}
else m_mltProducer->set_speed(speed);
+ } else {
+ m_isRefreshing = false;
}
}
@@ -2051,6 +2070,7 @@ void Render::mltInsertSpace(QMap <int, int> trackClipStartList, QMap <int, int>
}
service.unlock();
mltCheckLength(&tractor);
+ m_isRefreshing = true;
m_mltConsumer->set("refresh", 1);
}
@@ -2805,6 +2825,7 @@ bool Render::mltResizeClipCrop(ItemInfo info, GenTime newCropStart)
int frameOffset = newCropFrame - previousStart;
trackPlaylist.resize_clip(clipIndex, newCropFrame, previousOut + frameOffset);
service.unlock();
+ m_isRefreshing = true;
m_mltConsumer->set("refresh", 1);
return true;
}
diff --git a/src/renderer.h b/src/renderer.h
index a634418..5debf8f 100644
--- a/src/renderer.h
+++ b/src/renderer.h
@@ -345,6 +345,8 @@ private:
QList <requestClipInfo> m_requestList;
/** @brief True if this monitor is active. */
bool m_isActive;
+ /** @brief True if the consumer is currently refreshing itself. */
+ bool m_isRefreshing;
void closeMlt();
void mltPasteEffects(Mlt::Producer *source, Mlt::Producer *dest);
diff --git a/src/timeline/customtrackview.cpp b/src/timeline/customtrackview.cpp
index 1604476..8969108 100644
--- a/src/timeline/customtrackview.cpp
+++ b/src/timeline/customtrackview.cpp
@@ -2728,7 +2728,7 @@ void CustomTrackView::updateTransition(int track, const GenTime &pos, const QDom
qWarning() << "Unable to find transition at pos :" << pos.frames(m_document->fps()) << ", ON track: " << track;
return;
}
-
+
bool force = false;
if (oldTransition.attribute("transition_atrack") != transition.attribute("transition_atrack") || oldTransition.attribute("transition_btrack") != transition.attribute("transition_btrack"))
force = true;