static void set_volume(uint8_t volume, struct audio_device *dev, void *user_data) { struct media_player *mp = user_data; GSList *l; if (mp->volume == volume) return; mp->volume = volume; for (l = mp->adapter->endpoints; l; l = l->next) { struct media_endpoint *endpoint = l->data; struct media_transport *transport; /* Volume is A2DP only */ if (endpoint->sep == NULL) continue; transport = find_device_transport(endpoint, dev); if (transport == NULL) continue; media_transport_update_volume(transport, volume); } }
void media_transport_update_device_volume(struct btd_device *dev, uint8_t volume) { GSList *l; if (dev == NULL) return; for (l = transports; l; l = l->next) { struct media_transport *transport = l->data; if (transport->device != dev) continue; /* Volume is A2DP only */ if (media_endpoint_get_sep(transport->endpoint)) media_transport_update_volume(transport, volume); } }