summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
Diffstat (limited to 'audio')
-rw-r--r--audio/format.c5
-rw-r--r--audio/format.h2
-rw-r--r--audio/out/ao_alsa.c2
-rw-r--r--audio/out/ao_lavc.c2
-rw-r--r--audio/out/ao_openal.c2
-rw-r--r--audio/out/ao_opensles.c2
-rw-r--r--audio/out/ao_oss.c2
-rw-r--r--audio/out/ao_wasapi_utils.c2
8 files changed, 10 insertions, 9 deletions
diff --git a/audio/format.c b/audio/format.c
index 3df11ba301..b6d6761b65 100644
--- a/audio/format.c
+++ b/audio/format.c
@@ -209,10 +209,11 @@ static int cmp_entry(const void *a, const void *b)
// and the list is terminated with 0 (AF_FORMAT_UNKNOWN).
// Keep in mind that this also returns formats with flipped interleaving
// (e.g. for s16, it returns [s16, s16p, ...]).
-void af_get_best_sample_formats(int src_format, int out_formats[AF_FORMAT_COUNT])
+// out_formats must be an int[AF_FORMAT_COUNT + 1] array.
+void af_get_best_sample_formats(int src_format, int *out_formats)
{
int num = 0;
- struct entry e[AF_FORMAT_COUNT];
+ struct entry e[AF_FORMAT_COUNT + 1];
for (int fmt = 1; fmt < AF_FORMAT_COUNT; fmt++) {
int score = af_format_conversion_score(fmt, src_format);
if (score > INT_MIN)
diff --git a/audio/format.h b/audio/format.h
index 6d6485ff68..8c620226df 100644
--- a/audio/format.h
+++ b/audio/format.h
@@ -69,7 +69,7 @@ int af_fmt_seconds_to_bytes(int format, float seconds, int channels, int sampler
void af_fill_silence(void *dst, size_t bytes, int format);
-void af_get_best_sample_formats(int src_format, int out_formats[AF_FORMAT_COUNT]);
+void af_get_best_sample_formats(int src_format, int *out_formats);
int af_select_best_samplerate(int src_sampelrate, const int *available);
int af_format_sample_alignment(int format);
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];
diff --git a/audio/out/ao_lavc.c b/audio/out/ao_lavc.c
index f247cba12e..830fbf9b72 100644
--- a/audio/out/ao_lavc.c
+++ b/audio/out/ao_lavc.c
@@ -72,7 +72,7 @@ static bool supports_format(AVCodec *codec, int format)
static void select_format(struct ao *ao, AVCodec *codec)
{
- int formats[AF_FORMAT_COUNT];
+ int formats[AF_FORMAT_COUNT + 1];
af_get_best_sample_formats(ao->format, formats);
for (int n = 0; formats[n]; n++) {
diff --git a/audio/out/ao_openal.c b/audio/out/ao_openal.c
index 715ffddceb..6ae91162d3 100644
--- a/audio/out/ao_openal.c
+++ b/audio/out/ao_openal.c
@@ -197,7 +197,7 @@ static int init(struct ao *ao)
ao->samplerate = freq;
p->al_format = AL_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]; n++) {
p->al_format = get_al_format(try_formats[n]);
diff --git a/audio/out/ao_opensles.c b/audio/out/ao_opensles.c
index 5357ab4920..76bd91cb91 100644
--- a/audio/out/ao_opensles.c
+++ b/audio/out/ao_opensles.c
@@ -136,7 +136,7 @@ static int init(struct ao *ao)
pcm.formatType = SL_DATAFORMAT_PCM;
pcm.numChannels = 2;
- int compatible_formats[AF_FORMAT_COUNT];
+ int compatible_formats[AF_FORMAT_COUNT + 1];
af_get_best_sample_formats(ao->format, compatible_formats);
pcm.bitsPerSample = 0;
for (int i = 0; compatible_formats[i] && !pcm.bitsPerSample; ++i)
diff --git a/audio/out/ao_oss.c b/audio/out/ao_oss.c
index 1300a72043..f037812e70 100644
--- a/audio/out/ao_oss.c
+++ b/audio/out/ao_oss.c
@@ -315,7 +315,7 @@ static int reopen_device(struct ao *ao, bool allow_format_changes)
}
}
- int try_formats[AF_FORMAT_COUNT];
+ int try_formats[AF_FORMAT_COUNT + 1];
af_get_best_sample_formats(format, try_formats);
for (int n = 0; try_formats[n]; n++) {
format = try_formats[n];
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c
index 471cc847ac..55a16da812 100644
--- a/audio/out/ao_wasapi_utils.c
+++ b/audio/out/ao_wasapi_utils.c
@@ -97,7 +97,7 @@ static const struct wasapi_sample_fmt wasapi_formats[] = {
static void wasapi_get_best_sample_formats(
int src_format, struct wasapi_sample_fmt *out_formats)
{
- int mp_formats[AF_FORMAT_COUNT];
+ int mp_formats[AF_FORMAT_COUNT + 1];
af_get_best_sample_formats(src_format, mp_formats);
for (int n = 0; mp_formats[n]; n++) {
for (int i = 0; wasapi_formats[i].mp_format; i++) {