Open peterbarlow2000 opened 3 years ago
After days of trawling through the code I think I have the answer. It seems there are different flavours of Kodi, some use ALSA, some use OMX. The binary I was running was using OMX whilst the source code I was looking at was using ALSA. This lost me A LOT of time. I got the right source code (OMX) and have found that Kodi(OMX) does not use the standard channel mapping call OMX_SetParameter(handle, OMX_IndexParamAudioPcm, &sPCMMode);
. Instead the channel mapping is achieved by a call to vcgencmnd. Specifically vcgencmd hdmi_channel_map 0x0b02c4c8
. If I execute this command from the shell before launching omxplay then I get the correct result. PCM 5.1 surround sound with the correct channel mapping. I hope this is useful to someone else.
NB: This is in an issue in OMXPlayer that needs to be addressed. Kodi(OMX) handles it well. The relevant bits of code need carrying over to OMXPlayer.
Playing a pcm_s16le 48000Hz 5.1 file through omxplayer with the -p flag results in a minor mapping error. The centre speaker audio is routed through the LFE. (the AVR reports a 5.1 PCM signal). (Removing the -p flag puts omxplayer in stereo down-mix mode.). I have written my own program using the OpenMAX IL client library and have the exact same problem. However, when playing the file through kodi all is well. I have to select 5.1 in the config, but the AVR again reports and good 5.1 PCM signal and all channels are correct this time. DTS and AC3(DDP) passthrough work fine under omxplayer.
I'm using test wave files from this site https://www2.iis.fraunhofer.de/AAC/multichannel.html