libobs: Add surround sound audio support

(This commit also modifies the following modules: UI,
deps/media-playback, coreaudio-encoder, decklink, linux-alsa,
linux-pulseaudio, mac-capture, obs-ffmpeg, obs-filters, obs-libfdk,
obs-outputs, win-dshow, and win-wasapi)

Adds surround sound audio support to the core, core plugins, and user
interface.

Compatible streaming services: Twitch, FB 360 live
Compatible protocols: rtmp / mpeg-ts tcp udp
Compatible file formats: mkv mp4 ts  (others untested)
Compatible codecs: ffmpeg aac, fdk_aac, CoreAudio aac,
		   opus, vorbis, pcm (others untested).
Tested streaming servers: wowza, nginx
	 HLS, mpeg-dash : surround passthrough
Html5 players tested with live surround:
	 videojs, mediaelement, viblast (hls+dash), hls.js
Decklink: on win32, swap channels order for 5.1 7.1
         (due to different channel mapping on wav, mpeg, ffmpeg)
Audio filters: surround working.
Monitoring: surround working (win macOs linux (pulse-audio)).
VST:	 stereo plugins keep in general only the first two channels.
	 surround plugins should work (e.g. mcfx does).
OS: win, macOs, linux (alsa, pulse-audio).
Misc: larger audio bitrates unlocked to accommodate more channels
NB: mf-aac only supports mono and stereo + 5.1 on win 10
         (not implemented due to lack of usefulness)

Closes jp9000/obs-studio#968
This commit is contained in:
pkviet
2017-05-27 02:15:54 +02:00
committed by jp9000
parent 54ecfc8fe7
commit bbac3280c1
30 changed files with 628 additions and 116 deletions

View File

@@ -16,6 +16,7 @@
struct gain_data {
obs_source_t *context;
size_t channels;
float multiple;
};
@@ -35,7 +36,7 @@ static void gain_update(void *data, obs_data_t *s)
{
struct gain_data *gf = data;
double val = obs_data_get_double(s, S_GAIN_DB);
gf->channels = audio_output_get_channels(obs_get_audio());
gf->multiple = db_to_mul((float)val);
}
@@ -51,11 +52,11 @@ static struct obs_audio_data *gain_filter_audio(void *data,
struct obs_audio_data *audio)
{
struct gain_data *gf = data;
float *adata[2] = {(float*)audio->data[0], (float*)audio->data[1]};
const size_t channels = gf->channels;
float **adata = (float**)audio->data;
const float multiple = gf->multiple;
for (size_t c = 0; c < 2; c++) {
for (size_t c = 0; c < channels; c++) {
if (audio->data[c]) {
for (size_t i = 0; i < audio->frames; i++) {
adata[c][i] *= multiple;