mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-29 23:46:01 -05:00
Identify RAOP device type
Identify the device type in the mDNS callback and decide features & quirk in RAOP based on the identified device type.
This commit is contained in:
parent
3abf62179e
commit
aa33b520ed
25
src/player.c
25
src/player.c
@ -123,6 +123,15 @@ struct player_source
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Keep in sync with enum raop_devtype */
|
||||||
|
static const char *raop_devtype[] =
|
||||||
|
{
|
||||||
|
"AirPort Express 802.11G",
|
||||||
|
"AirPort Express 802.11N",
|
||||||
|
"AppleTV",
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct event_base *evbase_player;
|
struct event_base *evbase_player;
|
||||||
|
|
||||||
#ifdef USE_EVENTFD
|
#ifdef USE_EVENTFD
|
||||||
@ -2985,9 +2994,8 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
|
|||||||
char *password;
|
char *password;
|
||||||
uint64_t id;
|
uint64_t id;
|
||||||
char has_password;
|
char has_password;
|
||||||
char encrypt;
|
|
||||||
char auth_quirk_itunes;
|
|
||||||
char last_active;
|
char last_active;
|
||||||
|
enum raop_devtype devtype;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = safe_hextou64(name, &id);
|
ret = safe_hextou64(name, &id);
|
||||||
@ -3072,15 +3080,15 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
|
|||||||
DPRINTF(E_LOG, L_PLAYER, "No password given in config for AirTunes device %s\n", name);
|
DPRINTF(E_LOG, L_PLAYER, "No password given in config for AirTunes device %s\n", name);
|
||||||
}
|
}
|
||||||
|
|
||||||
encrypt = 1;
|
devtype = RAOP_DEV_APEX_80211N;
|
||||||
auth_quirk_itunes = 0;
|
|
||||||
p = keyval_get(txt, "am");
|
p = keyval_get(txt, "am");
|
||||||
if (!p)
|
if (!p)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_PLAYER, "AirTunes %s: no am field in TXT record!\n", name);
|
DPRINTF(E_LOG, L_PLAYER, "AirTunes %s: no am field in TXT record!\n", name);
|
||||||
|
|
||||||
/* Old AirPort Express */
|
/* Old AirPort Express */
|
||||||
auth_quirk_itunes = 1;
|
devtype = RAOP_DEV_APEX_80211G;
|
||||||
|
|
||||||
goto no_am;
|
goto no_am;
|
||||||
}
|
}
|
||||||
@ -3093,7 +3101,7 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (strncmp(p, "AppleTV", strlen("AppleTV")) == 0)
|
if (strncmp(p, "AppleTV", strlen("AppleTV")) == 0)
|
||||||
encrypt = 0;
|
devtype = RAOP_DEV_APPLETV;
|
||||||
|
|
||||||
no_am:
|
no_am:
|
||||||
/* Check if the device was selected last time */
|
/* Check if the device was selected last time */
|
||||||
@ -3124,7 +3132,7 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
|
|||||||
if (rd->name)
|
if (rd->name)
|
||||||
DPRINTF(E_DBG, L_PLAYER, "Updating AirTunes device %s, already in list\n", name);
|
DPRINTF(E_DBG, L_PLAYER, "Updating AirTunes device %s, already in list\n", name);
|
||||||
else
|
else
|
||||||
DPRINTF(E_DBG, L_PLAYER, "Adding AirTunes device %s (password: %s)\n", name, (password) ? "yes" : "no");
|
DPRINTF(E_DBG, L_PLAYER, "Adding AirTunes device %s (password: %s, type %s)\n", name, (password) ? "yes" : "no", raop_devtype[devtype]);
|
||||||
|
|
||||||
rd->advertised = 1;
|
rd->advertised = 1;
|
||||||
rd->selected = last_active;
|
rd->selected = last_active;
|
||||||
@ -3152,8 +3160,7 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
|
|||||||
free(rd->name);
|
free(rd->name);
|
||||||
rd->name = strdup(at_name);
|
rd->name = strdup(at_name);
|
||||||
|
|
||||||
rd->encrypt = encrypt;
|
rd->devtype = devtype;
|
||||||
rd->auth_quirk_itunes = auth_quirk_itunes;
|
|
||||||
|
|
||||||
rd->has_password = has_password;
|
rd->has_password = has_password;
|
||||||
rd->password = password;
|
rd->password = password;
|
||||||
|
21
src/raop.c
21
src/raop.c
@ -1559,11 +1559,26 @@ raop_session_make(struct raop_device *rd, int family, raop_status_cb cb)
|
|||||||
rs->status_cb = cb;
|
rs->status_cb = cb;
|
||||||
rs->server_fd = -1;
|
rs->server_fd = -1;
|
||||||
|
|
||||||
rs->encrypt = rd->encrypt;
|
|
||||||
rs->auth_quirk_itunes = rd->auth_quirk_itunes;
|
|
||||||
|
|
||||||
rs->password = rd->password;
|
rs->password = rd->password;
|
||||||
|
|
||||||
|
switch (rd->devtype)
|
||||||
|
{
|
||||||
|
case RAOP_DEV_APEX_80211G:
|
||||||
|
rs->encrypt = 1;
|
||||||
|
rs->auth_quirk_itunes = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RAOP_DEV_APEX_80211N:
|
||||||
|
rs->encrypt = 1;
|
||||||
|
rs->auth_quirk_itunes = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RAOP_DEV_APPLETV:
|
||||||
|
rs->encrypt = 0;
|
||||||
|
rs->auth_quirk_itunes = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
rs->ctrl = evrtsp_connection_new(address, port);
|
rs->ctrl = evrtsp_connection_new(address, port);
|
||||||
if (!rs->ctrl)
|
if (!rs->ctrl)
|
||||||
{
|
{
|
||||||
|
10
src/raop.h
10
src/raop.h
@ -16,6 +16,12 @@ union sockaddr_all
|
|||||||
struct sockaddr_storage ss;
|
struct sockaddr_storage ss;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum raop_devtype {
|
||||||
|
RAOP_DEV_APEX_80211G,
|
||||||
|
RAOP_DEV_APEX_80211N,
|
||||||
|
RAOP_DEV_APPLETV,
|
||||||
|
};
|
||||||
|
|
||||||
struct raop_session;
|
struct raop_session;
|
||||||
|
|
||||||
struct raop_device
|
struct raop_device
|
||||||
@ -28,10 +34,10 @@ struct raop_device
|
|||||||
short v4_port;
|
short v4_port;
|
||||||
short v6_port;
|
short v6_port;
|
||||||
|
|
||||||
|
enum raop_devtype devtype;
|
||||||
|
|
||||||
unsigned selected:1;
|
unsigned selected:1;
|
||||||
unsigned advertised:1;
|
unsigned advertised:1;
|
||||||
unsigned encrypt:1;
|
|
||||||
unsigned auth_quirk_itunes:1;
|
|
||||||
|
|
||||||
unsigned has_password:1;
|
unsigned has_password:1;
|
||||||
const char *password;
|
const char *password;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user