device-port: introduce available_group member

In some cases, the I/O connector functionality can be shared
and we cannot determine the proper purpose automatically.
We just know that something was inserted to the jack.

Introduce a group identifier (a simple string - unique
per group) which helps to determine the proper ports
for the application. The user interface may be used
to set the wanted behaviour.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2020-04-14 17:42:34 +02:00 committed by Tanu Kaskinen
parent 9315bbdfe5
commit 861836c5f7
7 changed files with 54 additions and 8 deletions

View file

@ -219,6 +219,11 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u
goto fail;
i.ports[j]->available = av;
}
i.ports[j]->available_group = NULL;
if (o->context->version >= 34) {
if (pa_tagstruct_gets(t, &i.ports[j]->available_group) < 0)
goto fail;
}
}
i.ports[j] = NULL;
@ -492,11 +497,15 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command,
goto fail;
i.ports[j]->available = av;
}
i.ports[j]->available_group = NULL;
if (o->context->version >= 34) {
if (pa_tagstruct_gets(t, &i.ports[j]->available_group) < 0)
goto fail;
}
}
i.ports[j] = NULL;
}
if (pa_tagstruct_gets(t, &ap) < 0)
goto fail;
@ -863,6 +872,11 @@ static int fill_card_port_info(pa_context *context, pa_tagstruct* t, pa_card_inf
return -PA_ERR_PROTOCOL;
} else
port->latency_offset = 0;
if (context->version >= 34) {
if (pa_tagstruct_gets(t, &port->available_group) < 0)
return -PA_ERR_PROTOCOL;
} else
port->available_group = NULL;
}
return 0;