return -EINVAL;
}
-void avrcp_player_event(struct avrcp_player *player, uint8_t id, void *data)
+void avrcp_player_event(struct avrcp_player *player, uint8_t id,
+ const void *data)
{
uint8_t buf[AVRCP_HEADER_LENGTH + 9];
struct avrcp_header *pdu = (void *) buf;
uint16_t size;
GSList *l;
- GList *settings;
+ int attr;
+ int val;
if (player->sessions == NULL)
return;
break;
case AVRCP_EVENT_SETTINGS_CHANGED:
size = 2;
- settings = data;
- pdu->params[1] = g_list_length(settings);
- for (; settings; settings = settings->next) {
- const char *key = settings->data;
- int attr;
- int val;
+ pdu->params[1] = 1;
- attr = attr_to_val(key);
- if (attr < 0)
- continue;
+ attr = attr_to_val(data);
+ if (attr < 0)
+ return;
- val = player_get_setting(player, attr);
- if (val < 0)
- continue;
+ val = player_get_setting(player, attr);
+ if (val < 0)
+ return;
- pdu->params[++size] = attr;
- pdu->params[++size] = val;
- }
+ pdu->params[++size] = attr;
+ pdu->params[++size] = val;
break;
default:
error("Unknown event %u", id);
GDestroyNotify destroy);
void avrcp_unregister_player(struct avrcp_player *player);
-void avrcp_player_event(struct avrcp_player *player, uint8_t id, void *data);
+void avrcp_player_event(struct avrcp_player *player, uint8_t id,
+ const void *data);
size_t avrcp_handle_vendor_reject(uint8_t *code, uint8_t *operands);
const char *value)
{
const char *curval;
- GList *settings;
curval = g_hash_table_lookup(mp->settings, key);
if (g_strcmp0(curval, value) == 0)
g_hash_table_replace(mp->settings, g_strdup(key), g_strdup(value));
- settings = list_settings(mp);
-
- avrcp_player_event(mp->player, AVRCP_EVENT_SETTINGS_CHANGED, settings);
-
- g_list_free(settings);
+ avrcp_player_event(mp->player, AVRCP_EVENT_SETTINGS_CHANGED, key);
return TRUE;
}