From 1199a459acc3bb91c0ace2a08c6e764e2290a261 Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Sat, 23 Nov 2013 11:25:30 +0100 Subject: [PATCH] Obey device "md" (metadata) tag - credit @couteau - original patch https://gist.github.com/couteau/7532531 --- src/player.c | 21 +++++++++++++++++++++ src/raop.c | 5 +---- src/raop.h | 1 + 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/player.c b/src/player.c index dd1b3a41..6519bb73 100644 --- a/src/player.c +++ b/src/player.c @@ -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; @@ -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; @@ -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; diff --git a/src/raop.c b/src/raop.c index f9e293b6..b535c9c4 100644 --- a/src/raop.c +++ b/src/raop.c @@ -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; } diff --git a/src/raop.h b/src/raop.h index a9206682..1205d0e4 100644 --- a/src/raop.h +++ b/src/raop.h @@ -40,6 +40,7 @@ struct raop_device unsigned selected:1; unsigned advertised:1; + unsigned wants_metadata:1; unsigned has_password:1; const char *password;