• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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_DCAMERA_PIPELINE_EVENT_H
17 #define OHOS_DCAMERA_PIPELINE_EVENT_H
18 
19 #include <vector>
20 
21 #include "event.h"
22 #include "data_buffer.h"
23 #include "image_common_type.h"
24 
25 namespace OHOS {
26 namespace DistributedHardware {
27 enum class PipelineAction : int32_t {
28     NO_ACTION = 0,
29 };
30 
31 class PipelineConfig {
32 public:
PipelineConfig()33     PipelineConfig() : pipelineType_(PipelineType::VIDEO) {}
PipelineConfig(PipelineType pipelineType,const std::string & pipelineOwner,const std::vector<std::shared_ptr<DataBuffer>> & multiDataBuffers)34     PipelineConfig(PipelineType pipelineType, const std::string& pipelineOwner,
35         const std::vector<std::shared_ptr<DataBuffer>>& multiDataBuffers)
36         : pipelineType_(pipelineType), pipelineOwner_(pipelineOwner), multiDataBuffers_(multiDataBuffers) {}
37     ~PipelineConfig() = default;
38 
SetPipelineType(PipelineType pipelineType)39     void SetPipelineType(PipelineType pipelineType)
40     {
41         pipelineType_ = pipelineType;
42     }
43 
GetPipelineType()44     PipelineType GetPipelineType() const
45     {
46         return pipelineType_;
47     }
48 
SetPipelineOwner(std::string pipelineOwner)49     void SetPipelineOwner(std::string pipelineOwner)
50     {
51         pipelineOwner_ = pipelineOwner;
52     }
53 
GetPipelineOwner()54     std::string GetPipelineOwner() const
55     {
56         return pipelineOwner_;
57     }
58 
SetDataBuffers(std::vector<std::shared_ptr<DataBuffer>> & multiDataBuffers)59     void SetDataBuffers(std::vector<std::shared_ptr<DataBuffer>>& multiDataBuffers)
60     {
61         multiDataBuffers_ = multiDataBuffers;
62     }
63 
GetDataBuffers()64     std::vector<std::shared_ptr<DataBuffer>> GetDataBuffers() const
65     {
66         return multiDataBuffers_;
67     }
68 
69 private:
70     PipelineType pipelineType_;
71     std::string pipelineOwner_;
72     std::vector<std::shared_ptr<DataBuffer>> multiDataBuffers_;
73 };
74 
75 class DCameraPipelineEvent : public Event {
TYPEINDENT(DCameraPipelineEvent)76     TYPEINDENT(DCameraPipelineEvent)
77 public:
78     DCameraPipelineEvent(EventSender& sender, const std::shared_ptr<PipelineConfig>& pipelineConfig)
79         : Event(sender), pipelineConfig_(pipelineConfig), action_(PipelineAction::NO_ACTION) {}
DCameraPipelineEvent(EventSender & sender,const std::shared_ptr<PipelineConfig> & pipelineConfig,PipelineAction otherAction)80     DCameraPipelineEvent(EventSender& sender, const std::shared_ptr<PipelineConfig>& pipelineConfig,
81         PipelineAction otherAction)
82         : Event(sender), pipelineConfig_(pipelineConfig), action_(otherAction) {}
83     ~DCameraPipelineEvent() = default;
84 
GetPipelineConfig()85     std::shared_ptr<PipelineConfig> GetPipelineConfig() const
86     {
87         return pipelineConfig_;
88     }
89 
GetAction()90     PipelineAction GetAction() const
91     {
92         return action_;
93     }
94 
95 private:
96     std::shared_ptr<PipelineConfig> pipelineConfig_ = nullptr;
97     PipelineAction action_;
98 };
99 } // namespace DistributedHardware
100 } // namespace OHOS
101 #endif // OHOS_DCAMERA_PIPELINE_EVENT_H
102