From: Jean-Baptiste M. <jb...@kd...> - 2013-01-03 13:52:16
|
Git commit f15361123a17fd8bcd0f42aab9eabdd07e5acf7d by Jean-Baptiste Mardelle. Committed on 03/01/2013 at 14:43. Pushed by mardelle into branch 'master'. Disable screen grab if FFmpeg does not support it: http://kdenlive.org/mantis/view.php?id=2643 M +8 -1 src/recmonitor.cpp M +14 -0 src/renderer.cpp M +2 -0 src/renderer.h http://commits.kde.org/kdenlive/f15361123a17fd8bcd0f42aab9eabdd07e5acf7d diff --git a/src/recmonitor.cpp b/src/recmonitor.cpp index cb117df..06dba63 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 79873c2..15673b7 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -4737,5 +4737,19 @@ void Render::slotMultiStreamProducerFound(const QString path, QList<int> 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 28e317c..972feb0 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; |