mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-07 04:34:07 -05:00
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:
parent
eb096bfb62
commit
13b8c23767
30 changed files with 136 additions and 108 deletions
|
|
@ -38,6 +38,7 @@
|
|||
extern struct spa_i18n *acp_i18n;
|
||||
|
||||
#define MAX_POLL 16
|
||||
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||
|
||||
#define DEFAULT_DEVICE "hw:0"
|
||||
#define DEFAULT_AUTO_PROFILE true
|
||||
|
|
@ -156,7 +157,7 @@ static int emit_node(struct impl *this, struct acp_device *dev)
|
|||
uint32_t n_items, i;
|
||||
char device_name[128], path[210], channels[16], ch[12], routes[16];
|
||||
char card_index[16], card_name[64], *p;
|
||||
char positions[SPA_AUDIO_MAX_CHANNELS * 12];
|
||||
char positions[MAX_CHANNELS * 12];
|
||||
char codecs[512];
|
||||
struct spa_device_object_info info;
|
||||
struct acp_card *card = this->card;
|
||||
|
|
@ -673,8 +674,8 @@ static int apply_device_props(struct impl *this, struct acp_device *dev, struct
|
|||
struct spa_pod_prop *prop;
|
||||
struct spa_pod_object *obj = (struct spa_pod_object *) props;
|
||||
int changed = 0;
|
||||
float volumes[SPA_AUDIO_MAX_CHANNELS];
|
||||
uint32_t channels[SPA_AUDIO_MAX_CHANNELS];
|
||||
float volumes[MAX_CHANNELS];
|
||||
uint32_t channels[MAX_CHANNELS];
|
||||
uint32_t n_volumes = 0;
|
||||
|
||||
if (!spa_pod_is_object_type(props, SPA_TYPE_OBJECT_Props))
|
||||
|
|
|
|||
|
|
@ -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 ||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
#define MAX_RATES 16
|
||||
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||
|
||||
#define DEFAULT_PERIOD 1024u
|
||||
#define DEFAULT_RATE 48000u
|
||||
|
|
@ -72,7 +73,7 @@ struct buffer {
|
|||
|
||||
struct channel_map {
|
||||
uint32_t channels;
|
||||
uint32_t pos[SPA_AUDIO_MAX_CHANNELS];
|
||||
uint32_t pos[MAX_CHANNELS];
|
||||
};
|
||||
|
||||
struct card {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue