[gnome-sound-recorder] Temporary fix for waveforms



commit 3b9571735afbfba7be764d0852c90ff83b9a28e4
Author: Meg Ford <megford gnome org>
Date:   Sat Mar 14 14:05:54 2015 -0500

    Temporary fix for waveforms
    
    The Gst level element does not properly read files with one channel.
    There is now a fix for this in Gst master branch.
    Add temporary workaround until the fix is released.
    https://bugzilla.gnome.org/show_bug.cgi?id=742028
    https://bugzilla.gnome.org/show_bug.cgi?id=746065

 src/record.js   |    8 ++++++--
 src/waveform.js |    6 +++---
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/record.js b/src/record.js
index 697df3e..f58a1be 100644
--- a/src/record.js
+++ b/src/record.js
@@ -79,6 +79,9 @@ const Record = new Lang.Class({
         }
 
         this.pipeline.add(this.srcElement);
+        this.audioConvert = Gst.ElementFactory.make("audioconvert", "audioConvert");
+        this.pipeline.add(this.audioConvert);
+        this.caps = Gst.Caps.from_string("audio/x-raw, channels=2");
         this.clock = this.pipeline.get_clock();
         this.recordBus = this.pipeline.get_bus();
         this.recordBus.add_signal_watch();
@@ -124,12 +127,13 @@ const Record = new Lang.Class({
             this.onEndOfStream();
         }
 
-        let srcLink = this.srcElement.link(this.level);
+        let srcLink = this.srcElement.link(this.audioConvert);
+        let audioConvertLink = this.audioConvert.link_filtered(this.level, this.caps);
         let levelLink = this.level.link(this.volume);
         let volLink = this.volume.link(this.ebin);
         let ebinLink = this.ebin.link(this.filesink);
 
-        if (!srcLink || !levelLink || !ebinLink) {
+        if (!srcLink || !audioConvertLink || !levelLink || !ebinLink) {
             this._showErrorDialog(_("Not all of the elements were linked."));
             errorDialogState = ErrState.ON;
             this.onEndOfStream();
diff --git a/src/waveform.js b/src/waveform.js
index 56f207a..6067522 100644
--- a/src/waveform.js
+++ b/src/waveform.js
@@ -90,8 +90,8 @@ const WaveForm = new Lang.Class({
 
     _launchPipeline: function() {
         this.pipeline =
-            Gst.parse_launch("uridecodebin name=decode uri=" + this._uri + " ! audioconvert ! 
audio/x-raw,channels=1 !level name=level interval=100000000 post-messages=true ! fakesink qos=false");
-        this._level = this.pipeline.get_by_name("wavelevel");
+            Gst.parse_launch("uridecodebin name=decode uri=" + this._uri + " ! audioconvert ! 
audio/x-raw,channels=2 ! level name=level interval=100000000 post-messages=true ! fakesink qos=false");
+        this._level = this.pipeline.get_by_name("level");
         let decode = this.pipeline.get_by_name("decode");
         let bus = this.pipeline.get_bus();
         bus.add_signal_watch();
@@ -253,7 +253,7 @@ const WaveForm = new Lang.Class({
     },
 
     endDrawing: function() {
-        if(this.pipeline)
+        if (this.pipeline)
             this.stopGeneration();
 
         this.count = 0;


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