Exiv2
webpimage.hpp
Go to the documentation of this file.
1 // ***************************************************************** -*- C++ -*-
2 /*
3  * Copyright (C) 2004-2018 Exiv2 authors
4  * This program is part of the Exiv2 distribution.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA.
19  */
27 #ifndef WEBPIMAGE_HPP
28 #define WEBPIMAGE_HPP
29 
30 // *****************************************************************************
31 #include "exiv2lib_export.h"
32 
33 // included header files
34 #include "image.hpp"
35 
36 // *****************************************************************************
37 // namespace extensions
38 namespace Exiv2 {
39 
40 // *****************************************************************************
41 // class definitions
42 
43  // Add WEBP to the supported image formats
44  namespace ImageType {
45  const int webp = 23;
46  }
47 
51  class EXIV2API WebPImage:public Image
52  {
53  public:
55 
56 
69 
71 
72  void readMetadata();
73  void writeMetadata();
74  void printStructure(std::ostream& out, PrintStructureOption option,int depth);
76 
80  void setComment(const std::string& comment);
81  void setIptcData(const IptcData& /*iptcData*/);
82 
84 
85  std::string mimeType() const;
87 
88  private:
89  void doWriteMetadata(BasicIo& outIo);
91 
92  long getHeaderOffset(byte *data, long data_size,
93  byte *header, long header_size);
94  bool equalsWebPTag(Exiv2::DataBuf& buf ,const char* str);
95  void debugPrintHex(byte *data, long size);
96  void decodeChunks(long filesize);
97  void inject_VP8X(BasicIo& iIo, bool has_xmp, bool has_exif,
98  bool has_alpha, bool has_icc, int width,
99  int height);
100 
102  WebPImage(const WebPImage& rhs);
104  WebPImage& operator=(const WebPImage& rhs);
106 
107  private:
108  const static byte WEBP_PAD_ODD;
109  const static int WEBP_TAG_SIZE;
110  const static int WEBP_VP8X_ICC_BIT;
111  const static int WEBP_VP8X_ALPHA_BIT;
112  const static int WEBP_VP8X_EXIF_BIT;
113  const static int WEBP_VP8X_XMP_BIT;
114  const static char* WEBP_CHUNK_HEADER_VP8X;
115  const static char* WEBP_CHUNK_HEADER_VP8L;
116  const static char* WEBP_CHUNK_HEADER_VP8;
117  const static char* WEBP_CHUNK_HEADER_ANMF;
118  const static char* WEBP_CHUNK_HEADER_ANIM;
119  const static char* WEBP_CHUNK_HEADER_ICCP;
120  const static char* WEBP_CHUNK_HEADER_EXIF;
121  const static char* WEBP_CHUNK_HEADER_XMP;
122 
123 
124  }; //Class WebPImage
125 
126 // *****************************************************************************
127 // template, inline and free functions
128 
129  // These could be static private functions on Image subclasses but then
130  // ImageFactory needs to be made a friend.
136  EXIV2API Image::AutoPtr newWebPInstance(BasicIo::AutoPtr io, bool create);
137 
139  EXIV2API bool isWebPType(BasicIo& iIo, bool advance);
140 
141 } // namespace Exiv2
142 
143 #endif // WEBPIMAGE_HPP
An interface for simple binary IO.
Definition: basicio.hpp:55
EXIV2API bool isWebPType(BasicIo &iIo, bool advance)
Check if the file iIo is a WebP Video.
Definition: webpimage.cpp:730
std::auto_ptr< Image > AutoPtr
Image auto_ptr type.
Definition: image.hpp:84
Utility class containing a character array. All it does is to take care of memory allocation and dele...
Definition: types.hpp:204
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:721
uint8_t byte
1 byte unsigned integer type.
Definition: types.hpp:105
Abstract base class defining the interface for an image. This is the top-level interface to the Exiv2...
Definition: image.hpp:81
PrintStructureOption
Options for printStructure.
Definition: image.hpp:67
A container for IPTC data. This is a top-level class of the Exiv2 library.
Definition: iptc.hpp:173
std::auto_ptr< BasicIo > AutoPtr
BasicIo auto_ptr type.
Definition: basicio.hpp:58
IPTC string type.
Definition: types.hpp:147
Provides classes and functions to encode and decode Exif and Iptc data. The libexiv2 API consists of ...
Definition: asfvideo.hpp:36
const int webp
Treating webp as an image type>
Definition: webpimage.hpp:45
Exiv2 type for the Exif user comment.
Definition: types.hpp:150
Class to access WEBP video files.
Definition: webpimage.hpp:51