linux client: v4l2 decoder

This commit is contained in:
galister committed 2026-09-27 17:14:33 +09:00
1 parent ce4486bc61
commit 2191884e95
8 files changed
+1342 -8

No files matched your search

+28 -7
View File
@@ -22,8 +22,13 @@
#include "decoder/android/android_decoder.h"
#else
#include "decoder/ffmpeg/ffmpeg_decoder.h"
#ifdef WIVRN_USE_V4L2
#include "decoder/v4l2/v4l2_decoder.h"
#endif
#endif
#include "decoder/raw_decoder.h"
#include "spdlog/spdlog.h"
#include <algorithm>
wivrn::decoder::~decoder() = default;
@@ -50,13 +55,22 @@ std::shared_ptr<wivrn::decoder> wivrn::decoder::make(
scene,
acc);
#else
#ifdef WIVRN_USE_V4L2
if (wivrn::v4l2::decoder::available_for(description.codec[stream_index]))
{
try
{
return std::make_shared<wivrn::v4l2::decoder>(
device, phys_dev, vk_queue_family_index, description, stream_index, scene, acc);
}
catch (const std::exception & e)
{
spdlog::warn("V4L2 iris decoder initialization failed: {}. Falling back to FFmpeg.", e.what());
}
}
#endif
return std::make_shared<wivrn::ffmpeg::decoder>(
device,
phys_dev,
description,
stream_index,
scene,
acc);
device, phys_dev, description, stream_index, scene, acc);
#endif
case raw:
return std::make_shared<wivrn::raw_decoder>(
@@ -77,7 +91,14 @@ static std::vector<wivrn::video_codec> supported_codecs_()
#ifdef __ANDROID__
wivrn::android::decoder::supported_codecs(res);
#else
wivrn::ffmpeg::decoder::supported_codecs(res);
#ifdef WIVRN_USE_V4L2
wivrn::v4l2::decoder::supported_codecs(res);
#endif
std::vector<wivrn::video_codec> software_codecs;
wivrn::ffmpeg::decoder::supported_codecs(software_codecs);
for (auto codec: software_codecs)
if (not std::ranges::contains(res, codec))
res.push_back(codec);
#endif
res.push_back(wivrn::video_codec::raw);
return res;