summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKacper Michajłow <kasper93@gmail.com>2023-01-31 00:31:25 +0100
committerDudemanguy <random342@airmail.cc>2023-09-29 02:35:10 +0000
commitdb59a1c1a76f9a4c5390b47d715aabd7dfd2e83e (patch)
tree3c888af3b91b9d57996e9e54e83b37770cbca176
parentf9234d890aab3bf0f959b79ec2b7843b6c9610d8 (diff)
downloadmpv-db59a1c1a76f9a4c5390b47d715aabd7dfd2e83e.tar.bz2
mpv-db59a1c1a76f9a4c5390b47d715aabd7dfd2e83e.tar.xz
audio/chmap: link string buffer size to MP_NUM_CHANNELS
-rw-r--r--audio/chmap.h6
-rw-r--r--audio/out/ao_wasapi_utils.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/audio/chmap.h b/audio/chmap.h
index 6fbb60d025..35f569d9cc 100644
--- a/audio/chmap.h
+++ b/audio/chmap.h
@@ -124,10 +124,12 @@ 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);
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c
index 97a8e17b2f..d2261bfb6c 100644
--- a/audio/out/ao_wasapi_utils.c
+++ b/audio/out/ao_wasapi_utils.c
@@ -236,7 +236,8 @@ static char *waveformat_to_str_buf(char *buf, size_t buf_size, WAVEFORMATEX *wf)
(unsigned) wf->nSamplesPerSec);
return buf;
}
-#define waveformat_to_str(wf) waveformat_to_str_buf((char[64]){0}, 64, (wf))
+#define waveformat_to_str_(wf, sz) waveformat_to_str_buf((char[sz]){0}, sz, (wf))
+#define waveformat_to_str(wf) waveformat_to_str_(wf, MP_NUM_CHANNELS * 4 + 42)
static void waveformat_copy(WAVEFORMATEXTENSIBLE* dst, WAVEFORMATEX* src)
{