leon 1 개월 전
부모
커밋
d6e4a7a8e9
3개의 변경된 파일51개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      src/main.cpp
  2. 42 0
      src/nodes/analyze/analyzeNode.cpp
  3. 3 0
      src/pipeline/pipiline.hpp

+ 6 - 0
src/main.cpp

@@ -5,22 +5,28 @@
 #include "nodes/httpPush/httpPush.hpp"
 
 
+
 int main()
 {
     std::shared_ptr<Node::StreamNode> src_node   = std::make_shared<Node::StreamNode>("src", "rtsp://admin:lww123456@172.16.22.16:554/Streaming/Channels/101");
     src_node->set_skip_frame(10);
 
+    std::shared_ptr<Node::StreamNode> src_node1   = std::make_shared<Node::StreamNode>("src", "rtsp://admin:lww123456@172.16.22.16:554/Streaming/Channels/201");
+    src_node1->set_skip_frame(10);
+
 
     std::shared_ptr<Node::InferNode> infer_node   = std::make_shared<Node::InferNode>("infer");
     std::shared_ptr<Node::DrawNode> draw_node     = std::make_shared<Node::DrawNode>("draw");
     std::shared_ptr<Node::HttpPushNode> push_node = std::make_shared<Node::HttpPushNode>("push", "172.16.20.168", 8080, "/push");
     Node::LinkNode(src_node, infer_node);
+    Node::LinkNode(src_node1, infer_node);
     Node::LinkNode(infer_node, draw_node);
     Node::LinkNode(draw_node, push_node);
     push_node->start();
     draw_node->start();
     infer_node->start();
     src_node->start();
+    src_node1->start();
     
     getchar();
     return 0;

+ 42 - 0
src/nodes/analyze/analyzeNode.cpp

@@ -0,0 +1,42 @@
+#include "nodes/base/base.hpp"
+#include "nodes/analyze/analyzeNode.hpp"
+
+
+namespace Node
+{
+
+
+void AnalyzeNode::work()
+{
+    printf("AnalyzeNode %s\n", name_.c_str());
+    while (running_)
+    {
+        
+        for (auto& input_buffer : input_buffers_)
+        {
+            std::shared_ptr<meta::MetaData> metaData;
+            if (!input_buffer.second->try_pop(metaData))
+            {
+                continue;
+            }
+            printf("Node %s get data from %s\n", name_.c_str(), input_buffer.first.c_str());
+            int width = metaData->image.cols;
+            int height = metaData->image.rows;
+
+            auto boxes = metaData->boxes;
+            for (auto& box : boxes)
+            {
+                // 将分析的结果存入到 metaData->result 中
+            }
+            metaData->result = boxes;
+            for (auto& output_buffer : output_buffers_)
+            {
+                printf("Node %s push data to %s\n", name_.c_str(), output_buffer.first.c_str());
+                output_buffer.second->push(metaData);
+            }
+        }
+    }
+}
+
+
+}   // namespace Node

+ 3 - 0
src/pipeline/pipiline.hpp

@@ -21,6 +21,9 @@ private:
     bool running_ = false;
 };
 
+
+void create_pipeline();
+
 }
 
 #endif // PIPELINE_HPP__