Don't use SPA_AUDIO_MAX_CHANNELS directly

Make a MAX_CHANNELS define and use that one in code. This makes it
easier to change the constant later.
This commit is contained in:
Wim Taymans 2025-10-20 15:33:17 +02:00
parent eb096bfb62
commit 13b8c23767
30 changed files with 136 additions and 108 deletions

View file

@ -163,10 +163,10 @@ static int alsa_set_param(struct state *state, const char *k, const char *s)
int fmt_change = 0;
if (spa_streq(k, SPA_KEY_AUDIO_CHANNELS)) {
state->default_channels = atoi(s);
if (state->default_channels > SPA_AUDIO_MAX_CHANNELS) {
if (state->default_channels > MAX_CHANNELS) {
spa_log_warn(state->log, "%p: %s: %s > %d, clamping",
state, k, s, SPA_AUDIO_MAX_CHANNELS);
state->default_channels = SPA_AUDIO_MAX_CHANNELS;
state, k, s, MAX_CHANNELS);
state->default_channels = MAX_CHANNELS;
}
fmt_change++;
} else if (spa_streq(k, SPA_KEY_AUDIO_RATE)) {
@ -1584,8 +1584,8 @@ static int add_channels(struct state *state, bool all, uint32_t index, uint32_t
spa_log_debug(state->log, "channels (%d %d) default:%d all:%d",
min, max, state->default_channels, all);
min = SPA_MIN(min, SPA_AUDIO_MAX_CHANNELS);
max = SPA_MIN(max, SPA_AUDIO_MAX_CHANNELS);
min = SPA_MIN(min, MAX_CHANNELS);
max = SPA_MIN(max, MAX_CHANNELS);
if (state->default_channels != 0 && !all) {
if (min > state->default_channels ||