summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-02-02 20:01:53 +0100
committerDudemanguy <random342@airmail.cc>2023-09-29 02:35:10 +0000
commit0728e4778f711c12a0c94add133befdbba1e4c86 (patch)
tree9d34607b46f1989976201d3dbc0a353239ad3f1f
parentdb59a1c1a76f9a4c5390b47d715aabd7dfd2e83e (diff)
downloadmpv-0728e4778f711c12a0c94add133befdbba1e4c86.tar.bz2
mpv-0728e4778f711c12a0c94add133befdbba1e4c86.tar.xz
chmap: add more channel layouts up to 22.2
-rw-r--r--audio/chmap.c12
-rw-r--r--audio/chmap.h5
-rw-r--r--audio/out/ao_coreaudio_chmap.c9
-rw-r--r--audio/out/ao_pipewire.c5
4 files changed, 30 insertions, 1 deletions
diff --git a/audio/chmap.c b/audio/chmap.c
index cd8c767c47..e2b95f4bd8 100644
--- a/audio/chmap.c
+++ b/audio/chmap.c
@@ -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}
};
diff --git a/audio/chmap.h b/audio/chmap.h
index 35f569d9cc..f2b53cac6d 100644
--- a/audio/chmap.h
+++ b/audio/chmap.h
@@ -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*.
diff --git a/audio/out/ao_coreaudio_chmap.c b/audio/out/ao_coreaudio_chmap.c
index 13ac87e2ba..3fd95503c9 100644
--- a/audio/out/ao_coreaudio_chmap.c
+++ b/audio/out/ao_coreaudio_chmap.c
@@ -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 },
diff --git a/audio/out/ao_pipewire.c b/audio/out/ao_pipewire.c
index 0b3f5fb483..c545a571c4 100644
--- a/audio/out/ao_pipewire.c
+++ b/audio/out/ao_pipewire.c
@@ -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);