From: Jean-Baptiste Mardelle Date: Thu, 3 Jan 2013 13:43:34 +0000 (+0100) Subject: Disable screen grab if FFmpeg does not support it: http://kdenlive.org/mantis/view... X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=f15361123a17fd8bcd0f42aab9eabdd07e5acf7d;p=kdenlive Disable screen grab if FFmpeg does not support it: http://kdenlive.org/mantis/view.php?id=2643 --- diff --git a/src/recmonitor.cpp b/src/recmonitor.cpp index cb117df9..06dba63e 100644 --- a/src/recmonitor.cpp +++ b/src/recmonitor.cpp @@ -262,7 +262,14 @@ void RecMonitor::slotVideoDeviceChanged(int ix) if (exepath.isEmpty()) video_frame->setPixmap(mergeSideBySide(KIcon("dialog-warning").pixmap(QSize(50, 50)), i18n("ffmpeg or avconv not found,\n please install it for screen grabs"))); else KdenliveSettings::setFfmpegpath(exepath); } - if (!KdenliveSettings::ffmpegpath().isEmpty()) video_frame->setPixmap(mergeSideBySide(KIcon("video-display").pixmap(QSize(50, 50)), i18n("Press record button\nto start screen capture\nFiles will be saved in:\n%1", m_capturePath))); + if (!KdenliveSettings::ffmpegpath().isEmpty()) { + if (!Render::checkX11Grab()) { + // FFmpeg does not support screen grab + video_frame->setPixmap(mergeSideBySide(KIcon("dialog-warning").pixmap(QSize(50, 50)), i18n("Your FFmpeg / Libav installation\n does not support screen grab"))); + m_recAction->setEnabled(false); + } + else video_frame->setPixmap(mergeSideBySide(KIcon("video-display").pixmap(QSize(50, 50)), i18n("Press record button\nto start screen capture\nFiles will be saved in:\n%1", m_capturePath))); + } //video_frame->setText(i18n("Press record button\nto start screen capture")); break; case VIDEO4LINUX: diff --git a/src/renderer.cpp b/src/renderer.cpp index 79873c2b..15673b70 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -4737,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" diff --git a/src/renderer.h b/src/renderer.h index 28e317c6..972feb03 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -335,6 +335,8 @@ Q_OBJECT public: int getCurrentSeekPosition() const; /** @brief Create a producer from url and load it in the monitor */ void loadUrl(const QString &url); + /** @brief Check if the installed FFmpeg / Libav supports x11grab */ + static bool checkX11Grab(); QSemaphore showFrameSemaphore; bool externalConsumer;