Add codec and 10-bit config in headset

This commit is contained in:
Sapphire
2025-12-11 13:42:16 +01:00
committed by Patrick Nicolas
parent 9b4a26b5a8
commit 6f32f049d7
14 changed files with 117 additions and 11 deletions
+21
View File
@@ -20,6 +20,7 @@
#include "configuration.h"
#include "application.h"
#include "utils/json_string.h"
#include "wivrn_packets.h"
#include <fstream>
#include <magic_enum.hpp>
@@ -132,6 +133,21 @@ configuration::configuration(xr::system & system)
if (auto val = root["stream_scale"]; val.is_double())
stream_scale = val.get_double();
if (auto val = root["codec"]; val.is_string())
{
const auto codec_str = val.get_string().value();
for (const auto & [c, name]: magic_enum::enum_entries<wivrn::video_codec>())
{
if (codec_str == name)
{
codec = c;
}
}
}
if (auto val = root["bit_depth"]; val.is_uint64())
bit_depth = val.get_uint64();
if (auto val = root["bitrate_bps"]; val.is_number())
bitrate_bps = val.get_uint64();
@@ -194,6 +210,8 @@ configuration::configuration(xr::system & system)
preferred_refresh_rate.reset();
minimum_refresh_rate.reset();
resolution_scale = 1.0;
codec.reset();
bit_depth = 10;
bitrate_bps = 50'000'000;
openxr_post_processing = {};
passthrough_enabled = system.passthrough_supported() == xr::passthrough_type::color;
@@ -260,6 +278,9 @@ void configuration::save()
json << ",\"resolution_scale\":" << resolution_scale;
if (stream_scale)
json << ",\"stream_scale\":" << *stream_scale;
if (codec)
json << ",\"codec\":" << json_string(magic_enum::enum_name(*codec));
json << ",\"bit_depth\":" << (uint64_t)bit_depth;
json << ",\"bitrate_bps\":" << bitrate_bps;
json << ",\"openxr_post_processing\":";
write_openxr_post_processing(json, openxr_post_processing);