1 /*
2  * Copyright (C) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FRAMEWORKS_INNERKITSIMPL_UTILS_INCLUDE_IMAGE_FWK_EXT_MANAGER_H
17 #define FRAMEWORKS_INNERKITSIMPL_UTILS_INCLUDE_IMAGE_FWK_EXT_MANAGER_H
18 
19 #include <cstdint>
20 #include <vector>
21 
22 namespace OHOS::ImagePlugin {
23     struct PlEncodeOptions;
24     struct HevcSoftDecodeParam;
25 }
26 
27 namespace OHOS::Media {
28     class PixelMap;
29     class Picture;
30 }
31 
32 class SkWStream;
33 
34 using DoHardWareEncodeFunc = int32_t (*)(SkWStream* output, const OHOS::ImagePlugin::PlEncodeOptions& opts,
35     OHOS::Media::PixelMap* pixelMap);
36 using HevcSoftwareDecodeFunc = int32_t (*)(std::vector<std::vector<uint8_t>>& inputs,
37                                            OHOS::ImagePlugin::HevcSoftDecodeParam& param);
38 
39 using DoHardwareEncodePictureFunc = int32_t (*)(SkWStream* output, const OHOS::ImagePlugin::PlEncodeOptions& opts,
40     OHOS::Media::Picture* picture);
41 
42 namespace OHOS {
43 namespace Media {
44 class ImageFwkExtManager {
45 public:
46     ImageFwkExtManager();
47     ~ImageFwkExtManager();
48     bool LoadImageFwkExtNativeSo();
49     DoHardWareEncodeFunc doHardWareEncodeFunc_;
50     HevcSoftwareDecodeFunc hevcSoftwareDecodeFunc_;
51     DoHardwareEncodePictureFunc doHardwareEncodePictureFunc_;
52 private:
53     bool isImageFwkExtNativeSoOpened_;
54     void* extNativeSoHandle_;
55 };
56 } // namespace Media
57 } // namespace OHOS
58 
59 #endif // FRAMEWORKS_INNERKITSIMPL_UTILS_INCLUDE_IMAGE_FWK_EXT_MANAGER_H