1 /*
2  * Copyright (c) 2023-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 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 OHOS_DEFERRED_PROCESSING_SERVICE_BUFFER_INFO_H
17 #define OHOS_DEFERRED_PROCESSING_SERVICE_BUFFER_INFO_H
18 
19 #include "ipc_file_descriptor.h"
20 #include "shared_buffer.h"
21 
22 namespace OHOS::Media {
23     class Picture;
24 }
25 namespace OHOS {
26 namespace CameraStandard {
27 namespace DeferredProcessing {
28 class BufferInfo {
29 public:
30     BufferInfo(const std::shared_ptr<SharedBuffer>& sharedBuffer, int32_t dataSize, bool isHighQuality,
31         bool isCloudImageEnhanceSupported);
32     ~BufferInfo();
33 
34     sptr<IPCFileDescriptor> GetIPCFileDescriptor();
35 
GetDataSize()36     inline int32_t GetDataSize()
37     {
38         return dataSize_;
39     }
40 
IsHighQuality()41     inline bool IsHighQuality()
42     {
43         return isHighQuality_;
44     }
45 
IsCloudImageEnhanceSupported()46     inline bool IsCloudImageEnhanceSupported()
47     {
48         return isCloudImageEnhanceSupported_;
49     }
50 
51 private:
52     std::shared_ptr<SharedBuffer> sharedBuffer_;
53     const int32_t dataSize_;
54     const bool isHighQuality_;
55     bool isCloudImageEnhanceSupported_;
56 };
57 class BufferInfoExt {
58 public:
59     explicit BufferInfoExt(std::shared_ptr<Media::Picture> picture, long dataSize, bool isHighQuality,
60         bool isCloudImageEnhanceSupported);
61     ~BufferInfoExt();
62     std::shared_ptr<Media::Picture> GetPicture();
63     long GetDataSize();
64     bool IsHighQuality();
65     bool IsCloudImageEnhanceSupported();
66 
67 private:
68     std::shared_ptr<Media::Picture> picture_;
69     long dataSize_;
70     bool isHighQuality_;
71     bool isCloudImageEnhanceSupported_;
72 };
73 } // namespace DeferredProcessing
74 } // namespace CameraStandard
75 } // namespace OHOS
76 #endif // OHOS_DEFERRED_PROCESSING_SERVICE_BUFFER_INFO_H