Make encoder options explicit in cmake
This commit is contained in:
@@ -81,12 +81,12 @@ target_compile_features(wivrn-server PRIVATE cxx_std_20)
|
||||
|
||||
target_include_directories(wivrn-server SYSTEM PRIVATE ${monado_SOURCE_DIR}/src/xrt/compositor/)
|
||||
|
||||
if(CUDAToolkit_FOUND)
|
||||
if(WIVRN_USE_NVENC)
|
||||
target_sources(wivrn-server PRIVATE driver/video_encoder_nvenc.cpp)
|
||||
target_link_libraries(wivrn-server PRIVATE CUDA::cuda_driver nvidia-encode)
|
||||
endif()
|
||||
|
||||
if(LIBAV_FOUND)
|
||||
if(WIVRN_USE_VAAPI)
|
||||
target_sources(
|
||||
wivrn-server
|
||||
PRIVATE driver/ffmpeg/VideoEncoderFFMPEG.cpp driver/ffmpeg/VideoEncoderVA.cpp
|
||||
@@ -95,7 +95,7 @@ if(LIBAV_FOUND)
|
||||
target_link_libraries(wivrn-server PRIVATE PkgConfig::LIBAV)
|
||||
endif()
|
||||
|
||||
if(X264_FOUND)
|
||||
if(WIVRN_USE_X264)
|
||||
target_sources(wivrn-server PRIVATE driver/video_encoder_x264.cpp)
|
||||
target_link_libraries(wivrn-server PRIVATE PkgConfig::X264)
|
||||
endif()
|
||||
|
||||
@@ -22,12 +22,13 @@
|
||||
#include "video_encoder.h"
|
||||
#include "vk/vk_helpers.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#include "wivrn_config.h"
|
||||
|
||||
#ifdef WIVRN_HAVE_FFMPEG
|
||||
#ifdef WIVRN_USE_VAAPI
|
||||
#include "ffmpeg/VideoEncoderVA.h"
|
||||
#endif
|
||||
|
||||
@@ -56,9 +57,9 @@ static std::vector<xrt::drivers::wivrn::encoder_settings> get_encoder_default_se
|
||||
|
||||
if (is_nvidia(vk))
|
||||
{
|
||||
#ifdef WIVRN_HAVE_CUDA
|
||||
#ifdef WIVRN_USE_NVENC
|
||||
settings.encoder_name = encoder_nvenc;
|
||||
#elif defined(WIVRN_HAVE_X264)
|
||||
#elif defined(WIVRN_USE_X264)
|
||||
settings.encoder_name = encoder_x264;
|
||||
settings.codec = xrt::drivers::wivrn::h264;
|
||||
U_LOG_W("nvidia GPU detected, but cuda support not compiled");
|
||||
@@ -69,9 +70,9 @@ static std::vector<xrt::drivers::wivrn::encoder_settings> get_encoder_default_se
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef WIVRN_HAVE_FFMPEG
|
||||
#ifdef WIVRN_USE_VAAPI
|
||||
settings.encoder_name = encoder_vaapi;
|
||||
#elif defined(WIVRN_HAVE_X264)
|
||||
#elif defined(WIVRN_USE_X264)
|
||||
settings.encoder_name = encoder_x264;
|
||||
settings.codec = xrt::drivers::wivrn::h264;
|
||||
U_LOG_W("ffmpeg support not compiled, vaapi encoder not available");
|
||||
@@ -127,7 +128,7 @@ VkImageTiling xrt::drivers::wivrn::get_required_tiling(vk_bundle * vk,
|
||||
bool can_drm = vk->has_EXT_image_drm_format_modifier;
|
||||
for (const auto & item: settings)
|
||||
{
|
||||
#ifdef WIVRN_HAVE_FFMPEG
|
||||
#ifdef WIVRN_USE_VAAPI
|
||||
if (item.encoder_name == encoder_vaapi)
|
||||
{
|
||||
can_optimal = false;
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
|
||||
#include "wivrn_config.h"
|
||||
|
||||
#ifdef WIVRN_HAVE_CUDA
|
||||
#ifdef WIVRN_USE_NVENC
|
||||
#include "video_encoder_nvenc.h"
|
||||
#endif
|
||||
#ifdef WIVRN_HAVE_FFMPEG
|
||||
#ifdef WIVRN_USE_VAAPI
|
||||
#include "ffmpeg/VideoEncoderVA.h"
|
||||
#endif
|
||||
#ifdef WIVRN_HAVE_X264
|
||||
#ifdef WIVRN_USE_X264
|
||||
#include "video_encoder_x264.h"
|
||||
#endif
|
||||
|
||||
@@ -51,19 +51,19 @@ std::unique_ptr<VideoEncoder> VideoEncoder::Create(
|
||||
{
|
||||
using namespace std::string_literals;
|
||||
std::unique_ptr<VideoEncoder> res;
|
||||
#ifdef WIVRN_HAVE_X264
|
||||
#ifdef WIVRN_USE_X264
|
||||
if (settings.encoder_name == encoder_x264)
|
||||
{
|
||||
res = std::make_unique<VideoEncoderX264>(vk, pool, settings, input_width, input_height, fps);
|
||||
}
|
||||
#endif
|
||||
#ifdef WIVRN_HAVE_CUDA
|
||||
#ifdef WIVRN_USE_NVENC
|
||||
if (settings.encoder_name == encoder_nvenc)
|
||||
{
|
||||
res = std::make_unique<VideoEncoderNvenc>(vk, settings, fps);
|
||||
}
|
||||
#endif
|
||||
#ifdef WIVRN_HAVE_FFMPEG
|
||||
#ifdef WIVRN_USE_VAAPI
|
||||
if (settings.encoder_name == encoder_vaapi)
|
||||
{
|
||||
res = std::make_unique<VideoEncoderVA>(vk, settings, fps);
|
||||
|
||||
@@ -68,7 +68,6 @@ int create_listen_socket()
|
||||
int fd = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
|
||||
int ret = bind(fd, (struct sockaddr *)&addr, sizeof(addr));
|
||||
|
||||
#ifdef XRT_HAVE_LIBBSD
|
||||
// no other instance is running, or we would have never arrived here
|
||||
if (ret < 0 && errno == EADDRINUSE)
|
||||
{
|
||||
@@ -82,7 +81,6 @@ int create_listen_socket()
|
||||
}
|
||||
ret = bind(fd, (struct sockaddr *)&addr, sizeof(addr));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user