增加windows端屏幕捕获编码demo
This commit is contained in:
27
demo/windows_sender/ScreenCapture.h
Normal file
27
demo/windows_sender/ScreenCapture.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <dxgi1_2.h>
|
||||
#include <wrl/client.h>
|
||||
#include <memory>
|
||||
|
||||
using Microsoft::WRL::ComPtr;
|
||||
|
||||
class ScreenCapture {
|
||||
public:
|
||||
ScreenCapture();
|
||||
~ScreenCapture();
|
||||
|
||||
bool Initialize();
|
||||
bool CaptureFrame(ComPtr<ID3D11Texture2D>& texture);
|
||||
void ReleaseFrame();
|
||||
|
||||
ID3D11Device* GetDevice() const { return device_.Get(); }
|
||||
ID3D11DeviceContext* GetContext() const { return context_.Get(); }
|
||||
|
||||
private:
|
||||
ComPtr<ID3D11Device> device_;
|
||||
ComPtr<ID3D11DeviceContext> context_;
|
||||
ComPtr<IDXGIOutputDuplication> duplication_;
|
||||
bool frame_acquired_ = false;
|
||||
};
|
||||
Reference in New Issue
Block a user