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

  1. From aae49f0f80e73d1b52f23b89b0d314e9b9f89425 Mon Sep 17 00:00:00 2001
  2. From: Daniel Kamil Kozar <dkk089@gmail.com>
  3. Date: Sat, 15 Dec 2018 22:55:44 +0100
  4. Subject: [PATCH] Add an option to disable cover art resizing
  5. Imported from
  6. https://sourceforge.net/p/minidlna/patches/_discuss/thread/9825a1a0/4c28/attachment/minidlna-1.1.2-no-cover-resize.patch
  7. ---
  8. albumart.c | 3 +++
  9. minidlna.c | 4 ++++
  10. options.c | 1 +
  11. options.h | 1 +
  12. upnpglobalvars.h | 1 +
  13. 5 files changed, 10 insertions(+)
  14. diff --git a/albumart.c b/albumart.c
  15. index de026ec..04fa8f2 100644
  16. --- a/albumart.c
  17. +++ b/albumart.c
  18. @@ -67,6 +67,9 @@ save_resized_album_art(image_s *imsrc, const char *path)
  19. strncpyt(cache_dir, cache_file, sizeof(cache_dir));
  20. make_dir(dirname(cache_dir), S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH);
  21. + if( GETFLAG(NO_COVER_RESIZE_MASK) )
  22. + return image_save_to_jpeg_file(imsrc, cache_file);
  23. +
  24. if( imsrc->width > imsrc->height )
  25. {
  26. dstw = 160;
  27. diff --git a/minidlna.c b/minidlna.c
  28. index 7cce301..a1dd08b 100644
  29. --- a/minidlna.c
  30. +++ b/minidlna.c
  31. @@ -735,6 +735,10 @@ init(int argc, char **argv)
  32. if (strtobool(ary_options[i].value))
  33. SETFLAG(DLNA_STRICT_MASK);
  34. break;
  35. + case RESIZE_COVER_ART:
  36. + if((strcmp(ary_options[i].value, "no") == 0) || !atoi(ary_options[i].value))
  37. + SETFLAG(NO_COVER_RESIZE_MASK);
  38. + break;
  39. case ROOT_CONTAINER:
  40. switch (ary_options[i].value[0]) {
  41. case '.':
  42. diff --git a/options.c b/options.c
  43. index cee3dff..cacbdfb 100644
  44. --- a/options.c
  45. +++ b/options.c
  46. @@ -68,6 +68,7 @@ static const struct {
  47. { WIDE_LINKS, "wide_links" },
  48. { TIVO_DISCOVERY, "tivo_discovery" },
  49. { ENABLE_SUBTITLES, "enable_subtitles" },
  50. + { RESIZE_COVER_ART, "resize_covers" },
  51. };
  52. int
  53. diff --git a/options.h b/options.h
  54. index 1ff5b22..ec5ea68 100644
  55. --- a/options.h
  56. +++ b/options.h
  57. @@ -61,6 +61,7 @@ enum upnpconfigoptions {
  58. WIDE_LINKS, /* allow following symlinks outside the defined media_dirs */
  59. TIVO_DISCOVERY, /* TiVo discovery protocol: bonjour or beacon. Defaults to bonjour if supported */
  60. ENABLE_SUBTITLES, /* Enable generic subtitle support for all clients by default */
  61. + RESIZE_COVER_ART, /* resize cover art to comply with DLNA spec */
  62. };
  63. /* readoptionsfile()
  64. diff --git a/upnpglobalvars.h b/upnpglobalvars.h
  65. index 1a2fb5e..7e3a1ba 100644
  66. --- a/upnpglobalvars.h
  67. +++ b/upnpglobalvars.h
  68. @@ -205,6 +205,7 @@ extern uint32_t runtime_flags;
  69. #define RESCAN_MASK 0x0200
  70. #define SUBTITLES_MASK 0x0400
  71. #define FORCE_ALPHASORT_MASK 0x0800
  72. +#define NO_COVER_RESIZE_MASK 0x1000
  73. #define SETFLAG(mask) runtime_flags |= mask
  74. #define GETFLAG(mask) (runtime_flags & mask)