* Add flag to force downscaled thumbnails rather than using embedded ones.

* Add DirecTV client detection.
This commit is contained in:
Justin Maggard 2012-05-31 18:37:22 +00:00
parent bca5a24a57
commit ba162fc082
4 changed files with 28 additions and 22 deletions

View File

@ -85,6 +85,7 @@ enum client_types {
ESamsungSeriesB,
EMarantzDMP,
ELifeTab,
EDirecTV,
EStandardDLNA150 = 100
};

View File

@ -347,6 +347,7 @@ ParseHttpHeaders(struct upnphttp * h)
else if(strstrc(p, "fbxupnpav/", '\r'))
{
h->req_client = EFreeBox;
h->reqflags |= FLAG_RESIZE_THUMBS;
}
else if(strncmp(p, "SMP8634", 7)==0)
{
@ -367,6 +368,12 @@ ParseHttpHeaders(struct upnphttp * h)
{
h->req_client = ENetgearEVA2000;
h->reqflags |= FLAG_MS_PFS;
h->reqflags |= FLAG_RESIZE_THUMBS;
}
else if(strstrc(p, "DIRECTV ", '\r'))
{
h->req_client = EDirecTV;
h->reqflags |= FLAG_RESIZE_THUMBS;
}
else if(strstrc(p, "UPnP/1.0 DLNADOC/1.50 Intel_SDK_for_UPnP_devices/1.2", '\r'))
{

View File

@ -133,11 +133,12 @@ struct upnphttp {
#define FLAG_MIME_AVI_AVI 0x00400000
#define FLAG_MIME_FLAC_FLAC 0x00800000
#define FLAG_MIME_WAV_WAV 0x01000000
#define FLAG_NO_RESIZE 0x02000000
#define FLAG_MS_PFS 0x04000000 // Microsoft PlaysForSure client
#define FLAG_SAMSUNG 0x08000000
#define FLAG_SAMSUNG_TV 0x10000000
#define FLAG_AUDIO_ONLY 0x20000000
#define FLAG_RESIZE_THUMBS 0x02000000
#define FLAG_NO_RESIZE 0x04000000
#define FLAG_MS_PFS 0x08000000 // Microsoft PlaysForSure client
#define FLAG_SAMSUNG 0x10000000
#define FLAG_SAMSUNG_TV 0x20000000
#define FLAG_AUDIO_ONLY 0x40000000
#define FLAG_FREE_OBJECT_ID 0x00000001
#define FLAG_ROOT_CONTAINER 0x00000002

View File

@ -926,7 +926,7 @@ callback(void *args, int argc, char **argv, char **azColName)
ret = strcatf(str, "<upnp:album>%s</upnp:album>", "[No Keywords]");
/* EVA2000 doesn't seem to handle embedded thumbnails */
if( passed_args->client != ENetgearEVA2000 && tn && atoi(tn) ) {
if( !(passed_args->flags & FLAG_RESIZE_THUMBS) && tn && atoi(tn) ) {
ret = strcatf(str, "<upnp:albumArtURI>"
"http://%s:%d/Thumbnails/%s.jpg"
"</upnp:albumArtURI>",
@ -940,31 +940,28 @@ callback(void *args, int argc, char **argv, char **azColName)
}
if( passed_args->filter & FILTER_RES ) {
mime_to_ext(mime, ext);
if( (passed_args->client == EFreeBox) && tn && atoi(tn) ) {
ret = strcatf(str, "<res protocolInfo=\"http-get:*:%s:%s\">"
"http://%s:%d/Thumbnails/%s.jpg"
"</res>",
mime, "DLNA.ORG_PN=JPEG_TN", lan_addr[passed_args->iface].str,
runtime_vars.port, detailID);
}
add_res(size, duration, bitrate, sampleFrequency, nrAudioChannels,
resolution, dlna_buf, mime, detailID, ext, passed_args);
if( (*mime == 'i') && (passed_args->client != EFreeBox) ) {
int srcw = atoi(strsep(&resolution, "x"));
int srch = atoi(resolution);
if( !dlna_pn ) {
add_resized_res(srcw, srch, 4096, 4096, "JPEG_LRG", detailID, passed_args);
if( *mime == 'i' ) {
int srcw, srch;
if( resolution && (sscanf(resolution, "%dx%d", &srcw, &srch) == 2) )
{
if( srcw > 4096 || srch > 4096 )
add_resized_res(srcw, srch, 4096, 4096, "JPEG_LRG", detailID, passed_args);
if( srcw > 1024 || srch > 768 )
add_resized_res(srcw, srch, 1024, 768, "JPEG_MED", detailID, passed_args);
if( srcw > 640 || srch > 480 )
add_resized_res(srcw, srch, 640, 480, "JPEG_SM", detailID, passed_args);
}
if( !dlna_pn || !strncmp(dlna_pn, "JPEG_L", 6) || !strncmp(dlna_pn, "JPEG_M", 6) ) {
add_resized_res(srcw, srch, 640, 480, "JPEG_SM", detailID, passed_args);
}
if( tn && atoi(tn) ) {
if( !(passed_args->flags & FLAG_RESIZE_THUMBS) && tn && atoi(tn) ) {
ret = strcatf(str, "<res protocolInfo=\"http-get:*:%s:%s\">"
"http://%s:%d/Thumbnails/%s.jpg"
"</res>",
mime, "DLNA.ORG_PN=JPEG_TN;DLNA.ORG_CI=1", lan_addr[passed_args->iface].str,
runtime_vars.port, detailID);
}
else
add_resized_res(srcw, srch, 160, 160, "JPEG_TN", detailID, passed_args);
}
else if( *mime == 'v' ) {
switch( passed_args->client ) {