obs-studio/UI/goliveapi-postdata.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
1.4 KiB
C++
Raw Normal View History

2024-04-18 15:41:36 +02:00
#include "goliveapi-postdata.hpp"
#include <nlohmann/json.hpp>
#include "system-info.hpp"
#include "models/multitrack-video.hpp"
GoLiveApi::PostData
constructGoLivePost(QString streamKey,
const std::optional<uint64_t> &maximum_aggregate_bitrate,
const std::optional<uint32_t> &maximum_video_tracks,
bool vod_track_enabled)
{
GoLiveApi::PostData post_data{};
post_data.service = "IVS";
post_data.schema_version = "2024-06-04";
2024-04-18 15:41:36 +02:00
post_data.authentication = streamKey.toStdString();
system_info(post_data.capabilities);
auto &client = post_data.client;
2024-04-18 15:41:36 +02:00
client.name = "obs-studio";
client.version = obs_get_version_string();
auto &preferences = post_data.preferences;
preferences.vod_track_audio = vod_track_enabled;
2024-04-18 15:41:36 +02:00
obs_video_info ovi;
if (obs_get_video_info(&ovi)) {
preferences.width = ovi.output_width;
preferences.height = ovi.output_height;
preferences.framerate.numerator = ovi.fps_num;
preferences.framerate.denominator = ovi.fps_den;
2024-04-18 15:41:36 +02:00
preferences.canvas_width = ovi.base_width;
preferences.canvas_height = ovi.base_height;
preferences.composition_gpu_index = ovi.adapter;
2024-04-18 15:41:36 +02:00
}
if (maximum_aggregate_bitrate.has_value())
preferences.maximum_aggregate_bitrate =
maximum_aggregate_bitrate.value();
if (maximum_video_tracks.has_value())
preferences.maximum_video_tracks = maximum_video_tracks.value();
return post_data;
}