blob: 2f8f0f825aef426412a70cb28acab5d6e0ffef5e [file] [log] [blame]
Chong Zhangea280cb2017-08-02 11:10:10 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _HEIF_DECODER_IMPL_
18#define _HEIF_DECODER_IMPL_
19
20#include "include/HeifDecoderAPI.h"
21#include <system/graphics.h>
22#include <utils/RefBase.h>
23
24namespace android {
25
26class IDataSource;
27class IMemory;
28class MediaMetadataRetriever;
29
30/*
31 * An implementation of HeifDecoder based on Android's MediaMetadataRetriever.
32 */
33class HeifDecoderImpl : public HeifDecoder {
34public:
35
36 HeifDecoderImpl();
37 ~HeifDecoderImpl() override;
38
39 bool init(HeifStream* stream, HeifFrameInfo* frameInfo) override;
40
41 bool getEncodedColor(HeifEncodedColor* outColor) const override;
42
43 bool setOutputColor(HeifColorFormat heifColor) override;
44
45 bool decode(HeifFrameInfo* frameInfo) override;
46
47 bool getScanline(uint8_t* dst) override;
48
49 size_t skipScanlines(size_t count) override;
50
51private:
52 sp<IDataSource> mDataSource;
53 sp<MediaMetadataRetriever> mRetriever;
54 sp<IMemory> mFrameMemory;
55 android_pixel_format_t mOutputColor;
56 size_t mCurScanline;
57};
58
59} // namespace android
60
61#endif // _HEIF_DECODER_IMPL_