interleave: Fix the example by setting channel-masks in the sink pads
authorAntonio Ospite <ao2@ao2.it>
Fri, 29 Aug 2014 13:07:58 +0000 (15:07 +0200)
committerTim-Philipp Müller <tim@centricular.com>
Tue, 12 Jan 2016 22:11:30 +0000 (22:11 +0000)
The current example does not work, it fails with:

ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstWavParse:wavparse0: Internal data flow error.
gstwavparse.c(2178): gst_wavparse_loop (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstWavParse:wavparse0:
streaming task paused, reason not-negotiated (-4)

This is because negotiation with wavenc gets messed up by the missing
channel positions configuration.

The proper way to define the channel layout when using the interleave
element in code would be to set the channel-positions property, but
gst-launch-1.0 does not know how to deal with arrays; so the example
pipeline works around the issue by setting the channel-masks in the sink
pads.

Also fix a repetition in the deinterleave example description

https://bugzilla.gnome.org/show_bug.cgi?id=735673

gst/interleave/interleave.c

index f27591a..45d72f9 100644 (file)
  * |[
  * gst-launch-1.0 filesrc location=file.mp3 ! decodebin ! audioconvert ! "audio/x-raw,channels=2" ! deinterleave name=d  interleave name=i ! audioconvert ! wavenc ! filesink location=test.wav    d.src_0 ! queue ! audioconvert ! i.sink_1    d.src_1 ! queue ! audioconvert ! i.sink_0
  * ]| Decodes and deinterleaves a Stereo MP3 file into separate channels and
- * then interleaves the channels again to a WAV file with the channel with the
- * channels exchanged.
+ * then interleaves the channels again to a WAV file with the channels
+ * exchanged.
  * |[
- * gst-launch-1.0 interleave name=i ! audioconvert ! wavenc ! filesink location=file.wav  filesrc location=file1.wav ! decodebin ! audioconvert ! "audio/x-raw,channels=1" ! queue ! i.sink_0   filesrc location=file2.wav ! decodebin ! audioconvert ! "audio/x-raw,channels=1" ! queue ! i.sink_1
- * ]| Interleaves two Mono WAV files to a single Stereo WAV file.
+ * gst-launch-1.0 interleave name=i ! audioconvert ! wavenc ! filesink location=file.wav  filesrc location=file1.wav ! decodebin ! audioconvert ! "audio/x-raw,channels=1,channel-mask=(bitmask)0x1" ! queue ! i.sink_0   filesrc location=file2.wav ! decodebin ! audioconvert ! "audio/x-raw,channels=1,channel-mask=(bitmask)0x2" ! queue ! i.sink_1
+ * ]| Interleaves two Mono WAV files to a single Stereo WAV file. Having
+ * channel-masks defined in the sink pads ensures a sane mapping of the mono
+ * streams into the stereo stream. NOTE: the proper way to map channels in
+ * code is by using the channel-positions property of the interleave element.
  * </refsect2>
  */