mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
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:
@@ -31,9 +31,17 @@ struct audio_monitor {
|
||||
static enum speaker_layout pulseaudio_channels_to_obs_speakers(
|
||||
uint_fast32_t channels)
|
||||
{
|
||||
if ((channels >= 1 && channels <= 6) || channels == 8)
|
||||
return (enum speaker_layout) channels;
|
||||
return SPEAKERS_UNKNOWN;
|
||||
switch (channels) {
|
||||
case 0: return SPEAKERS_UNKNOWN;
|
||||
case 1: return SPEAKERS_MONO;
|
||||
case 2: return SPEAKERS_STEREO;
|
||||
case 3: return SPEAKERS_2POINT1;
|
||||
case 4: return SPEAKERS_QUAD;
|
||||
case 5: return SPEAKERS_4POINT1;
|
||||
case 6: return SPEAKERS_5POINT1;
|
||||
case 8: return SPEAKERS_7POINT1;
|
||||
default: return SPEAKERS_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
static enum audio_format pulseaudio_to_obs_audio_format(
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
#include <mmdeviceapi.h>
|
||||
#include <audioclient.h>
|
||||
|
||||
#define KSAUDIO_SPEAKER_4POINT1 (KSAUDIO_SPEAKER_QUAD|SPEAKER_LOW_FREQUENCY)
|
||||
|
||||
#define KSAUDIO_SPEAKER_2POINT1 (KSAUDIO_SPEAKER_STEREO|SPEAKER_LOW_FREQUENCY)
|
||||
#define KSAUDIO_SPEAKER_SURROUND_AVUTIL \
|
||||
(KSAUDIO_SPEAKER_STEREO|SPEAKER_FRONT_CENTER)
|
||||
#define KSAUDIO_SPEAKER_4POINT1 (KSAUDIO_SPEAKER_SURROUND|SPEAKER_LOW_FREQUENCY)
|
||||
|
||||
#define safe_release(ptr) \
|
||||
do { \
|
||||
|
||||
@@ -26,7 +26,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAX_AUDIO_MIXES 6
|
||||
#define MAX_AUDIO_CHANNELS 2
|
||||
#define MAX_AUDIO_CHANNELS 8
|
||||
#define AUDIO_OUTPUT_FRAMES 1024
|
||||
|
||||
/*
|
||||
@@ -101,13 +101,13 @@ static inline uint32_t get_audio_channels(enum speaker_layout speakers)
|
||||
switch (speakers) {
|
||||
case SPEAKERS_MONO: return 1;
|
||||
case SPEAKERS_STEREO: return 2;
|
||||
case SPEAKERS_2POINT1: return 3;
|
||||
case SPEAKERS_SURROUND:
|
||||
case SPEAKERS_2POINT1:
|
||||
case SPEAKERS_SURROUND: return 3;
|
||||
case SPEAKERS_QUAD: return 4;
|
||||
case SPEAKERS_4POINT1: return 5;
|
||||
case SPEAKERS_5POINT1:
|
||||
case SPEAKERS_5POINT1_SURROUND: return 6;
|
||||
case SPEAKERS_7POINT1: return 8;
|
||||
case SPEAKERS_7POINT1:
|
||||
case SPEAKERS_7POINT1_SURROUND: return 8;
|
||||
case SPEAKERS_UNKNOWN: return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user