mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-08-10 00:52:16 +00:00
Intel QuickSync support for Windows (#758)
This commit is contained in:
@@ -210,6 +210,13 @@ struct hwdevice_t {
|
||||
*/
|
||||
virtual void init_hwframes(AVHWFramesContext *frames) {};
|
||||
|
||||
/**
|
||||
* Implementations may make modifications required before context derivation
|
||||
*/
|
||||
virtual int prepare_to_derive_context(int hw_device_type) {
|
||||
return 0;
|
||||
};
|
||||
|
||||
virtual ~hwdevice_t() = default;
|
||||
};
|
||||
|
||||
|
||||
@@ -406,6 +406,23 @@ public:
|
||||
frames->initial_pool_size = 1;
|
||||
}
|
||||
|
||||
int prepare_to_derive_context(int hw_device_type) override {
|
||||
// QuickSync requires our device to be multithread-protected
|
||||
if(hw_device_type == AV_HWDEVICE_TYPE_QSV) {
|
||||
multithread_t mt;
|
||||
|
||||
auto status = device->QueryInterface(IID_ID3D11Multithread, (void **)&mt);
|
||||
if(FAILED(status)) {
|
||||
BOOST_LOG(warning) << "Failed to query ID3D11Multithread interface from device [0x"sv << util::hex(status).to_string_view() << ']';
|
||||
return -1;
|
||||
}
|
||||
|
||||
mt->SetMultithreadProtected(TRUE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int set_frame(AVFrame *frame, AVBufferRef *hw_frames_ctx) override {
|
||||
this->hwframe.reset(frame);
|
||||
this->frame = frame;
|
||||
|
||||
Reference in New Issue
Block a user