mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-15 07:00:05 -05:00
spa: remove some obsolete functions
The spa_audio_info array now always holds enough positions for all channels and we don't need to wrap around.
This commit is contained in:
parent
6d74eee874
commit
78219471ff
12 changed files with 34 additions and 64 deletions
|
|
@ -883,8 +883,8 @@ static int create_stream(struct stream_info *info)
|
|||
s->remap[i] = i;
|
||||
for (j = 0; j < tmp_info.channels; j++) {
|
||||
uint32_t pj, pi;
|
||||
pj = spa_format_audio_raw_get_position(&tmp_info, j);
|
||||
pi = spa_format_audio_raw_get_position(&remap_info, i);
|
||||
pj = tmp_info.position[j];
|
||||
pi = remap_info.position[i];
|
||||
if (pj == pi) {
|
||||
s->remap[i] = j;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -525,8 +525,7 @@ static void make_stream_ports(struct stream *s)
|
|||
|
||||
if (i < s->info.channels) {
|
||||
str = spa_type_audio_channel_make_short_name(
|
||||
spa_format_audio_raw_get_position(&s->info, i),
|
||||
pos, sizeof(pos), NULL);
|
||||
s->info.position[i], pos, sizeof(pos), NULL);
|
||||
if (str)
|
||||
snprintf(name, sizeof(name), "%s_%s", prefix, str);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -546,7 +546,7 @@ static void param_format_changed(struct impl *impl, const struct spa_pod *param,
|
|||
(impl->info.channels != 0 &&
|
||||
(impl->info.channels != info.channels ||
|
||||
memcmp(impl->info.position, info.position,
|
||||
SPA_MIN(info.channels, SPA_N_ELEMENTS(info.position)) * sizeof(uint32_t)) != 0))) {
|
||||
info.channels * sizeof(uint32_t)) != 0))) {
|
||||
uint8_t buffer[1024];
|
||||
struct spa_pod_builder b;
|
||||
const struct spa_pod *params[1];
|
||||
|
|
|
|||
|
|
@ -442,8 +442,7 @@ static void make_stream_ports(struct stream *s)
|
|||
|
||||
if (i < s->info.channels) {
|
||||
str = spa_type_audio_channel_make_short_name(
|
||||
spa_format_audio_raw_get_position(&s->info, i),
|
||||
name, sizeof(name), "UNK");
|
||||
s->info.position[i], name, sizeof(name), "UNK");
|
||||
props = pw_properties_new(
|
||||
PW_KEY_FORMAT_DSP, "32 bit float mono audio",
|
||||
PW_KEY_AUDIO_CHANNEL, str,
|
||||
|
|
@ -866,8 +865,7 @@ static int handle_follower_setup(struct impl *impl, struct nj2_session_params *p
|
|||
if ((uint32_t)peer->params.send_audio_channels != impl->sink.info.channels) {
|
||||
impl->sink.info.channels = peer->params.send_audio_channels;
|
||||
for (i = 0; i < impl->sink.info.channels; i++)
|
||||
spa_format_audio_raw_set_position(&impl->sink.info, i,
|
||||
SPA_AUDIO_CHANNEL_AUX0 + i);
|
||||
impl->sink.info.position[i] = SPA_AUDIO_CHANNEL_AUX0 + i;
|
||||
}
|
||||
impl->source.n_ports = peer->params.recv_audio_channels + peer->params.recv_midi_channels;
|
||||
if (impl->source.n_ports > MAX_PORTS) {
|
||||
|
|
@ -878,8 +876,7 @@ static int handle_follower_setup(struct impl *impl, struct nj2_session_params *p
|
|||
if ((uint32_t)peer->params.recv_audio_channels != impl->source.info.channels) {
|
||||
impl->source.info.channels = peer->params.recv_audio_channels;
|
||||
for (i = 0; i < impl->source.info.channels; i++)
|
||||
spa_format_audio_raw_set_position(&impl->source.info, i,
|
||||
SPA_AUDIO_CHANNEL_AUX0 + i);
|
||||
impl->source.info.position[i] = SPA_AUDIO_CHANNEL_AUX0 + i;
|
||||
}
|
||||
impl->samplerate = peer->params.sample_rate;
|
||||
impl->period_size = peer->params.period_size;
|
||||
|
|
|
|||
|
|
@ -602,8 +602,7 @@ static void make_stream_ports(struct stream *s)
|
|||
|
||||
if (i < s->info.channels) {
|
||||
str = spa_type_audio_channel_make_short_name(
|
||||
spa_format_audio_raw_get_position(&s->info, i),
|
||||
name, sizeof(name), "UNK");
|
||||
s->info.position[i], name, sizeof(name), "UNK");
|
||||
props = pw_properties_new(
|
||||
PW_KEY_FORMAT_DSP, "32 bit float mono audio",
|
||||
PW_KEY_AUDIO_CHANNEL, str,
|
||||
|
|
@ -1031,16 +1030,14 @@ static int handle_follower_available(struct impl *impl, struct nj2_session_param
|
|||
if ((uint32_t)peer->params.recv_audio_channels != follower->source.info.channels) {
|
||||
follower->source.info.channels = peer->params.recv_audio_channels;
|
||||
for (i = 0; i < follower->source.info.channels; i++)
|
||||
spa_format_audio_raw_set_position(&follower->source.info, i,
|
||||
SPA_AUDIO_CHANNEL_AUX0 + i);
|
||||
follower->source.info.position[i] = SPA_AUDIO_CHANNEL_AUX0 + i;
|
||||
}
|
||||
follower->sink.n_ports = peer->params.send_audio_channels + peer->params.send_midi_channels;
|
||||
follower->sink.info.rate = peer->params.sample_rate;
|
||||
if ((uint32_t)peer->params.send_audio_channels != follower->sink.info.channels) {
|
||||
follower->sink.info.channels = peer->params.send_audio_channels;
|
||||
for (i = 0; i < follower->sink.info.channels; i++)
|
||||
spa_format_audio_raw_set_position(&follower->sink.info, i,
|
||||
SPA_AUDIO_CHANNEL_AUX0 + i);
|
||||
follower->sink.info.position[i] = SPA_AUDIO_CHANNEL_AUX0 + i;
|
||||
}
|
||||
|
||||
if (follower->source.n_ports > MAX_PORTS || follower->sink.n_ports > MAX_PORTS) {
|
||||
|
|
|
|||
|
|
@ -585,7 +585,7 @@ int format_parse_param(const struct spa_pod *param, bool collect,
|
|||
if (info.info.raw.channels) {
|
||||
map->channels = SPA_MIN(info.info.raw.channels, CHANNELS_MAX);
|
||||
for (i = 0; i < map->channels; i++)
|
||||
map->map[i] = spa_format_audio_raw_get_position(&info.info.raw, i);
|
||||
map->map[i] = info.info.raw.position[i];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ int module_args_to_audioinfo_keys(struct impl *impl, struct pw_properties *props
|
|||
} else {
|
||||
/* FIXME add more mappings */
|
||||
for (i = 0; i < info->channels; i++)
|
||||
spa_format_audio_raw_set_position(info, i, SPA_AUDIO_CHANNEL_UNKNOWN);
|
||||
info->position[i] = SPA_AUDIO_CHANNEL_UNKNOWN;
|
||||
}
|
||||
if (info->position[0] == SPA_AUDIO_CHANNEL_UNKNOWN)
|
||||
info->flags |= SPA_AUDIO_FLAG_UNPOSITIONED;
|
||||
|
|
@ -290,8 +290,7 @@ void audioinfo_to_properties(struct spa_audio_info_raw *info, struct pw_properti
|
|||
p = s = alloca(info->channels * 8);
|
||||
for (i = 0; i < info->channels; i++)
|
||||
p += spa_scnprintf(p, 8, "%s%s", i == 0 ? "" : ", ",
|
||||
channel_id2name(spa_format_audio_raw_get_position(info, i),
|
||||
pos, sizeof(pos)));
|
||||
channel_id2name(info->position[i], pos, sizeof(pos)));
|
||||
pw_properties_setf(props, SPA_KEY_AUDIO_POSITION, "[ %s ]", s);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -755,7 +755,7 @@ static int create_pulse_stream(struct impl *impl)
|
|||
map.channels = impl->info.channels;
|
||||
for (i = 0; i < map.channels; i++)
|
||||
map.map[i] = (pa_channel_position_t)channel_id2pa(
|
||||
spa_format_audio_raw_get_position(&impl->info, i), &aux);
|
||||
impl->info.position[i], &aux);
|
||||
|
||||
snprintf(stream_name, sizeof(stream_name), _("Tunnel for %s@%s"),
|
||||
pw_get_user_name(), pw_get_host_name());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue