mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-08 13:29:59 -05:00
alsa: Move UCM port availability updating to the mixer code
Previously module-alsa-card assigned to pa_alsa_jack.plugged_in directly, and then did the port availability updating manually. The idea of pa_alsa_jack_set_plugged_in() is to move the availability updating to the mixer infrastructure, where it really belongs. Similarly, pa_alsa_jack.has_control was previously modified directly from several places. The has_control field affects the port availability, and pa_alsa_jack_set_has_control() takes care of updating the availability. For now, pa_alsa_jack_set_plugged_in() and pa_alsa_jack_set_has_control() only update the port availability when using UCM. My plan is to adapt the traditional mixer code later.
This commit is contained in:
parent
40714b6bcc
commit
c9557e6969
6 changed files with 112 additions and 17 deletions
|
|
@ -66,8 +66,6 @@ void pa_device_port_new_data_done(pa_device_port_new_data *data) {
|
|||
}
|
||||
|
||||
void pa_device_port_set_available(pa_device_port *p, pa_available_t status) {
|
||||
pa_core *core;
|
||||
|
||||
pa_assert(p);
|
||||
|
||||
if (p->available == status)
|
||||
|
|
@ -80,10 +78,14 @@ void pa_device_port_set_available(pa_device_port *p, pa_available_t status) {
|
|||
status == PA_AVAILABLE_NO ? "no" : "unknown");
|
||||
|
||||
/* Post subscriptions to the card which owns us */
|
||||
pa_assert_se(core = p->core);
|
||||
pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, p->card->index);
|
||||
|
||||
pa_hook_fire(&core->hooks[PA_CORE_HOOK_PORT_AVAILABLE_CHANGED], p);
|
||||
/* XXX: We need to check p->card, because this function may be called
|
||||
* before the card object has been created. The card object should probably
|
||||
* be created before port objects, and then p->card could be non-NULL for
|
||||
* the whole lifecycle of pa_device_port. */
|
||||
if (p->card) {
|
||||
pa_subscription_post(p->core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, p->card->index);
|
||||
pa_hook_fire(&p->core->hooks[PA_CORE_HOOK_PORT_AVAILABLE_CHANGED], p);
|
||||
}
|
||||
}
|
||||
|
||||
static void device_port_free(pa_object *o) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue