linux-pulseaudio: Surround speaker map

When using more than two channels, the channel map of pulse-audio is incorrect.

Add an API for getting a speaker map based on OBS speaker layout. Then use the
speaker map when connecting to a pulse-audio device, for both source and
monitor output.
This commit is contained in:
Tjienta Vara
2018-01-08 21:27:28 +01:00
parent 9b9d57a7ee
commit 48a8e750bb
3 changed files with 133 additions and 10 deletions

View File

@@ -51,15 +51,24 @@ enum audio_format {
AUDIO_FORMAT_FLOAT_PLANAR,
};
/**
* The speaker layout describes where the speakers are located in the room.
* For OBS it dictates:
* * how many channels are available and
* * which channels are used for which speakers.
*
* Standard channel layouts where retrieved from ffmpeg documentation at:
* https://trac.ffmpeg.org/wiki/AudioChannelManipulation
*/
enum speaker_layout {
SPEAKERS_UNKNOWN,
SPEAKERS_MONO,
SPEAKERS_STEREO,
SPEAKERS_2POINT1,
SPEAKERS_4POINT0,
SPEAKERS_4POINT1,
SPEAKERS_5POINT1,
SPEAKERS_7POINT1=8,
SPEAKERS_UNKNOWN, /**< Unknown setting, fallback is stereo. */
SPEAKERS_MONO, /**< Channels: MONO */
SPEAKERS_STEREO, /**< Channels: FL, FR */
SPEAKERS_2POINT1, /**< Channels: FL, FR, LFE */
SPEAKERS_4POINT0, /**< Channels: FL, FR, FC, RC */
SPEAKERS_4POINT1, /**< Channels: FL, FR, FC, LFE, RC */
SPEAKERS_5POINT1, /**< Channels: FL, FR, FC, LFE, RL, RR */
SPEAKERS_7POINT1=8, /**< Channels: FL, FR, FC, LFE, RL, RR, SL, SR */
};
struct audio_data {