• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 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 OHOS_HDI_CODEC_V1_0_CODECIMAGESERVICE_H
17 #define OHOS_HDI_CODEC_V1_0_CODECIMAGESERVICE_H
18 
19 #include <map>
20 #include <mutex>
21 #include "buffer_handle.h"
22 #include "codec_image_config.h"
23 #include "v1_0/icodec_image.h"
24 #include "codec_jpeg_service.h"
25 
26 constexpr uint32_t CODEC_IMAGE_MAX_BUFFER_SIZE = 50 * 1024 *1024;
27 namespace OHOS {
28 namespace HDI {
29 namespace Codec {
30 namespace Image {
31 namespace V1_0 {
32 class CodecImageService : public ICodecImage {
33 public:
34     explicit CodecImageService();
35 
36     virtual ~CodecImageService() = default;
37 
38     int32_t GetImageCapability(std::vector<CodecImageCapability>& capList) override;
39 
40     int32_t Init(enum CodecImageRole role) override;
41 
42     int32_t DeInit(enum CodecImageRole role) override;
43 
44     int32_t DoJpegDecode(const CodecImageBuffer& inBuffer, const CodecImageBuffer& outBuffer,
45         const CodecJpegDecInfo& decInfo) override;
46 
47     int32_t AllocateInBuffer(CodecImageBuffer& inBuffer, uint32_t size, CodecImageRole role) override;
48 
49     int32_t FreeInBuffer(const CodecImageBuffer& buffer) override;
50 
51 private:
52     std::unique_ptr<CodecJpegService> jpegImpl_;
53 };
54 } // V1_0
55 } // Image
56 } // Codec
57 } // HDI
58 } // OHOS
59 
60 #endif // OHOS_HDI_CODEC_V1_0_CODECIMAGESERVICE_H
61