]> git.sesse.net Git - kdenlive/commitdiff
Disable screen grab if FFmpeg does not support it: http://kdenlive.org/mantis/view...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 3 Jan 2013 13:43:34 +0000 (14:43 +0100)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Thu, 3 Jan 2013 13:43:34 +0000 (14:43 +0100)
src/recmonitor.cpp
src/renderer.cpp
src/renderer.h

index cb117df95ecaba0ca923ee1047db9e35155c2d5a..06dba63e6608e14d17fabf6d0eb14bc83c119632 100644 (file)
@@ -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:
index 79873c2ba5eb1e28fd9400409d9268c3a62485b4..15673b70086f6e5a0ea35fee0a47fa41dd5c5a3d 100644 (file)
@@ -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"
 
index 28e317c6981dad5382b76b115c1601814ec64fa0..972feb03649dde577d08415fec8273a2e850e352 100644 (file)
@@ -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;