public Encoder(IDirect3DDevice device, GraphicsCaptureItem item) { _device = device; _d3dDevice = Direct3D11Helpers.CreateSharpDXDevice(device); _captureItem = item; _isRecording = false; _previewLock = new object(); CreateMediaObjects(); }
public CaptureFrameWait( IDirect3DDevice device, GraphicsCaptureItem item, SizeInt32 size) { _device = device; _d3dDevice = Direct3D11Helpers.CreateSharpDXDevice(device); _multithread = _d3dDevice.QueryInterface <SharpDX.Direct3D11.Multithread>(); _multithread.SetMultithreadProtected(true); _item = item; _frameEvent = new ManualResetEvent(false); _closedEvent = new ManualResetEvent(false); _events = new[] { _closedEvent, _frameEvent }; InitializeBlankTexture(size); InitializeCapture(size); }
public CaptureFrameWait( Microsoft.Graphics.Canvas.CanvasDevice canvasDevice, GraphicsCaptureItem item, Windows.UI.Composition.CompositionDrawingSurface surface, SizeInt32 size) { // _device = device; _canvasDevice = canvasDevice; _d3dDevice = Direct3D11Helpers.CreateSharpDXDevice(_canvasDevice); _multithread = _d3dDevice.QueryInterface <SharpDX.Direct3D11.Multithread>(); _multithread.SetMultithreadProtected(true); _item = item; _surface = surface; _frameEvent = new ManualResetEvent(false); _closedEvent = new ManualResetEvent(false); _events = new[] { _closedEvent, _frameEvent }; InitializeBlankTexture(size); InitializeCapture(size); _frameCounter = 0; }
public CapturePreview(IDirect3DDevice device, GraphicsCaptureItem item) { _item = item; _device = device; _d3dDevice = Direct3D11Helpers.CreateSharpDXDevice(device); var dxgiDevice = _d3dDevice.QueryInterface <SharpDX.DXGI.Device>(); var adapter = dxgiDevice.GetParent <SharpDX.DXGI.Adapter>(); var factory = adapter.GetParent <SharpDX.DXGI.Factory2>(); var description = new SharpDX.DXGI.SwapChainDescription1 { Width = item.Size.Width, Height = item.Size.Height, Format = SharpDX.DXGI.Format.B8G8R8A8_UNorm, Usage = SharpDX.DXGI.Usage.RenderTargetOutput, SampleDescription = new SharpDX.DXGI.SampleDescription() { Count = 1, Quality = 0 }, BufferCount = 2, Scaling = SharpDX.DXGI.Scaling.Stretch, SwapEffect = SharpDX.DXGI.SwapEffect.FlipSequential, AlphaMode = SharpDX.DXGI.AlphaMode.Premultiplied }; _swapChain = new SharpDX.DXGI.SwapChain1(factory, dxgiDevice, ref description); _framePool = Direct3D11CaptureFramePool.CreateFreeThreaded( _device, DirectXPixelFormat.B8G8R8A8UIntNormalized, 2, item.Size); _session = _framePool.CreateCaptureSession(item); _lastSize = item.Size; _framePool.FrameArrived += OnFrameArrived; }