struct source_state_callback {
source_state_cb cb;
+ struct audio_device *dev;
void *user_data;
unsigned int id;
};
for (l = source_callbacks; l != NULL; l = l->next) {
struct source_state_callback *cb = l->data;
+
+ if (cb->dev != dev)
+ continue;
+
cb->cb(dev, old_state, new_state, cb->user_data);
}
return avdtp_close(source->session, source->stream, FALSE);
}
-unsigned int source_add_state_cb(source_state_cb cb, void *user_data)
+unsigned int source_add_state_cb(struct audio_device *dev, source_state_cb cb,
+ void *user_data)
{
struct source_state_callback *state_cb;
static unsigned int id = 0;
state_cb = g_new(struct source_state_callback, 1);
state_cb->cb = cb;
+ state_cb->dev = dev;
state_cb->user_data = user_data;
state_cb->id = ++id;
source_state_t new_state,
void *user_data);
-unsigned int source_add_state_cb(source_state_cb cb, void *user_data);
+unsigned int source_add_state_cb(struct audio_device *dev, source_state_cb cb,
+ void *user_data);
gboolean source_remove_state_cb(unsigned int id);
struct source *source_init(struct audio_device *dev);
{
struct media_transport *transport = user_data;
- if (dev != transport->device)
- return;
-
if (new_state == SOURCE_STATE_PLAYING)
transport_update_playing(transport, TRUE);
else
} else {
a2dp->volume = 127;
avrcp_set_volume(device, a2dp->volume);
- transport->source_watch = source_add_state_cb(
+ transport->source_watch = source_add_state_cb(device,
source_state_changed,
transport);
}