libobs-d3d11: Store index and add "Start" function
This allows restarting the duplicator at a later point in time.master
parent
75cd6b4ab4
commit
a5ed61e02e
|
@ -33,14 +33,13 @@ static inline bool get_monitor(gs_device_t *device, int monitor_idx,
|
|||
return true;
|
||||
}
|
||||
|
||||
gs_duplicator::gs_duplicator(gs_device_t *device_, int monitor_idx)
|
||||
: texture(nullptr), device(device_)
|
||||
void gs_duplicator::Start()
|
||||
{
|
||||
ComPtr<IDXGIOutput1> output1;
|
||||
ComPtr<IDXGIOutput> output;
|
||||
HRESULT hr;
|
||||
|
||||
if (!get_monitor(device, monitor_idx, output.Assign()))
|
||||
if (!get_monitor(device, idx, output.Assign()))
|
||||
throw "Invalid monitor index";
|
||||
|
||||
hr = output->QueryInterface(__uuidof(IDXGIOutput1),
|
||||
|
@ -53,6 +52,12 @@ gs_duplicator::gs_duplicator(gs_device_t *device_, int monitor_idx)
|
|||
throw HRError("Failed to duplicate output", hr);
|
||||
}
|
||||
|
||||
gs_duplicator::gs_duplicator(gs_device_t *device_, int monitor_idx)
|
||||
: texture(nullptr), device(device_), idx(monitor_idx)
|
||||
{
|
||||
Start();
|
||||
}
|
||||
|
||||
gs_duplicator::~gs_duplicator()
|
||||
{
|
||||
delete texture;
|
||||
|
|
|
@ -453,6 +453,9 @@ struct gs_duplicator {
|
|||
ComPtr<IDXGIOutputDuplication> duplicator;
|
||||
gs_texture_2d *texture;
|
||||
gs_device_t *device;
|
||||
int idx;
|
||||
|
||||
void Start();
|
||||
|
||||
gs_duplicator(gs_device_t *device, int monitor_idx);
|
||||
~gs_duplicator();
|
||||
|
|
Loading…
Reference in New Issue