* Make strict DLNA adherence optional. Many products appear to handle JPEGs >4096x4096 classified as JPEG_LRG, and it's better to not downscale if we don't have to.

This commit is contained in:
Justin Maggard 2009-10-14 21:24:23 +00:00
parent b632bf1704
commit 4efa9d06ac
8 changed files with 25 additions and 13 deletions

View File

@ -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);

View File

@ -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))
{

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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";

View File

@ -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

View File

@ -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;