Skip to content

Instantly share code, notes, and snippets.

@couteau
Created November 18, 2013 18:11
Show Gist options
  • Save couteau/7532531 to your computer and use it in GitHub Desktop.
Save couteau/7532531 to your computer and use it in GitHub Desktop.
forked-daapd fix for non-apple airtunes devices-libevent branch
From ab3a54869b32bfdfe04fb8743d04a792b8e5580f Mon Sep 17 00:00:00 2001
From: Stuart C Naifeh <scnaifeh@ruby.naifeh.org>
Date: Mon, 18 Nov 2013 12:49:49 -0500
Subject: [PATCH 5/5] fix to support non-apple airtunes devices-libevent branch
---
src/player.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
src/raop.c | 12 ++++--------
src/raop.h | 2 ++
3 files changed, 50 insertions(+), 8 deletions(-)
diff --git a/src/player.c b/src/player.c
index 15bd3df..43b3dea 100644
--- a/src/player.c
+++ b/src/player.c
@@ -3590,6 +3590,8 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
char *at_name;
char *password;
uint64_t id;
+ char encrypt;
+ char wants_metadata;
char has_password;
enum raop_devtype devtype;
int ret;
@@ -3721,6 +3723,46 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
devtype = RAOP_DEV_APPLETV;
no_am:
+ p = keyval_get(txt, "ek");
+ if (!p)
+ {
+ DPRINTF(E_LOG, L_PLAYER, "AirTunes %s: no ek field in TXT record!\n", name);
+ encrypt = 0;
+
+ goto no_ek;
+ }
+
+ if (*p == '\0')
+ {
+ DPRINTF(E_LOG, L_PLAYER, "AirTunes %s: ek has no value\n", name);
+ encrypt = 0;
+
+ goto no_ek;
+ }
+
+ encrypt = (*p == '1') ? 1: 0;
+
+ no_ek:
+ p = keyval_get(txt, "md");
+ if (!p)
+ {
+ DPRINTF(E_LOG, L_PLAYER, "AirTunes %s: no md field in TXT record!\n", name);
+ wants_metadata = 0;
+
+ goto no_md;
+ }
+
+ if (*p == '\0')
+ {
+ DPRINTF(E_LOG, L_PLAYER, "AirTunes %s: md has no value\n", name);
+ wants_metadata = 0;
+
+ 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;
@@ -3740,6 +3782,8 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
rd->devtype = devtype;
+ rd->encrypt = encrypt;
+ rd->wants_metadata = wants_metadata;
rd->has_password = has_password;
rd->password = password;
diff --git a/src/raop.c b/src/raop.c
index adaff10..347cf33 100644
--- a/src/raop.c
+++ b/src/raop.c
@@ -1823,26 +1823,22 @@ raop_session_make(struct raop_device *rd, int family, raop_status_cb cb)
rs->status_cb = cb;
rs->server_fd = -1;
+ rs->encrypt = rd->encrypt;
+ rs->wants_metadata = rd->wants_metadata;
rs->password = rd->password;
switch (rd->devtype)
{
case RAOP_DEV_APEX_80211G:
- rs->encrypt = 1;
- rs->auth_quirk_itunes = 1;
- rs->wants_metadata = 0;
- break;
+ rs->auth_quirk_itunes = 1;
+ 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;
}
diff --git a/src/raop.h b/src/raop.h
index 5c240e1..dd08a65 100644
--- a/src/raop.h
+++ b/src/raop.h
@@ -39,6 +39,8 @@ struct raop_device
unsigned selected:1;
unsigned advertised:1;
+ unsigned encrypt:1;
+ unsigned wants_metadata:1;
unsigned has_password:1;
const char *password;
--
1.8.3.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment