You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

80 lines
2.6 KiB

From aae49f0f80e73d1b52f23b89b0d314e9b9f89425 Mon Sep 17 00:00:00 2001
From: Daniel Kamil Kozar <dkk089@gmail.com>
Date: Sat, 15 Dec 2018 22:55:44 +0100
Subject: [PATCH] Add an option to disable cover art resizing
Imported from
https://sourceforge.net/p/minidlna/patches/_discuss/thread/9825a1a0/4c28/attachment/minidlna-1.1.2-no-cover-resize.patch
---
albumart.c | 3 +++
minidlna.c | 4 ++++
options.c | 1 +
options.h | 1 +
upnpglobalvars.h | 1 +
5 files changed, 10 insertions(+)
diff --git a/albumart.c b/albumart.c
index de026ec..04fa8f2 100644
--- a/albumart.c
+++ b/albumart.c
@@ -67,6 +67,9 @@ save_resized_album_art(image_s *imsrc, const char *path)
strncpyt(cache_dir, cache_file, sizeof(cache_dir));
make_dir(dirname(cache_dir), S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
+ if( GETFLAG(NO_COVER_RESIZE_MASK) )
+ return image_save_to_jpeg_file(imsrc, cache_file);
+
if( imsrc->width > imsrc->height )
{
dstw = 160;
diff --git a/minidlna.c b/minidlna.c
index 7cce301..a1dd08b 100644
--- a/minidlna.c
+++ b/minidlna.c
@@ -735,6 +735,10 @@ init(int argc, char **argv)
if (strtobool(ary_options[i].value))
SETFLAG(DLNA_STRICT_MASK);
break;
+ case RESIZE_COVER_ART:
+ if((strcmp(ary_options[i].value, "no") == 0) || !atoi(ary_options[i].value))
+ SETFLAG(NO_COVER_RESIZE_MASK);
+ break;
case ROOT_CONTAINER:
switch (ary_options[i].value[0]) {
case '.':
diff --git a/options.c b/options.c
index cee3dff..cacbdfb 100644
--- a/options.c
+++ b/options.c
@@ -68,6 +68,7 @@ static const struct {
{ WIDE_LINKS, "wide_links" },
{ TIVO_DISCOVERY, "tivo_discovery" },
{ ENABLE_SUBTITLES, "enable_subtitles" },
+ { RESIZE_COVER_ART, "resize_covers" },
};
int
diff --git a/options.h b/options.h
index 1ff5b22..ec5ea68 100644
--- a/options.h
+++ b/options.h
@@ -61,6 +61,7 @@ enum upnpconfigoptions {
WIDE_LINKS, /* allow following symlinks outside the defined media_dirs */
TIVO_DISCOVERY, /* TiVo discovery protocol: bonjour or beacon. Defaults to bonjour if supported */
ENABLE_SUBTITLES, /* Enable generic subtitle support for all clients by default */
+ RESIZE_COVER_ART, /* resize cover art to comply with DLNA spec */
};
/* readoptionsfile()
diff --git a/upnpglobalvars.h b/upnpglobalvars.h
index 1a2fb5e..7e3a1ba 100644
--- a/upnpglobalvars.h
+++ b/upnpglobalvars.h
@@ -205,6 +205,7 @@ extern uint32_t runtime_flags;
#define RESCAN_MASK 0x0200
#define SUBTITLES_MASK 0x0400
#define FORCE_ALPHASORT_MASK 0x0800
+#define NO_COVER_RESIZE_MASK 0x1000
#define SETFLAG(mask) runtime_flags |= mask
#define GETFLAG(mask) (runtime_flags & mask)