mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
pulse-server: use EnumFormat as fallback
Use a fixated format and position from EnumFormat as a fallback.
This commit is contained in:
parent
124b1221a6
commit
66cf4e68d5
3 changed files with 61 additions and 17 deletions
|
|
@ -326,18 +326,19 @@ static int format_parse_param(const struct spa_pod *param, struct sample_spec *s
|
|||
!SPA_AUDIO_FORMAT_IS_INTERLEAVED(info.info.raw.format)) {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
if (ss) {
|
||||
ss->format = format_id2pa(info.info.raw.format);
|
||||
if (ss->format == SAMPLE_INVALID)
|
||||
return -ENOTSUP;
|
||||
|
||||
ss->rate = info.info.raw.rate;
|
||||
ss->channels = info.info.raw.channels;
|
||||
|
||||
}
|
||||
if (map) {
|
||||
map->channels = info.info.raw.channels;
|
||||
for (i = 0; i < map->channels; i++)
|
||||
map->map[i] = channel_id2pa(info.info.raw.position[i], &aux);
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -529,8 +529,6 @@ struct pw_manager *pw_manager_new(struct pw_core *core)
|
|||
&m->registry_listener,
|
||||
®istry_events, m);
|
||||
|
||||
core_sync(m);
|
||||
|
||||
return &m->this;
|
||||
}
|
||||
|
||||
|
|
@ -540,6 +538,7 @@ void pw_manager_add_listener(struct pw_manager *manager,
|
|||
{
|
||||
struct manager *m = SPA_CONTAINER_OF(manager, struct manager, this);
|
||||
spa_hook_list_append(&m->hooks, listener, events, data);
|
||||
core_sync(m);
|
||||
}
|
||||
|
||||
struct pw_manager_object *pw_manager_find_object(struct pw_manager *manager,
|
||||
|
|
|
|||
|
|
@ -1067,7 +1067,6 @@ static int reply_create_playback_stream(struct stream *stream)
|
|||
peer_name = NULL;
|
||||
peer_suspended = false;
|
||||
}
|
||||
pw_log_info("peer:%p id:%d name:%s", peer, peer_id, peer_name);
|
||||
|
||||
if (client->version >= 9) {
|
||||
message_put(reply,
|
||||
|
|
@ -1179,7 +1178,6 @@ static int reply_create_record_stream(struct stream *stream)
|
|||
peer_name = NULL;
|
||||
peer_suspended = false;
|
||||
}
|
||||
pw_log_info("peer:%p id:%d name:%s", peer, peer_id, peer_name);
|
||||
|
||||
if (client->version >= 9) {
|
||||
message_put(reply,
|
||||
|
|
@ -1928,8 +1926,6 @@ static int do_create_record_stream(struct client *client, uint32_t command, uint
|
|||
if (no_move)
|
||||
flags |= PW_STREAM_FLAG_DONT_RECONNECT;
|
||||
|
||||
pw_log_info("direct %u", direct_on_input_idx);
|
||||
|
||||
if (direct_on_input_idx != SPA_ID_INVALID) {
|
||||
source_index = direct_on_input_idx;
|
||||
} else if (source_name != NULL) {
|
||||
|
|
@ -2917,11 +2913,23 @@ static int fill_sink_info(struct client *client, struct message *m,
|
|||
|
||||
spa_list_for_each(p, &o->param_list, link) {
|
||||
switch (p->id) {
|
||||
case SPA_PARAM_EnumFormat:
|
||||
{
|
||||
struct spa_pod *copy = spa_pod_copy(p->param);
|
||||
spa_pod_fixate(copy);
|
||||
format_parse_param(copy, &ss, &map);
|
||||
free(copy);
|
||||
break;
|
||||
}
|
||||
case SPA_PARAM_Format:
|
||||
format_parse_param(p->param, &ss, &map);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ss.channels != map.channels)
|
||||
ss.channels = map.channels;
|
||||
if (volume_info.volume.channels != map.channels)
|
||||
volume_info.volume.channels = map.channels;
|
||||
|
||||
message_put(m,
|
||||
TAG_U32, o->id, /* sink index */
|
||||
|
|
@ -3010,11 +3018,23 @@ static int fill_source_info(struct client *client, struct message *m,
|
|||
|
||||
spa_list_for_each(p, &o->param_list, link) {
|
||||
switch (p->id) {
|
||||
case SPA_PARAM_EnumFormat:
|
||||
{
|
||||
struct spa_pod *copy = spa_pod_copy(p->param);
|
||||
spa_pod_fixate(copy);
|
||||
format_parse_param(copy, &ss, &map);
|
||||
free(copy);
|
||||
break;
|
||||
}
|
||||
case SPA_PARAM_Format:
|
||||
format_parse_param(p->param, &ss, &map);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ss.channels != map.channels)
|
||||
ss.channels = map.channels;
|
||||
if (volume_info.volume.channels != map.channels)
|
||||
volume_info.volume.channels = map.channels;
|
||||
|
||||
message_put(m,
|
||||
TAG_U32, is_monitor ? o->id | 0x10000 : o->id, /* source index */
|
||||
|
|
@ -3088,6 +3108,14 @@ static int fill_sink_input_info(struct client *client, struct message *m,
|
|||
|
||||
spa_list_for_each(p, &o->param_list, link) {
|
||||
switch (p->id) {
|
||||
case SPA_PARAM_EnumFormat:
|
||||
{
|
||||
struct spa_pod *copy = spa_pod_copy(p->param);
|
||||
spa_pod_fixate(copy);
|
||||
format_parse_param(copy, &ss, &map);
|
||||
free(copy);
|
||||
break;
|
||||
}
|
||||
case SPA_PARAM_Format:
|
||||
format_parse_param(p->param, &ss, &map);
|
||||
break;
|
||||
|
|
@ -3096,6 +3124,10 @@ static int fill_sink_input_info(struct client *client, struct message *m,
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (ss.channels != map.channels)
|
||||
ss.channels = map.channels;
|
||||
if (volume_info.volume.channels != map.channels)
|
||||
volume_info.volume.channels = map.channels;
|
||||
|
||||
peer = find_linked(client, o->id, PW_DIRECTION_OUTPUT);
|
||||
|
||||
|
|
@ -3164,6 +3196,14 @@ static int fill_source_output_info(struct client *client, struct message *m,
|
|||
|
||||
spa_list_for_each(p, &o->param_list, link) {
|
||||
switch (p->id) {
|
||||
case SPA_PARAM_EnumFormat:
|
||||
{
|
||||
struct spa_pod *copy = spa_pod_copy(p->param);
|
||||
spa_pod_fixate(copy);
|
||||
format_parse_param(copy, &ss, &map);
|
||||
free(copy);
|
||||
break;
|
||||
}
|
||||
case SPA_PARAM_Format:
|
||||
format_parse_param(p->param, &ss, &map);
|
||||
break;
|
||||
|
|
@ -3172,6 +3212,10 @@ static int fill_source_output_info(struct client *client, struct message *m,
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (ss.channels != map.channels)
|
||||
ss.channels = map.channels;
|
||||
if (volume_info.volume.channels != map.channels)
|
||||
volume_info.volume.channels = map.channels;
|
||||
|
||||
peer = find_linked(client, o->id, PW_DIRECTION_INPUT);
|
||||
if (peer && is_source_or_monitor(peer)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue