mirror of
https://github.com/matrix-construct/construct
synced 2025-01-14 00:34:18 +01:00
modules/media: Start an {Image|Graphics}Magick library interface module.
This commit is contained in:
parent
c0e3f0db51
commit
582cecccec
2 changed files with 87 additions and 0 deletions
|
@ -471,6 +471,24 @@ media_module_LTLIBRARIES = \
|
||||||
media/media_media.la \
|
media/media_media.la \
|
||||||
###
|
###
|
||||||
|
|
||||||
|
#
|
||||||
|
# {Image|Graphics}Magick Support
|
||||||
|
#
|
||||||
|
if IMAGEMAGICK
|
||||||
|
|
||||||
|
media_media_magick_la_SOURCES = \
|
||||||
|
media/magick.cc \
|
||||||
|
###
|
||||||
|
|
||||||
|
media_media_magick_la_CPPFLAGS = $(AM_CPPFLAGS) @IMAGEMAGICK_CPPFLAGS@
|
||||||
|
media_media_magick_la_LDFLAGS = $(AM_LDFLAGS) @IMAGEMAGICK_LDFLAGS@
|
||||||
|
media_media_magick_la_LIBADD = $(AM_LIBS) @IMAGEMAGICK_LIBS@
|
||||||
|
media_module_LTLIBRARIES += \
|
||||||
|
media/media_magick.la \
|
||||||
|
###
|
||||||
|
|
||||||
|
endif IMAGEMAGICK
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
#
|
#
|
||||||
# /_matrix/app/
|
# /_matrix/app/
|
||||||
|
|
69
modules/media/magick.cc
Normal file
69
modules/media/magick.cc
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
// Matrix Construct
|
||||||
|
//
|
||||||
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
||||||
|
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
|
||||||
|
//
|
||||||
|
// Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
// purpose with or without fee is hereby granted, provided that the above
|
||||||
|
// copyright notice and this permission notice is present in all copies. The
|
||||||
|
// full license for this software is available in the LICENSE file.
|
||||||
|
|
||||||
|
#include <RB_INC_MAGICK_API_H
|
||||||
|
|
||||||
|
namespace ircd::magick
|
||||||
|
{
|
||||||
|
static void init();
|
||||||
|
static void fini();
|
||||||
|
}
|
||||||
|
|
||||||
|
ircd::mapi::header
|
||||||
|
IRCD_MODULE
|
||||||
|
{
|
||||||
|
"GraphicsMagick Library support for media manipulation",
|
||||||
|
ircd::magick::init,
|
||||||
|
ircd::magick::fini
|
||||||
|
};
|
||||||
|
|
||||||
|
//
|
||||||
|
// init
|
||||||
|
//
|
||||||
|
|
||||||
|
void
|
||||||
|
ircd::magick::init()
|
||||||
|
{
|
||||||
|
ulong lib_version(0);
|
||||||
|
const char *const lib_version_text
|
||||||
|
{
|
||||||
|
::GetMagickVersion(&lib_version)
|
||||||
|
};
|
||||||
|
|
||||||
|
log::debug
|
||||||
|
{
|
||||||
|
"Initializing Magick Library include:%lu [%s] library:%lu [%s]",
|
||||||
|
ulong(MagickLibVersion),
|
||||||
|
MagickLibVersionText,
|
||||||
|
lib_version,
|
||||||
|
lib_version_text,
|
||||||
|
};
|
||||||
|
|
||||||
|
if(lib_version != ulong(MagickLibVersion))
|
||||||
|
log::warning
|
||||||
|
{
|
||||||
|
"Magick Library version mismatch headers:%lu library:%lu",
|
||||||
|
ulong(MagickLibVersion),
|
||||||
|
lib_version,
|
||||||
|
};
|
||||||
|
|
||||||
|
::InitializeMagick(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ircd::magick::fini()
|
||||||
|
{
|
||||||
|
log::debug
|
||||||
|
{
|
||||||
|
"Shutting down Magick Library..."
|
||||||
|
};
|
||||||
|
|
||||||
|
::DestroyMagick();
|
||||||
|
}
|
Loading…
Reference in a new issue