1
This commit is contained in:
parent
f56d94dbca
commit
f2c8cbfd9a
@ -22,13 +22,28 @@ class RTMPManager
|
|||||||
std::string last_error;
|
std::string last_error;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 初始化与控制接口
|
||||||
static void init();
|
static void init();
|
||||||
static void start_all();
|
static void start_all();
|
||||||
static void stop_all();
|
static void stop_all();
|
||||||
static bool is_streaming(const std::string &cam_name);
|
static bool is_streaming(const std::string &cam_name);
|
||||||
static std::string get_stream_url(const std::string &cam_name);
|
static std::string get_stream_url(const std::string &cam_name);
|
||||||
|
|
||||||
|
// 旧版接口(已保留)
|
||||||
static std::vector<std::pair<std::string, bool>> get_all_status();
|
static std::vector<std::pair<std::string, bool>> get_all_status();
|
||||||
|
|
||||||
|
// ✅ 新增:单通道状态结构体(用于心跳)
|
||||||
|
struct ChannelInfo
|
||||||
|
{
|
||||||
|
int loc; // 摄像头位置索引(0~7)
|
||||||
|
std::string url; // 正常时的推流地址
|
||||||
|
bool running; // 是否正常运行
|
||||||
|
std::string reason; // 错误原因(仅在异常时填)
|
||||||
|
};
|
||||||
|
|
||||||
|
// ✅ 新增:获取所有通道详细状态
|
||||||
|
static std::vector<ChannelInfo> get_all_channels_status();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct StreamContext
|
struct StreamContext
|
||||||
{
|
{
|
||||||
@ -44,6 +59,5 @@ class RTMPManager
|
|||||||
static std::unordered_map<std::string, std::unique_ptr<StreamContext>> streams;
|
static std::unordered_map<std::string, std::unique_ptr<StreamContext>> streams;
|
||||||
static std::mutex streams_mutex;
|
static std::mutex streams_mutex;
|
||||||
|
|
||||||
// 参数
|
|
||||||
static constexpr int RETRY_BASE_DELAY_MS = 3000;
|
static constexpr int RETRY_BASE_DELAY_MS = 3000;
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user