libobs/media-io: Replace quad with 4.0

(also obs, deps/media-playback, libobs/audio-monitoring, decklink,
linux-alsa, linux-pulseaudio, mac-capture, obs-ffmpeg, win-dshow,
win-wasapi)

Default channel layout for 4 channels is 4.0 in FFmpeg.
Replacing quad with 4.0 will improve compatibility since FFmpeg has
better support of its default channel layouts.
master
pkviet 2017-12-01 17:10:05 +01:00 committed by jp9000
parent fb580535c9
commit 67e48ecc2c
19 changed files with 25 additions and 29 deletions

View File

@ -3229,7 +3229,7 @@
</item>
<item>
<property name="text">
<string>4.0 Quad</string>
<string>4.0</string>
</property>
</item>
<item>

View File

@ -3185,8 +3185,8 @@ bool OBSBasic::ResetAudio()
ai.speakers = SPEAKERS_MONO;
else if (strcmp(channelSetupStr, "2.1") == 0)
ai.speakers = SPEAKERS_2POINT1;
else if (strcmp(channelSetupStr, "4.0 Quad") == 0)
ai.speakers = SPEAKERS_QUAD;
else if (strcmp(channelSetupStr, "4.0") == 0)
ai.speakers = SPEAKERS_4POINT0;
else if (strcmp(channelSetupStr, "4.1") == 0)
ai.speakers = SPEAKERS_4POINT1;
else if (strcmp(channelSetupStr, "5.1") == 0)

View File

@ -1390,7 +1390,7 @@ static inline bool IsSurround(const char *speakers)
{
static const char *surroundLayouts[] = {
"2.1",
"4.0 Quad",
"4.0",
"4.1",
"5.1",
"7.1",
@ -2109,7 +2109,7 @@ void OBSBasicSettings::LoadAudioSettings()
ui->channelSetup->setCurrentIndex(0);
else if (strcmp(speakers, "2.1") == 0)
ui->channelSetup->setCurrentIndex(2);
else if (strcmp(speakers, "4.0 Quad") == 0)
else if (strcmp(speakers, "4.0") == 0)
ui->channelSetup->setCurrentIndex(3);
else if (strcmp(speakers, "4.1") == 0)
ui->channelSetup->setCurrentIndex(4);
@ -3015,7 +3015,7 @@ void OBSBasicSettings::SaveAudioSettings()
channelSetup = "2.1";
break;
case 3:
channelSetup = "4.0 Quad";
channelSetup = "4.0";
break;
case 4:
channelSetup = "4.1";

View File

@ -68,7 +68,7 @@ static inline enum speaker_layout convert_speaker_layout(uint8_t channels)
case 1: return SPEAKERS_MONO;
case 2: return SPEAKERS_STEREO;
case 3: return SPEAKERS_2POINT1;
case 4: return SPEAKERS_QUAD;
case 4: return SPEAKERS_4POINT0;
case 5: return SPEAKERS_4POINT1;
case 6: return SPEAKERS_5POINT1;
case 8: return SPEAKERS_7POINT1;

View File

@ -36,7 +36,7 @@ static enum speaker_layout pulseaudio_channels_to_obs_speakers(
case 1: return SPEAKERS_MONO;
case 2: return SPEAKERS_STEREO;
case 3: return SPEAKERS_2POINT1;
case 4: return SPEAKERS_QUAD;
case 4: return SPEAKERS_4POINT0;
case 5: return SPEAKERS_4POINT1;
case 6: return SPEAKERS_5POINT1;
case 8: return SPEAKERS_7POINT1;

View File

@ -230,8 +230,8 @@ static enum speaker_layout convert_speaker_layout(DWORD layout, WORD channels)
{
switch (layout) {
case KSAUDIO_SPEAKER_2POINT1: return SPEAKERS_2POINT1;
case KSAUDIO_SPEAKER_SURROUND: return SPEAKERS_4POINT0;
case KSAUDIO_SPEAKER_4POINT1: return SPEAKERS_4POINT1;
case KSAUDIO_SPEAKER_QUAD: return SPEAKERS_QUAD;
case KSAUDIO_SPEAKER_5POINT1: return SPEAKERS_5POINT1;
case KSAUDIO_SPEAKER_7POINT1: return SPEAKERS_7POINT1;
}

View File

@ -56,7 +56,7 @@ enum speaker_layout {
SPEAKERS_MONO,
SPEAKERS_STEREO,
SPEAKERS_2POINT1,
SPEAKERS_QUAD,
SPEAKERS_4POINT0,
SPEAKERS_4POINT1,
SPEAKERS_5POINT1,
SPEAKERS_7POINT1=8,
@ -99,7 +99,7 @@ static inline uint32_t get_audio_channels(enum speaker_layout speakers)
case SPEAKERS_MONO: return 1;
case SPEAKERS_STEREO: return 2;
case SPEAKERS_2POINT1: return 3;
case SPEAKERS_QUAD: return 4;
case SPEAKERS_4POINT0: return 4;
case SPEAKERS_4POINT1: return 5;
case SPEAKERS_5POINT1: return 6;
case SPEAKERS_7POINT1: return 8;

View File

@ -64,7 +64,7 @@ static inline uint64_t convert_speaker_layout(enum speaker_layout layout)
case SPEAKERS_MONO: return AV_CH_LAYOUT_MONO;
case SPEAKERS_STEREO: return AV_CH_LAYOUT_STEREO;
case SPEAKERS_2POINT1: return AV_CH_LAYOUT_2_1;
case SPEAKERS_QUAD: return AV_CH_LAYOUT_QUAD;
case SPEAKERS_4POINT0: return AV_CH_LAYOUT_4POINT0;
case SPEAKERS_4POINT1: return AV_CH_LAYOUT_4POINT1;
case SPEAKERS_5POINT1: return AV_CH_LAYOUT_5POINT1;
case SPEAKERS_7POINT1: return AV_CH_LAYOUT_7POINT1;

View File

@ -31,7 +31,7 @@ static inline int ConvertChannelFormat(speaker_layout format)
{
switch (format) {
case SPEAKERS_2POINT1:
case SPEAKERS_QUAD:
case SPEAKERS_4POINT0:
case SPEAKERS_4POINT1:
case SPEAKERS_5POINT1:
case SPEAKERS_7POINT1:
@ -46,7 +46,7 @@ static inline int ConvertChannelFormat(speaker_layout format)
static inline audio_repack_mode_t ConvertRepackFormat(speaker_layout format)
{
switch (format) {
case SPEAKERS_QUAD:
case SPEAKERS_4POINT0:
return repack_mode_8to4ch_swap23;
case SPEAKERS_4POINT1:
return repack_mode_8to5ch_swap23;

View File

@ -157,7 +157,7 @@ static bool decklink_device_changed(obs_properties_t *props,
if (device->GetMaxChannel() >= 8) {
obs_property_list_add_int(channelList, TEXT_CHANNEL_FORMAT_4_0CH,
SPEAKERS_QUAD);
SPEAKERS_4POINT0);
obs_property_list_add_int(channelList, TEXT_CHANNEL_FORMAT_5_1CH,
SPEAKERS_5POINT1);
obs_property_list_add_int(channelList, TEXT_CHANNEL_FORMAT_7_1CH,
@ -258,7 +258,7 @@ static obs_properties_t *decklink_get_properties(void *data)
obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_2_1CH,
SPEAKERS_2POINT1);
obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_4_0CH,
SPEAKERS_QUAD);
SPEAKERS_4POINT0);
obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_4_1CH,
SPEAKERS_4POINT1);
obs_property_list_add_int(list, TEXT_CHANNEL_FORMAT_5_1CH,

View File

@ -625,7 +625,7 @@ enum speaker_layout _alsa_channels_to_obs_speakers(unsigned int channels)
case 1: return SPEAKERS_MONO;
case 2: return SPEAKERS_STEREO;
case 3: return SPEAKERS_2POINT1;
case 4: return SPEAKERS_QUAD;
case 4: return SPEAKERS_4POINT0;
case 5: return SPEAKERS_4POINT1;
case 6: return SPEAKERS_5POINT1;
case 8: return SPEAKERS_7POINT1;

View File

@ -84,7 +84,7 @@ static enum speaker_layout pulse_channels_to_obs_speakers(
case 1: return SPEAKERS_MONO;
case 2: return SPEAKERS_STEREO;
case 3: return SPEAKERS_2POINT1;
case 4: return SPEAKERS_QUAD;
case 4: return SPEAKERS_4POINT0;
case 5: return SPEAKERS_4POINT1;
case 6: return SPEAKERS_5POINT1;
case 8: return SPEAKERS_7POINT1;

View File

@ -191,7 +191,7 @@ static inline enum speaker_layout convert_ca_speaker_layout(UInt32 channels)
case 1: return SPEAKERS_MONO;
case 2: return SPEAKERS_STEREO;
case 3: return SPEAKERS_2POINT1;
case 4: return SPEAKERS_QUAD;
case 4: return SPEAKERS_4POINT0;
case 5: return SPEAKERS_4POINT1;
case 6: return SPEAKERS_5POINT1;
case 8: return SPEAKERS_7POINT1;

View File

@ -63,7 +63,7 @@ static inline uint64_t convert_speaker_layout(enum speaker_layout layout)
case SPEAKERS_MONO: return AV_CH_LAYOUT_MONO;
case SPEAKERS_STEREO: return AV_CH_LAYOUT_STEREO;
case SPEAKERS_2POINT1: return AV_CH_LAYOUT_2_1;
case SPEAKERS_QUAD: return AV_CH_LAYOUT_QUAD;
case SPEAKERS_4POINT0: return AV_CH_LAYOUT_4POINT0;
case SPEAKERS_4POINT1: return AV_CH_LAYOUT_4POINT1;
case SPEAKERS_5POINT1: return AV_CH_LAYOUT_5POINT1;
case SPEAKERS_7POINT1: return AV_CH_LAYOUT_7POINT1;
@ -79,7 +79,7 @@ static inline enum speaker_layout convert_ff_channel_layout(uint64_t channel_la
case AV_CH_LAYOUT_MONO: return SPEAKERS_MONO;
case AV_CH_LAYOUT_STEREO: return SPEAKERS_STEREO;
case AV_CH_LAYOUT_2_1: return SPEAKERS_2POINT1;
case AV_CH_LAYOUT_QUAD: return SPEAKERS_QUAD;
case AV_CH_LAYOUT_4POINT0: return SPEAKERS_4POINT0;
case AV_CH_LAYOUT_4POINT1: return SPEAKERS_4POINT1;
case AV_CH_LAYOUT_5POINT1: return SPEAKERS_5POINT1;
case AV_CH_LAYOUT_7POINT1: return SPEAKERS_7POINT1;

View File

@ -335,10 +335,6 @@ static bool create_audio_stream(struct ffmpeg_data *data)
context->channel_layout =
av_get_default_channel_layout(context->channels);
//AVlib default channel layout for 4 channels is 4.0 ; fix for quad
if (aoi.speakers == SPEAKERS_QUAD)
context->channel_layout = av_get_channel_layout("quad");
//AVlib default channel layout for 5 channels is 5.0 ; fix for 4.1
if (aoi.speakers == SPEAKERS_4POINT1)
context->channel_layout = av_get_channel_layout("4.1");

View File

@ -106,7 +106,7 @@ static bool build_flv_meta_data(obs_output_t *context,
audio_output_get_channels(audio) == 3);
enc_bool_val(&enc, end, "3.1",
audio_output_get_channels(audio) == 4);
enc_bool_val(&enc, end, "4.0 Quad",
enc_bool_val(&enc, end, "4.0",
audio_output_get_channels(audio) == 4);
enc_bool_val(&enc, end, "4.1",
audio_output_get_channels(audio) == 5);

View File

@ -101,7 +101,7 @@ static inline enum speaker_layout convert_speaker_layout(uint8_t channels)
case 1: return SPEAKERS_MONO;
case 2: return SPEAKERS_STEREO;
case 3: return SPEAKERS_2POINT1;
case 4: return SPEAKERS_QUAD;
case 4: return SPEAKERS_4POINT0;
case 5: return SPEAKERS_4POINT1;
case 6: return SPEAKERS_5POINT1;
case 8: return SPEAKERS_7POINT1;

View File

@ -411,7 +411,7 @@ static inline enum speaker_layout convert_speaker_layout(uint8_t channels)
case 1: return SPEAKERS_MONO;
case 2: return SPEAKERS_STEREO;
case 3: return SPEAKERS_2POINT1;
case 4: return SPEAKERS_QUAD;
case 4: return SPEAKERS_4POINT0;
case 5: return SPEAKERS_4POINT1;
case 6: return SPEAKERS_5POINT1;
case 8: return SPEAKERS_7POINT1;

View File

@ -243,7 +243,7 @@ static speaker_layout ConvertSpeakerLayout(DWORD layout, WORD channels)
{
switch (layout) {
case KSAUDIO_SPEAKER_2POINT1: return SPEAKERS_2POINT1;
case KSAUDIO_SPEAKER_QUAD: return SPEAKERS_QUAD;
case KSAUDIO_SPEAKER_SURROUND: return SPEAKERS_4POINT0;
case KSAUDIO_SPEAKER_4POINT1: return SPEAKERS_4POINT1;
case KSAUDIO_SPEAKER_5POINT1_SURROUND: return SPEAKERS_5POINT1;
case KSAUDIO_SPEAKER_7POINT1_SURROUND: return SPEAKERS_7POINT1;