diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-05-11 21:42:56 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-05-11 21:42:56 +0200 |
commit | a6d9949d47f583c18b2cb2e35e621936f62d02ab (patch) | |
tree | 622bc50ed4d2a9470163d97a6f4348447eab9c97 /src/config.hpp | |
parent | 4d8eba913d88b669f9d93c347354bc8ed9808f72 (diff) |
Separate stream key per streaming service
Diffstat (limited to 'src/config.hpp')
-rw-r--r-- | src/config.hpp | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/config.hpp b/src/config.hpp index 9120394..e7f57e3 100644 --- a/src/config.hpp +++ b/src/config.hpp @@ -37,10 +37,24 @@ struct MainConfig { bool record_cursor = true; }; -struct StreamingConfig { - std::string streaming_service; +struct YoutubeStreamConfig { + std::string stream_key; +}; + +struct TwitchStreamConfig { std::string stream_key; +}; + +struct CustomStreamConfig { + std::string url; std::string container; +}; + +struct StreamingConfig { + std::string streaming_service; + YoutubeStreamConfig youtube; + TwitchStreamConfig twitch; + CustomStreamConfig custom; ConfigHotkey start_recording_hotkey; }; @@ -351,10 +365,14 @@ static Config read_config(bool &config_empty) { config.main_config.record_cursor = false; } else if(key == "streaming.service") { config.streaming_config.streaming_service.assign(value.str, value.size); - } else if(key == "streaming.key") { - config.streaming_config.stream_key.assign(value.str, value.size); - } else if(key == "streaming.container") { - config.streaming_config.container.assign(value.str, value.size); + } else if(key == "streaming.youtube.key") { + config.streaming_config.youtube.stream_key.assign(value.str, value.size); + } else if(key == "streaming.twitch.key") { + config.streaming_config.twitch.stream_key.assign(value.str, value.size); + } else if(key == "streaming.custom.url") { + config.streaming_config.custom.url.assign(value.str, value.size); + } else if(key == "streaming.custom.container") { + config.streaming_config.custom.container.assign(value.str, value.size); } else if(key == "streaming.start_recording_hotkey") { std::string value_str(value.str, value.size); if(sscanf(value_str.c_str(), FORMAT_I64 " " FORMAT_U32, &config.streaming_config.start_recording_hotkey.keysym, &config.streaming_config.start_recording_hotkey.modifiers) != 2) { @@ -450,8 +468,10 @@ static void save_config(const Config &config) { fprintf(file, "main.record_cursor %s\n", config.main_config.record_cursor ? "true" : "false"); fprintf(file, "streaming.service %s\n", config.streaming_config.streaming_service.c_str()); - fprintf(file, "streaming.key %s\n", config.streaming_config.stream_key.c_str()); - fprintf(file, "streaming.container %s\n", config.streaming_config.container.c_str()); + fprintf(file, "streaming.youtube.key %s\n", config.streaming_config.youtube.stream_key.c_str()); + fprintf(file, "streaming.twitch.key %s\n", config.streaming_config.twitch.stream_key.c_str()); + fprintf(file, "streaming.custom.url %s\n", config.streaming_config.custom.url.c_str()); + fprintf(file, "streaming.custom.container %s\n", config.streaming_config.custom.container.c_str()); fprintf(file, "streaming.start_recording_hotkey " FORMAT_I64 " " FORMAT_U32 "\n", config.streaming_config.start_recording_hotkey.keysym, config.streaming_config.start_recording_hotkey.modifiers); fprintf(file, "record.save_directory %s\n", config.record_config.save_directory.c_str()); |