mirror of
https://github.com/matrix-construct/construct
synced 2024-12-26 15:33:54 +01:00
modules/media/media: Branch for conditional loading of magick.so.
This commit is contained in:
parent
fefaaca2c2
commit
739490722e
3 changed files with 37 additions and 22 deletions
|
@ -18,6 +18,14 @@ IRCD_MODULE
|
|||
ircd::m::media::fini
|
||||
};
|
||||
|
||||
struct ircd::m::media::magick
|
||||
{
|
||||
module modules
|
||||
{
|
||||
"magick"
|
||||
};
|
||||
};
|
||||
|
||||
void
|
||||
ircd::m::media::init()
|
||||
{
|
||||
|
@ -30,24 +38,29 @@ ircd::m::media::init()
|
|||
conf::reset("ircd.media.blocks.cache.size");
|
||||
conf::reset("ircd.media.blocks.cache_comp.size");
|
||||
|
||||
try
|
||||
{
|
||||
::magick_support.reset(new module{"magick"});
|
||||
}
|
||||
catch(std::exception &e)
|
||||
// conditions to load the magick.so module
|
||||
const bool enable_magick
|
||||
{
|
||||
// used by the thumbnailer
|
||||
thumbnail::enable
|
||||
|
||||
// support is available
|
||||
&& mods::available("magick")
|
||||
};
|
||||
|
||||
if(enable_magick)
|
||||
magick_support.reset(new media::magick{});
|
||||
else
|
||||
log::warning
|
||||
{
|
||||
media_log, "Failed to load GraphicsMagick support :%s",
|
||||
e.what()
|
||||
media_log, "GraphicsMagick support is disabled or unavailable."
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ircd::m::media::fini()
|
||||
{
|
||||
::magick_support.reset();
|
||||
magick_support.reset();
|
||||
|
||||
// The database close contains pthread_join()'s within RocksDB which
|
||||
// deadlock under certain conditions when called during a dlclose()
|
||||
|
|
|
@ -10,10 +10,24 @@
|
|||
|
||||
namespace ircd::m::media
|
||||
{
|
||||
struct magick;
|
||||
|
||||
void init();
|
||||
void fini();
|
||||
}
|
||||
|
||||
namespace ircd::m::media::thumbnail
|
||||
{
|
||||
extern conf::item<bool> enable;
|
||||
extern conf::item<bool> enable_remote;
|
||||
extern conf::item<size_t> width_min;
|
||||
extern conf::item<size_t> width_max;
|
||||
extern conf::item<size_t> height_min;
|
||||
extern conf::item<size_t> height_max;
|
||||
extern conf::item<std::string> mime_whitelist;
|
||||
extern conf::item<std::string> mime_blacklist;
|
||||
}
|
||||
|
||||
using namespace ircd;
|
||||
|
||||
extern mapi::header IRCD_MODULE;
|
||||
|
@ -26,7 +40,7 @@ extern const db::descriptor media_blocks_descriptor;
|
|||
extern const db::description media_description;
|
||||
extern std::shared_ptr<db::database> media;
|
||||
extern db::column blocks;
|
||||
extern std::unique_ptr<module> magick_support;
|
||||
extern std::unique_ptr<m::media::magick> magick_support;
|
||||
|
||||
extern "C" m::room::id
|
||||
file_room_id(m::room::id::buf &out,
|
||||
|
|
|
@ -10,18 +10,6 @@
|
|||
|
||||
#include "media.h"
|
||||
|
||||
namespace ircd::m::media::thumbnail
|
||||
{
|
||||
extern conf::item<bool> enable;
|
||||
extern conf::item<bool> enable_remote;
|
||||
extern conf::item<size_t> width_min;
|
||||
extern conf::item<size_t> width_max;
|
||||
extern conf::item<size_t> height_min;
|
||||
extern conf::item<size_t> height_max;
|
||||
extern conf::item<std::string> mime_whitelist;
|
||||
extern conf::item<std::string> mime_blacklist;
|
||||
}
|
||||
|
||||
using namespace ircd::m::media::thumbnail; //TODO: XXX
|
||||
|
||||
decltype(ircd::m::media::thumbnail::enable)
|
||||
|
|
Loading…
Reference in a new issue