int ctl_sink_connect(struct ctl_sink *s, const char *target) { struct sockaddr_in addr = { }; char *t; int r; if (!s || !target || s->fd >= 0) return cli_EINVAL(); addr.sin_family = AF_INET; addr.sin_port = htons(7236); r = inet_pton(AF_INET, target, &addr.sin_addr); if (r != 1) return cli_EINVAL(); t = strdup(target); if (!t) return cli_ENOMEM(); free(s->target); s->target = t; memcpy(&s->addr, &addr, sizeof(addr)); s->addr_size = sizeof(addr); return sink_connect(s); }
static int a2dp_sink_connect(struct btd_service *service) { struct btd_device *dev = btd_service_get_device(service); const char *path = device_get_path(dev); DBG("path %s", path); return sink_connect(service); }