• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_DFX_H
17 #define FRAMEWORKS_INNERKITSIMPL_UTILS_INCLUDE_IMAGE_DFX_H
18 
19 #include <string>
20 
21 namespace OHOS {
22 namespace Media {
23 const uint16_t INNER_INTERFACE = 0;
24 const uint16_t JS_INTERFACE = 1;
25 const uint16_t C_INTERFACE = 2;
26 
27 struct DecodeInfoOptions {
28     uint32_t sampleSize;
29     float rotate;
30     bool editable;
31     int32_t sourceWidth;
32     int32_t sourceHeight;
33     int32_t desireSizeWidth;
34     int32_t desireSizeHeight;
35     int32_t desireRegionWidth;
36     int32_t desireRegionHeight;
37     int32_t desireRegionX;
38     int32_t desireRegionY;
39     int32_t desirePixelFormat;
40     int32_t photoDesiredPixelFormat;
41     uint32_t index;
42     int32_t fitDensity;
43     int32_t desireColorSpace;
44     std::string mimeType;
45     uint32_t memorySize;
46     int32_t memoryType;
47     std::string imageSource;
48     uint16_t invokeType;
49     bool isIncrementalDecode = false;
50     bool isHardDecode;
51     std::string hardDecodeError;
52     std::string errorMsg;
53 };
54 
55 class ImageEvent {
56 public:
57     ImageEvent();
58     ~ImageEvent();
59     std::string getInvokeType();
60     void SetDecodeInfoOptions(const DecodeInfoOptions &options);
61     void SetDecodeErrorMsg(std::string msg);
62     void ReportDecodeFault();
63     void ReportDecodeInfo();
SetIncrementalDecode()64     void SetIncrementalDecode()
65     {
66         options_.isIncrementalDecode = true;
67     }
68     DecodeInfoOptions &GetDecodeInfoOptions();
69 private:
70     DecodeInfoOptions options_ = {};
71     uint64_t startTime_;
72 };
73 
74 void ReportCreateImageSourceFault(uint32_t width, uint32_t height, std::string type, std::string message);
75 void ReportEncodeFault(uint32_t width, uint32_t height, std::string mimeType, std::string message);
76 } // namespace Media
77 } // namespace OHOS
78 #endif // FRAMEWORKS_INNERKITSIMPL_UTILS_INCLUDE_IMAGE_DFX_H
79