Use cmakedefine01 instead of cmakedefine
This commit is contained in:
@@ -30,10 +30,10 @@
|
||||
|
||||
#include "wivrn_config.h"
|
||||
|
||||
#ifdef WIVRN_USE_NVENC
|
||||
#if WIVRN_USE_NVENC
|
||||
#include "video_encoder_nvenc.h"
|
||||
#endif
|
||||
#ifdef WIVRN_USE_VAAPI
|
||||
#if WIVRN_USE_VAAPI
|
||||
#include "ffmpeg/video_encoder_va.h"
|
||||
#endif
|
||||
|
||||
@@ -98,7 +98,7 @@ void print_encoders(const std::vector<xrt::drivers::wivrn::encoder_settings> & e
|
||||
|
||||
static void check_scale(std::string_view encoder_name, video_codec codec, uint16_t width, uint16_t height, std::array<double, 2> & scale)
|
||||
{
|
||||
#ifdef WIVRN_USE_NVENC
|
||||
#if WIVRN_USE_NVENC
|
||||
if (encoder_name == encoder_nvenc)
|
||||
{
|
||||
auto max = VideoEncoderNvenc::get_max_size(codec);
|
||||
@@ -116,7 +116,7 @@ static void check_scale(std::string_view encoder_name, video_codec codec, uint16
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef WIVRN_USE_VAAPI
|
||||
#if WIVRN_USE_VAAPI
|
||||
static std::optional<xrt::drivers::wivrn::video_codec> filter_codecs_vaapi(wivrn_vk_bundle & bundle, const std::vector<xrt::drivers::wivrn::video_codec> & codecs)
|
||||
{
|
||||
VideoEncoderFFMPEG::mute_logs mute;
|
||||
@@ -154,9 +154,9 @@ static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector<xrt::drive
|
||||
{
|
||||
if (is_nvidia(*bundle.physical_device))
|
||||
{
|
||||
#ifdef WIVRN_USE_NVENC
|
||||
#if WIVRN_USE_NVENC
|
||||
config.name = encoder_nvenc;
|
||||
#elif defined(WIVRN_USE_X264)
|
||||
#elif WIVRN_USE_X264
|
||||
U_LOG_W("nvidia GPU detected, but nvenc support not compiled");
|
||||
config.name = encoder_x264;
|
||||
config.codec = h264;
|
||||
@@ -166,9 +166,9 @@ static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector<xrt::drive
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef WIVRN_USE_VAAPI
|
||||
#if WIVRN_USE_VAAPI
|
||||
config.name = encoder_vaapi;
|
||||
#elif defined(WIVRN_USE_X264)
|
||||
#elif WIVRN_USE_X264
|
||||
U_LOG_W("ffmpeg support not compiled, vaapi encoder not available");
|
||||
config.name = encoder_x264;
|
||||
config.codec = h264;
|
||||
@@ -178,7 +178,7 @@ static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector<xrt::drive
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef WIVRN_USE_VAAPI
|
||||
#if WIVRN_USE_VAAPI
|
||||
if (config.name == encoder_vaapi and not config.codec)
|
||||
{
|
||||
config.codec = filter_codecs_vaapi(bundle, headset_codecs);
|
||||
@@ -191,7 +191,7 @@ static void fill_defaults(wivrn_vk_bundle & bundle, const std::vector<xrt::drive
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WIVRN_USE_X264
|
||||
#if WIVRN_USE_X264
|
||||
if (config.name == encoder_x264)
|
||||
config.codec = h264;
|
||||
#endif
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
|
||||
#include "wivrn_config.h"
|
||||
|
||||
#ifdef WIVRN_USE_NVENC
|
||||
#if WIVRN_USE_NVENC
|
||||
#include "video_encoder_nvenc.h"
|
||||
#endif
|
||||
#ifdef WIVRN_USE_VAAPI
|
||||
#if WIVRN_USE_VAAPI
|
||||
#include "ffmpeg/video_encoder_va.h"
|
||||
#endif
|
||||
#ifdef WIVRN_USE_X264
|
||||
#if WIVRN_USE_X264
|
||||
#include "video_encoder_x264.h"
|
||||
#endif
|
||||
|
||||
@@ -108,7 +108,7 @@ std::unique_ptr<VideoEncoder> VideoEncoder::Create(
|
||||
std::unique_ptr<VideoEncoder> res;
|
||||
if (settings.encoder_name == encoder_x264)
|
||||
{
|
||||
#ifdef WIVRN_USE_X264
|
||||
#if WIVRN_USE_X264
|
||||
res = std::make_unique<VideoEncoderX264>(wivrn_vk, settings, fps);
|
||||
#else
|
||||
throw std::runtime_error("x264 encoder not enabled");
|
||||
@@ -116,7 +116,7 @@ std::unique_ptr<VideoEncoder> VideoEncoder::Create(
|
||||
}
|
||||
if (settings.encoder_name == encoder_nvenc)
|
||||
{
|
||||
#ifdef WIVRN_USE_NVENC
|
||||
#if WIVRN_USE_NVENC
|
||||
res = std::make_unique<VideoEncoderNvenc>(wivrn_vk, settings, fps);
|
||||
#else
|
||||
throw std::runtime_error("nvenc support not enabled");
|
||||
@@ -124,7 +124,7 @@ std::unique_ptr<VideoEncoder> VideoEncoder::Create(
|
||||
}
|
||||
if (settings.encoder_name == encoder_vaapi)
|
||||
{
|
||||
#ifdef WIVRN_USE_VAAPI
|
||||
#if WIVRN_USE_VAAPI
|
||||
res = std::make_unique<video_encoder_va>(wivrn_vk, settings, fps);
|
||||
#else
|
||||
throw std::runtime_error("vaapi support not enabled");
|
||||
|
||||
Reference in New Issue
Block a user