1 /* 2 * Copyright (c) 2021 - 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 * 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 #include <dlfcn.h> 21 extern "C" { 22 #include "config.h" 23 #include "params.h" 24 #include "ibuffer.h" 25 #include "stream.h" 26 } 27 namespace OHOS::Camera { 28 using PortInfo = struct { 29 std::string name_; 30 std::string peerPortName_; 31 std::string peerPortNodeName_; 32 }; 33 34 using PortFormat = struct { 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 45 struct PortSpec { 46 uint8_t direction_; 47 PortInfo info_; 48 PortFormat format_; 49 }; 50 51 struct NodeSpec { 52 std::string name_; 53 std::string status_; 54 std::string type_; 55 int streamId_; 56 std::vector<PortSpec> portSpecSet_; 57 bool operator==(const NodeSpec& n) 58 { 59 if (this->portSpecSet_.size() == n.portSpecSet_.size()) { 60 return true; 61 } else { 62 return false; 63 } 64 } 65 bool operator!=(const NodeSpec& n) 66 { 67 if (this->portSpecSet_.size() != n.portSpecSet_.size()) { 68 return true; 69 } else { 70 return false; 71 } 72 } 73 }; 74 75 struct PipelineSpec { 76 std::vector<NodeSpec> nodeSpecSet_; 77 }; 78 79 extern "C" const struct HdfConfigRoot* HdfGetModuleConfigRoot(void); 80 extern "C" const struct HdfConfigPipelineSpecsRoot* HdfGetPipelineSpecsModuleConfigRoot(void); 81 82 #define G_STREAM_SCENE_TABLE HdfGetModuleConfigRoot() 83 #define G_STREAM_TABLE_PTR HdfGetModuleConfigRoot()->streamInfo 84 #define G_STREAM_TABLE_SIZE HdfGetModuleConfigRoot()->streamInfoSize 85 #define G_STREAM_INFO const struct HdfConfigStreamInfo* 86 #define G_SCENE_TABLE_PTR HdfGetModuleConfigRoot()->sceneInfo 87 #define G_SCENE_TABLE_SIZE HdfGetModuleConfigRoot()->sceneInfoSize 88 #define G_SCENE_INFO const struct HdfConfigSceneInfo* 89 #define G_PIPELINE_CONFIG_TABLE HdfGetPipelineSpecsModuleConfigRoot() 90 #define G_PIPELINE_SPECS_TABLE HdfGetPipelineSpecsModuleConfigRoot()->pipelineSpec 91 #define G_PIPELINE_SPECS_SIZE HdfGetPipelineSpecsModuleConfigRoot()->pipelineSpecSize 92 #define G_PIPELINE_SPEC_DATA_TYPE const struct HdfConfigPipelineSpecsPipelineSpec* 93 #define G_NODE_SPEC_DATA_TYPE const struct HdfConfigPipelineSpecsNodeSpec* 94 #define G_PORT_SPEC_DATA_TYPE const struct HdfConfigPipelineSpecsPORTSpec* 95 96 class INode; 97 using Pipeline = struct { 98 std::vector<std::shared_ptr<INode>> nodes_; 99 uint32_t maxWidth_; 100 uint32_t maxHeight_; 101 }; 102 } 103 #endif 104