1 /*
2  * Copyright (C) 2022 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 IMAGE_CREATOR_PRIVATE_H
17 #define IMAGE_CREATOR_PRIVATE_H
18 
19 #include <surface.h>
20 #include <list>
21 #include "iconsumer_surface.h"
22 
23 namespace OHOS {
24 namespace Media {
25 class ImageCreatorContext {
26 public:
ImageCreatorContext()27     ImageCreatorContext() {
28     };
~ImageCreatorContext()29     ~ImageCreatorContext() {
30     };
31     OHOS::sptr<OHOS::SurfaceBuffer> currentCreatorBuffer_;
32     static std::shared_ptr<ImageCreatorContext> CreateImageCreatorContext();
SetCreatorBufferConsumer(sptr<IConsumerSurface> & consumer)33     void SetCreatorBufferConsumer(sptr<IConsumerSurface> &consumer)
34     {
35         creatorConsumerSurface_ = consumer;
36     }
GetCreatorBufferConsumer()37     sptr<IConsumerSurface> GetCreatorBufferConsumer()
38     {
39         return creatorConsumerSurface_;
40     }
SetCreatorBufferProducer(sptr<Surface> & producer)41     void SetCreatorBufferProducer(sptr<Surface> &producer)
42     {
43         creatorProducerSurface_ = producer;
44     }
GetCreatorBufferProducer()45     sptr<Surface> GetCreatorBufferProducer()
46     {
47         return creatorProducerSurface_;
48     }
SetWidth(int32_t width)49     void SetWidth(int32_t width)
50     {
51         width_ = width;
52     }
GetWidth()53     int32_t GetWidth() const
54     {
55         return width_;
56     }
SetHeight(int32_t height)57     void SetHeight(int32_t height)
58     {
59         height_ = height;
60     }
GetHeight()61     int32_t GetHeight() const
62     {
63         return height_;
64     }
SetFormat(int32_t format)65     void SetFormat(int32_t format)
66     {
67         format_ = format;
68     }
GetFormat()69     int32_t GetFormat() const
70     {
71         return format_;
72     }
SetCapicity(int32_t capicity)73     void SetCapicity(int32_t capicity)
74     {
75         capicity_ = capicity;
76     }
GetCapicity()77     int32_t GetCapicity() const
78     {
79         return capicity_;
80     }
SetCreatorKey(std::string creatorKey)81     void SetCreatorKey(std::string creatorKey)
82     {
83         creatorKey_ = creatorKey;
84     }
GetCreatorKey()85     std::string GetCreatorKey() const
86     {
87         return creatorKey_;
88     }
GetCurrentCreatorBuffer()89     OHOS::sptr<OHOS::SurfaceBuffer> GetCurrentCreatorBuffer() const
90     {
91         return currentCreatorBuffer_;
92     }
SetCurrentBuffer(OHOS::sptr<OHOS::SurfaceBuffer> currentCreatorBuffer)93     void SetCurrentBuffer(OHOS::sptr<OHOS::SurfaceBuffer> currentCreatorBuffer)
94     {
95         currentCreatorBuffer_ = currentCreatorBuffer;
96     }
97 private:
98     OHOS::sptr<IConsumerSurface> creatorConsumerSurface_;
99     OHOS::sptr<Surface> creatorProducerSurface_;
100     int32_t width_;
101     int32_t height_;
102     int32_t format_;
103     int32_t capicity_;
104     std::string creatorKey_;
105 };
106 } // namespace Media
107 } // namespace OHOS
108 #endif // IMAGE_CREATOR_PRIVATE_H
109