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 struct PortInfo { 28 std::string name_; 29 std::string peerPortName_; 30 std::string peerPortNodeName_; 31 }; 32 using PortInfo = struct PortInfo; 33 34 struct PortFormat { 35 int32_t w_; 36 int32_t h_; 37 uint32_t streamId_; 38 int32_t format_; 39 uint64_t usage_; 40 uint8_t needAllocation_; 41 uint32_t bufferCount_; 42 int64_t bufferPoolId_; 43 }; 44 using PortFormat = struct PortFormat; 45 46 struct PortSpec { 47 uint8_t direction_; 48 PortInfo info_; 49 PortFormat format_; 50 }; 51 52 struct NodeSpec { 53 std::string name_; 54 std::string status_; 55 std::string type_; 56 int streamId_; 57 std::vector<PortSpec> portSpecSet_; 58 bool operator==(const NodeSpec& n) 59 { 60 if (this->portSpecSet_.size() == n.portSpecSet_.size()) { 61 return true; 62 } else { 63 return false; 64 } 65 } 66 bool operator!=(const NodeSpec& n) 67 { 68 if (this->portSpecSet_.size() != n.portSpecSet_.size()) { 69 return true; 70 } else { 71 return false; 72 } 73 } 74 }; 75 76 struct PipelineSpec { 77 std::vector<NodeSpec> nodeSpecSet_; 78 }; 79 80 #define G_STREAM_SCENE_TABLE HdfGetModuleConfigRoot() 81 #define G_STREAM_TABLE_PTR HdfGetModuleConfigRoot()->streamInfo 82 #define G_STREAM_TABLE_SIZE HdfGetModuleConfigRoot()->streamInfoSize 83 #define G_STREAM_INFO const struct HdfConfigStreamInfo* 84 #define G_SCENE_TABLE_PTR HdfGetModuleConfigRoot()->sceneInfo 85 #define G_SCENE_TABLE_SIZE HdfGetModuleConfigRoot()->sceneInfoSize 86 #define G_SCENE_INFO const struct HdfConfigSceneInfo* 87 #define G_PIPELINE_CONFIG_TABLE HdfGetPipelineSpecsModuleConfigRoot() 88 #define G_PIPELINE_SPECS_TABLE HdfGetPipelineSpecsModuleConfigRoot()->pipelineSpec 89 #define G_PIPELINE_SPECS_SIZE HdfGetPipelineSpecsModuleConfigRoot()->pipelineSpecSize 90 #define G_PIPELINE_SPEC_DATA_TYPE const struct HdfConfigPipelineSpecsPipelineSpec* 91 #define G_NODE_SPEC_DATA_TYPE const struct HdfConfigPipelineSpecsNodeSpec* 92 #define G_PORT_SPEC_DATA_TYPE const struct HdfConfigPipelineSpecsPORTSpec* 93 94 class INode; 95 struct Pipeline { 96 std::vector<std::shared_ptr<INode>> nodes_; 97 }; 98 using Pipeline = struct Pipeline; 99 } 100 #endif 101