33#ifndef JPGIMAGE_HPP_
44#define JPGIMAGE_HPP_
55
6- // *****************************************************************************
76#include " exiv2lib_export.h"
87
9- #include < array>
10-
118// included header files
129#include " error.hpp"
1310#include " image.hpp"
@@ -18,59 +15,6 @@ namespace Exiv2 {
1815// *****************************************************************************
1916// class definitions
2017
21- // / @brief Helper class, has methods to deal with %Photoshop "Information Resource Blocks" (IRBs).
22- struct EXIV2API Photoshop {
23- // Todo: Public for now
24- static constexpr std::array irbId_{" 8BIM" , " AgHg" , " DCSR" , " PHUT" }; // !< %Photoshop IRB markers
25- static constexpr auto ps3Id_ = " Photoshop 3.0\0 " ; // !< %Photoshop marker
26- static constexpr uint16_t iptc_ = 0x0404 ; // !< %Photoshop IPTC marker
27- static constexpr uint16_t preview_ = 0x040c ; // !< %Photoshop preview marker
28-
29- // / @brief Checks an IRB
30- // / @param pPsData Existing IRB buffer. It is expected to be of size 4.
31- // / @return true if the IRB marker is known
32- // / @todo This should be an implementation detail and not exposed in the API. An attacker could try to pass
33- // / a smaller buffer or null pointer.
34- static bool isIrb (const byte* pPsData);
35-
36- // / @brief Validates all IRBs
37- // / @param pPsData Existing IRB buffer
38- // / @param sizePsData Size of the IRB buffer, may be 0
39- // / @return true if all IRBs are valid;<BR> false otherwise
40- static bool valid (const byte* pPsData, size_t sizePsData);
41-
42- // / @brief Locates the data for a %Photoshop tag in a %Photoshop formated memory buffer.
43- // / Operates on raw data to simplify reuse.
44- // / @param pPsData Pointer to buffer containing entire payload of %Photoshop formated data (from APP13 Jpeg segment)
45- // / @param sizePsData Size in bytes of pPsData.
46- // / @param psTag %Tag number of the block to look for.
47- // / @param record Output value that is set to the start of the data block within pPsData (may not be null).
48- // / @param sizeHdr Output value that is set to the size of the header within the data block pointed to by record
49- // / (may not be null).
50- // / @param sizeData Output value that is set to the size of the actual data within the data block pointed to by record
51- // / (may not be null).
52- // / @return 0 if successful;<BR>
53- // / 3 if no data for psTag was found in pPsData;<BR>
54- // / -2 if the pPsData buffer does not contain valid data.
55- static int locateIrb (const byte* pPsData, size_t sizePsData, uint16_t psTag, const byte** record,
56- uint32_t * const sizeHdr, uint32_t * const sizeData);
57-
58- // / @brief Forwards to locateIrb() with \em psTag = \em iptc_
59- static int locateIptcIrb (const byte* pPsData, size_t sizePsData, const byte** record, uint32_t * const sizeHdr,
60- uint32_t * const sizeData);
61-
62- // / @brief Forwards to locatePreviewIrb() with \em psTag = \em preview_
63- static int locatePreviewIrb (const byte* pPsData, size_t sizePsData, const byte** record, uint32_t * const sizeHdr,
64- uint32_t * const sizeData);
65-
66- // / @brief Set the new IPTC IRB, keeps existing IRBs but removes the IPTC block if there is no new IPTC data to write.
67- // / @param pPsData Existing IRB buffer
68- // / @param sizePsData Size of the IRB buffer, may be 0
69- // / @param iptcData Iptc data to embed, may be empty
70- // / @return A data buffer containing the new IRB buffer, may have 0 size
71- static DataBuf setIptcIrb (const byte* pPsData, size_t sizePsData, const IptcData& iptcData);
72- };
73-
7418/* !
7519 @brief Abstract helper base class to access JPEG images.
7620 */
0 commit comments