* Add WAV MIME workaround for Marantz Receivers and Roku SoundBridge.

* Fix bitrate displayed on Microsoft PFS devices.
This commit is contained in:
Justin Maggard
2011-08-18 23:24:17 +00:00
parent c599ed3a9f
commit 546175743a
6 changed files with 55 additions and 24 deletions

View File

@ -364,7 +364,7 @@ ParseUPnPClient(char *location)
int client;
enum client_types type = 0;
uint32_t flags = 0;
char *model, *serial;
char *model, *serial, *name;
if (strncmp(location, "http://", 7) != 0)
return;
@ -448,13 +448,16 @@ close:
ParseNameValue(off, nread, &xml);
model = GetValueFromNameValueList(&xml, "modelName");
serial = GetValueFromNameValueList(&xml, "serialNumber");
name = GetValueFromNameValueList(&xml, "friendlyName");
if( model )
{
DPRINTF(E_DEBUG, L_SSDP, "Model: %s\n", model);
if( strstr(model, "Roku SoundBridge") )
{
type = ERokuSoundBridge;
flags |= FLAG_MS_PFS;
flags |= FLAG_AUDIO_ONLY;
flags |= FLAG_MIME_WAV_WAV;
}
else if( strcmp(model, "Samsung DTV DMR") == 0 && serial )
{
@ -468,12 +471,21 @@ close:
flags |= FLAG_NO_RESIZE;
}
}
else
{
if( name && (strcmp(name, "marantz DMP") == 0) )
{
type = EMarantzDMP;
flags |= FLAG_DLNA;
flags |= FLAG_MIME_WAV_WAV;
}
}
}
ClearNameValueList(&xml);
if( !type )
return;
client = SearchClientCache(dest.sin_addr, 1);
/* Add this client to the cache if it's not there already. */
client = SearchClientCache(dest.sin_addr, 1);
if( client < 0 )
{
for( client=0; client<CLIENT_CACHE_SLOTS; client++ )
@ -506,7 +518,7 @@ ProcessSSDPRequest(int s, unsigned short port)
socklen_t len_r;
struct sockaddr_in sendername;
int i;
char *st = NULL, *mx = NULL, *man = NULL, *mx_end = NULL, *loc = NULL, *srv = NULL;
char *st = NULL, *mx = NULL, *man = NULL, *mx_end = NULL;
int man_len = 0;
len_r = sizeof(struct sockaddr_in);
@ -521,7 +533,8 @@ ProcessSSDPRequest(int s, unsigned short port)
if(memcmp(bufr, "NOTIFY", 6) == 0)
{
int loc_len = 0, srv_len = 0;
char *loc = NULL, *srv = NULL, *nts = NULL, *nt = NULL;
int loc_len = 0;
//DEBUG DPRINTF(E_DEBUG, L_SSDP, "Received SSDP notify:\n%.*s", n, bufr);
for(i=0; i < n; i++)
{
@ -540,32 +553,34 @@ ProcessSSDPRequest(int s, unsigned short port)
if(strncasecmp(bufr+i, "SERVER:", 7) == 0)
{
srv = bufr+i+7;
srv_len = 0;
while(*srv == ' ' || *srv == '\t') srv++;
while(srv[srv_len]!='\r' && srv[srv_len]!='\n') srv_len++;
}
else if(strncasecmp(bufr+i, "LOCATION:", 9) == 0)
{
loc = bufr+i+9;
loc_len = 0;
while(*loc == ' ' || *loc == '\t') loc++;
while(loc[loc_len]!='\r' && loc[loc_len]!='\n') loc_len++;
loc[loc_len] = '\0';
}
else if(strncasecmp(bufr+i, "NTS:", 4) == 0)
{
man = bufr+i+4;
man_len = 0;
while(*man == ' ' || *man == '\t') man++;
while(man[man_len]!='\r' && man[man_len]!='\n') man_len++;
nts = bufr+i+4;
while(*nts == ' ' || *nts == '\t') nts++;
}
else if(strncasecmp(bufr+i, "NT:", 3) == 0)
{
nt = bufr+i+3;
while(*nt == ' ' || *nt == '\t') nt++;
}
}
if( !loc || !srv || !man || (strncmp(man, "ssdp:alive", man_len) != 0) )
if( !loc || !srv || !nt || !nts || (strncmp(nts, "ssdp:alive", 10) != 0) ||
(strncmp(nt, "urn:schemas-upnp-org:device:MediaRenderer", 41) != 0) )
{
return;
}
if( strncmp(srv, "Allegro-Software-RomPlug", 24) == 0 ||
strstr(loc, "SamsungMRDesc.xml") )
loc[loc_len] = '\0';
if( (strncmp(srv, "Allegro-Software-RomPlug", 24) == 0) || /* Roku */
(strstr(loc, "SamsungMRDesc.xml") != NULL) || /* Samsung TV */
(strstrc(srv, "DigiOn DiXiM", '\r') != NULL) ) /* Marantz Receiver */
{
/* Check if the client is already in cache */
i = SearchClientCache(sendername.sin_addr, 1);