-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfig.h
More file actions
70 lines (53 loc) · 1.9 KB
/
Config.h
File metadata and controls
70 lines (53 loc) · 1.9 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#pragma once
#include <string_view>
#include <set>
#include <map>
#include <deque>
#include <optional>
#include <spdlog/common.h>
struct Config
{
static constexpr std::string_view KeyPlaceholder = "{key}";
struct ReStreamer;
spdlog::level::level_enum logLevel = spdlog::level::info;
#if VK_VIDEO_STREAMER
const static constexpr std::string_view targetUrlTemplate = "rtmp://ovsu.okcdn.ru/input/{key}";
#elif YOUTUBE_LIVE_STREAMER
const static constexpr std::string_view targetUrlTemplate = "rtmp://a.rtmp.youtube.com/live2/{key}";
#endif
std::map<std::string, ReStreamer>::const_iterator
addReStreamer(
const std::string& id,
const Config::ReStreamer&);
void removeReStreamer(const std::string& id);
std::map<std::string, ReStreamer> reStreamers; // uniqueId -> ReStreamer
std::deque<std::string> reStreamersOrder;
};
struct Config::ReStreamer {
static std::string BuildTargetUrl(const char* targetUrl, const char* key);
static std::string BuildTargetUrl(const char* key)
{ return BuildTargetUrl(nullptr, key); }
static std::string BuildTargetUrl(const std::string& key)
{ return BuildTargetUrl(key.c_str()); }
std::string sourceUrl;
std::string description;
std::string targetUrl;
bool enabled;
std::string forceH264ProfileLevelId = "42c015";
};
struct ConfigChanges
{
struct ReStreamerChanges;
std::map<std::string, ReStreamerChanges> reStreamersChanges; // uniqueId -> ReStreamer
};
struct ConfigChanges::ReStreamerChanges {
std::optional<std::string> sourceUrl;
std::optional<std::string> description;
std::optional<std::string> targetUrl;
std::optional<bool> enabled;
bool drop = false;
Config::ReStreamer makeReStreamer() const;
};
std::string UserConfigPath(const std::string& userConfigDir);
std::optional<std::string> AppConfigPath();
void SaveAppConfig(const Config& appConfig);