audio: remove layout from audio

Make special format types for planar and interleaved instead of
having a field.
Add enum for audio channel positions
Add some default audio channel layouts
Place the channel layout in the audio format when possible
alsa: place audio channel positions in format
Add sse optimized channel mixing for some common cases
Remove name from port info, it's not mandatory and in the properties
Add direction to port info
This commit is contained in:
Wim Taymans 2018-09-13 17:03:56 +02:00
parent fb3379e587
commit 5196f7f053
38 changed files with 981 additions and 369 deletions

View file

@ -896,6 +896,9 @@ static void client_node_initialized(void *data)
spa_debug_type_find_name(spa_type_media_subtype, media_subtype));
if (pw_log_level_enabled(SPA_LOG_LEVEL_DEBUG))
spa_debug_format(2, NULL, format);
if (!exclusive &&
media_type == SPA_MEDIA_TYPE_audio &&
media_subtype == SPA_MEDIA_SUBTYPE_raw) {

View file

@ -646,7 +646,6 @@ static int collect_audio_format(void *data, uint32_t id,
if (info.channels > d->channels) {
d->channels = info.channels;
d->channelmask = info.channel_mask;
d->rate = info.rate;
}
return 0;

View file

@ -144,7 +144,8 @@ static const struct pw_port_implementation port_implementation = {
static const char *chmap_names[] =
{
"FL",
"MONO", /**< mono */
"FL", /**< front left */
"FR", /**< front right */
"RL", /**< rear left */
"RR", /**< rear right */
@ -242,6 +243,8 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core,
pw_properties_set(pr, "node.session", str);
pw_properties_setf(pr, "node.format.rate", "%d", sample_rate);
pw_properties_setf(pr, "node.format.channels", "%d", channels);
pw_properties_setf(pr, "node.format.channelmask", "%"PRIu64, channelmask);
node = pw_spa_node_load(core, NULL, NULL,
"audioconvert/libspa-audioconvert",
@ -293,6 +296,7 @@ struct pw_node *pw_audio_dsp_new(struct pw_core *core,
alias,
direction == PW_DIRECTION_INPUT ? "in" : "out",
channel_name);
pw_properties_setf(props, "port.channel", "%s", channel_name);
port = pw_port_new(direction,
i,

View file

@ -331,8 +331,7 @@ static int port_enum_formats(struct spa_node *node,
SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
SPA_FORMAT_mediaType, &SPA_POD_Id(SPA_MEDIA_TYPE_audio),
SPA_FORMAT_mediaSubtype, &SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
SPA_FORMAT_AUDIO_format, &SPA_POD_Id(SPA_AUDIO_FORMAT_F32),
SPA_FORMAT_AUDIO_layout, &SPA_POD_Id(SPA_AUDIO_LAYOUT_NON_INTERLEAVED),
SPA_FORMAT_AUDIO_format, &SPA_POD_Id(SPA_AUDIO_FORMAT_F32P),
SPA_FORMAT_AUDIO_rate, &SPA_POD_CHOICE_RANGE_Int(44100, 1, INT32_MAX),
SPA_FORMAT_AUDIO_channels, &SPA_POD_Int(1),
0);
@ -550,7 +549,7 @@ static int port_set_format(struct spa_node *node,
if (memcmp(&info, &this->format, sizeof(struct spa_audio_info)))
return -EINVAL;
} else {
if (info.info.raw.format != SPA_AUDIO_FORMAT_F32)
if (info.info.raw.format != SPA_AUDIO_FORMAT_F32P)
return -EINVAL;
this->stride = sizeof(float);

View file

@ -777,8 +777,8 @@ static void port_marshal_info(void *object, struct pw_port_info *info)
spa_pod_builder_add(b,
"[",
"i", info->id,
"i", info->direction,
"l", info->change_mask,
"s", info->name,
"i", n_items, NULL);
for (i = 0; i < n_items; i++) {
@ -803,8 +803,8 @@ static int port_demarshal_info(void *object, void *data, size_t size)
if (spa_pod_parser_get(&prs,
"["
"i", &info.id,
"i", &info.direction,
"l", &info.change_mask,
"s", &info.name,
"i", &props.n_items, NULL) < 0)
return -EINVAL;