1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozilla_image_decoders_EXIF_h
7 #define mozilla_image_decoders_EXIF_h
12 #include "Orientation.h"
17 enum class ByteOrder
: uint8_t {
26 explicit EXIFData(Orientation aOrientation
) : orientation(aOrientation
) { }
28 const Orientation orientation
;
35 Parse(const uint8_t* aData
, const uint32_t aLength
)
38 return parser
.ParseEXIF(aData
, aLength
);
47 , mByteOrder(ByteOrder::Unknown
)
50 EXIFData
ParseEXIF(const uint8_t* aData
, const uint32_t aLength
);
51 bool ParseEXIFHeader();
52 bool ParseTIFFHeader(uint32_t& aIFD0OffsetOut
);
53 bool ParseIFD0(Orientation
& aOrientationOut
);
54 bool ParseOrientation(uint16_t aType
, uint32_t aCount
, Orientation
& aOut
);
56 bool Initialize(const uint8_t* aData
, const uint32_t aLength
);
57 void Advance(const uint32_t aDistance
);
58 void JumpTo(const uint32_t aOffset
);
60 bool MatchString(const char* aString
, const uint32_t aLength
);
61 bool MatchUInt16(const uint16_t aValue
);
62 bool ReadUInt16(uint16_t& aOut
);
63 bool ReadUInt32(uint32_t& aOut
);
65 const uint8_t* mStart
;
66 const uint8_t* mCurrent
;
68 uint32_t mRemainingLength
;
73 } // namespace mozilla
75 #endif // mozilla_image_decoders_EXIF_h