Loading...
Searching...
No Matches
webpimage.hpp
// SPDX-License-Identifier: GPL-2.0-or-later
#ifndef WEBPIMAGE_HPP
#define WEBPIMAGE_HPP
// *****************************************************************************
#include "exiv2lib_export.h"
// included header files
#include "image.hpp"
// *****************************************************************************
// namespace extensions
namespace Exiv2 {
// *****************************************************************************
// class definitions
class EXIV2API WebPImage : public Image {
public:
explicit WebPImage(BasicIo::UniquePtr io);
void readMetadata() override;
void writeMetadata() override;
void printStructure(std::ostream& out, PrintStructureOption option, size_t depth) override;
void setComment(const std::string&) override;
void setIptcData(const IptcData& /*iptcData*/) override;
[[nodiscard]] std::string mimeType() const override;
private:
void doWriteMetadata(BasicIo& outIo);
static size_t getHeaderOffset(const byte* data, size_t data_size, const byte* header, size_t header_size);
static bool equalsWebPTag(const Exiv2::DataBuf& buf, const char* str);
void debugPrintHex(byte* data, size_t size);
void decodeChunks(uint32_t filesize);
void inject_VP8X(BasicIo& iIo, bool has_xmp, bool has_exif, bool has_alpha, bool has_icc, uint32_t width,
uint32_t height) const;
/* Misc. */
static constexpr byte WEBP_PAD_ODD = 0;
static constexpr int WEBP_TAG_SIZE = 0x4;
/* VP8X feature flags */
static constexpr int WEBP_VP8X_ICC_BIT = 0x20;
static constexpr int WEBP_VP8X_ALPHA_BIT = 0x10;
static constexpr int WEBP_VP8X_EXIF_BIT = 0x8;
static constexpr int WEBP_VP8X_XMP_BIT = 0x4;
/* Chunk header names */
static constexpr auto WEBP_CHUNK_HEADER_VP8X = "VP8X";
static constexpr auto WEBP_CHUNK_HEADER_VP8L = "VP8L";
static constexpr auto WEBP_CHUNK_HEADER_VP8 = "VP8 ";
static constexpr auto WEBP_CHUNK_HEADER_ANMF = "ANMF";
static constexpr auto WEBP_CHUNK_HEADER_ANIM = "ANIM";
static constexpr auto WEBP_CHUNK_HEADER_ICCP = "ICCP";
static constexpr auto WEBP_CHUNK_HEADER_EXIF = "EXIF";
static constexpr auto WEBP_CHUNK_HEADER_XMP = "XMP ";
}; // Class WebPImage
// *****************************************************************************
// template, inline and free functions
// These could be static private functions on Image subclasses but then
// ImageFactory needs to be made a friend.
EXIV2API Image::UniquePtr newWebPInstance(BasicIo::UniquePtr io, bool create);
EXIV2API bool isWebPType(BasicIo& iIo, bool advance);
} // namespace Exiv2
#endif // WEBPIMAGE_HPP
Exiv2::BasicIo
An interface for simple binary IO.
Definition basicio.hpp:35
Exiv2::BasicIo::UniquePtr
std::unique_ptr< BasicIo > UniquePtr
BasicIo auto_ptr type.
Definition basicio.hpp:38
Exiv2::Image
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition image.hpp:50
Exiv2::Image::UniquePtr
std::unique_ptr< Image > UniquePtr
Image auto_ptr type.
Definition image.hpp:53
Exiv2::IptcData
A container for IPTC data. This is a top-level class of the Exiv2 library.
Definition iptc.hpp:153
Exiv2::WebPImage
Class to access WEBP video files.
Definition webpimage.hpp:21
Exiv2
Class CrwImage to access Canon CRW images. References: The Canon RAW (CRW) File Format by Phil Harv...
Definition asfvideo.hpp:15
Exiv2::PrintStructureOption
PrintStructureOption
Options for printStructure.
Definition image.hpp:38
Exiv2::isWebPType
EXIV2API bool isWebPType(BasicIo &iIo, bool advance)
Check if the file iIo is a WebP Video.
Definition webpimage.cpp:688
Exiv2::newWebPInstance
EXIV2API Image::UniquePtr newWebPInstance(BasicIo::UniquePtr io, bool create)
Create a new WebPImage instance and return an auto-pointer to it. Caller owns the returned object and...
Definition webpimage.cpp:680
Exiv2::DataBuf
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition types.hpp:124
Exiv2::mimeType
List of TIFF compression to MIME type mappings.
Definition tiffimage.cpp:47