From 1e23a1e8e9aba1001cd116e89b034575b305b6dd Mon Sep 17 00:00:00 2001 From: Justin Maggard Date: Wed, 31 Aug 2011 18:21:30 +0000 Subject: [PATCH] * Send a custom root description to enable the subtitle menu on some Samsung TV's. --- NEWS | 4 ++++ minidlnatypes.h | 2 +- upnpdescgen.c | 26 ++++++++++++++++++++++++-- upnpdescgen.h | 3 +++ upnphttp.c | 8 +++++++- upnphttp.h | 3 ++- 6 files changed, 41 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index b98702b..5521433 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +1.0.23 - Released 00-Month-0000 +-------------------------------- +- Enable the subtitle menu on some Samsung TV's. + 1.0.22 - Released 24-Aug-2011 -------------------------------- - Add bookmark support for some Samsung TV's. diff --git a/minidlnatypes.h b/minidlnatypes.h index 31d25dc..63ce852 100644 --- a/minidlnatypes.h +++ b/minidlnatypes.h @@ -68,7 +68,7 @@ enum file_types { enum client_types { EXbox = 1, EPS3, - ESamsungTV, + ESamsungSeriesC, EDenonReceiver, EFreeBox, EPopcornHour, diff --git a/upnpdescgen.c b/upnpdescgen.c index c52ad8c..8126d92 100644 --- a/upnpdescgen.c +++ b/upnpdescgen.c @@ -675,18 +675,40 @@ genRootDesc(int * len) { char * str; int tmplen; - tmplen = 2048; + tmplen = 2560; str = (char *)malloc(tmplen); if(str == NULL) return NULL; * len = strlen(xmlver); - /*strcpy(str, xmlver); */ memcpy(str, xmlver, *len + 1); str = genXML(str, len, &tmplen, rootDesc); str[*len] = '\0'; return str; } +char * +genRootDescSamsung(int * len) +{ + char * str; + int tmplen; + struct XMLElt samsungRootDesc[sizeof(rootDesc)/sizeof(struct XMLElt)]; + tmplen = 2560; + str = (char *)malloc(tmplen); + if(str == NULL) + return NULL; + * len = strlen(xmlver); + memcpy(str, xmlver, *len + 1); + /* Replace the optional modelURL and manufacturerURL fields with Samsung foo */ + memcpy(&samsungRootDesc, &rootDesc, sizeof(rootDesc)); + samsungRootDesc[8+PNPX].eltname = "/sec:ProductCap"; + samsungRootDesc[8+PNPX].data = "smi,DCM10,getMediaInfo.sec,getCaptionInfo.sec"; + samsungRootDesc[12+PNPX].eltname = "/sec:X_ProductCap"; + samsungRootDesc[12+PNPX].data = "smi,DCM10,getMediaInfo.sec,getCaptionInfo.sec"; + str = genXML(str, len, &tmplen, samsungRootDesc); + str[*len] = '\0'; + return str; +} + /* genServiceDesc() : * Generate service description with allowed methods and * related variables. */ diff --git a/upnpdescgen.h b/upnpdescgen.h index edfd9f5..b377d82 100644 --- a/upnpdescgen.h +++ b/upnpdescgen.h @@ -74,6 +74,9 @@ struct stateVar { char * genRootDesc(int * len); +char * +genRootDescSamsung(int * len); + /* for the two following functions */ char * genContentDirectory(int * len); diff --git a/upnphttp.c b/upnphttp.c index d65bf22..19d4bc0 100644 --- a/upnphttp.c +++ b/upnphttp.c @@ -304,10 +304,12 @@ intervening space) by either an integer or the keyword "infinite". */ } else if(strstrc(p, "SEC_HHP_", '\r')) { - h->req_client = ESamsungTV; + h->req_client = ESamsungSeriesC; h->reqflags |= FLAG_SAMSUNG; h->reqflags |= FLAG_DLNA; h->reqflags |= FLAG_NO_RESIZE; + if(strstrc(p, "SEC_HHP_TV", '\r')) + h->reqflags |= FLAG_SAMSUNG_TV; } else if(strncmp(p, "SamsungWiselinkPro", 18)==0) { @@ -844,6 +846,10 @@ ProcessHttpQuery_upnphttp(struct upnphttp * h) sendXMLdesc(h, genRootDesc); friendly_name[i] = '\0'; } + else if( h->reqflags & FLAG_SAMSUNG_TV ) + { + sendXMLdesc(h, genRootDescSamsung); + } else { sendXMLdesc(h, genRootDesc); diff --git a/upnphttp.h b/upnphttp.h index 2998c22..b58ecae 100644 --- a/upnphttp.h +++ b/upnphttp.h @@ -113,7 +113,8 @@ struct upnphttp { #define FLAG_NO_RESIZE 0x02000000 #define FLAG_MS_PFS 0x04000000 // Microsoft PlaysForSure client #define FLAG_SAMSUNG 0x08000000 -#define FLAG_AUDIO_ONLY 0x10000000 +#define FLAG_SAMSUNG_TV 0x10000000 +#define FLAG_AUDIO_ONLY 0x20000000 #define FLAG_FREE_OBJECT_ID 0x00000001 #define FLAG_ROOT_CONTAINER 0x00000002