2 * Copyright 2017 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkStubHeifDecoderAPI_DEFINED
9 #define SkStubHeifDecoderAPI_DEFINED
11 // This stub implementation of HeifDecoderAPI.h lets us compile SkHeifCodec.cpp
12 // even when libheif is not available. It, of course, does nothing and fails to decode.
18 enum HeifColorFormat {
19 kHeifColorFormat_RGB565,
20 kHeifColorFormat_RGBA_8888,
21 kHeifColorFormat_BGRA_8888,
22 kHeifColorFormat_RGBA_1010102,
26 virtual ~HeifStream() {}
28 virtual size_t read(void*, size_t) = 0;
29 virtual bool rewind() = 0;
30 virtual bool seek(size_t) = 0;
31 virtual bool hasLength() const = 0;
32 virtual size_t getLength() const = 0;
35 struct HeifFrameInfo {
38 int32_t mRotationAngle; // Rotation angle, clockwise, should be multiple of 90
39 uint32_t mBytesPerPixel; // Number of bytes for one pixel
40 int64_t mDurationUs; // Duration of the frame in us
41 std::vector<uint8_t> mIccData; // ICC data array
45 bool init(HeifStream* stream, HeifFrameInfo*) {
50 bool getSequenceInfo(HeifFrameInfo* frameInfo, size_t *frameCount) {
54 bool decode(HeifFrameInfo*) {
58 bool decodeSequence(int frameIndex, HeifFrameInfo* frameInfo) {
62 bool setOutputColor(HeifColorFormat) {
66 bool getScanline(uint8_t*) {
70 int skipScanlines(int) {
74 uint32_t getColorDepth() {
79 static inline HeifDecoder* createHeifDecoder() { return new HeifDecoder; }
81 #endif//SkStubHeifDecoderAPI_DEFINED