Skip to content

Commit

Permalink
Obey device "md" (metadata) tag - credit @couteau
Browse files Browse the repository at this point in the history
  • Loading branch information
ejurgensen committed Nov 23, 2013
1 parent 9760a43 commit 1199a45
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
21 changes: 21 additions & 0 deletions src/player.c
Original file line number Diff line number Diff line change
Expand Up @@ -3716,6 +3716,7 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
char *at_name;
char *password;
uint64_t id;
char wants_metadata;
char has_password;
enum raop_devtype devtype;
int ret;
Expand Down Expand Up @@ -3850,6 +3851,25 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
devtype = OTHER;

no_am:
wants_metadata = 0;
p = keyval_get(txt, "md");
if (!p)
{
DPRINTF(E_LOG, L_PLAYER, "AirTunes %s: no md field in TXT record!\n", name);

goto no_md;
}

if (*p == '\0')
{
DPRINTF(E_LOG, L_PLAYER, "AirTunes %s: md has no value\n", name);

goto no_md;
}

wants_metadata = 1;

no_md:
DPRINTF(E_DBG, L_PLAYER, "AirTunes device %s: password: %s, type %s\n", name, (password) ? "yes" : "no", raop_devtype[devtype]);

rd->advertised = 1;
Expand All @@ -3869,6 +3889,7 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha

rd->devtype = devtype;

rd->wants_metadata = wants_metadata;
rd->has_password = has_password;
rd->password = password;

Expand Down
5 changes: 1 addition & 4 deletions src/raop.c
Original file line number Diff line number Diff line change
Expand Up @@ -1848,31 +1848,28 @@ raop_session_make(struct raop_device *rd, int family, raop_status_cb cb)
rs->server_fd = -1;

rs->password = rd->password;
rs->wants_metadata = rd->wants_metadata;

switch (rd->devtype)
{
case RAOP_DEV_APEX_80211G:
rs->encrypt = 1;
rs->auth_quirk_itunes = 1;
rs->wants_metadata = 0;
break;

case RAOP_DEV_APEX_80211N:
rs->encrypt = 1;
rs->auth_quirk_itunes = 0;
rs->wants_metadata = 0;
break;

case RAOP_DEV_APPLETV:
rs->encrypt = 0;
rs->auth_quirk_itunes = 0;
rs->wants_metadata = 1;
break;

case OTHER:
rs->encrypt = 0;
rs->auth_quirk_itunes = 0;
rs->wants_metadata = 0;
break;
}

Expand Down
1 change: 1 addition & 0 deletions src/raop.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ struct raop_device
unsigned selected:1;
unsigned advertised:1;

unsigned wants_metadata:1;
unsigned has_password:1;
const char *password;

Expand Down

0 comments on commit 1199a45

Please sign in to comment.