- 创建基本项目结构和目录 - 添加CMake构建系统 - 实现基础的配置解析功能 - 添加YOLO推理框架支持 - 集成RTSP和视频流处理功能 - 添加性能监控和日志系统
62 lines
1.6 KiB
C++
62 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <memory>
|
|
#include <mutex>
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
#include "writer_interface.hpp"
|
|
#include "../common/config_parser.hpp"
|
|
|
|
namespace pipeline {
|
|
|
|
class OutputManager {
|
|
public:
|
|
OutputManager();
|
|
~OutputManager();
|
|
|
|
// 禁用拷贝
|
|
OutputManager(const OutputManager&) = delete;
|
|
OutputManager& operator=(const OutputManager&) = delete;
|
|
|
|
// 添加输出目标
|
|
bool addTarget(const OutputTargetConfig& config);
|
|
|
|
// 写入帧
|
|
bool writeFrames(const cv::Mat& frame);
|
|
|
|
// 写入来自特定输入源的帧
|
|
bool writeFrames(const std::string& source_name, const cv::Mat& frame);
|
|
|
|
// 获取目标状态
|
|
bool getTargetStatus(const std::string& name, std::string& error_msg) const;
|
|
|
|
// 获取目标数量
|
|
size_t getTargetCount() const;
|
|
|
|
// 获取所有目标名称
|
|
std::vector<std::string> getTargetNames() const;
|
|
|
|
// 移除目标
|
|
bool removeTarget(const std::string& name);
|
|
|
|
// 清理所有资源
|
|
void cleanup();
|
|
|
|
// 添加输入源到输出目标的映射
|
|
bool addSourceTargetMapping(const std::string& source_name, const std::vector<std::string>& target_names);
|
|
|
|
// 移除输入源的映射
|
|
bool removeSourceMapping(const std::string& source_name);
|
|
|
|
private:
|
|
// 创建写入器实例
|
|
std::unique_ptr<WriterInterface> createWriter(const std::string& type);
|
|
|
|
mutable std::mutex mutex_;
|
|
std::unordered_map<std::string, std::unique_ptr<WriterInterface>> writers_;
|
|
std::unordered_map<std::string, std::unordered_set<std::string>> source_target_mapping_;
|
|
bool initialized_{false};
|
|
};
|
|
|
|
} // namespace pipeline
|