0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 08:12:37 +01:00

ircd::png: Add unit; start header; stub.

This commit is contained in:
Jason Volk 2021-01-15 18:41:25 -08:00
parent b26bb2ec6c
commit 7aff759abc
5 changed files with 74 additions and 1 deletions

View file

@ -105,6 +105,7 @@
#include "rfc3986.h"
#include "net/net.h"
#include "server/server.h"
#include "png.h"
#include "magick.h"
#include "resource/resource.h"
#include "client.h"

20
include/ircd/png.h Normal file
View file

@ -0,0 +1,20 @@
// The Construct
//
// Copyright (C) The Construct Developers, Authors & Contributors
// Copyright (C) 2016-2021 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.
#pragma once
#define HAVE_IRCD_PNG_H
/// Portable Network Graphics; wrappers a la carte
namespace ircd::png
{
bool is_animated(const const_buffer &);
extern const info::versions version_api, version_abi;
}

View file

@ -96,6 +96,7 @@ libircd_la_LDFLAGS = \
@SODIUM_LDFLAGS@ \
@MAGIC_LDFLAGS@ \
@IMAGEMAGICK_LDFLAGS@ \
@PNG_LDFLAGS@ \
@ZSTD_LDFLAGS@ \
@SNAPPY_LDFLAGS@ \
@LZ4_LDFLAGS@ \
@ -212,6 +213,7 @@ endif
if IMAGEMAGICK
libircd_la_SOURCES += magick.cc
endif
libircd_la_SOURCES += png.cc
if OPENCL
libircd_la_SOURCES += cl.cc
endif
@ -305,6 +307,9 @@ parse.lo: AM_CXXFLAGS := ${SPIRIT_UNIT_CXXFLAGS} ${AM_CXXFLAGS}
if PBC
pbc.lo: AM_CPPFLAGS := @PBC_CPPFLAGS@ ${AM_CPPFLAGS}
endif
if PNG
png.o: AM_CPPFLAGS := @PNG_CPPFLAGS@ ${AM_CPPFLAGS}
endif PNG
rfc1459.lo: AM_CPPFLAGS := ${SPIRIT_UNIT_CPPFLAGS} ${AM_CPPFLAGS}
rfc1459.lo: AM_CXXFLAGS := ${SPIRIT_UNIT_CXXFLAGS} ${AM_CXXFLAGS}
rfc3986.lo: AM_CPPFLAGS := ${SPIRIT_UNIT_CPPFLAGS} ${AM_CPPFLAGS}

View file

@ -9,7 +9,6 @@
// full license for this software is available in the LICENSE file.
#include <RB_INC_SIGNAL_H
#include <RB_INC_PNG_H
#include <RB_INC_MAGICK_API_H
namespace ircd::magick

48
ircd/png.cc Normal file
View file

@ -0,0 +1,48 @@
// The Construct
//
// Copyright (C) The Construct Developers, Authors & Contributors
// Copyright (C) 2016-2021 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_PNG_H
decltype(ircd::png::version_api)
ircd::png::version_api
{
"png", info::versions::API,
#ifdef HAVE_PNG_H
PNG_LIBPNG_VER,
{
PNG_LIBPNG_VER_MAJOR,
PNG_LIBPNG_VER_MINOR,
PNG_LIBPNG_VER_RELEASE,
},
rstrip(lstrip(PNG_HEADER_VERSION_STRING, " "), "\n")
#endif
};
/// Since libpng may not loaded prior to static initialization there is
/// no linked library identification. libmagick takes care of loading libpng
/// dynamically if it requires it for us.
decltype(ircd::png::version_abi)
ircd::png::version_abi
{
"png", info::versions::ABI,
};
bool
ircd::png::is_animated(const const_buffer &buf)
#ifdef PNG_APNG_SUPPORTED
{
return false;
}
#else
{
#warning "Upgrade your libpng version for animation detection."
return false;
}
#endif