mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04: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
|
|
@ -22,9 +22,11 @@ PW_LOG_TOPIC_STATIC(alsa_log_topic, "alsa.ctl");
|
||||||
#define VOLUME_MIN ((uint32_t) 0U)
|
#define VOLUME_MIN ((uint32_t) 0U)
|
||||||
#define VOLUME_MAX ((uint32_t) 0x10000U)
|
#define VOLUME_MAX ((uint32_t) 0x10000U)
|
||||||
|
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
|
|
||||||
struct volume {
|
struct volume {
|
||||||
uint32_t channels;
|
uint32_t channels;
|
||||||
long values[SPA_AUDIO_MAX_CHANNELS];
|
long values[MAX_CHANNELS];
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -498,7 +500,7 @@ static struct spa_pod *build_volume_mute(struct spa_pod_builder *b, struct volum
|
||||||
spa_pod_builder_push_object(b, &f[0],
|
spa_pod_builder_push_object(b, &f[0],
|
||||||
SPA_TYPE_OBJECT_Props, SPA_PARAM_Props);
|
SPA_TYPE_OBJECT_Props, SPA_PARAM_Props);
|
||||||
if (volume) {
|
if (volume) {
|
||||||
float volumes[SPA_AUDIO_MAX_CHANNELS];
|
float volumes[MAX_CHANNELS];
|
||||||
uint32_t i, n_volumes = 0;
|
uint32_t i, n_volumes = 0;
|
||||||
|
|
||||||
n_volumes = volume->channels;
|
n_volumes = volume->channels;
|
||||||
|
|
@ -850,7 +852,7 @@ static void parse_props(struct global *g, const struct spa_pod *param, bool devi
|
||||||
break;
|
break;
|
||||||
case SPA_PROP_channelVolumes:
|
case SPA_PROP_channelVolumes:
|
||||||
{
|
{
|
||||||
float volumes[SPA_AUDIO_MAX_CHANNELS];
|
float volumes[MAX_CHANNELS];
|
||||||
uint32_t n_volumes, i;
|
uint32_t n_volumes, i;
|
||||||
|
|
||||||
n_volumes = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
|
n_volumes = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ PW_LOG_TOPIC_STATIC(alsa_log_topic, "alsa.pcm");
|
||||||
#define MAX_BUFFERS 64u
|
#define MAX_BUFFERS 64u
|
||||||
|
|
||||||
#define MAX_RATE (48000*8)
|
#define MAX_RATE (48000*8)
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
|
|
||||||
#define MIN_PERIOD 64
|
#define MIN_PERIOD 64
|
||||||
|
|
||||||
|
|
@ -642,7 +643,7 @@ static int snd_pcm_pipewire_pause(snd_pcm_ioplug_t * io, int enable)
|
||||||
#define _FORMAT_BE(p, fmt) p ? SPA_AUDIO_FORMAT_UNKNOWN : SPA_AUDIO_FORMAT_ ## fmt ## _OE
|
#define _FORMAT_BE(p, fmt) p ? SPA_AUDIO_FORMAT_UNKNOWN : SPA_AUDIO_FORMAT_ ## fmt ## _OE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int set_default_channels(uint32_t channels, uint32_t position[SPA_AUDIO_MAX_CHANNELS])
|
static int set_default_channels(uint32_t channels, uint32_t position[MAX_CHANNELS])
|
||||||
{
|
{
|
||||||
switch (channels) {
|
switch (channels) {
|
||||||
case 8:
|
case 8:
|
||||||
|
|
@ -1097,7 +1098,7 @@ struct param_info infos[] = {
|
||||||
{ "alsa.rate", SND_PCM_IOPLUG_HW_RATE, TYPE_MIN_MAX,
|
{ "alsa.rate", SND_PCM_IOPLUG_HW_RATE, TYPE_MIN_MAX,
|
||||||
{ 1, MAX_RATE }, 2, collect_int },
|
{ 1, MAX_RATE }, 2, collect_int },
|
||||||
{ "alsa.channels", SND_PCM_IOPLUG_HW_CHANNELS, TYPE_MIN_MAX,
|
{ "alsa.channels", SND_PCM_IOPLUG_HW_CHANNELS, TYPE_MIN_MAX,
|
||||||
{ 1, SPA_AUDIO_MAX_CHANNELS }, 2, collect_int },
|
{ 1, MAX_CHANNELS }, 2, collect_int },
|
||||||
{ "alsa.buffer-bytes", SND_PCM_IOPLUG_HW_BUFFER_BYTES, TYPE_MIN_MAX,
|
{ "alsa.buffer-bytes", SND_PCM_IOPLUG_HW_BUFFER_BYTES, TYPE_MIN_MAX,
|
||||||
{ MIN_BUFFER_BYTES, MAX_BUFFER_BYTES }, 2, collect_int },
|
{ MIN_BUFFER_BYTES, MAX_BUFFER_BYTES }, 2, collect_int },
|
||||||
{ "alsa.period-bytes", SND_PCM_IOPLUG_HW_PERIOD_BYTES, TYPE_MIN_MAX,
|
{ "alsa.period-bytes", SND_PCM_IOPLUG_HW_PERIOD_BYTES, TYPE_MIN_MAX,
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
extern struct spa_i18n *acp_i18n;
|
extern struct spa_i18n *acp_i18n;
|
||||||
|
|
||||||
#define MAX_POLL 16
|
#define MAX_POLL 16
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
|
|
||||||
#define DEFAULT_DEVICE "hw:0"
|
#define DEFAULT_DEVICE "hw:0"
|
||||||
#define DEFAULT_AUTO_PROFILE true
|
#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;
|
uint32_t n_items, i;
|
||||||
char device_name[128], path[210], channels[16], ch[12], routes[16];
|
char device_name[128], path[210], channels[16], ch[12], routes[16];
|
||||||
char card_index[16], card_name[64], *p;
|
char card_index[16], card_name[64], *p;
|
||||||
char positions[SPA_AUDIO_MAX_CHANNELS * 12];
|
char positions[MAX_CHANNELS * 12];
|
||||||
char codecs[512];
|
char codecs[512];
|
||||||
struct spa_device_object_info info;
|
struct spa_device_object_info info;
|
||||||
struct acp_card *card = this->card;
|
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_prop *prop;
|
||||||
struct spa_pod_object *obj = (struct spa_pod_object *) props;
|
struct spa_pod_object *obj = (struct spa_pod_object *) props;
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
float volumes[SPA_AUDIO_MAX_CHANNELS];
|
float volumes[MAX_CHANNELS];
|
||||||
uint32_t channels[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t channels[MAX_CHANNELS];
|
||||||
uint32_t n_volumes = 0;
|
uint32_t n_volumes = 0;
|
||||||
|
|
||||||
if (!spa_pod_is_object_type(props, SPA_TYPE_OBJECT_Props))
|
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;
|
int fmt_change = 0;
|
||||||
if (spa_streq(k, SPA_KEY_AUDIO_CHANNELS)) {
|
if (spa_streq(k, SPA_KEY_AUDIO_CHANNELS)) {
|
||||||
state->default_channels = atoi(s);
|
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",
|
spa_log_warn(state->log, "%p: %s: %s > %d, clamping",
|
||||||
state, k, s, SPA_AUDIO_MAX_CHANNELS);
|
state, k, s, MAX_CHANNELS);
|
||||||
state->default_channels = SPA_AUDIO_MAX_CHANNELS;
|
state->default_channels = MAX_CHANNELS;
|
||||||
}
|
}
|
||||||
fmt_change++;
|
fmt_change++;
|
||||||
} else if (spa_streq(k, SPA_KEY_AUDIO_RATE)) {
|
} 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",
|
spa_log_debug(state->log, "channels (%d %d) default:%d all:%d",
|
||||||
min, max, state->default_channels, all);
|
min, max, state->default_channels, all);
|
||||||
|
|
||||||
min = SPA_MIN(min, SPA_AUDIO_MAX_CHANNELS);
|
min = SPA_MIN(min, MAX_CHANNELS);
|
||||||
max = SPA_MIN(max, SPA_AUDIO_MAX_CHANNELS);
|
max = SPA_MIN(max, MAX_CHANNELS);
|
||||||
|
|
||||||
if (state->default_channels != 0 && !all) {
|
if (state->default_channels != 0 && !all) {
|
||||||
if (min > state->default_channels ||
|
if (min > state->default_channels ||
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_RATES 16
|
#define MAX_RATES 16
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
|
|
||||||
#define DEFAULT_PERIOD 1024u
|
#define DEFAULT_PERIOD 1024u
|
||||||
#define DEFAULT_RATE 48000u
|
#define DEFAULT_RATE 48000u
|
||||||
|
|
@ -72,7 +73,7 @@ struct buffer {
|
||||||
|
|
||||||
struct channel_map {
|
struct channel_map {
|
||||||
uint32_t channels;
|
uint32_t channels;
|
||||||
uint32_t pos[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t pos[MAX_CHANNELS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct card {
|
struct card {
|
||||||
|
|
|
||||||
|
|
@ -47,10 +47,11 @@ SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.audioconvert");
|
||||||
#define DEFAULT_RATE 48000
|
#define DEFAULT_RATE 48000
|
||||||
#define DEFAULT_CHANNELS 2
|
#define DEFAULT_CHANNELS 2
|
||||||
|
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
#define MAX_ALIGN FMT_OPS_MAX_ALIGN
|
#define MAX_ALIGN FMT_OPS_MAX_ALIGN
|
||||||
#define MAX_BUFFERS 32
|
#define MAX_BUFFERS 32
|
||||||
#define MAX_DATAS SPA_AUDIO_MAX_CHANNELS
|
#define MAX_DATAS MAX_CHANNELS
|
||||||
#define MAX_PORTS (SPA_AUDIO_MAX_CHANNELS+1)
|
#define MAX_PORTS (MAX_CHANNELS+1)
|
||||||
#define MAX_STAGES 64
|
#define MAX_STAGES 64
|
||||||
#define MAX_GRAPH 9 /* 8 active + 1 replacement slot */
|
#define MAX_GRAPH 9 /* 8 active + 1 replacement slot */
|
||||||
|
|
||||||
|
|
@ -62,7 +63,7 @@ SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.audioconvert");
|
||||||
struct volumes {
|
struct volumes {
|
||||||
bool mute;
|
bool mute;
|
||||||
uint32_t n_volumes;
|
uint32_t n_volumes;
|
||||||
float volumes[SPA_AUDIO_MAX_CHANNELS];
|
float volumes[MAX_CHANNELS];
|
||||||
};
|
};
|
||||||
|
|
||||||
static void init_volumes(struct volumes *vol)
|
static void init_volumes(struct volumes *vol)
|
||||||
|
|
@ -70,7 +71,7 @@ static void init_volumes(struct volumes *vol)
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
vol->mute = DEFAULT_MUTE;
|
vol->mute = DEFAULT_MUTE;
|
||||||
vol->n_volumes = 0;
|
vol->n_volumes = 0;
|
||||||
for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++)
|
for (i = 0; i < MAX_CHANNELS; i++)
|
||||||
vol->volumes[i] = DEFAULT_VOLUME;
|
vol->volumes[i] = DEFAULT_VOLUME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,7 +92,7 @@ struct props {
|
||||||
float max_volume;
|
float max_volume;
|
||||||
float prev_volume;
|
float prev_volume;
|
||||||
uint32_t n_channels;
|
uint32_t n_channels;
|
||||||
uint32_t channel_map[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t channel_map[MAX_CHANNELS];
|
||||||
struct volumes channel;
|
struct volumes channel;
|
||||||
struct volumes soft;
|
struct volumes soft;
|
||||||
struct volumes monitor;
|
struct volumes monitor;
|
||||||
|
|
@ -112,7 +113,7 @@ static void props_reset(struct props *props)
|
||||||
props->min_volume = DEFAULT_MIN_VOLUME;
|
props->min_volume = DEFAULT_MIN_VOLUME;
|
||||||
props->max_volume = DEFAULT_MAX_VOLUME;
|
props->max_volume = DEFAULT_MAX_VOLUME;
|
||||||
props->n_channels = 0;
|
props->n_channels = 0;
|
||||||
for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++)
|
for (i = 0; i < MAX_CHANNELS; i++)
|
||||||
props->channel_map[i] = SPA_AUDIO_CHANNEL_UNKNOWN;
|
props->channel_map[i] = SPA_AUDIO_CHANNEL_UNKNOWN;
|
||||||
init_volumes(&props->channel);
|
init_volumes(&props->channel);
|
||||||
init_volumes(&props->soft);
|
init_volumes(&props->soft);
|
||||||
|
|
@ -241,9 +242,9 @@ struct filter_graph {
|
||||||
struct spa_filter_graph *graph;
|
struct spa_filter_graph *graph;
|
||||||
struct spa_hook listener;
|
struct spa_hook listener;
|
||||||
uint32_t n_inputs;
|
uint32_t n_inputs;
|
||||||
uint32_t inputs_position[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t inputs_position[MAX_CHANNELS];
|
||||||
uint32_t n_outputs;
|
uint32_t n_outputs;
|
||||||
uint32_t outputs_position[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t outputs_position[MAX_CHANNELS];
|
||||||
uint32_t latency;
|
uint32_t latency;
|
||||||
bool removing;
|
bool removing;
|
||||||
bool setup;
|
bool setup;
|
||||||
|
|
@ -1966,7 +1967,7 @@ static int node_set_param_port_config(struct impl *this, uint32_t flags,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (info.info.raw.channels == 0 ||
|
if (info.info.raw.channels == 0 ||
|
||||||
info.info.raw.channels > SPA_AUDIO_MAX_CHANNELS)
|
info.info.raw.channels > MAX_CHANNELS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
infop = &info;
|
infop = &info;
|
||||||
|
|
@ -2153,7 +2154,7 @@ static void set_volume(struct impl *this)
|
||||||
{
|
{
|
||||||
struct volumes *vol;
|
struct volumes *vol;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
float volumes[SPA_AUDIO_MAX_CHANNELS];
|
float volumes[MAX_CHANNELS];
|
||||||
struct dir *dir = &this->dir[this->direction];
|
struct dir *dir = &this->dir[this->direction];
|
||||||
|
|
||||||
spa_log_debug(this->log, "%p set volume %f have_format:%d", this, this->props.volume, dir->have_format);
|
spa_log_debug(this->log, "%p set volume %f have_format:%d", this, this->props.volume, dir->have_format);
|
||||||
|
|
@ -2671,7 +2672,7 @@ static int port_param_enum_formats(struct impl *impl, struct port *port, uint32_
|
||||||
}
|
}
|
||||||
spa_pod_builder_add(b,
|
spa_pod_builder_add(b,
|
||||||
SPA_FORMAT_AUDIO_channels, SPA_POD_CHOICE_RANGE_Int(
|
SPA_FORMAT_AUDIO_channels, SPA_POD_CHOICE_RANGE_Int(
|
||||||
DEFAULT_CHANNELS, 1, SPA_AUDIO_MAX_CHANNELS),
|
DEFAULT_CHANNELS, 1, MAX_CHANNELS),
|
||||||
0);
|
0);
|
||||||
*param = spa_pod_builder_pop(b, &f[0]);
|
*param = spa_pod_builder_pop(b, &f[0]);
|
||||||
}
|
}
|
||||||
|
|
@ -3064,7 +3065,7 @@ static int port_set_format(void *object,
|
||||||
if (info.info.raw.format == 0 ||
|
if (info.info.raw.format == 0 ||
|
||||||
(!this->props.resample_disabled && info.info.raw.rate == 0) ||
|
(!this->props.resample_disabled && info.info.raw.rate == 0) ||
|
||||||
info.info.raw.channels == 0 ||
|
info.info.raw.channels == 0 ||
|
||||||
info.info.raw.channels > SPA_AUDIO_MAX_CHANNELS) {
|
info.info.raw.channels > MAX_CHANNELS) {
|
||||||
spa_log_error(this->log, "invalid format:%d rate:%d channels:%d",
|
spa_log_error(this->log, "invalid format:%d rate:%d channels:%d",
|
||||||
info.info.raw.format, info.info.raw.rate,
|
info.info.raw.format, info.info.raw.rate,
|
||||||
info.info.raw.channels);
|
info.info.raw.channels);
|
||||||
|
|
|
||||||
|
|
@ -142,29 +142,29 @@ static uint32_t mask_to_ch(struct channelmix *mix, uint64_t mask)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void distribute_mix(struct channelmix *mix,
|
static void distribute_mix(struct channelmix *mix,
|
||||||
float matrix[SPA_AUDIO_MAX_CHANNELS][SPA_AUDIO_MAX_CHANNELS],
|
float matrix[MAX_CHANNELS][MAX_CHANNELS],
|
||||||
uint64_t mask)
|
uint64_t mask)
|
||||||
{
|
{
|
||||||
uint32_t i, ch = mask_to_ch(mix, mask);
|
uint32_t i, ch = mask_to_ch(mix, mask);
|
||||||
for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++)
|
for (i = 0; i < MAX_CHANNELS; i++)
|
||||||
matrix[i][ch]= 1.0f;
|
matrix[i][ch]= 1.0f;
|
||||||
}
|
}
|
||||||
static void average_mix(struct channelmix *mix,
|
static void average_mix(struct channelmix *mix,
|
||||||
float matrix[SPA_AUDIO_MAX_CHANNELS][SPA_AUDIO_MAX_CHANNELS],
|
float matrix[MAX_CHANNELS][MAX_CHANNELS],
|
||||||
uint64_t mask)
|
uint64_t mask)
|
||||||
{
|
{
|
||||||
uint32_t i, ch = mask_to_ch(mix, mask);
|
uint32_t i, ch = mask_to_ch(mix, mask);
|
||||||
for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++)
|
for (i = 0; i < MAX_CHANNELS; i++)
|
||||||
matrix[ch][i]= 1.0f;
|
matrix[ch][i]= 1.0f;
|
||||||
}
|
}
|
||||||
static void pair_mix(float matrix[SPA_AUDIO_MAX_CHANNELS][SPA_AUDIO_MAX_CHANNELS])
|
static void pair_mix(float matrix[MAX_CHANNELS][MAX_CHANNELS])
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++)
|
for (i = 0; i < MAX_CHANNELS; i++)
|
||||||
matrix[i][i]= 1.0f;
|
matrix[i][i]= 1.0f;
|
||||||
}
|
}
|
||||||
static bool match_mix(struct channelmix *mix,
|
static bool match_mix(struct channelmix *mix,
|
||||||
float matrix[SPA_AUDIO_MAX_CHANNELS][SPA_AUDIO_MAX_CHANNELS],
|
float matrix[MAX_CHANNELS][MAX_CHANNELS],
|
||||||
uint64_t src_mask, uint64_t dst_mask)
|
uint64_t src_mask, uint64_t dst_mask)
|
||||||
{
|
{
|
||||||
bool matched = false;
|
bool matched = false;
|
||||||
|
|
@ -181,7 +181,7 @@ static bool match_mix(struct channelmix *mix,
|
||||||
|
|
||||||
static int make_matrix(struct channelmix *mix)
|
static int make_matrix(struct channelmix *mix)
|
||||||
{
|
{
|
||||||
float matrix[SPA_AUDIO_MAX_CHANNELS][SPA_AUDIO_MAX_CHANNELS] = {{ 0.0f }};
|
float matrix[MAX_CHANNELS][MAX_CHANNELS] = {{ 0.0f }};
|
||||||
uint64_t src_mask = mix->src_mask, src_paired;
|
uint64_t src_mask = mix->src_mask, src_paired;
|
||||||
uint64_t dst_mask = mix->dst_mask, dst_paired;
|
uint64_t dst_mask = mix->dst_mask, dst_paired;
|
||||||
uint32_t src_chan = mix->src_chan;
|
uint32_t src_chan = mix->src_chan;
|
||||||
|
|
@ -293,7 +293,7 @@ static int make_matrix(struct channelmix *mix)
|
||||||
keep &= ~STEREO;
|
keep &= ~STEREO;
|
||||||
} else if (dst_mask & _MASK(MONO)){
|
} else if (dst_mask & _MASK(MONO)){
|
||||||
spa_log_info(mix->log, "assign FC to MONO (%f)", 1.0f);
|
spa_log_info(mix->log, "assign FC to MONO (%f)", 1.0f);
|
||||||
for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++)
|
for (i = 0; i < MAX_CHANNELS; i++)
|
||||||
matrix[i][_CH(FC)]= 1.0f;
|
matrix[i][_CH(FC)]= 1.0f;
|
||||||
normalize = true;
|
normalize = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -313,7 +313,7 @@ static int make_matrix(struct channelmix *mix)
|
||||||
keep &= ~FRONT;
|
keep &= ~FRONT;
|
||||||
} else if ((dst_mask & _MASK(MONO))){
|
} else if ((dst_mask & _MASK(MONO))){
|
||||||
spa_log_info(mix->log, "assign STEREO to MONO (%f)", 1.0f);
|
spa_log_info(mix->log, "assign STEREO to MONO (%f)", 1.0f);
|
||||||
for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++) {
|
for (i = 0; i < MAX_CHANNELS; i++) {
|
||||||
matrix[i][_CH(FL)]= 1.0f;
|
matrix[i][_CH(FL)]= 1.0f;
|
||||||
matrix[i][_CH(FR)]= 1.0f;
|
matrix[i][_CH(FR)]= 1.0f;
|
||||||
}
|
}
|
||||||
|
|
@ -352,7 +352,7 @@ static int make_matrix(struct channelmix *mix)
|
||||||
_MATRIX(FC,RC) += slev * SQRT1_2;
|
_MATRIX(FC,RC) += slev * SQRT1_2;
|
||||||
} else if (dst_mask & _MASK(MONO)){
|
} else if (dst_mask & _MASK(MONO)){
|
||||||
spa_log_info(mix->log, "assign RC to MONO (%f)", 1.0f);
|
spa_log_info(mix->log, "assign RC to MONO (%f)", 1.0f);
|
||||||
for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++)
|
for (i = 0; i < MAX_CHANNELS; i++)
|
||||||
matrix[i][_CH(RC)]= 1.0f;
|
matrix[i][_CH(RC)]= 1.0f;
|
||||||
normalize = true;
|
normalize = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -398,7 +398,7 @@ static int make_matrix(struct channelmix *mix)
|
||||||
_MATRIX(FC,RR)+= slev * SQRT1_2;
|
_MATRIX(FC,RR)+= slev * SQRT1_2;
|
||||||
} else if (dst_mask & _MASK(MONO)){
|
} else if (dst_mask & _MASK(MONO)){
|
||||||
spa_log_info(mix->log, "assign RL+RR to MONO (%f)", 1.0f);
|
spa_log_info(mix->log, "assign RL+RR to MONO (%f)", 1.0f);
|
||||||
for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++) {
|
for (i = 0; i < MAX_CHANNELS; i++) {
|
||||||
matrix[i][_CH(RL)]= 1.0f;
|
matrix[i][_CH(RL)]= 1.0f;
|
||||||
matrix[i][_CH(RR)]= 1.0f;
|
matrix[i][_CH(RR)]= 1.0f;
|
||||||
}
|
}
|
||||||
|
|
@ -450,7 +450,7 @@ static int make_matrix(struct channelmix *mix)
|
||||||
_MATRIX(FC,SR) += slev * SQRT1_2;
|
_MATRIX(FC,SR) += slev * SQRT1_2;
|
||||||
} else if (dst_mask & _MASK(MONO)){
|
} else if (dst_mask & _MASK(MONO)){
|
||||||
spa_log_info(mix->log, "assign SL+SR to MONO (%f)", 1.0f);
|
spa_log_info(mix->log, "assign SL+SR to MONO (%f)", 1.0f);
|
||||||
for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++) {
|
for (i = 0; i < MAX_CHANNELS; i++) {
|
||||||
matrix[i][_CH(SL)]= 1.0f;
|
matrix[i][_CH(SL)]= 1.0f;
|
||||||
matrix[i][_CH(SR)]= 1.0f;
|
matrix[i][_CH(SR)]= 1.0f;
|
||||||
}
|
}
|
||||||
|
|
@ -471,7 +471,7 @@ static int make_matrix(struct channelmix *mix)
|
||||||
_MATRIX(FC,FRC)+= SQRT1_2;
|
_MATRIX(FC,FRC)+= SQRT1_2;
|
||||||
} else if (dst_mask & _MASK(MONO)){
|
} else if (dst_mask & _MASK(MONO)){
|
||||||
spa_log_info(mix->log, "assign FLC+FRC to MONO (%f)", 1.0f);
|
spa_log_info(mix->log, "assign FLC+FRC to MONO (%f)", 1.0f);
|
||||||
for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++) {
|
for (i = 0; i < MAX_CHANNELS; i++) {
|
||||||
matrix[i][_CH(FLC)]= 1.0f;
|
matrix[i][_CH(FLC)]= 1.0f;
|
||||||
matrix[i][_CH(FRC)]= 1.0f;
|
matrix[i][_CH(FRC)]= 1.0f;
|
||||||
}
|
}
|
||||||
|
|
@ -492,7 +492,7 @@ static int make_matrix(struct channelmix *mix)
|
||||||
_MATRIX(FR,LFE) += llev * SQRT1_2;
|
_MATRIX(FR,LFE) += llev * SQRT1_2;
|
||||||
} else if ((dst_mask & _MASK(MONO))){
|
} else if ((dst_mask & _MASK(MONO))){
|
||||||
spa_log_info(mix->log, "assign LFE to MONO (%f)", 1.0f);
|
spa_log_info(mix->log, "assign LFE to MONO (%f)", 1.0f);
|
||||||
for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++)
|
for (i = 0; i < MAX_CHANNELS; i++)
|
||||||
matrix[i][_CH(LFE)]= 1.0f;
|
matrix[i][_CH(LFE)]= 1.0f;
|
||||||
normalize = true;
|
normalize = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -690,7 +690,7 @@ done:
|
||||||
static void impl_channelmix_set_volume(struct channelmix *mix, float volume, bool mute,
|
static void impl_channelmix_set_volume(struct channelmix *mix, float volume, bool mute,
|
||||||
uint32_t n_channel_volumes, float *channel_volumes)
|
uint32_t n_channel_volumes, float *channel_volumes)
|
||||||
{
|
{
|
||||||
float volumes[SPA_AUDIO_MAX_CHANNELS];
|
float volumes[MAX_CHANNELS];
|
||||||
float vol = mute ? 0.0f : volume, t;
|
float vol = mute ? 0.0f : volume, t;
|
||||||
uint32_t i, j;
|
uint32_t i, j;
|
||||||
uint32_t src_chan = mix->src_chan;
|
uint32_t src_chan = mix->src_chan;
|
||||||
|
|
@ -760,8 +760,8 @@ int channelmix_init(struct channelmix *mix)
|
||||||
{
|
{
|
||||||
const struct channelmix_info *info;
|
const struct channelmix_info *info;
|
||||||
|
|
||||||
if (mix->src_chan > SPA_AUDIO_MAX_CHANNELS ||
|
if (mix->src_chan > MAX_CHANNELS ||
|
||||||
mix->dst_chan > SPA_AUDIO_MAX_CHANNELS)
|
mix->dst_chan > MAX_CHANNELS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
info = find_channelmix_info(mix->src_chan, mix->src_mask, mix->dst_chan, mix->dst_mask,
|
info = find_channelmix_info(mix->src_chan, mix->src_mask, mix->dst_chan, mix->dst_mask,
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#define BUFFER_SIZE 4096
|
#define BUFFER_SIZE 4096
|
||||||
#define MAX_TAPS 255u
|
#define MAX_TAPS 255u
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
|
|
||||||
#define CHANNELMIX_OPS_MAX_ALIGN 16
|
#define CHANNELMIX_OPS_MAX_ALIGN 16
|
||||||
|
|
||||||
|
|
@ -50,8 +51,8 @@ struct channelmix {
|
||||||
#define CHANNELMIX_FLAG_EQUAL (1<<2) /**< all values are equal */
|
#define CHANNELMIX_FLAG_EQUAL (1<<2) /**< all values are equal */
|
||||||
#define CHANNELMIX_FLAG_COPY (1<<3) /**< 1 on diagonal, can be nxm */
|
#define CHANNELMIX_FLAG_COPY (1<<3) /**< 1 on diagonal, can be nxm */
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
float matrix_orig[SPA_AUDIO_MAX_CHANNELS][SPA_AUDIO_MAX_CHANNELS];
|
float matrix_orig[MAX_CHANNELS][MAX_CHANNELS];
|
||||||
float matrix[SPA_AUDIO_MAX_CHANNELS][SPA_AUDIO_MAX_CHANNELS];
|
float matrix[MAX_CHANNELS][MAX_CHANNELS];
|
||||||
|
|
||||||
float freq; /* sample frequency */
|
float freq; /* sample frequency */
|
||||||
float lfe_cutoff; /* in Hz, 0 is disabled */
|
float lfe_cutoff; /* in Hz, 0 is disabled */
|
||||||
|
|
@ -59,7 +60,7 @@ struct channelmix {
|
||||||
float rear_delay; /* in ms, 0 is disabled */
|
float rear_delay; /* in ms, 0 is disabled */
|
||||||
float widen; /* stereo widen. 0 is disabled */
|
float widen; /* stereo widen. 0 is disabled */
|
||||||
uint32_t hilbert_taps; /* to phase shift, 0 disabled */
|
uint32_t hilbert_taps; /* to phase shift, 0 disabled */
|
||||||
struct lr4 lr4[SPA_AUDIO_MAX_CHANNELS];
|
struct lr4 lr4[MAX_CHANNELS];
|
||||||
|
|
||||||
float buffer_mem[2 * BUFFER_SIZE*2 + CHANNELMIX_OPS_MAX_ALIGN/4];
|
float buffer_mem[2 * BUFFER_SIZE*2 + CHANNELMIX_OPS_MAX_ALIGN/4];
|
||||||
float *buffer[2];
|
float *buffer[2];
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@ SPA_LOG_IMPL(logger);
|
||||||
|
|
||||||
extern const struct spa_handle_factory test_source_factory;
|
extern const struct spa_handle_factory test_source_factory;
|
||||||
|
|
||||||
#define MAX_PORTS (SPA_AUDIO_MAX_CHANNELS+1)
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
|
#define MAX_PORTS (MAX_CHANNELS+1)
|
||||||
|
|
||||||
struct context {
|
struct context {
|
||||||
struct spa_handle *convert_handle;
|
struct spa_handle *convert_handle;
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ static inline char *format_streamid(char *str, size_t size, const uint64_t strea
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
#define MAX_BUFFERS 32
|
#define MAX_BUFFERS 32
|
||||||
|
|
||||||
struct buffer {
|
struct buffer {
|
||||||
|
|
@ -127,7 +128,7 @@ struct buffer {
|
||||||
|
|
||||||
struct channel_map {
|
struct channel_map {
|
||||||
uint32_t channels;
|
uint32_t channels;
|
||||||
uint32_t pos[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t pos[MAX_CHANNELS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct port {
|
struct port {
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,8 @@ static struct spa_log *log;
|
||||||
|
|
||||||
#define BITRATE_DUPLEX_BIDI 160000
|
#define BITRATE_DUPLEX_BIDI 160000
|
||||||
|
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
|
|
||||||
#define OPUS_05_MAX_BYTES (15 * 1024)
|
#define OPUS_05_MAX_BYTES (15 * 1024)
|
||||||
|
|
||||||
struct props {
|
struct props {
|
||||||
|
|
@ -313,14 +315,14 @@ static void parse_settings(struct props *props, const struct spa_dict *settings)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (spa_atou32(spa_dict_lookup(settings, "bluez5.a2dp.opus.pro.channels"), &v, 0))
|
if (spa_atou32(spa_dict_lookup(settings, "bluez5.a2dp.opus.pro.channels"), &v, 0))
|
||||||
props->channels = SPA_CLAMP(v, 1u, SPA_AUDIO_MAX_CHANNELS);
|
props->channels = SPA_CLAMP(v, 1u, MAX_CHANNELS);
|
||||||
if (spa_atou32(spa_dict_lookup(settings, "bluez5.a2dp.opus.pro.max-bitrate"), &v, 0))
|
if (spa_atou32(spa_dict_lookup(settings, "bluez5.a2dp.opus.pro.max-bitrate"), &v, 0))
|
||||||
props->max_bitrate = SPA_MAX(v, (uint32_t)BITRATE_MIN);
|
props->max_bitrate = SPA_MAX(v, (uint32_t)BITRATE_MIN);
|
||||||
if (spa_atou32(spa_dict_lookup(settings, "bluez5.a2dp.opus.pro.coupled-streams"), &v, 0))
|
if (spa_atou32(spa_dict_lookup(settings, "bluez5.a2dp.opus.pro.coupled-streams"), &v, 0))
|
||||||
props->coupled_streams = SPA_CLAMP(v, 0u, props->channels / 2);
|
props->coupled_streams = SPA_CLAMP(v, 0u, props->channels / 2);
|
||||||
|
|
||||||
if (spa_atou32(spa_dict_lookup(settings, "bluez5.a2dp.opus.pro.bidi.channels"), &v, 0))
|
if (spa_atou32(spa_dict_lookup(settings, "bluez5.a2dp.opus.pro.bidi.channels"), &v, 0))
|
||||||
props->bidi_channels = SPA_CLAMP(v, 0u, SPA_AUDIO_MAX_CHANNELS);
|
props->bidi_channels = SPA_CLAMP(v, 0u, MAX_CHANNELS);
|
||||||
if (spa_atou32(spa_dict_lookup(settings, "bluez5.a2dp.opus.pro.bidi.max-bitrate"), &v, 0))
|
if (spa_atou32(spa_dict_lookup(settings, "bluez5.a2dp.opus.pro.bidi.max-bitrate"), &v, 0))
|
||||||
props->bidi_max_bitrate = SPA_MAX(v, (uint32_t)BITRATE_MIN);
|
props->bidi_max_bitrate = SPA_MAX(v, (uint32_t)BITRATE_MIN);
|
||||||
if (spa_atou32(spa_dict_lookup(settings, "bluez5.a2dp.opus.pro.bidi.coupled-streams"), &v, 0))
|
if (spa_atou32(spa_dict_lookup(settings, "bluez5.a2dp.opus.pro.bidi.coupled-streams"), &v, 0))
|
||||||
|
|
@ -503,7 +505,7 @@ static int get_mapping(const struct media_codec *codec, const a2dp_opus_05_direc
|
||||||
const uint8_t *permutation = NULL;
|
const uint8_t *permutation = NULL;
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
|
|
||||||
if (channels > SPA_AUDIO_MAX_CHANNELS)
|
if (channels > MAX_CHANNELS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
if (2 * coupled_streams > channels)
|
if (2 * coupled_streams > channels)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
@ -561,7 +563,7 @@ static int codec_fill_caps(const struct media_codec *codec, uint32_t flags,
|
||||||
a2dp_opus_05_t a2dp_opus_05 = {
|
a2dp_opus_05_t a2dp_opus_05 = {
|
||||||
.info = codec->vendor,
|
.info = codec->vendor,
|
||||||
.main = {
|
.main = {
|
||||||
.channels = SPA_MIN(255u, SPA_AUDIO_MAX_CHANNELS),
|
.channels = SPA_MIN(255u, MAX_CHANNELS),
|
||||||
.frame_duration = (OPUS_05_FRAME_DURATION_25 |
|
.frame_duration = (OPUS_05_FRAME_DURATION_25 |
|
||||||
OPUS_05_FRAME_DURATION_50 |
|
OPUS_05_FRAME_DURATION_50 |
|
||||||
OPUS_05_FRAME_DURATION_100 |
|
OPUS_05_FRAME_DURATION_100 |
|
||||||
|
|
@ -571,7 +573,7 @@ static int codec_fill_caps(const struct media_codec *codec, uint32_t flags,
|
||||||
OPUS_05_INIT_BITRATE(0)
|
OPUS_05_INIT_BITRATE(0)
|
||||||
},
|
},
|
||||||
.bidi = {
|
.bidi = {
|
||||||
.channels = SPA_MIN(255u, SPA_AUDIO_MAX_CHANNELS),
|
.channels = SPA_MIN(255u, MAX_CHANNELS),
|
||||||
.frame_duration = (OPUS_05_FRAME_DURATION_25 |
|
.frame_duration = (OPUS_05_FRAME_DURATION_25 |
|
||||||
OPUS_05_FRAME_DURATION_50 |
|
OPUS_05_FRAME_DURATION_50 |
|
||||||
OPUS_05_FRAME_DURATION_100 |
|
OPUS_05_FRAME_DURATION_100 |
|
||||||
|
|
@ -771,7 +773,7 @@ static int codec_enum_config(const struct media_codec *codec, uint32_t flags,
|
||||||
a2dp_opus_05_t conf;
|
a2dp_opus_05_t conf;
|
||||||
a2dp_opus_05_direction_t *dir;
|
a2dp_opus_05_direction_t *dir;
|
||||||
struct spa_pod_frame f[1];
|
struct spa_pod_frame f[1];
|
||||||
uint32_t position[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t position[MAX_CHANNELS];
|
||||||
|
|
||||||
if (caps_size < sizeof(conf))
|
if (caps_size < sizeof(conf))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
|
||||||
|
|
@ -6850,7 +6850,7 @@ static void parse_bap_locations(struct spa_bt_monitor *this, const struct spa_di
|
||||||
const char *key, uint32_t *value)
|
const char *key, uint32_t *value)
|
||||||
{
|
{
|
||||||
const char *str;
|
const char *str;
|
||||||
uint32_t position[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t position[MAX_CHANNELS];
|
||||||
uint32_t n_channels;
|
uint32_t n_channels;
|
||||||
uint32_t locations;
|
uint32_t locations;
|
||||||
unsigned int i, j;
|
unsigned int i, j;
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.bluez5.device");
|
||||||
#undef SPA_LOG_TOPIC_DEFAULT
|
#undef SPA_LOG_TOPIC_DEFAULT
|
||||||
#define SPA_LOG_TOPIC_DEFAULT &log_topic
|
#define SPA_LOG_TOPIC_DEFAULT &log_topic
|
||||||
|
|
||||||
#define MAX_NODES (2*SPA_AUDIO_MAX_CHANNELS)
|
#define MAX_NODES (2*MAX_CHANNELS)
|
||||||
|
|
||||||
#define DEVICE_ID_SOURCE 0
|
#define DEVICE_ID_SOURCE 0
|
||||||
#define DEVICE_ID_SINK 1
|
#define DEVICE_ID_SINK 1
|
||||||
|
|
@ -99,9 +99,9 @@ struct node {
|
||||||
unsigned int offload_acquired:1;
|
unsigned int offload_acquired:1;
|
||||||
uint32_t n_channels;
|
uint32_t n_channels;
|
||||||
int64_t latency_offset;
|
int64_t latency_offset;
|
||||||
uint32_t channels[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t channels[MAX_CHANNELS];
|
||||||
float volumes[SPA_AUDIO_MAX_CHANNELS];
|
float volumes[MAX_CHANNELS];
|
||||||
float soft_volumes[SPA_AUDIO_MAX_CHANNELS];
|
float soft_volumes[MAX_CHANNELS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct dynamic_node
|
struct dynamic_node
|
||||||
|
|
@ -129,8 +129,8 @@ struct device_set {
|
||||||
bool leader;
|
bool leader;
|
||||||
uint32_t sinks;
|
uint32_t sinks;
|
||||||
uint32_t sources;
|
uint32_t sources;
|
||||||
struct device_set_member sink[SPA_AUDIO_MAX_CHANNELS];
|
struct device_set_member sink[MAX_CHANNELS];
|
||||||
struct device_set_member source[SPA_AUDIO_MAX_CHANNELS];
|
struct device_set_member source[MAX_CHANNELS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct impl {
|
struct impl {
|
||||||
|
|
@ -182,7 +182,7 @@ static void init_node(struct impl *this, struct node *node, uint32_t id)
|
||||||
|
|
||||||
spa_zero(*node);
|
spa_zero(*node);
|
||||||
node->id = id;
|
node->id = id;
|
||||||
for (i = 0; i < SPA_AUDIO_MAX_CHANNELS; i++) {
|
for (i = 0; i < MAX_CHANNELS; i++) {
|
||||||
node->volumes[i] = 1.0f;
|
node->volumes[i] = 1.0f;
|
||||||
node->soft_volumes[i] = 1.0f;
|
node->soft_volumes[i] = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
@ -546,7 +546,7 @@ static void emit_device_set_node(struct impl *this, uint32_t id)
|
||||||
if (node->channels[k] == t->channels[j])
|
if (node->channels[k] == t->channels[j])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (k == node->n_channels && node->n_channels < SPA_AUDIO_MAX_CHANNELS)
|
if (k == node->n_channels && node->n_channels < MAX_CHANNELS)
|
||||||
node->channels[node->n_channels++] = t->channels[j];
|
node->channels[node->n_channels++] = t->channels[j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2946,8 +2946,8 @@ static int apply_device_props(struct impl *this, struct node *node, struct spa_p
|
||||||
struct spa_pod_prop *prop;
|
struct spa_pod_prop *prop;
|
||||||
struct spa_pod_object *obj = (struct spa_pod_object *) props;
|
struct spa_pod_object *obj = (struct spa_pod_object *) props;
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
float volumes[SPA_AUDIO_MAX_CHANNELS];
|
float volumes[MAX_CHANNELS];
|
||||||
uint32_t channels[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t channels[MAX_CHANNELS];
|
||||||
uint32_t n_volumes = 0, SPA_UNUSED n_channels = 0;
|
uint32_t n_volumes = 0, SPA_UNUSED n_channels = 0;
|
||||||
int64_t latency_offset = 0;
|
int64_t latency_offset = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,8 @@ extern "C" {
|
||||||
|
|
||||||
#define SPA_BT_NO_BATTERY ((uint8_t)255)
|
#define SPA_BT_NO_BATTERY ((uint8_t)255)
|
||||||
|
|
||||||
|
#define MAX_CHANNELS (SPA_AUDIO_MAX_CHANNELS)
|
||||||
|
|
||||||
enum spa_bt_media_direction {
|
enum spa_bt_media_direction {
|
||||||
SPA_BT_MEDIA_SOURCE,
|
SPA_BT_MEDIA_SOURCE,
|
||||||
SPA_BT_MEDIA_SINK,
|
SPA_BT_MEDIA_SINK,
|
||||||
|
|
@ -678,7 +680,7 @@ struct spa_bt_transport {
|
||||||
struct spa_list bap_transport_linked;
|
struct spa_list bap_transport_linked;
|
||||||
|
|
||||||
uint32_t n_channels;
|
uint32_t n_channels;
|
||||||
uint32_t channels[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t channels[MAX_CHANNELS];
|
||||||
|
|
||||||
struct spa_bt_transport_volume volumes[SPA_BT_VOLUME_ID_TERM];
|
struct spa_bt_transport_volume volumes[SPA_BT_VOLUME_ID_TERM];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2139,7 +2139,7 @@ static int port_set_format(struct impl *this, struct port *port,
|
||||||
|
|
||||||
if (info.info.raw.rate == 0 ||
|
if (info.info.raw.rate == 0 ||
|
||||||
info.info.raw.channels == 0 ||
|
info.info.raw.channels == 0 ||
|
||||||
info.info.raw.channels > SPA_AUDIO_MAX_CHANNELS)
|
info.info.raw.channels > MAX_CHANNELS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (this->transport && this->transport->iso_io) {
|
if (this->transport && this->transport->iso_io) {
|
||||||
|
|
|
||||||
|
|
@ -1439,7 +1439,7 @@ static int port_set_format(struct impl *this, struct port *port,
|
||||||
|
|
||||||
if (info.info.raw.rate == 0 ||
|
if (info.info.raw.rate == 0 ||
|
||||||
info.info.raw.channels == 0 ||
|
info.info.raw.channels == 0 ||
|
||||||
info.info.raw.channels > SPA_AUDIO_MAX_CHANNELS)
|
info.info.raw.channels > MAX_CHANNELS)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
port->frame_size = info.info.raw.channels;
|
port->frame_size = info.info.raw.channels;
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@
|
||||||
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.filter-graph");
|
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.filter-graph");
|
||||||
|
|
||||||
#define MAX_HNDL 64
|
#define MAX_HNDL 64
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
|
|
||||||
#define DEFAULT_RATE 48000
|
#define DEFAULT_RATE 48000
|
||||||
|
|
||||||
|
|
@ -154,15 +155,15 @@ struct graph_hndl {
|
||||||
struct volume {
|
struct volume {
|
||||||
bool mute;
|
bool mute;
|
||||||
uint32_t n_volumes;
|
uint32_t n_volumes;
|
||||||
float volumes[SPA_AUDIO_MAX_CHANNELS];
|
float volumes[MAX_CHANNELS];
|
||||||
|
|
||||||
uint32_t n_ports;
|
uint32_t n_ports;
|
||||||
struct port *ports[SPA_AUDIO_MAX_CHANNELS];
|
struct port *ports[MAX_CHANNELS];
|
||||||
float min[SPA_AUDIO_MAX_CHANNELS];
|
float min[MAX_CHANNELS];
|
||||||
float max[SPA_AUDIO_MAX_CHANNELS];
|
float max[MAX_CHANNELS];
|
||||||
#define SCALE_LINEAR 0
|
#define SCALE_LINEAR 0
|
||||||
#define SCALE_CUBIC 1
|
#define SCALE_CUBIC 1
|
||||||
int scale[SPA_AUDIO_MAX_CHANNELS];
|
int scale[MAX_CHANNELS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct graph {
|
struct graph {
|
||||||
|
|
@ -194,9 +195,9 @@ struct graph {
|
||||||
|
|
||||||
uint32_t n_inputs;
|
uint32_t n_inputs;
|
||||||
uint32_t n_outputs;
|
uint32_t n_outputs;
|
||||||
uint32_t inputs_position[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t inputs_position[MAX_CHANNELS];
|
||||||
uint32_t n_inputs_position;
|
uint32_t n_inputs_position;
|
||||||
uint32_t outputs_position[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t outputs_position[MAX_CHANNELS];
|
||||||
uint32_t n_outputs_position;
|
uint32_t n_outputs_position;
|
||||||
|
|
||||||
float min_latency;
|
float min_latency;
|
||||||
|
|
@ -256,8 +257,8 @@ static void emit_filter_graph_info(struct impl *impl, bool full)
|
||||||
char n_inputs[64], n_outputs[64], latency[64];
|
char n_inputs[64], n_outputs[64], latency[64];
|
||||||
struct spa_dict_item items[6];
|
struct spa_dict_item items[6];
|
||||||
struct spa_dict dict = SPA_DICT(items, 0);
|
struct spa_dict dict = SPA_DICT(items, 0);
|
||||||
char in_pos[SPA_AUDIO_MAX_CHANNELS * 8];
|
char in_pos[MAX_CHANNELS * 8];
|
||||||
char out_pos[SPA_AUDIO_MAX_CHANNELS * 8];
|
char out_pos[MAX_CHANNELS * 8];
|
||||||
|
|
||||||
snprintf(n_inputs, sizeof(n_inputs), "%d", impl->graph.n_inputs);
|
snprintf(n_inputs, sizeof(n_inputs), "%d", impl->graph.n_inputs);
|
||||||
snprintf(n_outputs, sizeof(n_outputs), "%d", impl->graph.n_outputs);
|
snprintf(n_outputs, sizeof(n_outputs), "%d", impl->graph.n_outputs);
|
||||||
|
|
@ -745,7 +746,7 @@ static int impl_set_props(void *object, enum spa_direction direction, const stru
|
||||||
case SPA_PROP_channelVolumes:
|
case SPA_PROP_channelVolumes:
|
||||||
{
|
{
|
||||||
uint32_t i, n_vols;
|
uint32_t i, n_vols;
|
||||||
float vols[SPA_AUDIO_MAX_CHANNELS];
|
float vols[MAX_CHANNELS];
|
||||||
|
|
||||||
if ((n_vols = spa_pod_copy_array(&prop->value, SPA_TYPE_Float, vols,
|
if ((n_vols = spa_pod_copy_array(&prop->value, SPA_TYPE_Float, vols,
|
||||||
SPA_AUDIO_MAX_CHANNELS)) > 0) {
|
SPA_AUDIO_MAX_CHANNELS)) > 0) {
|
||||||
|
|
@ -772,7 +773,7 @@ static int impl_set_props(void *object, enum spa_direction direction, const stru
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (do_volume && vol->n_ports != 0) {
|
if (do_volume && vol->n_ports != 0) {
|
||||||
float soft_vols[SPA_AUDIO_MAX_CHANNELS];
|
float soft_vols[MAX_CHANNELS];
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
for (i = 0; i < vol->n_volumes; i++)
|
for (i = 0; i < vol->n_volumes; i++)
|
||||||
|
|
@ -1264,7 +1265,7 @@ static int parse_volume(struct graph *graph, struct spa_json *json, enum spa_dir
|
||||||
spa_log_error(impl->log, "unknown control port %s", control);
|
spa_log_error(impl->log, "unknown control port %s", control);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
if (vol->n_ports >= SPA_AUDIO_MAX_CHANNELS) {
|
if (vol->n_ports >= MAX_CHANNELS) {
|
||||||
spa_log_error(impl->log, "too many volume controls");
|
spa_log_error(impl->log, "too many volume controls");
|
||||||
return -ENOSPC;
|
return -ENOSPC;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,13 @@
|
||||||
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.null-audio-sink");
|
SPA_LOG_TOPIC_DEFINE_STATIC(log_topic, "spa.null-audio-sink");
|
||||||
|
|
||||||
#define DEFAULT_CLOCK_NAME "clock.system.monotonic"
|
#define DEFAULT_CLOCK_NAME "clock.system.monotonic"
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
|
|
||||||
struct props {
|
struct props {
|
||||||
uint32_t format;
|
uint32_t format;
|
||||||
uint32_t channels;
|
uint32_t channels;
|
||||||
uint32_t rate;
|
uint32_t rate;
|
||||||
uint32_t pos[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t pos[MAX_CHANNELS];
|
||||||
char clock_name[64];
|
char clock_name[64];
|
||||||
unsigned int debug:1;
|
unsigned int debug:1;
|
||||||
unsigned int driver:1;
|
unsigned int driver:1;
|
||||||
|
|
|
||||||
|
|
@ -231,9 +231,9 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
||||||
"( stream.props=<properties> ) " \
|
"( stream.props=<properties> ) " \
|
||||||
"( stream.rules=<properties> ) "
|
"( stream.rules=<properties> ) "
|
||||||
|
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
#define DELAYBUF_MAX_SIZE (20 * sizeof(float) * 96000)
|
#define DELAYBUF_MAX_SIZE (20 * sizeof(float) * 96000)
|
||||||
|
|
||||||
|
|
||||||
static const struct spa_dict_item module_props[] = {
|
static const struct spa_dict_item module_props[] = {
|
||||||
{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
|
{ PW_KEY_MODULE_AUTHOR, "Wim Taymans <wim.taymans@gmail.com>" },
|
||||||
{ PW_KEY_MODULE_DESCRIPTION, "Combine multiple streams into a single stream" },
|
{ PW_KEY_MODULE_DESCRIPTION, "Combine multiple streams into a single stream" },
|
||||||
|
|
@ -312,10 +312,10 @@ struct stream {
|
||||||
struct spa_latency_info latency;
|
struct spa_latency_info latency;
|
||||||
|
|
||||||
struct spa_audio_info_raw info;
|
struct spa_audio_info_raw info;
|
||||||
uint32_t remap[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t remap[MAX_CHANNELS];
|
||||||
|
|
||||||
void *delaybuf;
|
void *delaybuf;
|
||||||
struct ringbuffer delay[SPA_AUDIO_MAX_CHANNELS];
|
struct ringbuffer delay[MAX_CHANNELS];
|
||||||
|
|
||||||
int64_t delay_samples; /* for main loop */
|
int64_t delay_samples; /* for main loop */
|
||||||
int64_t data_delay_samples; /* for data loop */
|
int64_t data_delay_samples; /* for data loop */
|
||||||
|
|
@ -509,7 +509,7 @@ static void update_latency(struct impl *impl)
|
||||||
struct replace_delay_info {
|
struct replace_delay_info {
|
||||||
struct stream *stream;
|
struct stream *stream;
|
||||||
void *buf;
|
void *buf;
|
||||||
struct ringbuffer delay[SPA_AUDIO_MAX_CHANNELS];
|
struct ringbuffer delay[MAX_CHANNELS];
|
||||||
};
|
};
|
||||||
|
|
||||||
static int do_replace_delay(struct spa_loop *loop, bool async, uint32_t seq,
|
static int do_replace_delay(struct spa_loop *loop, bool async, uint32_t seq,
|
||||||
|
|
@ -1228,7 +1228,7 @@ static void combine_output_process(void *d)
|
||||||
struct pw_buffer *in, *out;
|
struct pw_buffer *in, *out;
|
||||||
struct stream *s;
|
struct stream *s;
|
||||||
bool delay_changed = false;
|
bool delay_changed = false;
|
||||||
bool mix[SPA_AUDIO_MAX_CHANNELS];
|
bool mix[MAX_CHANNELS];
|
||||||
|
|
||||||
if ((out = pw_stream_dequeue_buffer(impl->combine)) == NULL) {
|
if ((out = pw_stream_dequeue_buffer(impl->combine)) == NULL) {
|
||||||
pw_log_debug("%p: out of output buffers: %m", impl);
|
pw_log_debug("%p: out of output buffers: %m", impl);
|
||||||
|
|
|
||||||
|
|
@ -154,6 +154,7 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
||||||
|
|
||||||
#define DEFAULT_RATE 48000
|
#define DEFAULT_RATE 48000
|
||||||
#define DEFAULT_POSITION "[ FL FR ]"
|
#define DEFAULT_POSITION "[ FL FR ]"
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
|
|
||||||
/* Hopefully this is enough for any combination of AEC engine and resampler
|
/* Hopefully this is enough for any combination of AEC engine and resampler
|
||||||
* input requirement for rate matching */
|
* input requirement for rate matching */
|
||||||
|
|
@ -203,7 +204,7 @@ struct impl {
|
||||||
struct spa_hook source_listener;
|
struct spa_hook source_listener;
|
||||||
struct spa_audio_info_raw source_info;
|
struct spa_audio_info_raw source_info;
|
||||||
|
|
||||||
void *rec_buffer[SPA_AUDIO_MAX_CHANNELS];
|
void *rec_buffer[MAX_CHANNELS];
|
||||||
uint32_t rec_ringsize;
|
uint32_t rec_ringsize;
|
||||||
struct spa_ringbuffer rec_ring;
|
struct spa_ringbuffer rec_ring;
|
||||||
|
|
||||||
|
|
@ -215,13 +216,13 @@ struct impl {
|
||||||
struct pw_properties *sink_props;
|
struct pw_properties *sink_props;
|
||||||
struct pw_stream *sink;
|
struct pw_stream *sink;
|
||||||
struct spa_hook sink_listener;
|
struct spa_hook sink_listener;
|
||||||
void *play_buffer[SPA_AUDIO_MAX_CHANNELS];
|
void *play_buffer[MAX_CHANNELS];
|
||||||
uint32_t play_ringsize;
|
uint32_t play_ringsize;
|
||||||
struct spa_ringbuffer play_ring;
|
struct spa_ringbuffer play_ring;
|
||||||
struct spa_ringbuffer play_delayed_ring;
|
struct spa_ringbuffer play_delayed_ring;
|
||||||
struct spa_audio_info_raw sink_info;
|
struct spa_audio_info_raw sink_info;
|
||||||
|
|
||||||
void *out_buffer[SPA_AUDIO_MAX_CHANNELS];
|
void *out_buffer[MAX_CHANNELS];
|
||||||
uint32_t out_ringsize;
|
uint32_t out_ringsize;
|
||||||
struct spa_ringbuffer out_ring;
|
struct spa_ringbuffer out_ring;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,7 @@
|
||||||
PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
||||||
#define PW_LOG_TOPIC_DEFAULT mod_topic
|
#define PW_LOG_TOPIC_DEFAULT mod_topic
|
||||||
|
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
#define MAX_PORTS 128
|
#define MAX_PORTS 128
|
||||||
#define FFADO_RT_PRIORITY_PACKETIZER_RELATIVE 5
|
#define FFADO_RT_PRIORITY_PACKETIZER_RELATIVE 5
|
||||||
|
|
||||||
|
|
@ -179,7 +180,7 @@ struct port {
|
||||||
struct volume {
|
struct volume {
|
||||||
bool mute;
|
bool mute;
|
||||||
uint32_t n_volumes;
|
uint32_t n_volumes;
|
||||||
float volumes[SPA_AUDIO_MAX_CHANNELS];
|
float volumes[MAX_CHANNELS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct stream {
|
struct stream {
|
||||||
|
|
@ -760,7 +761,7 @@ static int make_stream_ports(struct stream *s)
|
||||||
struct port *port = s->ports[i];
|
struct port *port = s->ports[i];
|
||||||
char channel[32];
|
char channel[32];
|
||||||
|
|
||||||
snprintf(channel, sizeof(channel), "AUX%u", n_channels % SPA_AUDIO_MAX_CHANNELS);
|
snprintf(channel, sizeof(channel), "AUX%u", n_channels % MAX_CHANNELS);
|
||||||
|
|
||||||
switch (port->stream_type) {
|
switch (port->stream_type) {
|
||||||
case ffado_stream_type_audio:
|
case ffado_stream_type_audio:
|
||||||
|
|
@ -873,7 +874,7 @@ static void parse_props(struct stream *s, const struct spa_pod *param)
|
||||||
case SPA_PROP_channelVolumes:
|
case SPA_PROP_channelVolumes:
|
||||||
{
|
{
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
float vols[SPA_AUDIO_MAX_CHANNELS];
|
float vols[MAX_CHANNELS];
|
||||||
if ((n = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
|
if ((n = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
|
||||||
vols, SPA_AUDIO_MAX_CHANNELS)) > 0) {
|
vols, SPA_AUDIO_MAX_CHANNELS)) > 0) {
|
||||||
s->volume.n_volumes = n;
|
s->volume.n_volumes = n;
|
||||||
|
|
@ -1228,7 +1229,7 @@ static int probe_ffado_device(struct impl *impl)
|
||||||
}
|
}
|
||||||
if (impl->source.info.channels != n_channels) {
|
if (impl->source.info.channels != n_channels) {
|
||||||
impl->source.info.channels = n_channels;
|
impl->source.info.channels = n_channels;
|
||||||
for (i = 0; i < SPA_MIN(impl->source.info.channels, SPA_AUDIO_MAX_CHANNELS); i++)
|
for (i = 0; i < SPA_MIN(impl->source.info.channels, MAX_CHANNELS); i++)
|
||||||
impl->source.info.position[i] = SPA_AUDIO_CHANNEL_AUX0 + i;
|
impl->source.info.position[i] = SPA_AUDIO_CHANNEL_AUX0 + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1254,7 +1255,7 @@ static int probe_ffado_device(struct impl *impl)
|
||||||
}
|
}
|
||||||
if (impl->sink.info.channels != n_channels) {
|
if (impl->sink.info.channels != n_channels) {
|
||||||
impl->sink.info.channels = n_channels;
|
impl->sink.info.channels = n_channels;
|
||||||
for (i = 0; i < SPA_MIN(impl->sink.info.channels, SPA_AUDIO_MAX_CHANNELS); i++)
|
for (i = 0; i < SPA_MIN(impl->sink.info.channels, MAX_CHANNELS); i++)
|
||||||
impl->sink.info.position[i] = SPA_AUDIO_CHANNEL_AUX0 + i;
|
impl->sink.info.position[i] = SPA_AUDIO_CHANNEL_AUX0 + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,6 +115,7 @@
|
||||||
PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
||||||
#define PW_LOG_TOPIC_DEFAULT mod_topic
|
#define PW_LOG_TOPIC_DEFAULT mod_topic
|
||||||
|
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
#define MAX_PORTS 128
|
#define MAX_PORTS 128
|
||||||
|
|
||||||
#define DEFAULT_CLIENT_NAME "PipeWire"
|
#define DEFAULT_CLIENT_NAME "PipeWire"
|
||||||
|
|
@ -157,7 +158,7 @@ struct port {
|
||||||
struct volume {
|
struct volume {
|
||||||
bool mute;
|
bool mute;
|
||||||
uint32_t n_volumes;
|
uint32_t n_volumes;
|
||||||
float volumes[SPA_AUDIO_MAX_CHANNELS];
|
float volumes[MAX_CHANNELS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct stream {
|
struct stream {
|
||||||
|
|
@ -624,7 +625,7 @@ static void parse_props(struct stream *s, const struct spa_pod *param)
|
||||||
case SPA_PROP_channelVolumes:
|
case SPA_PROP_channelVolumes:
|
||||||
{
|
{
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
float vols[SPA_AUDIO_MAX_CHANNELS];
|
float vols[MAX_CHANNELS];
|
||||||
if ((n = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
|
if ((n = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
|
||||||
vols, SPA_AUDIO_MAX_CHANNELS)) > 0) {
|
vols, SPA_AUDIO_MAX_CHANNELS)) > 0) {
|
||||||
s->volume.n_volumes = n;
|
s->volume.n_volumes = n;
|
||||||
|
|
|
||||||
|
|
@ -512,7 +512,7 @@ static void parse_props(struct stream *s, const struct spa_pod *param)
|
||||||
case SPA_PROP_channelVolumes:
|
case SPA_PROP_channelVolumes:
|
||||||
{
|
{
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
float vols[SPA_AUDIO_MAX_CHANNELS];
|
float vols[MAX_CHANNELS];
|
||||||
if ((n = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
|
if ((n = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
|
||||||
vols, SPA_AUDIO_MAX_CHANNELS)) > 0) {
|
vols, SPA_AUDIO_MAX_CHANNELS)) > 0) {
|
||||||
s->volume.n_volumes = n;
|
s->volume.n_volumes = n;
|
||||||
|
|
|
||||||
|
|
@ -677,7 +677,7 @@ static void parse_props(struct stream *s, const struct spa_pod *param)
|
||||||
case SPA_PROP_channelVolumes:
|
case SPA_PROP_channelVolumes:
|
||||||
{
|
{
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
float vols[SPA_AUDIO_MAX_CHANNELS];
|
float vols[MAX_CHANNELS];
|
||||||
if ((n = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
|
if ((n = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
|
||||||
vols, SPA_AUDIO_MAX_CHANNELS)) > 0) {
|
vols, SPA_AUDIO_MAX_CHANNELS)) > 0) {
|
||||||
s->volume.n_volumes = n;
|
s->volume.n_volumes = n;
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,12 @@
|
||||||
#include <opus/opus_custom.h>
|
#include <opus/opus_custom.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
|
|
||||||
struct volume {
|
struct volume {
|
||||||
bool mute;
|
bool mute;
|
||||||
uint32_t n_volumes;
|
uint32_t n_volumes;
|
||||||
float volumes[SPA_AUDIO_MAX_CHANNELS];
|
float volumes[MAX_CHANNELS];
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline float bswap_f32(float f)
|
static inline float bswap_f32(float f)
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
|
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
|
|
||||||
static const struct format audio_formats[] = {
|
static const struct format audio_formats[] = {
|
||||||
[SAMPLE_U8] = { SAMPLE_U8, SPA_AUDIO_FORMAT_U8, "u8", 1 },
|
[SAMPLE_U8] = { SAMPLE_U8, SPA_AUDIO_FORMAT_U8, "u8", 1 },
|
||||||
[SAMPLE_ALAW] = { SAMPLE_ALAW, SPA_AUDIO_FORMAT_ALAW, "alaw", 1 },
|
[SAMPLE_ALAW] = { SAMPLE_ALAW, SPA_AUDIO_FORMAT_ALAW, "alaw", 1 },
|
||||||
|
|
|
||||||
|
|
@ -117,6 +117,8 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
||||||
#define DEFAULT_CHANNELS 2
|
#define DEFAULT_CHANNELS 2
|
||||||
#define DEFAULT_POSITION "[ FL FR ]"
|
#define DEFAULT_POSITION "[ FL FR ]"
|
||||||
|
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
|
|
||||||
#define MODULE_USAGE "( remote.name=<remote> ] " \
|
#define MODULE_USAGE "( remote.name=<remote> ] " \
|
||||||
"( node.latency=<latency as fraction> ] " \
|
"( node.latency=<latency as fraction> ] " \
|
||||||
"( node.name=<name of the nodes> ] " \
|
"( node.name=<name of the nodes> ] " \
|
||||||
|
|
@ -295,7 +297,7 @@ static void stream_param_changed(void *d, uint32_t id, const struct spa_pod *par
|
||||||
{
|
{
|
||||||
struct pa_cvolume volume;
|
struct pa_cvolume volume;
|
||||||
uint32_t n;
|
uint32_t n;
|
||||||
float vols[SPA_AUDIO_MAX_CHANNELS];
|
float vols[MAX_CHANNELS];
|
||||||
|
|
||||||
if ((n = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
|
if ((n = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
|
||||||
vols, SPA_AUDIO_MAX_CHANNELS)) > 0) {
|
vols, SPA_AUDIO_MAX_CHANNELS)) > 0) {
|
||||||
|
|
@ -832,10 +834,10 @@ do_stream_sync_volumes(struct spa_loop *loop,
|
||||||
struct spa_pod_frame f[1];
|
struct spa_pod_frame f[1];
|
||||||
struct spa_pod *param;
|
struct spa_pod *param;
|
||||||
uint32_t i, channels;
|
uint32_t i, channels;
|
||||||
float vols[SPA_AUDIO_MAX_CHANNELS];
|
float vols[MAX_CHANNELS];
|
||||||
float soft_vols[SPA_AUDIO_MAX_CHANNELS];
|
float soft_vols[MAX_CHANNELS];
|
||||||
|
|
||||||
channels = SPA_MIN(impl->volume.channels, SPA_AUDIO_MAX_CHANNELS);
|
channels = SPA_MIN(impl->volume.channels, MAX_CHANNELS);
|
||||||
for (i = 0; i < channels; i++) {
|
for (i = 0; i < channels; i++) {
|
||||||
vols[i] = (float)pa_sw_volume_to_linear(impl->volume.values[i]);
|
vols[i] = (float)pa_sw_volume_to_linear(impl->volume.values[i]);
|
||||||
soft_vols[i] = 1.0f;
|
soft_vols[i] = 1.0f;
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,7 @@ PW_LOG_TOPIC(mod_topic, "mod." NAME);
|
||||||
#define RAOP_LATENCY_MS 250
|
#define RAOP_LATENCY_MS 250
|
||||||
#define DEFAULT_LATENCY_MS 1500
|
#define DEFAULT_LATENCY_MS 1500
|
||||||
|
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
#define VOLUME_MAX 0.0
|
#define VOLUME_MAX 0.0
|
||||||
#define VOLUME_MIN -30.0
|
#define VOLUME_MIN -30.0
|
||||||
#define VOLUME_MUTE -144.0
|
#define VOLUME_MUTE -144.0
|
||||||
|
|
@ -1612,8 +1613,8 @@ static void stream_props_changed(struct impl *impl, uint32_t id, const struct sp
|
||||||
case SPA_PROP_channelVolumes:
|
case SPA_PROP_channelVolumes:
|
||||||
{
|
{
|
||||||
uint32_t i, n_vols;
|
uint32_t i, n_vols;
|
||||||
float vols[SPA_AUDIO_MAX_CHANNELS], volume;
|
float vols[MAX_CHANNELS], volume;
|
||||||
float soft_vols[SPA_AUDIO_MAX_CHANNELS];
|
float soft_vols[MAX_CHANNELS];
|
||||||
|
|
||||||
if ((n_vols = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
|
if ((n_vols = spa_pod_copy_array(&prop->value, SPA_TYPE_Float,
|
||||||
vols, SPA_AUDIO_MAX_CHANNELS)) > 0) {
|
vols, SPA_AUDIO_MAX_CHANNELS)) > 0) {
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,7 @@ PW_LOG_TOPIC_STATIC(mod_topic, "mod." NAME);
|
||||||
#define DEFAULT_LOOP false
|
#define DEFAULT_LOOP false
|
||||||
|
|
||||||
#define MAX_SDP 2048
|
#define MAX_SDP 2048
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
|
|
||||||
#define USAGE "( local.ifname=<local interface name to use> ) " \
|
#define USAGE "( local.ifname=<local interface name to use> ) " \
|
||||||
"( sap.ip=<SAP IP address to send announce, default:"DEFAULT_SAP_IP"> ) " \
|
"( sap.ip=<SAP IP address to send announce, default:"DEFAULT_SAP_IP"> ) " \
|
||||||
|
|
@ -1404,7 +1405,7 @@ static int parse_sdp_i(struct impl *impl, char *c, struct sdp_info *info)
|
||||||
c[strcspn(c, " ")] = '\0';
|
c[strcspn(c, " ")] = '\0';
|
||||||
|
|
||||||
uint32_t channels;
|
uint32_t channels;
|
||||||
if (sscanf(c, "%u", &channels) != 1 || channels <= 0 || channels > SPA_AUDIO_MAX_CHANNELS)
|
if (sscanf(c, "%u", &channels) != 1 || channels <= 0 || channels > MAX_CHANNELS)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
c += strcspn(c, "\0");
|
c += strcspn(c, "\0");
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,8 @@
|
||||||
#define DEFAULT_VOLUME 1.0
|
#define DEFAULT_VOLUME 1.0
|
||||||
#define DEFAULT_QUALITY 4
|
#define DEFAULT_QUALITY 4
|
||||||
|
|
||||||
|
#define MAX_CHANNELS SPA_AUDIO_MAX_CHANNELS
|
||||||
|
|
||||||
enum mode {
|
enum mode {
|
||||||
mode_none,
|
mode_none,
|
||||||
mode_playback,
|
mode_playback,
|
||||||
|
|
@ -91,7 +93,7 @@ typedef int (*fill_fn)(struct data *d, void *dest, unsigned int n_frames, bool *
|
||||||
|
|
||||||
struct channelmap {
|
struct channelmap {
|
||||||
uint32_t n_channels;
|
uint32_t n_channels;
|
||||||
uint32_t channels[SPA_AUDIO_MAX_CHANNELS];
|
uint32_t channels[MAX_CHANNELS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct data {
|
struct data {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue