• 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  *     http://www.apache.org/licenses/LICENSE-2.0
7  * Unless required by applicable law or agreed to in writing, software
8  * distributed under the License is distributed on an "AS IS" BASIS,
9  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10  * See the License for the specific language governing permissions and
11  * limitations under the License.
12  */
13 
14 #ifndef STREAM_PIPELINE_DATA_STRUCTURE_H
15 #define STREAM_PIPELINE_DATA_STRUCTURE_H
16 
17 #include <vector>
18 #include <string>
19 #include <memory>
20 extern "C" {
21 #include "config.h"
22 #include "params.h"
23 #include "ibuffer.h"
24 #include "stream.h"
25 }
26 namespace OHOS::Camera {
27 using PortInfo = struct {
28     std::string name_;
29     std::string peerPortName_;
30     std::string peerPortNodeName_;
31 };
32 
33 using PortFormat = struct {
34     int32_t w_;
35     int32_t h_;
36     uint32_t streamId_;
37     int32_t format_;
38     uint64_t usage_;
39     uint8_t needAllocation_;
40     uint32_t bufferCount_;
41     int64_t bufferPoolId_;
42 };
43 
44 struct PortSpec {
45     uint8_t direction_;
46     PortInfo info_;
47     PortFormat format_;
48 };
49 
50 struct NodeSpec {
51     std::string name_;
52     std::string status_;
53     std::string type_;
54     int streamId_;
55     std::vector<PortSpec> portSpecSet_;
56     bool operator==(const NodeSpec& n)
57     {
58         if (this->portSpecSet_.size() == n.portSpecSet_.size()) {
59             return true;
60         } else {
61             return false;
62         }
63     }
64     bool operator!=(const NodeSpec& n)
65     {
66         if (this->portSpecSet_.size() != n.portSpecSet_.size()) {
67             return true;
68         } else {
69             return false;
70         }
71     }
72 };
73 
74 struct PipelineSpec {
75     std::vector<NodeSpec>   nodeSpecSet_;
76 };
77 
78 #define G_STREAM_SCENE_TABLE HdfGetModuleConfigRoot()
79 #define G_STREAM_TABLE_PTR HdfGetModuleConfigRoot()->streamInfo
80 #define G_STREAM_TABLE_SIZE HdfGetModuleConfigRoot()->streamInfoSize
81 #define G_STREAM_INFO const struct HdfConfigStreamInfo*
82 #define G_SCENE_TABLE_PTR HdfGetModuleConfigRoot()->sceneInfo
83 #define G_SCENE_TABLE_SIZE HdfGetModuleConfigRoot()->sceneInfoSize
84 #define G_SCENE_INFO const struct HdfConfigSceneInfo*
85 #define G_PIPELINE_CONFIG_TABLE HdfGetPipelineSpecsModuleConfigRoot()
86 #define G_PIPELINE_SPECS_TABLE HdfGetPipelineSpecsModuleConfigRoot()->pipelineSpec
87 #define G_PIPELINE_SPECS_SIZE HdfGetPipelineSpecsModuleConfigRoot()->pipelineSpecSize
88 #define G_PIPELINE_SPEC_DATA_TYPE const struct HdfConfigPipelineSpecsPipelineSpec*
89 #define G_NODE_SPEC_DATA_TYPE const struct HdfConfigPipelineSpecsNodeSpec*
90 #define G_PORT_SPEC_DATA_TYPE const struct HdfConfigPipelineSpecsPORTSpec*
91 
92 class INode;
93 using Pipeline = struct {
94     std::vector<std::shared_ptr<INode>> nodes_;
95 };
96 }
97 #endif
98