diff --git a/NEWS b/NEWS index c23fc4d..1911719 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,6 @@ 1.0.21 - Released 00-MONTH-2011 -------------------------------- +- Fix FF/REW of AVI files on Samsung Series B TV's. - Fix a crash bug when playing music on TiVo. - Add the ability to change the root media container. - Add WAV/RIFF INFO tag parsing support for the most common tags. diff --git a/minidlnatypes.h b/minidlnatypes.h index 2ca3f2b..8277a50 100644 --- a/minidlnatypes.h +++ b/minidlnatypes.h @@ -80,6 +80,7 @@ enum client_types { ELGDevice, ENetgearEVA2000, ESamsungSeriesA, + ESamsungSeriesB, EStandardDLNA150 = 100 }; diff --git a/minissdp.c b/minissdp.c index 5cfa35c..165f778 100644 --- a/minissdp.c +++ b/minissdp.c @@ -44,6 +44,7 @@ #include "upnpreplyparse.h" #include "getifaddr.h" #include "minissdp.h" +#include "utils.h" #include "log.h" /* SSDP ip/port */ @@ -357,9 +358,9 @@ ParseUPnPClient(char *location) int content_len = sizeof(buf); struct NameValueParserData xml; int client; - enum client_types type = -1; + enum client_types type = 0; uint32_t flags = 0; - char *model; + char *model, *serial; if (strncmp(location, "http://", 7) != 0) return; @@ -442,17 +443,29 @@ close: nread -= off - buf; ParseNameValue(off, nread, &xml); model = GetValueFromNameValueList(&xml, "modelName"); + serial = GetValueFromNameValueList(&xml, "serialNumber"); if( model ) { DPRINTF(E_DEBUG, L_SSDP, "Model: %s\n", model); - if (strstr(model, "Roku SoundBridge")) + if( strstr(model, "Roku SoundBridge") ) { type = ERokuSoundBridge; flags |= FLAG_AUDIO_ONLY; } + else if( strcmp(model, "Samsung DTV DMR") == 0 && serial ) + { + DPRINTF(E_DEBUG, L_SSDP, "Serial: %s\n", serial); + /* The Series B I saw was 20081224DMR. Series A should be older than that. */ + if( atoi(serial) > 20081200 ) + { + type = ESamsungSeriesB; + flags |= FLAG_SAMSUNG; + flags |= FLAG_DLNA; + flags |= FLAG_NO_RESIZE; + } + } } - - if( type < 0 ) + if( !type ) return; client = SearchClientCache(dest.sin_addr, 1); /* Add this client to the cache if it's not there already. */ @@ -542,18 +555,23 @@ ProcessSSDPRequest(int s, unsigned short port) while(man[man_len]!='\r' && man[man_len]!='\n') man_len++; } } - if (!loc || !srv || !man || (strncmp(man, "ssdp:alive", man_len) != 0)) + if( !loc || !srv || !man || (strncmp(man, "ssdp:alive", man_len) != 0) ) { return; } - if (strncmp(srv, "Allegro-Software-RomPlug", 24) == 0) + if( strncmp(srv, "Allegro-Software-RomPlug", 24) == 0 || + strstr(loc, "SamsungMRDesc.xml") ) { /* Check if the client is already in cache */ i = SearchClientCache(sendername.sin_addr, 1); - if( i >= 0 && clients[i].type < EStandardDLNA150 ) + if( i >= 0 ) { - clients[i].age = time(NULL); - return; + if( clients[i].type < EStandardDLNA150 && + clients[i].type != ESamsungSeriesA ) + { + clients[i].age = time(NULL); + return; + } } ParseUPnPClient(loc); } @@ -562,7 +580,7 @@ ProcessSSDPRequest(int s, unsigned short port) else if(memcmp(bufr, "M-SEARCH", 8) == 0) { int st_len = 0, mx_len = 0, mx_val = 0; - //DPRINTF(E_DEBUG, L_SSDP, "Received SSDP request:\n%.*s", n, bufr); + //DPRINTF(E_DEBUG, L_SSDP, "Received SSDP request:\n%.*s\n", n, bufr); for(i=0; i < n; i++) { if( bufr[i] == '*' ) diff --git a/upnpglobalvars.h b/upnpglobalvars.h index 3349324..d6d66d2 100644 --- a/upnpglobalvars.h +++ b/upnpglobalvars.h @@ -56,7 +56,7 @@ #include -#define MINIDLNA_VERSION "1.0.20.2" +#define MINIDLNA_VERSION "1.0.20.3" #ifdef NETGEAR # define SERVER_NAME "ReadyDLNA" diff --git a/upnphttp.c b/upnphttp.c index 3afea6b..49a9a3d 100644 --- a/upnphttp.c +++ b/upnphttp.c @@ -494,9 +494,11 @@ next_header: break; } } - else if( (clients[n].type < EStandardDLNA150) && (h->req_client == EStandardDLNA150) ) + else if( (clients[n].type < EStandardDLNA150 && h->req_client == EStandardDLNA150) || + (clients[n].type == ESamsungSeriesB && h->req_client == ESamsungSeriesA) ) { /* If we know the client and our new detection is generic, use our cached info */ + /* If we detected a Samsung Series B earlier, don't overwrite it with Series A info */ h->reqflags |= clients[n].flags; h->req_client = clients[n].type; return; @@ -1702,13 +1704,18 @@ SendResp_dlnafile(struct upnphttp * h, char * object) off_t total, offset, size; sqlite_int64 id; int sendfh; - static struct { sqlite_int64 id; char path[PATH_MAX]; char mime[32]; char dlna[96]; } last_file = { 0 }; + static struct { sqlite_int64 id; + enum client_types client; + char path[PATH_MAX]; + char mime[32]; + char dlna[96]; + } last_file = { 0, 0 }; #if USE_FORK pid_t newpid = 0; #endif id = strtoll(object, NULL, 10); - if( id != last_file.id ) + if( id != last_file.id || h->req_client != last_file.client ) { sprintf(sql_buf, "SELECT PATH, MIME, DLNA_PN from DETAILS where ID = '%lld'", id); ret = sql_get_table(db, sql_buf, &result, &rows, NULL); @@ -1727,6 +1734,7 @@ SendResp_dlnafile(struct upnphttp * h, char * object) } /* Cache the result */ last_file.id = id; + last_file.client = h->req_client; strncpy(last_file.path, result[3], sizeof(last_file.path)-1); if( result[4] ) { @@ -1894,6 +1902,7 @@ SendResp_dlnafile(struct upnphttp * h, char * object) "Server: " MINIDLNA_SERVER_STRING "\r\n\r\n", date, last_file.dlna); + //DEBUG DPRINTF(E_DEBUG, L_HTTP, "RESPONSE: %s\n", str.data); if( send_data(h, str.data, str.off, MSG_MORE) == 0 ) { if( h->req_command != EHead )