X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Frenderer.cpp;h=15673b70086f6e5a0ea35fee0a47fa41dd5c5a3d;hb=f15361123a17fd8bcd0f42aab9eabdd07e5acf7d;hp=6ba456ff1c4daa3048e00fa812cb384db3dbce4b;hpb=9d5d4f3acc4e27fef519365041a4a92b068692c9;p=kdenlive diff --git a/src/renderer.cpp b/src/renderer.cpp index 6ba456ff..15673b70 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -431,7 +431,7 @@ void Render::seek(int time) 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(); @@ -990,8 +990,8 @@ void Render::processFileProperties() // 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) { @@ -1141,6 +1141,12 @@ void Render::initSceneList() } #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(); @@ -1562,8 +1568,9 @@ void Render::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(); } @@ -1615,7 +1622,18 @@ void Render::switchPlay(bool play) 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(); + } } } @@ -4719,5 +4737,19 @@ void Render::slotMultiStreamProducerFound(const QString path, QList audio_l } } +//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"