Merge branch 'graphicsmagick' into develop. ref #42

This commit is contained in:
emeric
2020-03-29 14:07:00 +02:00
9 changed files with 49 additions and 65 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ matrix:
- gcc - gcc
before_install: before_install:
- eval "${MATRIX_EVAL}" - eval "${MATRIX_EVAL}"
- sudo apt-get install build-essential cmake libboost-all-dev libconfig++-dev libavcodec-dev libavutil-dev libavformat-dev ffmpeg libmagick++-dev libpstreams-dev libconfig++-dev libpstreams-dev libtag1-dev - sudo apt-get install build-essential cmake libboost-all-dev libconfig++-dev libavcodec-dev libavutil-dev libavformat-dev ffmpeg libgraphicsmagick++1-dev libpstreams-dev libconfig++-dev libpstreams-dev libtag1-dev
- git clone https://github.com/emweb/wt.git wt - git clone https://github.com/emweb/wt.git wt
- pushd wt; - pushd wt;
- git checkout 4.1.0 - git checkout 4.1.0
+1 -1
View File
@@ -7,7 +7,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
include(CTest) include(CTest)
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(IMAGEMAGICKXX REQUIRED ImageMagick++) pkg_check_modules(GRAPHICSMAGICKXX REQUIRED GraphicsMagick++)
add_subdirectory(src) add_subdirectory(src)
+2 -2
View File
@@ -85,7 +85,7 @@ __Notes__:
* a C++17 compiler is needed * a C++17 compiler is needed
* ffmpeg version 4 minimum is required * ffmpeg version 4 minimum is required
```sh ```sh
apt-get install g++ cmake libboost-system-dev libavutil-dev libavformat-dev libmagick++-dev libconfig++-dev libpstreams-dev ffmpeg libtag1-dev apt-get install g++ cmake libboost-system-dev libavutil-dev libavformat-dev libgraphicsmagick++1-dev libconfig++-dev libpstreams-dev ffmpeg libtag1-dev
``` ```
You also need _Wt4_, which is not packaged yet on _Debian_. See [installation instructions](https://www.webtoolkit.eu/wt/doc/reference/html/InstallationUnix.html).</br> You also need _Wt4_, which is not packaged yet on _Debian_. See [installation instructions](https://www.webtoolkit.eu/wt/doc/reference/html/InstallationUnix.html).</br>
@@ -208,6 +208,6 @@ To connect to _LMS_, just open your favorite browser and go to http://localhost:
* Wt (http://www.webtoolkit.eu/) * Wt (http://www.webtoolkit.eu/)
* bootstrap3 (http://getbootstrap.com/) * bootstrap3 (http://getbootstrap.com/)
* ffmpeg project (https://ffmpeg.org/) * ffmpeg project (https://ffmpeg.org/)
* Magick++ (http://www.imagemagick.org/Magick++/) * GraphicsMagick++ (http://www.graphicsmagick.org/)
* MetaBrainz (https://metabrainz.org/) * MetaBrainz (https://metabrainz.org/)
* Bootstrap Notify: https://github.com/mouse0270/bootstrap-notify * Bootstrap Notify: https://github.com/mouse0270/bootstrap-notify
+35 -40
View File
@@ -5,7 +5,7 @@ WORKDIR /tmp/workdir
ARG MAKEFLAGS="-j2" ARG MAKEFLAGS="-j2"
ARG FFMPEG_VERSION=4.1.4 ARG FFMPEG_VERSION=4.1.4
ARG WT_VERSION=4.2.0 ARG WT_VERSION=4.2.0
ARG IMAGEMAGICK6_VERSION=6.9.10-71 ARG GRAPHICSMAGICK_VERSION=1.3.35
ARG PSTREAMS_VERSION=1.0.1 ARG PSTREAMS_VERSION=1.0.1
ARG LMS_VERSION=v3.6.3 ARG LMS_VERSION=v3.6.3
@@ -24,6 +24,7 @@ ARG BUILD_PACKAGES=" \
make \ make \
libjpeg-turbo-dev \ libjpeg-turbo-dev \
openjpeg-dev \ openjpeg-dev \
jasper-dev \
libpng-dev \ libpng-dev \
tiff-dev \ tiff-dev \
nasm \ nasm \
@@ -95,50 +96,42 @@ RUN \
make && \ make && \
make install make install
# ImageMagick # GraphicsMagick++
RUN \ RUN \
DIR=/tmp/imagemagick && mkdir -p ${DIR} && cd ${DIR} && \ DIR=/tmp/graphicsmagick && mkdir -p ${DIR} && cd ${DIR} && \
curl -sLO https://github.com/ImageMagick/ImageMagick6/archive/${IMAGEMAGICK6_VERSION}.tar.gz && \ curl -sL ftp://ftp.graphicsmagick.org/pub/GraphicsMagick/1.3/GraphicsMagick-${GRAPHICSMAGICK_VERSION}.tar.gz -o ${GRAPHICSMAGICK_VERSION}.tar.gz && \
tar -x --strip-components=1 -f ${IMAGEMAGICK6_VERSION}.tar.gz tar -x --strip-components=1 -f ${GRAPHICSMAGICK_VERSION}.tar.gz
RUN \ RUN \
DIR=/tmp/imagemagick && mkdir -p ${DIR} && cd ${DIR} && \ DIR=/tmp/graphicsmagick && mkdir -p ${DIR} && cd ${DIR} && \
./configure \ ./configure \
--prefix=${PREFIX} \ --prefix=${PREFIX} \
--enable-shared=yes \ --enable-shared=yes \
--disable-static \ --enable-static=no \
--disable-docs \ --with-quantum-depth=8 \
--with-magick-plus-plus \ --with-modules=no \
--without-zstd \ --with-frozenpaths=no \
--without-dps \ --with-magick-plus-plus=yes \
--without-autotrace \ --with-perl=no \
--without-dps \ --with-bzlib=no \
--without-fftw \ --with-dps=no \
--without-flif \ --with-fpx=no \
--without-fpx \ --with-jbig=no \
--without-djvu \ --with-webp=no \
--without-fontconfig \ --with-jp2=yes \
--without-freetype \ --with-jpeg=yes \
--without-raqm \ --with-lcms2=no \
--without-gslib \ --with-lzma=no \
--without-gvc \ --with-png=yes \
--without-heic \ --with-tiff=yes \
--without-jbig \ --with-trio=no \
--with-jpeg \ --with-ttf=no \
--without-jxl \ --with-tcmalloc=no \
--without-lcms \ --with-wmf=no \
--with-openjp2 \ --with-xml=no \
--without-lqr \ --with-zlib=yes \
--with-lzma \ --with-zstd=no \
--without-openexr \ --with-x=no && \
--without-pango \
--with-png \
--without-raw \
--without-rsvg \
--with-tiff \
--without-webp \
--without-wmf \
--without-xml && \
make && \ make && \
make install && \ make install && \
make distclean make distclean
@@ -178,7 +171,8 @@ RUN \
done && \ done && \
cp -r ${PREFIX}/lib /tmp/fakeroot/lib && \ cp -r ${PREFIX}/lib /tmp/fakeroot/lib && \
cp -r ${PREFIX}/share /tmp/fakeroot/share && \ cp -r ${PREFIX}/share /tmp/fakeroot/share && \
LD_LIBRARY_PATH=/tmp/fakeroot/lib /tmp/fakeroot/bin/ffmpeg -buildconf rm -rf /tmp/fakeroot/share/doc && \
rm -rf /tmp/fakeroot/share/man
## Release Stage ## Release Stage
FROM alpine:3.10 AS release FROM alpine:3.10 AS release
@@ -188,6 +182,7 @@ ARG RUNTIME_PACKAGES=" \
openssl \ openssl \
libjpeg-turbo \ libjpeg-turbo \
openjpeg \ openjpeg \
jasper-libs \
libpng \ libpng \
tiff \ tiff \
libogg \ libogg \
+3 -3
View File
@@ -10,17 +10,17 @@ target_include_directories(lmscover INTERFACE
target_include_directories(lmscover PRIVATE target_include_directories(lmscover PRIVATE
include include
${IMAGEMAGICKXX_INCLUDE_DIRS} ${GRAPHICSMAGICKXX_INCLUDE_DIRS}
) )
target_compile_options(lmscover PRIVATE target_compile_options(lmscover PRIVATE
${IMAGEMAGICKXX_CFLAGS_OTHER} ${GRAPHICSMAGICKXX_CFLAGS_OTHER}
) )
target_link_libraries(lmscover PRIVATE target_link_libraries(lmscover PRIVATE
lmsav lmsav
lmsdatabase lmsdatabase
${IMAGEMAGICKXX_LIBRARIES} ${GRAPHICSMAGICKXX_LIBRARIES}
) )
install(TARGETS lmscover DESTINATION lib) install(TARGETS lmscover DESTINATION lib)
+6 -8
View File
@@ -49,15 +49,13 @@ Grabber::Grabber(const std::filesystem::path& execPath)
init(execPath); init(execPath);
} }
Grabber::~Grabber()
{
deinit();
}
void void
Grabber::setDefaultCover(const std::filesystem::path& p) Grabber::setDefaultCover(const std::filesystem::path& p)
{ {
if (!_defaultCover.load(p)) std::unique_lock lock {_mutex};
_defaultCover = std::make_unique<Image>();
if (!_defaultCover->load(p))
throw LmsException("Cannot read default cover file '" + p.string() + "'"); throw LmsException("Cannot read default cover file '" + p.string() + "'");
} }
@@ -65,12 +63,12 @@ Image
Grabber::getDefaultCover(std::size_t size) Grabber::getDefaultCover(std::size_t size)
{ {
LMS_LOG(COVER, DEBUG) << "Getting a default cover using size = " << size; LMS_LOG(COVER, DEBUG) << "Getting a default cover using size = " << size;
std::unique_lock<std::mutex> lock(_mutex); std::unique_lock lock {_mutex};
auto it = _defaultCovers.find(size); auto it = _defaultCovers.find(size);
if (it == _defaultCovers.end()) if (it == _defaultCovers.end())
{ {
Image cover = _defaultCover; Image cover = *_defaultCover;
LMS_LOG(COVER, DEBUG) << "default cover size = " << cover.getSize().width << " x " << cover.getSize().height; LMS_LOG(COVER, DEBUG) << "default cover size = " << cover.getSize().width << " x " << cover.getSize().height;
+1 -3
View File
@@ -41,7 +41,6 @@ namespace CoverArt
{ {
public: public:
Grabber(const std::filesystem::path& execPath); Grabber(const std::filesystem::path& execPath);
~Grabber();
Grabber(const Grabber&) = delete; Grabber(const Grabber&) = delete;
Grabber& operator=(const Grabber&) = delete; Grabber& operator=(const Grabber&) = delete;
@@ -63,9 +62,8 @@ namespace CoverArt
std::optional<Image> getFromDirectory(const std::filesystem::path& path) const; std::optional<Image> getFromDirectory(const std::filesystem::path& path) const;
Image getDefaultCover(std::size_t size); Image getDefaultCover(std::size_t size);
Image _defaultCover;
std::mutex _mutex; std::mutex _mutex;
std::unique_ptr<Image> _defaultCover;
std::map<std::size_t /* size */, Image> _defaultCovers; std::map<std::size_t /* size */, Image> _defaultCovers;
static inline const std::vector<std::filesystem::path> _fileExtensions {".jpg", ".jpeg", ".png", ".bmp"}; // TODO parametrize static inline const std::vector<std::filesystem::path> _fileExtensions {".jpg", ".jpeg", ".png", ".bmp"}; // TODO parametrize
-6
View File
@@ -29,12 +29,6 @@ init(const std::filesystem::path& path)
Magick::InitializeMagick(path.string().c_str()); Magick::InitializeMagick(path.string().c_str());
} }
void
deinit()
{
MagickCore::MagickCoreTerminus();
}
static static
std::string std::string
formatToMagick(Format format) formatToMagick(Format format)
-1
View File
@@ -30,7 +30,6 @@ namespace CoverArt
{ {
void init(const std::filesystem::path& path); void init(const std::filesystem::path& path);
void deinit();
class Image class Image
{ {