Giter VIP home page Giter VIP logo

win32capturesample's Introduction

Win32CaptureSample

A simple sample using the Windows.Graphics.Capture APIs in a Win32 application.

Points of interest

Here are some places you should look at in the code to learn the following:

Win32 vs UWP

For the most part, using the API is the same between Win32 and UWP. However, there are some small differences.

  1. The GraphicsCapturePicker won't be able to infer your window in a Win32 application, so you'll have to QI for IInitializeWithWindow and provide your window's HWND.
  2. Direct3D11CaptureFramePool requires a DispatcherQueue much like the Composition APIs. You'll need to create a dispatcher for your thread. Alternatively you can use Direct3D11CaptureFramePool::CreateFreeThreaded to create the frame pool. Doing so will remove the DispatcherQueue requirement, but the FrameArrived event will be called from an arbitrary thread.

Create vs CreateFreeThreaded

You might have noticed that there are two ways to create the Direct3D11CaptureFramePool in the code (SimpleCapture::SimpleCapture and CaptureSnapshot::TakeAsync). As the name suggests, the method you use to create the frame pool dictates its threading behavior.

Creating the frame pool using Direct3D11CaptureFramePool::Create ensures that the frame pool's FrameArrived event will always call you back on the thread the frame pool was created on. In order to do this, the frame pool requires that a DispatcherQueue be associated with the thread, much like the Windows::UI::Composition::Compositor object.

Creating the frame pool using Direct3D11CaptureFramePool::CreateFreeThreaded, on the other hand, does not require the presence of a DispatcherQueue. However, in return, the frame pool's FrameArrived event will call you back on an arbitrary thread. Additionally, your callback must be agile (this should only effect those using the raw WinRT ABI).

win32capturesample's People

Contributors

robmikh avatar chrisguzak avatar

Stargazers

 avatar Maciel Ribeiro de Oliveira avatar  avatar ペレス・クリス  avatar おじぎ  avatar Rui Neto avatar Mindula Dilthushan Manamperi avatar Gábor Mihálcz avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.