summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_alsa.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-01-24 00:02:13 +0100
committerKevin Mitchell <kevmitch@gmail.com>2018-01-25 20:18:32 -0800
commitd36ff64b29031f402184e4946969810e7d9db0e0 (patch)
treee57f501ce20b384d2183af98f3220ddaa4e7d602 /audio/out/ao_alsa.c
parent3dd5621cecdd41c86117d70f93a24aede5e50bbc (diff)
downloadmpv-d36ff64b29031f402184e4946969810e7d9db0e0.tar.bz2
mpv-d36ff64b29031f402184e4946969810e7d9db0e0.tar.xz
audio: fix annyoing af_get_best_sample_formats() definition
The af_get_best_sample_formats() function had an argument of int[AF_FORMAT_COUNT], which is slightly incorrect, because it's 0 terminated and should in theory have AF_FORMAT_COUNT+1 entries. It won't actually write this many formats (since some formats are fundamentally incompatible), but it still feels annoying and incorrect. So fix it, and require that callers pass an AF_FORMAT_COUNT+1 array. Note that the array size has no meaning in C function arguments (just another issue with C static arrays being weird and stupid), so get rid of it completely. Not changing the af_lavcac3enc use, since that is rewritten in another branch anyway.
Diffstat (limited to 'audio/out/ao_alsa.c')
-rw-r--r--audio/out/ao_alsa.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/audio/out/ao_alsa.c b/audio/out/ao_alsa.c
index b86bf5d89e..7828abb9d4 100644
--- a/audio/out/ao_alsa.c
+++ b/audio/out/ao_alsa.c
@@ -704,7 +704,7 @@ static int init_device(struct ao *ao, int mode)
dump_hw_params(ao, MSGL_DEBUG, "HW params after access:\n", alsa_hwparams);
bool found_format = false;
- int try_formats[AF_FORMAT_COUNT];
+ int try_formats[AF_FORMAT_COUNT + 1];
af_get_best_sample_formats(ao->format, try_formats);
for (int n = 0; try_formats[n] && !found_format; n++) {
int mp_format = try_formats[n];