From f2c8cbfd9a75850217a2ad6997cb89046943b97e Mon Sep 17 00:00:00 2001 From: cxh Date: Fri, 17 Oct 2025 15:54:49 +0800 Subject: [PATCH] 1 --- include/rtmp_manager.hpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/include/rtmp_manager.hpp b/include/rtmp_manager.hpp index 6f86b72..392c387 100644 --- a/include/rtmp_manager.hpp +++ b/include/rtmp_manager.hpp @@ -22,13 +22,28 @@ class RTMPManager std::string last_error; }; + // 初始化与控制接口 static void init(); static void start_all(); static void stop_all(); static bool is_streaming(const std::string &cam_name); static std::string get_stream_url(const std::string &cam_name); + + // 旧版接口(已保留) static std::vector> get_all_status(); + // ✅ 新增:单通道状态结构体(用于心跳) + struct ChannelInfo + { + int loc; // 摄像头位置索引(0~7) + std::string url; // 正常时的推流地址 + bool running; // 是否正常运行 + std::string reason; // 错误原因(仅在异常时填) + }; + + // ✅ 新增:获取所有通道详细状态 + static std::vector get_all_channels_status(); + private: struct StreamContext { @@ -44,6 +59,5 @@ class RTMPManager static std::unordered_map> streams; static std::mutex streams_mutex; - // 参数 static constexpr int RETRY_BASE_DELAY_MS = 3000; };