How do I keep an audio source from falling back to stereo?

Christian Leichsenring cleichsenring at techfak.uni-bielefeld.de
Tue Jul 29 07:24:01 PDT 2014


Just wanted to add that I fully understand that few people are able to
actually test the code below so I'd be more than happy about untested
potential solutions or hints as to what /should/ work in theory.

I just couldn't find anything on how setting custom audio channel
positions should generally be done and I was therefore blindly guessing
how gstreamer might expect me to tell it what to do.

So even a link to a tutorial would be much appreciated.

	Christian

On Thu, 24 Jul 2014 19:20:01 +0200
Christian Leichsenring <cleichsenring at techfak.uni-bielefeld.de> wrote:

> Hi,
> 
> I'm sure this is explained somewhere on the net but I just couldn't
> find so sorry in advance.
> 
> Anyway, I'm trying to get 28 channels out of a jackaudiosrc but as soon
> as I connect say a deinterleave element, the source will fall back to
> the 2-channel setup that works without any channel mask. My attempts at
> setting a channel mask have been futile though.
> 
> Here's what happens (the second line is shortened because 28 times
> GST_AUDIO_CHANNEL_POSITION_NONE makes the thing somewhat illegible and
> breaks SMTP):
> 
> potential caps: audio/x-raw-float, endianness=(int)1234, width=(int)32, rate=(int)48000, channels=(int)[ 1, 28 ]
> filter caps: audio/x-raw-float, channels=(int)28, channel-positions=(GstAudioChannelPosition)< GST_AUDIO_CHANNEL_POSITION_NONE, GST_AUDIO_CHANNEL_POSITION_NONE, ... , GST_AUDIO_CHANNEL_POSITION_NONE >
> actual caps: audio/x-raw-float, endianness=(int)1234, width=(int)32, rate=(int)48000, channels=(int)2, channel-positions=(GstAudioChannelPosition)< GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT >
> 
> And here's the Python code that produces that output:
> 
> #!/usr/bin/env python
> import pygst
> pygst.require("0.10")
> import gst
> import gobject
> import gst.audio
> 
> gobject.threads_init()
> pipeline = gst.Pipeline("mypipeline")
> src = gst.element_factory_make("jackaudiosrc", "jacksrc")
> pipeline.add(src)
> srcpad = src.get_pad("src")
> pipeline.set_state(gst.STATE_PLAYING)
> print 'potential caps:',srcpad.get_caps()
> sink = gst.element_factory_make("fakesink", "sink")
> pipeline.add(sink)
> filtercaps = gst.caps_from_string("audio/x-raw-float,channels=28")
> filtercaps[0].set_value("channel-positions", tuple([gst.audio.AUDIO_CHANNEL_POSITION_NONE]*28))
> print "filter caps:",filtercaps
> src.link_filtered(sink, filtercaps)
> pipeline.set_state(gst.STATE_PLAYING)
> print 'actual caps:',srcpad.get_negotiated_caps()
> #gst.DEBUG_BIN_TO_DOT_FILE_WITH_TS(pipeline, gst.DEBUG_GRAPH_SHOW_ALL, 'caps')
> 
> I also tried to set the caps of the output directly instead of using a
> filter but that didn't do anything either.
> 
> I'll attach the output of that last bin-to-dot-file line.
> 
> Thanks in advance for any explanation how to properly set channel
> positions/a channel mask,
> 
> 	Christian


More information about the gstreamer-devel mailing list