* Make a distiction between Samsung A series and later models. We need to trick A series only into playing AVI files.

This commit is contained in:
Justin Maggard 2011-05-28 00:01:21 +00:00
parent bec766497a
commit 0cf2e5731a
4 changed files with 26 additions and 12 deletions

View File

@ -78,6 +78,7 @@ enum client_types {
EToshibaTV,
ELGDevice,
ENetgearEVA2000,
ESamsungSeriesA,
EStandardDLNA150 = 100
};

View File

@ -302,13 +302,19 @@ intervening space) by either an integer or the keyword "infinite". */
h->reqflags |= FLAG_DLNA;
h->reqflags |= FLAG_MIME_AVI_DIVX;
}
else if(strncmp(p, "SamsungWiselinkPro", 18)==0 ||
strncmp(p, "SEC_HHP_", 8)==0)
else if(strncmp(p, "SEC_HHP_", 8)==0)
{
h->req_client = ESamsungTV;
h->reqflags |= FLAG_SAMSUNG;
h->reqflags |= FLAG_DLNA;
h->reqflags |= FLAG_NO_RESIZE;
}
else if(strncmp(p, "SamsungWiselinkPro", 18)==0)
{
h->req_client = ESamsungSeriesA;
h->reqflags |= FLAG_SAMSUNG;
h->reqflags |= FLAG_DLNA;
h->reqflags |= FLAG_NO_RESIZE;
//h->reqflags |= FLAG_MIME_AVI_DIVX;
}
else if(strstrc(p, "bridgeCo-DMP/3", '\r'))
{
@ -1726,10 +1732,16 @@ SendResp_dlnafile(struct upnphttp * h, char * object)
{
strncpy(last_file.mime, result[4], sizeof(last_file.mime)-1);
/* From what I read, Samsung TV's expect a [wrong] MIME type of x-mkv. */
if( h->req_client == ESamsungTV )
if( h->reqflags & FLAG_SAMSUNG )
{
if( strcmp(last_file.mime+6, "x-matroska") == 0 )
strcpy(last_file.mime+8, "mkv");
/* Samsung TV's such as the A750 can natively support many
Xvid/DivX AVI's however, the DLNA server needs the
mime type to say video/mpeg */
else if( h->req_client == ESamsungSeriesA &&
strcmp(last_file.mime+6, "x-msvideo") == 0 )
strcpy(last_file.mime+6, "mpeg");
}
/* ... and Sony BDP-S370 won't play MKV unless we pretend it's a DiVX file */
else if( h->req_client == ESonyBDP )
@ -1781,7 +1793,7 @@ SendResp_dlnafile(struct upnphttp * h, char * object)
DPRINTF(E_WARN, L_HTTP, "Client tried to specify transferMode as Interactive without an image!\n");
/* Samsung TVs (well, at least the A950) do this for some reason,
* and I don't see them fixing this bug any time soon. */
if( h->req_client != ESamsungTV || GETFLAG(DLNA_STRICT_MASK) )
if( !(h->reqflags & FLAG_SAMSUNG) || GETFLAG(DLNA_STRICT_MASK) )
{
Send406(h);
goto error;

View File

@ -111,7 +111,8 @@ struct upnphttp {
#define FLAG_MIME_FLAC_FLAC 0x00800000
#define FLAG_NO_RESIZE 0x01000000
#define FLAG_MS_PFS 0x02000000 // Microsoft PlaysForSure client
#define FLAG_AUDIO_ONLY 0x04000000
#define FLAG_SAMSUNG 0x04000000
#define FLAG_AUDIO_ONLY 0x08000000
#define FLAG_FREE_OBJECT_ID 0x00000001

View File

@ -346,14 +346,14 @@ mime_to_ext(const char * mime, char * buf)
#define FILTER_UPNP_SEARCHCLASS 0x00100000
static u_int32_t
set_filter_flags(char * filter, enum client_types client)
set_filter_flags(char * filter, struct upnphttp *h)
{
char *item, *saveptr = NULL;
u_int32_t flags = 0;
if( !filter || (strlen(filter) <= 1) )
return 0xFFFFFFFF;
if( client == ESamsungTV )
if( h->reqflags & FLAG_SAMSUNG )
flags |= FILTER_DLNA_NAMESPACE;
item = strtok_r(filter, ",", &saveptr);
while( item != NULL )
@ -393,7 +393,7 @@ set_filter_flags(char * filter, enum client_types client)
else if( strcmp(item, "upnp:albumArtURI") == 0 )
{
flags |= FILTER_UPNP_ALBUMARTURI;
if( client == ESamsungTV )
if( h->reqflags & FLAG_SAMSUNG )
flags |= FILTER_UPNP_ALBUMARTURI_DLNA_PROFILEID;
}
else if( strcmp(item, "upnp:albumArtURI@dlna:profileID") == 0 )
@ -694,7 +694,7 @@ callback(void *args, int argc, char **argv, char **azColName)
}
}
/* From what I read, Samsung TV's expect a [wrong] MIME type of x-mkv. */
if( passed_args->client == ESamsungTV )
if( passed_args->flags & FLAG_SAMSUNG )
{
if( strcmp(mime+6, "x-matroska") == 0 )
{
@ -992,7 +992,7 @@ BrowseContentDirectory(struct upnphttp * h, const char * action)
str.off = sprintf(str.data, "%s", resp0);
/* See if we need to include DLNA namespace reference */
args.iface = h->iface;
args.filter = set_filter_flags(Filter, h->req_client);
args.filter = set_filter_flags(Filter, h);
if( args.filter & FILTER_DLNA_NAMESPACE )
{
ret = strcatf(&str, DLNA_NAMESPACE);
@ -1169,7 +1169,7 @@ SearchContentDirectory(struct upnphttp * h, const char * action)
str.off = sprintf(str.data, "%s", resp0);
/* See if we need to include DLNA namespace reference */
args.iface = h->iface;
args.filter = set_filter_flags(Filter, h->req_client);
args.filter = set_filter_flags(Filter, h);
if( args.filter & FILTER_DLNA_NAMESPACE )
{
ret = strcatf(&str, DLNA_NAMESPACE);