robmikh / SimpleRecorder

A simple screen recorder using both the Windows.Graphics.Capture and Windows.Media.Transcoding APIs.
MIT License
219 stars 43 forks source link

Missing definitions #40

Closed mauriceackel closed 2 years ago

mauriceackel commented 2 years ago

Hi, I'm trying to build this project from source in VS 2017 on Windows 10 Build 19042.928.

However when I build the solution, the compile complaints about 2 missing definitions:

  1. Missing definition of CreateFreeThreaded in Direct3D11CaptureFramePool
  2. Missing definition of CreateFromDirect3D11Surface in MediaStreamSample

Does someone have an idea why these definitions might be missing? Is a certain directX version required?

Best Maurice

robmikh commented 2 years ago

You likely don't have the correct version of the SDK installed. You'll need version 10.0.18362.0, which you can find here. You'll want to make sure the project is set to target that SDK too. It should be set that way by default, but VS may have changed it to something else when you opened it and didn't have the right version.

Additionally, I'd recommend using at least VS 2019 to build this project.

robmikh commented 2 years ago

Feel free to reopen if you still hit this issue after grabbing the SDK.

mauriceackel commented 2 years ago

Lovely, this worked perfectly, thanks so much for the quick help! Do you have by chance any pointers so a C demo project of this API?

robmikh commented 2 years ago

No problem!

Unfortunately, using the bare WinRT ABI in C would probably be fairly painful. At least, it is with C++. I recommend using a language projection like C++/WinRT (C# is inherently using a language projection).

Here's a C++/WinRT rough equivalent of this project: https://github.com/robmikh/CaptureVideoSample

mauriceackel commented 2 years ago

Hm okay I see. Well, then I guess I will have to write the capturing part in C++ :) Thanks for pointing me to the repo and thanks for providing all those resources! 🚀 It's really appreciated 🎉❤️

robmikh commented 2 years ago

I'm glad that these resources are useful! Let me know if you run into anything else while using the capture API, and I'd love to see what you end up building 🙂

Note that the CaptureVideoSample has a media-foundation branch that swaps out Windows.Media.Transcoding for MediaFoundation. It's been a little more robust for me and might have useful bits in it, although it's a lot more code than the WinRT version.

EDIT: I'm by no means a MediaFoundation expert, so be warned.