mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
audio-format: set unpossisioned flag
If we don't have position information in the format, set the unpositioned flag. Don't set position info in the format when the unpositioned flag is set.
This commit is contained in:
parent
aade499aae
commit
00a570f7de
2 changed files with 11 additions and 5 deletions
|
|
@ -52,6 +52,9 @@ spa_format_audio_raw_parse(const struct spa_pod *format, struct spa_audio_info_r
|
|||
uint32_t n_values = SPA_MIN(SPA_POD_ARRAY_N_VALUES(position), SPA_AUDIO_MAX_CHANNELS);
|
||||
memcpy(info->position, values, n_values * sizeof(uint32_t));
|
||||
}
|
||||
else
|
||||
SPA_FLAG_SET(info->flags, SPA_AUDIO_FLAG_UNPOSITIONED);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -67,9 +70,10 @@ spa_format_audio_raw_build(struct spa_pod_builder *builder, uint32_t id, struct
|
|||
SPA_FORMAT_AUDIO_channels, &SPA_POD_Int(info->channels),
|
||||
0);
|
||||
|
||||
if (info->channels > 1) {
|
||||
if (!SPA_FLAG_CHECK(info->flags, SPA_AUDIO_FLAG_UNPOSITIONED)) {
|
||||
spa_pod_builder_prop(builder, SPA_FORMAT_AUDIO_position, 0);
|
||||
spa_pod_builder_array(builder, sizeof(uint32_t), SPA_TYPE_Id, info->channels, info->position);
|
||||
spa_pod_builder_array(builder, sizeof(uint32_t), SPA_TYPE_Id,
|
||||
info->channels, info->position);
|
||||
}
|
||||
return spa_pod_builder_pop(builder);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -354,9 +354,11 @@ static int port_enum_formats(struct spa_node *node,
|
|||
SPA_FORMAT_AUDIO_rate, &SPA_POD_Int(other->info.raw.rate),
|
||||
SPA_FORMAT_AUDIO_channels, &SPA_POD_Int(other->info.raw.channels),
|
||||
0);
|
||||
spa_pod_builder_prop(builder, SPA_FORMAT_AUDIO_position, 0);
|
||||
spa_pod_builder_array(builder, sizeof(uint32_t), SPA_TYPE_Id,
|
||||
info.info.raw.channels, info.info.raw.position);
|
||||
if (!SPA_FLAG_CHECK(other->info.raw.flags, SPA_AUDIO_FLAG_UNPOSITIONED)) {
|
||||
spa_pod_builder_prop(builder, SPA_FORMAT_AUDIO_position, 0);
|
||||
spa_pod_builder_array(builder, sizeof(uint32_t), SPA_TYPE_Id,
|
||||
info.info.raw.channels, info.info.raw.position);
|
||||
}
|
||||
*param = spa_pod_builder_pop(builder);
|
||||
} else {
|
||||
*param = spa_pod_builder_object(builder,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue