diff options
author | Jan Ekström <jeebjp@gmail.com> | 2022-06-12 23:26:22 +0300 |
---|---|---|
committer | Jan Ekström <jeebjp@gmail.com> | 2022-06-15 21:19:10 +0300 |
commit | 8123adadbd856e13a8870400fa5852eb3702e7a8 (patch) | |
tree | 542afcefeda11048f8894a6a0dd54e105ec4d5a8 /audio/chmap.c | |
parent | 0411acf5f632fd5814a9f62760df4d21fafc1b89 (diff) | |
download | mpv-8123adadbd856e13a8870400fa5852eb3702e7a8.tar.bz2 mpv-8123adadbd856e13a8870400fa5852eb3702e7a8.tar.xz |
audio/chmap: add mp_iterate_builtin_layouts
Mostly useful for unit tests in order to access the channel
layouts from chmap which have mapped channels.
Diffstat (limited to 'audio/chmap.c')
-rw-r--r-- | audio/chmap.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/audio/chmap.c b/audio/chmap.c index edbe83eb68..cd8c767c47 100644 --- a/audio/chmap.c +++ b/audio/chmap.c @@ -470,6 +470,23 @@ char *mp_chmap_to_str_hr_buf(char *buf, size_t buf_size, const struct mp_chmap * return mp_chmap_to_str_buf(buf, buf_size, &map); } +mp_ch_layout_tuple *mp_iterate_builtin_layouts(void **opaque) +{ + uintptr_t i = (uintptr_t)*opaque; + + if (i >= MP_ARRAY_SIZE(std_layout_names) || + !std_layout_names[i][0]) + return NULL; + + *opaque = (void *)(i + 1); + + if (std_layout_names[i][1][0] == '\0') { + return mp_iterate_builtin_layouts(opaque); + } + + return &std_layout_names[i]; +} + void mp_chmap_print_help(struct mp_log *log) { mp_info(log, "Speakers:\n"); |