34 lines
772 B
C++
34 lines
772 B
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
namespace fpv {
|
|
|
|
class Stream;
|
|
|
|
// 兼容输出用的 RTSP 服务器。
|
|
// 只做“把已经在收的 RTP 转成 RTSP 供 VLC/ffplay 拉流”,低延迟主路径仍是 UDP 直推。
|
|
// 支持 TCP interleaved 与 UDP 两种传输,H.265 单轨。
|
|
class RtspServer {
|
|
public:
|
|
// udpBase > 0 时启用 UDP 传输(RTP=udpBase, RTCP=udpBase+1)。
|
|
RtspServer(std::string address, int udpBase);
|
|
~RtspServer();
|
|
|
|
RtspServer(const RtspServer&) = delete;
|
|
RtspServer& operator=(const RtspServer&) = delete;
|
|
|
|
// 注册一路流,路径为 /<name>。
|
|
void addStream(Stream* stream);
|
|
|
|
void start();
|
|
void stop();
|
|
|
|
private:
|
|
struct Impl;
|
|
std::unique_ptr<Impl> impl_;
|
|
};
|
|
|
|
} // namespace fpv
|