Resizing Texture before sending to SinkWriter Shar

2019-08-21 15:36发布

问题:

I'm working on Screen recording application. My problem is I need to resize the Texure2d before making sample using CreateDXGISurfaceBuffer. I'm new with Mediafoundation and upon reading the documentation I couldn't find any sample code from the website. I'm using IDXGIOutput1::DuplicateOutput to get the screen texture. Is there a better way to resize the texture without suffering the performance?

回答1:

Video Processor MFT can scale your textures. When you use it in Direct3D 11 enabled mode, it scales using GPU. You feed IMFSample with textures and obtain IMFSample with scaled textures.

Even though it's not complete sample, this code snippet might give an idea on interface methods involved.

You will also find related questions here on StackOverflow too:

  • How to properly use a hardware accelerated Media Foundation Source Reader to decode a video?
  • Video resizing with the Video Processor MFT