diff --git a/metadata.c b/metadata.c index 366b14b..45fb9df 100644 --- a/metadata.c +++ b/metadata.c @@ -483,7 +483,7 @@ no_exifdata: asprintf(&m.dlna_pn, "JPEG_SM;DLNA.ORG_OP=01;DLNA.ORG_CI=0"); else if( width <= 1024 && height <= 768 ) asprintf(&m.dlna_pn, "JPEG_MED;DLNA.ORG_OP=01;DLNA.ORG_CI=0"); - else if( width <= 4096 && height <= 4096 ) + else if( (width <= 4096 && height <= 4096) || !(GETFLAG(DLNA_STRICT_MASK)) ) asprintf(&m.dlna_pn, "JPEG_LRG;DLNA.ORG_OP=01;DLNA.ORG_CI=0"); asprintf(&m.resolution, "%dx%d", width, height); diff --git a/minidlna.c b/minidlna.c index 6f3b200..6361656 100644 --- a/minidlna.c +++ b/minidlna.c @@ -373,11 +373,15 @@ init(int argc, char * * argv) break; case UPNPINOTIFY: if( (strcmp(ary_options[i].value, "yes") != 0) && !atoi(ary_options[i].value) ) - CLEARFLAG(INOTIFYMASK); + CLEARFLAG(INOTIFY_MASK); break; case ENABLE_TIVO: if( (strcmp(ary_options[i].value, "yes") == 0) || atoi(ary_options[i].value) ) - SETFLAG(TIVOMASK); + SETFLAG(TIVO_MASK); + break; + case ENABLE_DLNA_STRICT: + if( (strcmp(ary_options[i].value, "yes") == 0) || atoi(ary_options[i].value) ) + SETFLAG(DLNA_STRICT_MASK); break; default: fprintf(stderr, "Unknown option in file %s\n", @@ -741,7 +745,7 @@ main(int argc, char * * argv) sqlite3_free_table(result); } if( sqlite3_threadsafe() && sqlite3_libversion_number() >= 3005001 && - GETFLAG(INOTIFYMASK) && pthread_create(&inotify_thread, NULL, start_inotify, NULL) ) + GETFLAG(INOTIFY_MASK) && pthread_create(&inotify_thread, NULL, start_inotify, NULL) ) { DPRINTF(E_FATAL, L_GENERAL, "ERROR: pthread_create() failed for start_inotify.\n"); } @@ -768,7 +772,7 @@ main(int argc, char * * argv) } #ifdef TIVO_SUPPORT - if( GETFLAG(TIVOMASK) ) + if( GETFLAG(TIVO_MASK) ) { DPRINTF(E_WARN, L_GENERAL, "TiVo support is enabled.\n"); /* Add TiVo-specific randomize function to sqlite */ @@ -834,7 +838,7 @@ main(int argc, char * * argv) } } #ifdef TIVO_SUPPORT - if( GETFLAG(TIVOMASK) ) + if( GETFLAG(TIVO_MASK) ) { if(timeofday.tv_sec >= (lastbeacontime.tv_sec + beacon_interval)) { diff --git a/minidlna.conf b/minidlna.conf index bbf69d8..352c14b 100644 --- a/minidlna.conf +++ b/minidlna.conf @@ -27,6 +27,11 @@ inotify=yes # set this to yes to enable support for streaming .jpg and .mp3 files to a TiVo supporting HMO enable_tivo=no +# set this to strictly adhere to DLNA standards. +# * This will allow server-side downscaling of very large JPEG images, +# which may hurt JPEG serving performance on (at least) Sony DLNA products. +strict_dlna=no + # default presentation url is http address on port 80 #presentation_url=http://www.mylan/index.php diff --git a/options.c b/options.c index bbf3374..e654c60 100644 --- a/options.c +++ b/options.c @@ -33,7 +33,8 @@ static const struct { { UPNPMEDIADIR, "media_dir"}, { UPNPALBUMART_NAMES, "album_art_names"}, { UPNPINOTIFY, "inotify" }, - { ENABLE_TIVO, "enable_tivo" } + { ENABLE_TIVO, "enable_tivo" }, + { ENABLE_DLNA_STRICT, "strict_dlna" } }; int diff --git a/options.h b/options.h index 9cbba21..ae0b80f 100644 --- a/options.h +++ b/options.h @@ -26,7 +26,8 @@ enum upnpconfigoptions { UPNPMEDIADIR, /* directory to search for UPnP-A/V content */ UPNPALBUMART_NAMES, /* list of '/'-delimited file names to check for album art */ UPNPINOTIFY, /* enable inotify on the media directories */ - ENABLE_TIVO /* enable support for streaming images and music to TiVo */ + ENABLE_TIVO, /* enable support for streaming images and music to TiVo */ + ENABLE_DLNA_STRICT /* strictly adhere to DLNA specs */ }; /* readoptionsfile() diff --git a/upnpglobalvars.c b/upnpglobalvars.c index 9813b5c..f0a8865 100644 --- a/upnpglobalvars.c +++ b/upnpglobalvars.c @@ -23,7 +23,7 @@ time_t startup_time = 0; struct runtime_vars_s runtime_vars; -int runtime_flags = INOTIFYMASK; +int runtime_flags = INOTIFY_MASK; const char * pidfilename = "/var/run/minidlna.pid"; diff --git a/upnpglobalvars.h b/upnpglobalvars.h index 95ae571..0da3a41 100644 --- a/upnpglobalvars.h +++ b/upnpglobalvars.h @@ -76,8 +76,9 @@ extern time_t startup_time; extern struct runtime_vars_s runtime_vars; /* runtime boolean flags */ extern int runtime_flags; -#define INOTIFYMASK 0x0001 -#define TIVOMASK 0x0002 +#define INOTIFY_MASK 0x0001 +#define TIVO_MASK 0x0002 +#define DLNA_STRICT_MASK 0x0004 #define SETFLAG(mask) runtime_flags |= mask #define GETFLAG(mask) runtime_flags & mask diff --git a/upnphttp.c b/upnphttp.c index f9ca851..36408fc 100644 --- a/upnphttp.c +++ b/upnphttp.c @@ -762,7 +762,7 @@ ProcessHttpQuery_upnphttp(struct upnphttp * h) #ifdef TIVO_SUPPORT else if(strncmp(HttpUrl, "/TiVoConnect", 12) == 0) { - if( GETFLAG(TIVOMASK) ) + if( GETFLAG(TIVO_MASK) ) { if( *(HttpUrl+12) == '?' ) { @@ -1546,7 +1546,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 ) + if( h->req_client != ESamsungTV || GETFLAG(DLNA_STRICT_MASK) ) { Send406(h); goto error;