本文介绍了在发送到SinkWriter SharpDX之前调整纹理大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发屏幕录制应用程序.我的问题是,在使用CreateDXGISurfaceBuffer制作样本之前,我需要调整Texure2d的大小.我是Mediafoundation的新手,在阅读文档后,我从网站上找不到任何示例代码.我正在使用IDXGIOutput1 :: DuplicateOutput获取屏幕纹理.有没有更好的方法来调整纹理大小而不影响性能?

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?

推荐答案

视频处理器MFT 可以缩放纹理.在启用Direct3D 11的模式下使用它时,它将使用GPU进行缩放.您为IMFSample提供纹理,并为IMFSample提供缩放纹理.

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.

您也可以在StackOverflow上找到相关问题:

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

这篇关于在发送到SinkWriter SharpDX之前调整纹理大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 23:41