linux client: only show 10-bit if supported

This commit is contained in:
galister authored and xytovl committed 2026-09-29 19:22:33 +02:00
1 parent 9062f082e5
commit e5923e155a
9 files changed
+106 -28

No files matched your search

+27 -6
View File
@@ -223,10 +223,22 @@ public:
if (config.codec == video_codec::raw or config.name == encoder_raw)
return {encoder_raw, video_codec::raw};
std::vector<video_codec> codecs;
if (config.codec)
{
codecs.push_back(*config.codec);
}
else
{
codecs.reserve(info.supported_codecs.size());
for (const auto & capability: info.supported_codecs)
codecs.push_back(capability.codec);
}
#if WIVRN_USE_VULKAN_ENCODE
if (config.name.empty() or config.name == encoder_vulkan)
{
for (auto codec: config.codec ? std::vector{*config.codec} : info.supported_codecs)
for (auto codec: codecs)
{
if (has_vk(codec))
return {encoder_vulkan, codec};
@@ -237,7 +249,7 @@ public:
#if WIVRN_USE_NVENC
if ((nvidia and config.name.empty()) or config.name == encoder_nvenc)
{
for (auto codec: config.codec ? std::vector{*config.codec} : info.supported_codecs)
for (auto codec: codecs)
{
if (check_nvenc(codec))
return {encoder_nvenc, codec};
@@ -248,7 +260,7 @@ public:
#if WIVRN_USE_VAAPI
if (config.name.empty() or config.name == encoder_vaapi)
{
for (auto codec: config.codec ? std::vector{*config.codec} : info.supported_codecs)
for (auto codec: codecs)
{
if (check_vaapi(codec))
return {encoder_vaapi, codec};
@@ -309,11 +321,20 @@ std::array<encoder_settings, 3> get_encoder_settings(wivrn::vk_bundle & bundle,
if (bit_depth and bit_depth != 8 and bit_depth != 10)
throw std::runtime_error("invalid bit-depth setting. supported values: 8, 10");
if (std::ranges::contains(res, video_codec::h264, &encoder_settings::codec) or
std::ranges::contains(res, video_codec::raw, &encoder_settings::codec))
const bool all_encoders_10bit = std::ranges::all_of(res, [&](const encoder_settings & encoder) {
auto it = std::ranges::find(info.supported_codecs, encoder.codec, &video_codec_capability::codec);
return it != info.supported_codecs.end() and it->supports_10bit;
});
if (bit_depth == 10 and not all_encoders_10bit)
{
U_LOG_I("Using 8-bit encoding due to mixed encoder support.");
bit_depth = 8;
}
else if (not bit_depth)
bit_depth = 10;
{
bit_depth = all_encoders_10bit ? 10 : 8;
}
auto check_format = [&](vk::Format format) {
try