• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Shenzhen Kaihong DID 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 IMAGE_AUTO_INITER
17 #define IMAGE_AUTO_INITER
18 #include "v1_0/icodec_image_jpeg.h"
19 namespace OHOS {
20 namespace Codec {
21 namespace Image {
22 class ImageAutoIniter {
23 public:
ImageAutoIniter(OHOS::sptr<OHOS::HDI::Codec::Image::V1_0::ICodecImageJpeg> imageClient)24     ImageAutoIniter(OHOS::sptr<OHOS::HDI::Codec::Image::V1_0::ICodecImageJpeg> imageClient) : client_(imageClient)
25     {
26         if (client_) {
27             client_->JpegInit();
28         }
29     }
30 
~ImageAutoIniter()31     ~ImageAutoIniter()
32     {
33         if (client_) {
34             client_->JpegDeInit();
35             client_ = nullptr;
36         }
37     }
38 
39 private:
40     OHOS::sptr<OHOS::HDI::Codec::Image::V1_0::ICodecImageJpeg> client_;
41 };
42 }  // namespace Image
43 }  // namespace Codec
44 }  // namespace OHOS
45 
46 #endif