Provide ability to force a capture method via configuration. (#1063)
Co-authored-by: KuleRucket <luke.d.tucker@gmail.com>
This commit is contained in:
@@ -351,6 +351,7 @@ video_t video {
|
||||
-1,
|
||||
}, // vt
|
||||
|
||||
{}, // capture
|
||||
{}, // encoder
|
||||
{}, // adapter_name
|
||||
{}, // output_name
|
||||
@@ -882,6 +883,7 @@ void apply_config(std::unordered_map<std::string, std::string> &&vars) {
|
||||
int_f(vars, "vt_software", video.vt.vt_require_sw, vt::force_software_from_view);
|
||||
int_f(vars, "vt_realtime", video.vt.vt_realtime, vt::rt_from_view);
|
||||
|
||||
string_f(vars, "capture", video.capture);
|
||||
string_f(vars, "encoder", video.encoder);
|
||||
string_f(vars, "adapter_name", video.adapter_name);
|
||||
string_f(vars, "output_name", video.output_name);
|
||||
|
||||
@@ -52,6 +52,7 @@ struct video_t {
|
||||
int vt_coder;
|
||||
} vt;
|
||||
|
||||
std::string capture;
|
||||
std::string encoder;
|
||||
std::string adapter_name;
|
||||
std::string output_name;
|
||||
|
||||
@@ -1,4 +1,14 @@
|
||||
/**
|
||||
* @file misc.cpp
|
||||
*/
|
||||
|
||||
// standard includes
|
||||
#include <fstream>
|
||||
|
||||
// lib includes
|
||||
#include <arpa/inet.h>
|
||||
#include <boost/asio/ip/address.hpp>
|
||||
#include <boost/process.hpp>
|
||||
#include <dlfcn.h>
|
||||
#include <fcntl.h>
|
||||
#include <ifaddrs.h>
|
||||
@@ -6,17 +16,13 @@
|
||||
#include <pwd.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <fstream>
|
||||
|
||||
// local includes
|
||||
#include "graphics.h"
|
||||
#include "misc.h"
|
||||
#include "vaapi.h"
|
||||
|
||||
#include "src/config.h"
|
||||
#include "src/main.h"
|
||||
#include "src/platform/common.h"
|
||||
|
||||
#include <boost/asio/ip/address.hpp>
|
||||
#include <boost/process.hpp>
|
||||
#include "vaapi.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define SUNSHINE_GNUC_EXTENSION __extension__
|
||||
@@ -518,34 +524,44 @@ std::unique_ptr<deinit_t> init() {
|
||||
window_system = window_system_e::X11;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SUNSHINE_BUILD_CUDA
|
||||
if(verify_nvfbc()) {
|
||||
sources[source::NVFBC] = true;
|
||||
if(config::video.capture.empty() || config::video.capture == "nvfbc") {
|
||||
if(verify_nvfbc()) {
|
||||
sources[source::NVFBC] = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef SUNSHINE_BUILD_WAYLAND
|
||||
if(verify_wl()) {
|
||||
sources[source::WAYLAND] = true;
|
||||
if(config::video.capture.empty() || config::video.capture == "wlr") {
|
||||
if(verify_wl()) {
|
||||
sources[source::WAYLAND] = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef SUNSHINE_BUILD_DRM
|
||||
if(verify_kms()) {
|
||||
if(window_system == window_system_e::WAYLAND) {
|
||||
// On Wayland, using KMS, the cursor is unreliable.
|
||||
// Hide it by default
|
||||
display_cursor = false;
|
||||
if(config::video.capture.empty() || config::video.capture == "kms") {
|
||||
if(verify_kms()) {
|
||||
if(window_system == window_system_e::WAYLAND) {
|
||||
// On Wayland, using KMS, the cursor is unreliable.
|
||||
// Hide it by default
|
||||
display_cursor = false;
|
||||
}
|
||||
}
|
||||
|
||||
sources[source::KMS] = true;
|
||||
}
|
||||
#endif
|
||||
#ifdef SUNSHINE_BUILD_X11
|
||||
if(verify_x11()) {
|
||||
sources[source::X11] = true;
|
||||
if(config::video.capture.empty() || config::video.capture == "x11") {
|
||||
if(verify_x11()) {
|
||||
sources[source::X11] = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if(sources.none()) {
|
||||
BOOST_LOG(error) << "Unable to initialize capture method"sv;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -555,4 +571,4 @@ std::unique_ptr<deinit_t> init() {
|
||||
|
||||
return std::make_unique<deinit_t>();
|
||||
}
|
||||
} // namespace platf
|
||||
} // namespace platf
|
||||
|
||||
Reference in New Issue
Block a user