webpimage.hpp
// ***************************************************************** -*- C++ -*-
/*
* Copyright (C) 2004-2021 Exiv2 authors
* This program is part of the Exiv2 distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
*/
#ifndef WEBPIMAGE_HPP
#define WEBPIMAGE_HPP
// *****************************************************************************
#include "exiv2lib_export.h"
// included header files
#include "image.hpp"
// *****************************************************************************
// namespace extensions
namespace Exiv2 {
// *****************************************************************************
// class definitions
// Add WEBP to the supported image formats
namespace ImageType {
const int webp = 23;
}
class EXIV2API WebPImage:public Image
{
public:
WebPImage(BasicIo::AutoPtr io);
void readMetadata();
void writeMetadata();
void printStructure(std::ostream& out, PrintStructureOption option,int depth);
void setComment(const std::string& comment);
void setIptcData(const IptcData& /*iptcData*/);
std::string mimeType() const;
private:
void doWriteMetadata(BasicIo& outIo);
long getHeaderOffset(byte *data, long data_size,
byte *header, long header_size);
bool equalsWebPTag(Exiv2::DataBuf& buf ,const char* str);
void debugPrintHex(byte *data, long size);
void decodeChunks(long filesize);
void inject_VP8X(BasicIo& iIo, bool has_xmp, bool has_exif,
bool has_alpha, bool has_icc, int width,
int height);
WebPImage(const WebPImage& rhs);
WebPImage& operator=(const WebPImage& rhs);
private:
const static byte WEBP_PAD_ODD;
const static int WEBP_TAG_SIZE;
const static int WEBP_VP8X_ICC_BIT;
const static int WEBP_VP8X_ALPHA_BIT;
const static int WEBP_VP8X_EXIF_BIT;
const static int WEBP_VP8X_XMP_BIT;
const static char* WEBP_CHUNK_HEADER_VP8X;
const static char* WEBP_CHUNK_HEADER_VP8L;
const static char* WEBP_CHUNK_HEADER_VP8;
const static char* WEBP_CHUNK_HEADER_ANMF;
const static char* WEBP_CHUNK_HEADER_ANIM;
const static char* WEBP_CHUNK_HEADER_ICCP;
const static char* WEBP_CHUNK_HEADER_EXIF;
const static char* WEBP_CHUNK_HEADER_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::AutoPtr newWebPInstance(BasicIo::AutoPtr 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:55
Exiv2::BasicIo::AutoPtr
std::auto_ptr< BasicIo > AutoPtr
BasicIo auto_ptr type.
Definition: basicio.hpp:58
Exiv2::DataBuf
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:193
Exiv2::Image
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:78
Exiv2::Image::AutoPtr
std::auto_ptr< Image > AutoPtr
Image auto_ptr type.
Definition: image.hpp:81
Exiv2::IptcData
A container for IPTC data. This is a top-level class of the Exiv2 library.
Definition: iptc.hpp:170
Exiv2::WebPImage
Class to access WEBP video files.
Definition: webpimage.hpp:45
Exiv2::ImageType::webp
const int webp
Treating webp as an image type>
Definition: webpimage.hpp:38
Exiv2
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
Exiv2::PrintStructureOption
PrintStructureOption
Options for printStructure.
Definition: image.hpp:64
Exiv2::comment
@ comment
Exiv2 type for the Exif user comment.
Definition: types.hpp:139
Exiv2::isWebPType
EXIV2API bool isWebPType(BasicIo &iIo, bool advance)
Check if the file iIo is a WebP Video.
Definition: webpimage.cpp:743
Exiv2::newWebPInstance
EXIV2API Image::AutoPtr newWebPInstance(BasicIo::AutoPtr io, bool create)
Create a new WebPImage instance and return an auto-pointer to it. Caller owns the returned object and...
Definition: webpimage.cpp:734