GNOME Bugzilla – Bug 678021
The IEC 61937 payloader only supports bigendian output
Last modified: 2015-02-15 15:09:36 UTC
In order to add support for SPDIF output with directsoundsink and osxaudiosink it is required to use the IEC 61937 payloader in -base. That payloader is only able to generate a bigendian version of the payloaded data and it doesn't match with the requirements for directsound and CoreAudio. For directsound is exepcted to provide data in the native endianess. For CoreAudio it could be big or little endian depending on the hardware and the api has to queried on that. The current workaround is to swap bytes again after payloading. As an example the VLC payloader support both S16LE and S16BE formats for payloading. That means we should have a way to instruct the payloader in which format should the payloaded data be provided. As we discussed at #gstreamer the less intrussive (not breaking API or behaviour) would be change the payloader to honour the bigend flag in the spec. Also change the caps parser to set spec->bigend = TRUE for the compressed formats and keep the current default behaviour. Having this change in place would allow osxaudiosink and directsoundsink to specify in which endianess data has to be payloaded.
Actually the behaviour of the payloader is even more weird. On big endian systems it keeps the endianness, and on little endian systems it swaps the endianness. So you always get inverse-endianness on little endian systems (not necessarily big endian as I understand it as the stream itself can have any endianness) and stream-endianness on big endian systems. This should be looked at too, it looks weird.
Created attachment 224690 [details] [review] audio: Explicitly specify endianness for IEC 61937 payloading This is required since some systems (DirectSound and OS X) manage the final byte order themselves.
Created attachment 224691 [details] [review] pulsesink: Specify endianness in IEC 61937 payloading Corresponds to an API change in gst-plugins-base.
Created attachment 224692 [details] [review] directsoundsink: Specify endianness in IEC 61937 payloading DirectSound expects native endian byte order.
Created attachment 224693 [details] [review] osxaudiosink: Specify endianness in IEC 61937 payloading Corresponds to an API change in gst-plugins-base. This needs to be fixed to query the expected byte order using appropriate API.
Looks good to me :)
Comment on attachment 224690 [details] [review] audio: Explicitly specify endianness for IEC 61937 payloading Please push these
Comment on attachment 224690 [details] [review] audio: Explicitly specify endianness for IEC 61937 payloading Attachment 224690 [details] pushed as 9f97187 - audio: Explicitly specify endianness for IEC 61937 payloading
Attachment 224691 [details] pushed as f46475e - pulsesink: Specify endianness in IEC 61937 payloading Attachment 224692 [details] pushed as 333d568 - directsoundsink: Specify endianness in IEC 61937 payloading Attachment 224693 [details] pushed as c9821d3 - osxaudiosink: Specify endianness in IEC 61937 payloading
Reopening, since I'd like to fix this in 0.10 as well.