m_mltConsumer->set("refresh", 1);
m_paused = false;
}
- else if (m_mltProducer->get_speed() == 0) {
+ else if (m_winid != 0 && m_mltProducer->get_speed() == 0) {
// workaround specific bug in MLT's SDL consumer
m_mltConsumer->stop();
m_mltConsumer->start();
// keep for compatibility with MLT <= 0.8.6
if (af == 0) af = frame->get_int("frequency");
if (ac == 0) ac = frame->get_int("channels");
- filePropertyMap["frequency"] = QString::number(af);
- filePropertyMap["channels"] = QString::number(ac);
+ if (af > 0) filePropertyMap["frequency"] = QString::number(af);
+ if (ac > 0) filePropertyMap["channels"] = QString::number(ac);
if (!filePropertyMap.contains("aspect_ratio")) filePropertyMap["aspect_ratio"] = frame->get("aspect_ratio");
if (frame->get_int("test_image") == 0) {
}
#endif
+void Render::loadUrl(const QString &url)
+{
+ Mlt::Producer *producer = new Mlt::Producer(*m_mltProfile, url.toUtf8().constData());
+ setProducer(producer, 0);
+}
+
int Render::setProducer(Mlt::Producer *producer, int position)
{
m_refreshTimer.stop();
m_refreshTimer.stop();
QMutexLocker locker(&m_mutex);
if (m_mltProducer == NULL) return;
- if (m_mltConsumer && !m_mltConsumer->is_stopped()) {
- m_mltConsumer->stop();
+ if (m_mltConsumer) {
+ m_mltConsumer->set("refresh", 0);
+ if (!m_mltConsumer->is_stopped()) m_mltConsumer->stop();
m_mltConsumer->purge();
}
m_mltConsumer->set("refresh", 1);
} else if (!play) {
m_paused = true;
- m_mltProducer->set_speed(0.0);
+ if (m_winid == 0) {
+ // OpenGL consumer
+ m_mltProducer->set_speed(0.0);
+ }
+ else {
+ // SDL consumer, hack to allow pausing near the end of the playlist
+ m_mltConsumer->set("refresh", 0);
+ m_mltConsumer->stop();
+ m_mltProducer->set_speed(0.0);
+ m_mltProducer->seek(m_mltConsumer->position());
+ m_mltConsumer->start();
+ }
}
}
}
}
+//static
+bool Render::checkX11Grab()
+{
+ if (KdenliveSettings::rendererpath().isEmpty() || KdenliveSettings::ffmpegpath().isEmpty()) return false;
+ QProcess p;
+ QStringList args;
+ args << "avformat:f-list";
+ p.start(KdenliveSettings::rendererpath(), args);
+ if (!p.waitForStarted()) return false;
+ if (!p.waitForFinished()) return false;
+ QByteArray result = p.readAllStandardError();
+ return result.contains("x11grab");
+}
+
#include "renderer.moc"