[gnome-sound-recorder/Bug_777862: 1/2] Bug 777862



commit 3973f1a94ffd7e2e424f1d9c96cc1e4f7955f426
Author: Meg Ford <megford gnome org>
Date:   Mon Mar 13 21:08:13 2017 -0500

    Bug 777862

 configure.ac  |  111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 src/record.js |   17 ++++++---
 2 files changed, 121 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b8b0c57..53d7e63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,13 +18,120 @@ GOBJECT_INTROSPECTION_REQUIRE([0.9.6])
 
 GLIB_MIN_VERSION=2.46
 GTK_MIN_VERSION=3.12
-GOBJECT_INTROSPECTION_MIN_VERSION=1.31.6
+GOBJECT_MIN_VERSION=1.31.6
+GST__MIN_VERSION=1.4
+GSTPLUG_BASE__MIN_VERSION=1.4
 PKG_CHECK_MODULES([DEPS], [gdk-3.0
                   gdk-pixbuf-2.0
+                  gstreamer-1.0 >= $GST_MIN_VERSION
+                  gstreamer-pbutils-1.0
+                  gstreamer-plugins-base-1.0 >= $GSTPLUG_BASE__MIN_VERSION
                   glib-2.0 >= $GLIB_MIN_VERSION
-                  gobject-introspection-1.0 >= $GOBJECT_INTROSPECTION_MIN_VERSION
+                  gobject-introspection-1.0 >= $GOBJECT_MIN_VERSION
                   gtk+-3.0 >= $GTK_MIN_VERSION])
 
+# Check for required plugins (stolen from Totem's configure.ac)
+gst10_toolsdir=`$PKG_CONFIG --variable=toolsdir gstreamer-1.0`
+gst10_inspect="$gst10_toolsdir/gst-inspect-1.0"
+
+#Give error and exit if we don't have the gst_inspect tool
+AC_MSG_CHECKING([GStreamer 1.0 inspection tool])
+if test -r "$gst10_inspect"; then
+       AC_MSG_RESULT([yes])
+else
+       AC_MSG_RESULT([no])
+       AC_MSG_ERROR([
+               Cannot find required GStreamer-1.0 tool 'gst-inspect-1.0'.
+               It should be part of gstreamer-1_0-utils. Please install it.
+       ])
+fi
+
+# Check for elements from gst-plugins-base
+# Set plugins which contain below elements
+for base_element in playbin audioconvert uridecodebin
+do
+       AC_MSG_CHECKING([GStreamer 1.0 $base_element element])
+       if $gst10_inspect $base_element >/dev/null 2>/dev/null; then
+               AC_MSG_RESULT([yes])
+       else
+               AC_MSG_RESULT([no])
+               AC_MSG_ERROR([
+                       Cannot find required GStreamer-1.0 plugin '$1'.
+                       It should be part of gst-plugins-base. Please install it.
+               ])
+
+       fi
+       shift;
+done
+
+# Check for elements from gst-plugins-good
+# Set plugins which contain below elements
+for good_element in flacenc flacparse qtmux qtdemux oggdemux
+do
+       AC_MSG_CHECKING([GStreamer 1.0 $good_element element])
+       if $gst10_inspect $good_element >/dev/null 2>/dev/null; then
+               AC_MSG_RESULT([yes])
+       else
+               AC_MSG_RESULT([no])
+               AC_MSG_ERROR([
+                       Cannot find required GStreamer-1.0 plugin '$1'.
+                       It should be part of gst-plugins-good. Please install it.
+               ])
+       fi
+       shift;
+done
+
+# Do a diff check for pulseaudio since we've run into problems on deb systems
+AC_MSG_CHECKING([GStreamer 1.0 pulseaudio element])
+if $gst10_inspect $good_element >/dev/null 2>/dev/null; then
+       AC_MSG_RESULT([yes])
+else
+       AC_MSG_RESULT([no])
+       AC_MSG_WARN([
+               Cannot find required GStreamer-1.0 plugin PulseAudio.
+               It should be part of gst-plugins-good on RPM-based distros
+               and gstreamer1.0-pulseaudio on Debian-based distros.
+               Please install it.
+       ])
+fi
+
+# Check for elements from gst-plugins-bad
+# but don't exit if they aren't installed. Just print error.
+# Set plugins which contain below elements
+for bad_element in playbin id3mux
+do
+       AC_MSG_CHECKING([GStreamer 1.0 $base_element element])
+       if $gst10_inspect $base_element >/dev/null 2>/dev/null; then
+               AC_MSG_RESULT([yes])
+       else
+               AC_MSG_RESULT([no])
+               AC_MSG_ERROR([
+                       Cannot find required GStreamer-1.0 plugin '$1'.
+                       It should be part of gst-plugins-base. Please install it.
+               ])
+
+       fi
+       shift;
+done
+
+# Check for elements from gst-plugins-good
+# Set plugins which contain below elements
+for good_element in flacenc flacparse
+do
+       AC_MSG_CHECKING([GStreamer 1.0 $good_element element])
+       if $gst10_inspect $good_element >/dev/null 2>/dev/null; then
+               AC_MSG_RESULT([yes])
+       else
+               AC_MSG_RESULT([no])
+               AC_MSG_ERROR([
+                       Cannot find required GStreamer-1.0 plugin '$1'.
+                       It should be part of gst-plugins-good. Please install it.
+               ])
+       fi
+       shift;
+done
+
+
 AC_PATH_PROG(GJS, [gjs])
 
 GLIB_COMPILE_RESOURCES=`$PKG_CONFIG --variable glib_compile_resources gio-2.0`
diff --git a/src/record.js b/src/record.js
index bd396b2..c5d4585 100644
--- a/src/record.js
+++ b/src/record.js
@@ -76,11 +76,18 @@ const Record = new Lang.Class({
         this.pipeline = new Gst.Pipeline({ name: "pipe" });
         this.srcElement = Gst.ElementFactory.make("pulsesrc", "srcElement");
 
-        if(this.srcElement == null) {
-          this._showErrorDialog(_("Your audio capture settings are invalid."));
-          errorDialogState = ErrState.ON;
-          this.onEndOfStream();
-          return;
+        if (this.srcElement == null) {
+            let inspect = "gst-inspect-1.0 pulseaudio";
+            let [res, out, err, status] =  GLib.spawn_command_line_sync(inspect);
+            let err_str = String(err)
+            if (err_str.replace(/\W/g, ''))
+                this._showErrorDialog(_("Please install the GStreamer1.0 PulseAudio plugin."));
+            else
+                this._showErrorDialog(_("Your audio capture settings are invalid."));
+
+            errorDialogState = ErrState.ON;
+            this.onEndOfStream();
+            return;
         }
 
         this.pipeline.add(this.srcElement);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]