Probe supported codecs only once

This commit is contained in:
Patrick Nicolas
2026-03-02 11:07:03 +01:00
parent 6859db7c34
commit 33fac50895
5 changed files with 12 additions and 10 deletions
+10 -4
View File
@@ -71,14 +71,20 @@ std::shared_ptr<wivrn::decoder> wivrn::decoder::make(
__builtin_unreachable();
}
std::vector<wivrn::video_codec> wivrn::decoder::supported_codecs()
static std::vector<wivrn::video_codec> supported_codecs_()
{
std::vector<wivrn::video_codec> res;
#ifdef __ANDROID__
android::decoder::supported_codecs(res);
wivrn::android::decoder::supported_codecs(res);
#else
ffmpeg::decoder::supported_codecs(res);
wivrn::ffmpeg::decoder::supported_codecs(res);
#endif
res.push_back(video_codec::raw);
res.push_back(wivrn::video_codec::raw);
return res;
}
const std::vector<wivrn::video_codec> & wivrn::decoder::supported_codecs()
{
static std::vector<wivrn::video_codec> res = supported_codecs_();
return res;
}
+1 -1
View File
@@ -66,6 +66,6 @@ public:
virtual vk::Sampler sampler() = 0;
static std::vector<wivrn::video_codec> supported_codecs();
static const std::vector<wivrn::video_codec> & supported_codecs();
};
} // namespace wivrn
-2
View File
@@ -1262,8 +1262,6 @@ void scenes::lobby::on_focused()
vps,
image_cache);
supported_codecs = wivrn::decoder::supported_codecs();
auto t = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
auto tm = std::localtime(&t);
switch (tm->tm_mon)
-2
View File
@@ -132,8 +132,6 @@ class lobby : public scene_impl<lobby>
tab last_current_tab = tab::server_list;
int optional_feature_index = 0; // Which step of the first run screen are we in
std::vector<wivrn::video_codec> supported_codecs;
ImTextureID about_picture;
virtual_keyboard keyboard;
+1 -1
View File
@@ -747,7 +747,7 @@ void scenes::lobby::gui_settings()
config.codec = std::nullopt;
config.save();
}
for (auto codec: supported_codecs)
for (auto codec: decoder::supported_codecs())
{
// don't show raw in GUI
if (codec == wivrn::raw)