0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

UI: Add supported codecs to GetClientConfiguration request

This commit is contained in:
Ruwen Hahn 2024-06-18 17:39:02 +02:00 committed by Ryan Foster
parent 8a8019db3f
commit 9d1ac8816e
2 changed files with 28 additions and 1 deletions

View File

@ -24,6 +24,32 @@ constructGoLivePost(QString streamKey,
client.name = "obs-studio";
client.version = obs_get_version_string();
auto add_codec = [&](const char *codec) {
auto it = std::find(std::begin(client.supported_codecs),
std::end(client.supported_codecs), codec);
if (it != std::end(client.supported_codecs))
return;
client.supported_codecs.push_back(codec);
};
const char *encoder_id = nullptr;
for (size_t i = 0; obs_enum_encoder_types(i, &encoder_id); i++) {
auto codec = obs_get_encoder_codec(encoder_id);
if (!codec)
continue;
if (qstricmp(codec, "h264") == 0) {
add_codec("h264");
#ifdef ENABLE_HEVC
} else if (qstricmp(codec, "hevc")) {
add_codec("h265");
#endif
} else if (qstricmp(codec, "av1")) {
add_codec("av1");
}
}
auto &preferences = post_data.preferences;
preferences.vod_track_audio = vod_track_enabled;

View File

@ -109,8 +109,9 @@ using json = nlohmann::json;
struct Client {
string name = "obs-studio";
string version;
std::vector<string> supported_codecs;
NLOHMANN_DEFINE_TYPE_INTRUSIVE(Client, name, version)
NLOHMANN_DEFINE_TYPE_INTRUSIVE(Client, name, version, supported_codecs)
};
struct Cpu {