forked from sorayuki/obs-multi-rtmp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprotocols.cpp
31 lines (27 loc) · 861 Bytes
/
protocols.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include "protocols.h"
#include <string>
static ProtocolInfo s_infoList[] = {
// protocol, label, output_id, service_id
{ "RTMP", "RTMP", "rtmp_output", "rtmp_custom" },
{ "SRT_RIST", "SRT/RIST", "ffmpeg_mpegts_muxer", "rtmp_custom" },
{ "WHIP", "WebRTC (WHIP)", "whip_output", "whip_custom" },
{ nullptr, nullptr, nullptr, nullptr }
};
class ProtocolInfosImpl: public ProtocolInfos {
public:
const ProtocolInfo* GetInfo(const char* protocol) override {
std::string_view to_find{ protocol };
for(auto p = s_infoList; p->protocol; ++p) {
if (to_find == p->protocol)
return p;
}
return nullptr;
}
const ProtocolInfo* GetList() override {
return s_infoList;
}
};
ProtocolInfos* GetProtocolInfos() {
static ProtocolInfosImpl impl_;
return &impl_;
}