chmap: add more channel layouts up to 22.2

This commit is contained in:
Kacper Michajłow 2023-02-02 20:01:53 +01:00 committed by Dudemanguy
parent db59a1c1a7
commit 0728e4778f
4 changed files with 30 additions and 1 deletions

View File

@ -52,6 +52,11 @@ static const char *const speaker_names[MP_SPEAKER_ID_COUNT][2] = {
[MP_SPEAKER_ID_SDL] = {"sdl", "surround direct left"},
[MP_SPEAKER_ID_SDR] = {"sdr", "surround direct right"},
[MP_SPEAKER_ID_LFE2] = {"lfe2", "low frequency 2"},
[MP_SPEAKER_ID_TSL] = {"tsl", "top side left"},
[MP_SPEAKER_ID_TSR] = {"tsr", "top side right"},
[MP_SPEAKER_ID_BFC] = {"bfc", "bottom front center"},
[MP_SPEAKER_ID_BFL] = {"bfl", "bottom front left"},
[MP_SPEAKER_ID_BFR] = {"bfr", "bottom front right"},
[MP_SPEAKER_ID_NA] = {"na", "not available"},
};
@ -83,7 +88,7 @@ static const char *const std_layout_names[][2] = {
{"6.0(front)", "fl-fr-flc-frc-sl-sr"},
{"hexagonal", "fl-fr-fc-bl-br-bc"},
{"6.1", "fl-fr-fc-lfe-bc-sl-sr"},
{"6.1(back)", "fl-fr-fc-lfe-bl-br-bc"}, // lavc calls this "6.1" too
{"6.1(back)", "fl-fr-fc-lfe-bl-br-bc"},
{"6.1(top)", "fl-fr-fc-lfe-bl-br-tc"}, // not in lavc
{"6.1(front)", "fl-fr-lfe-flc-frc-sl-sr"},
{"7.0", "fl-fr-fc-bl-br-sl-sr"},
@ -93,8 +98,13 @@ static const char *const std_layout_names[][2] = {
{"7.1(alsa)", "fl-fr-bl-br-fc-lfe-sl-sr"}, // not in lavc
{"7.1(wide)", "fl-fr-fc-lfe-bl-br-flc-frc"},
{"7.1(wide-side)", "fl-fr-fc-lfe-flc-frc-sl-sr"},
{"7.1(top)", "fl-fr-fc-lfe-bl-br-tfl-tfr"},
{"7.1(rear)", "fl-fr-fc-lfe-bl-br-sdl-sdr"}, // not in lavc
{"octagonal", "fl-fr-fc-bl-br-bc-sl-sr"},
{"cube", "fl-fr-bl-br-tfl-tfr-tbl-tbr"},
{"hexadecagonal", "fl-fr-fc-bl-br-bc-sl-sr-tfc-tfl-tfr-tbl-tbc-tbr-wl-wr"},
{"downmix", "fl-fr"},
{"22.2", "fl-fr-fc-lfe-bl-br-flc-frc-bc-sl-sr-tc-tfl-tfc-tfr-tbl-tbc-tbr-lfe2-tsl-tsr-bfc-bfl-bfr"},
{"auto", ""}, // not in lavc
{0}
};

View File

@ -55,6 +55,11 @@ enum mp_speaker_id {
MP_SPEAKER_ID_SDL, // SURROUND_DIRECT_LEFT
MP_SPEAKER_ID_SDR, // SURROUND_DIRECT_RIGHT
MP_SPEAKER_ID_LFE2, // LOW_FREQUENCY_2
MP_SPEAKER_ID_TSL, // TOP_SIDE_LEFT
MP_SPEAKER_ID_TSR, // TOP_SIDE_RIGHT,
MP_SPEAKER_ID_BFC, // BOTTOM_FRONT_CENTER
MP_SPEAKER_ID_BFL, // BOTTOM_FRONT_LEFT
MP_SPEAKER_ID_BFR, // BOTTOM_FRONT_RIGHT
// Speaker IDs >= 64 are not representable in WAVEFORMATEXTENSIBLE or libav*.

View File

@ -15,6 +15,8 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
#include <Availability.h>
#include "common/common.h"
#include "ao_coreaudio_utils.h"
@ -47,6 +49,13 @@ static const int speaker_map[][2] = {
{ kAudioChannelLabel_LeftWide, MP_SPEAKER_ID_WL },
{ kAudioChannelLabel_RightWide, MP_SPEAKER_ID_WR },
{ kAudioChannelLabel_LFE2, MP_SPEAKER_ID_LFE2 },
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 130000
{ kAudioChannelLabel_LeftTopSurround, MP_SPEAKER_ID_TSL },
{ kAudioChannelLabel_RightTopSurround, MP_SPEAKER_ID_TSR },
{ kAudioChannelLabel_CenterBottom, MP_SPEAKER_ID_BFC },
{ kAudioChannelLabel_LeftBottom, MP_SPEAKER_ID_BFL },
{ kAudioChannelLabel_RightBottom, MP_SPEAKER_ID_BFR },
#endif
{ kAudioChannelLabel_HeadphonesLeft, MP_SPEAKER_ID_DL },
{ kAudioChannelLabel_HeadphonesRight, MP_SPEAKER_ID_DR },

View File

@ -133,6 +133,11 @@ static enum spa_audio_channel mp_speaker_id_to_spa(struct ao *ao, enum mp_speake
case MP_SPEAKER_ID_SDL: return SPA_AUDIO_CHANNEL_SL;
case MP_SPEAKER_ID_SDR: return SPA_AUDIO_CHANNEL_SL;
case MP_SPEAKER_ID_LFE2: return SPA_AUDIO_CHANNEL_LFE2;
case MP_SPEAKER_ID_TSL: return SPA_AUDIO_CHANNEL_TSL;
case MP_SPEAKER_ID_TSR: return SPA_AUDIO_CHANNEL_TSR;
case MP_SPEAKER_ID_BFC: return SPA_AUDIO_CHANNEL_BC;
case MP_SPEAKER_ID_BFL: return SPA_AUDIO_CHANNEL_BLC;
case MP_SPEAKER_ID_BFR: return SPA_AUDIO_CHANNEL_BRC;
case MP_SPEAKER_ID_NA: return SPA_AUDIO_CHANNEL_NA;
default:
MP_WARN(ao, "Unhandled channel %d\n", mp_speaker_id);