spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit 82b5e2c779690012dde783af2c45ac9bf3bf446c
parent efec786ca11450c4f7b89046cbbd8f4f6125d28f
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Wed, 19 May 2010 12:17:55 +1000

Add audioconvert element to the pipeline (issue 12)

Without it some streams (e.g. 24-bit FLACs) cannot be
processed by spectrum.

Diffstat:
Msrc/spek-source.vala | 14+++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/spek-source.vala b/src/spek-source.vala @@ -111,11 +111,19 @@ namespace Spek { // We want to construct the spectrum element only for the first decoded pad. return; } - source.spectrum = ElementFactory.make ("spectrum", null); - source.pipeline.add (source.spectrum); - var sinkpad = source.spectrum.get_static_pad ("sink"); + + // The audioconvert takes care of caps that `spectrum` can't handle, + // for example streams with 24-bit depth. + var convert = ElementFactory.make ("audioconvert", null); + source.pipeline.add (convert); + var sinkpad = convert.get_static_pad ("sink"); source.pad = new_pad; source.pad.link (sinkpad); + convert.set_state (State.PAUSED); + + source.spectrum = ElementFactory.make ("spectrum", null); + source.pipeline.add (source.spectrum); + convert.link (source.spectrum); source.spectrum.set ("bands", source.bands); source.spectrum.set ("threshold", source.threshold); source.spectrum.set ("message-magnitude", true);