在C#

时间:2015-10-20 02:06:43

标签: c# directx directshow.net samplegrabber

我正在尝试编写一个能够将视频与文本和图像叠加在一起的视频播放器。现在我使用driectshow样本抓取器过滤器来捕获视频并将其呈现在我的软件上。它工作正常,但在像Atom这样功能不强的系统上却很慢。我还试图像其他人建议的那样使用EVR Presenter。我在代码项目中使用了EVR Presenter(EVR Presenter in pure C# with Direct3D Video Rendering)代码示例在Managed DirectX 9图形和游戏编程上,Kick Start将帧转换为纹理并将转换后的纹理转换为屏幕,示例代码如下所示:

    lock (m_csLock)
{
    if (systemSurface == null)
        systemSurface = Surface.CreateOffscreenPlain(m_Device, _surface.Description.Width, _surface.Description.Height, _surface.Description.Format, Pool.SystemMemory);

    if (texture == null)
        texture = new Texture(m_Device, systemSurface.Description.Width, systemSurface.Description.Height, 1, Usage.Dynamic, systemSurface.Description.Format, Pool.Default);

    using (Surface texturesurface = texture.GetSurfaceLevel(0))
    {
        m_Device.GetRenderTargetData(_surface, systemSurface);
        m_Device.UpdateSurface(systemSurface, texturesurface);
    }
}

但是渲染速度仍然非常慢,需要大量的CPU功率。我是否知道是否有办法捕获视频或将视频帧复制到纹理更快?

0 个答案:

没有答案
相关问题