summaryrefslogtreecommitdiffstats
path: root/audio/chmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'audio/chmap.h')
-rw-r--r--audio/chmap.h28
1 files changed, 25 insertions, 3 deletions
diff --git a/audio/chmap.h b/audio/chmap.h
index dff69336d6..58a3f71907 100644
--- a/audio/chmap.h
+++ b/audio/chmap.h
@@ -22,7 +22,7 @@
#include <stdbool.h>
#include "misc/bstr.h"
-#define MP_NUM_CHANNELS 16
+#define MP_NUM_CHANNELS 64
// Speaker a channel can be assigned to.
// This corresponds to WAVEFORMATEXTENSIBLE channel mask bit indexes.
@@ -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*.
@@ -75,6 +80,8 @@ struct mp_chmap {
uint8_t speaker[MP_NUM_CHANNELS];
};
+typedef const char * const (mp_ch_layout_tuple)[2];
+
#define MP_SP(speaker) MP_SPEAKER_ID_ ## speaker
#define MP_CHMAP2(a, b) \
@@ -122,13 +129,28 @@ void mp_chmap_get_reorder(int src[MP_NUM_CHANNELS], const struct mp_chmap *from,
int mp_chmap_diffn(const struct mp_chmap *a, const struct mp_chmap *b);
char *mp_chmap_to_str_buf(char *buf, size_t buf_size, const struct mp_chmap *src);
-#define mp_chmap_to_str(m) mp_chmap_to_str_buf((char[64]){0}, 64, (m))
+#define mp_chmap_to_str_(m, sz) mp_chmap_to_str_buf((char[sz]){0}, sz, (m))
+#define mp_chmap_to_str(m) mp_chmap_to_str_(m, MP_NUM_CHANNELS * 4)
char *mp_chmap_to_str_hr_buf(char *buf, size_t buf_size, const struct mp_chmap *src);
-#define mp_chmap_to_str_hr(m) mp_chmap_to_str_hr_buf((char[128]){0}, 128, (m))
+#define mp_chmap_to_str_hr_(m, sz) mp_chmap_to_str_hr_buf((char[sz]){0}, sz, (m))
+#define mp_chmap_to_str_hr(m) mp_chmap_to_str_hr_(m, MP_NUM_CHANNELS * 4)
bool mp_chmap_from_str(struct mp_chmap *dst, bstr src);
+/**
+ * Iterate over all built-in channel layouts which have mapped channels.
+ *
+ * @param opaque a pointer where the iteration state is stored. Must point
+ * to nullptr to start the iteration.
+ *
+ * @return nullptr when the iteration is finished.
+ * Otherwise a pointer to an array of two char pointers.
+ * - [0] being the human-readable layout name.
+ * - [1] being the string representation of the layout.
+ */
+mp_ch_layout_tuple *mp_iterate_builtin_layouts(void **opaque);
+
struct mp_log;
void mp_chmap_print_help(struct mp_log *log);