Browse Source

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.
pkviet 8 years ago
parent
commit
67e48ecc2c

+ 1 - 1
UI/forms/OBSBasicSettings.ui

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

+ 2 - 2
UI/window-basic-main.cpp

@@ -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)

+ 3 - 3
UI/window-basic-settings.cpp

@@ -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";

+ 1 - 1
deps/media-playback/media-playback/media.c

@@ -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;

+ 1 - 1
libobs/audio-monitoring/pulse/pulseaudio-output.c

@@ -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;

+ 1 - 1
libobs/audio-monitoring/win32/wasapi-output.c

@@ -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;
 	}

+ 2 - 2
libobs/media-io/audio-io.h

@@ -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;

+ 1 - 1
libobs/media-io/audio-resampler-ffmpeg.c

@@ -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;

+ 2 - 2
plugins/decklink/decklink-device-instance.cpp

@@ -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;

+ 2 - 2
plugins/decklink/plugin-main.cpp

@@ -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,

+ 1 - 1
plugins/linux-alsa/alsa-input.c

@@ -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;

+ 1 - 1
plugins/linux-pulseaudio/pulse-input.c

@@ -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;

+ 1 - 1
plugins/mac-capture/mac-audio.c

@@ -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;

+ 2 - 2
plugins/obs-ffmpeg/obs-ffmpeg-audio-encoders.c

@@ -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;

+ 0 - 4
plugins/obs-ffmpeg/obs-ffmpeg-output.c

@@ -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");

+ 1 - 1
plugins/obs-outputs/flv-mux.c

@@ -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);

+ 1 - 1
plugins/win-dshow/ffmpeg-decode.c

@@ -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;

+ 1 - 1
plugins/win-dshow/win-dshow.cpp

@@ -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;

+ 1 - 1
plugins/win-wasapi/win-wasapi.cpp

@@ -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;