diff --git a/CMakeLists.txt b/CMakeLists.txt index a7461945..14edbe98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -204,7 +204,9 @@ if (WIVRN_BUILD_CLIENT) endif() if (WIVRN_BUILD_CLIENT AND NOT ANDROID) - pkg_check_modules(LIBAV_CLIENT REQUIRED IMPORTED_TARGET libavcodec libavutil libswscale) + if(NOT WIVRN_USE_V4L2) + pkg_check_modules(LIBAV_CLIENT REQUIRED IMPORTED_TARGET libavcodec libavutil libswscale) + endif() find_package(Fontconfig REQUIRED) if (WIVRN_USE_SYSTEM_OPENXR) diff --git a/CMakePresets.json b/CMakePresets.json index 45a30ab2..986b07be 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -157,6 +157,28 @@ "cacheVariables": { "WIVRN_USE_SYSTEM_BOOST": "OFF" } + }, + { + "name": "frame", + "generator": "Ninja", + "cacheVariables": { + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "CMAKE_INTERPROCEDURAL_OPTIMIZATION": "ON", + "CMAKE_BUILD_TYPE": "Release", + "WIVRN_BUILD_CLIENT": "ON", + "WIVRN_BUILD_SERVER": "OFF", + "WIVRN_BUILD_SERVER_LIBRARY": "OFF", + "WIVRN_BUILD_DASHBOARD": "OFF", + "WIVRN_BUILD_DISSECTOR": "OFF", + "WIVRN_BUILD_WIVRNCTL": "OFF", + "WIVRN_USE_PIPEWIRE": "ON", + "WIVRN_USE_V4L2": "ON", + "WIVRN_USE_SYSTEM_BOOST": "OFF", + "WIVRN_USE_SYSTEM_LIBKTX": "OFF", + "WIVRN_USE_SYSTEM_OPENXR": "OFF", + "WIVRN_COMPRESS_GLB": "ON", + "WIVRN_WERROR": "ON" + } } ], "buildPresets": [ diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index ff06bf74..51610e7a 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -108,16 +108,17 @@ else() target_link_libraries(wivrn openxr_loader) endif() - target_link_libraries(wivrn PkgConfig::LIBAV_CLIENT Fontconfig::Fontconfig CURL::libcurl) - - file(GLOB PLATFORM_SOURCE CONFIGURE_DEPENDS - "decoder/ffmpeg/*.cpp") + target_link_libraries(wivrn Fontconfig::Fontconfig CURL::libcurl) if(WIVRN_USE_V4L2) file(GLOB CLIENT_V4L2_SOURCE CONFIGURE_DEPENDS "decoder/v4l2/*.cpp") list(APPEND PLATFORM_SOURCE ${CLIENT_V4L2_SOURCE}) target_compile_definitions(wivrn PRIVATE WIVRN_USE_V4L2) + else() + target_link_libraries(wivrn PkgConfig::LIBAV_CLIENT) + file(GLOB PLATFORM_SOURCE CONFIGURE_DEPENDS + "decoder/ffmpeg/*.cpp") endif() if(WIVRN_USE_PIPEWIRE) diff --git a/client/decoder/decoder.cpp b/client/decoder/decoder.cpp index 8cd72ca9..12943258 100644 --- a/client/decoder/decoder.cpp +++ b/client/decoder/decoder.cpp @@ -21,14 +21,13 @@ #ifdef __ANDROID__ #include "decoder/android/android_decoder.h" #else -#include "decoder/ffmpeg/ffmpeg_decoder.h" #ifdef WIVRN_USE_V4L2 #include "decoder/v4l2/v4l2_decoder.h" +#else +#include "decoder/ffmpeg/ffmpeg_decoder.h" #endif #endif #include "decoder/raw_decoder.h" -#include "spdlog/spdlog.h" -#include wivrn::decoder::~decoder() = default; @@ -54,21 +53,10 @@ std::shared_ptr wivrn::decoder::make( stream_index, scene, acc); +#elifdef WIVRN_USE_V4L2 + return std::make_shared( + device, phys_dev, vk_queue_family_index, description, stream_index, scene, acc); #else -#ifdef WIVRN_USE_V4L2 - if (wivrn::v4l2::decoder::available_for(description.codec[stream_index])) - { - try - { - return std::make_shared( - 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( device, phys_dev, description, stream_index, scene, acc); #endif @@ -90,15 +78,10 @@ static std::vector supported_codecs_() std::vector res; #ifdef __ANDROID__ wivrn::android::decoder::supported_codecs(res); -#else -#ifdef WIVRN_USE_V4L2 +#elifdef WIVRN_USE_V4L2 wivrn::v4l2::decoder::supported_codecs(res); -#endif - std::vector 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); +#else + wivrn::ffmpeg::decoder::supported_codecs(res); #endif res.push_back(wivrn::video_codec::raw); return res;