Fix multicasting for nvenc
This commit is contained in:
@@ -29,9 +29,17 @@ constexpr std::uint16_t B = 0x2000;
|
||||
constexpr std::uint16_t X = 0x4000;
|
||||
constexpr std::uint16_t Y = 0x8000;
|
||||
|
||||
enum class dev_type_e {
|
||||
none,
|
||||
dxgi,
|
||||
unknown
|
||||
};
|
||||
|
||||
enum class pix_fmt_e {
|
||||
yuv420p,
|
||||
yuv420p10
|
||||
yuv420p10,
|
||||
nv12,
|
||||
unknown
|
||||
};
|
||||
|
||||
struct gamepad_state_t {
|
||||
@@ -114,7 +122,7 @@ std::string from_sockaddr(const sockaddr *const);
|
||||
std::pair<std::uint16_t, std::string> from_sockaddr_ex(const sockaddr *const);
|
||||
|
||||
std::unique_ptr<mic_t> microphone(std::uint32_t sample_rate);
|
||||
std::shared_ptr<display_t> display(int hwdevice_type);
|
||||
std::shared_ptr<display_t> display(dev_type_e hwdevice_type);
|
||||
|
||||
input_t input();
|
||||
void move_mouse(input_t &input, int deltaX, int deltaY);
|
||||
|
||||
@@ -38,6 +38,7 @@ using output1_t = util::safe_ptr<IDXGIOutput1, Release<IDXGIOutput1>>;
|
||||
using dup_t = util::safe_ptr<IDXGIOutputDuplication, Release<IDXGIOutputDuplication>>;
|
||||
using texture2d_t = util::safe_ptr<ID3D11Texture2D, Release<ID3D11Texture2D>>;
|
||||
using resource_t = util::safe_ptr<IDXGIResource, Release<IDXGIResource>>;
|
||||
using multithread_t = util::safe_ptr<ID3D11Multithread, Release<ID3D11Multithread>>;
|
||||
|
||||
namespace video {
|
||||
using device_t = util::safe_ptr<ID3D11VideoDevice, Release<ID3D11VideoDevice>>;
|
||||
@@ -894,6 +895,12 @@ public:
|
||||
}
|
||||
|
||||
std::shared_ptr<platf::hwdevice_ctx_t> make_hwdevice_ctx(int width, int height, pix_fmt_e pix_fmt) override {
|
||||
if(pix_fmt != platf::pix_fmt_e::nv12) {
|
||||
BOOST_LOG(error) << "display_gpu_t doesn't support pixel format ["sv << (int)pix_fmt << ']';
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto hwdevice = std::make_shared<hwdevice_ctx_t>();
|
||||
|
||||
auto ret = hwdevice->init(
|
||||
@@ -909,6 +916,24 @@ public:
|
||||
|
||||
return hwdevice;
|
||||
}
|
||||
|
||||
int init() {
|
||||
if(display_base_t::init()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
multithread_t::pointer multithread_p {};
|
||||
auto status = device->QueryInterface(__uuidof(multithread_t::element_type), (void**)&multithread_p);
|
||||
multithread_t multithread { multithread_p };
|
||||
|
||||
if(FAILED(status)) {
|
||||
BOOST_LOG(error) << "Couldn't query Multithread interface [0x"sv << util::hex(status).to_string_view() << ']';
|
||||
return -1;
|
||||
}
|
||||
multithread->SetMultithreadProtected(true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
const char *format_str[] = {
|
||||
@@ -1039,15 +1064,15 @@ const char *format_str[] = {
|
||||
}
|
||||
|
||||
namespace platf {
|
||||
std::shared_ptr<display_t> display(int hwdevice_type) {
|
||||
if(hwdevice_type == AV_HWDEVICE_TYPE_D3D11VA) {
|
||||
std::shared_ptr<display_t> display(platf::dev_type_e hwdevice_type) {
|
||||
if(hwdevice_type == platf::dev_type_e::dxgi) {
|
||||
auto disp = std::make_shared<dxgi::display_gpu_t>();
|
||||
|
||||
if(!disp->init()) {
|
||||
return disp;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if(hwdevice_type == platf::dev_type_e::none) {
|
||||
auto disp = std::make_shared<dxgi::display_cpu_t>();
|
||||
|
||||
if(!disp->init()) {
|
||||
|
||||
Reference in New Issue
Block a user