2011-07-11 40 views
1

我使用自定义分配器编写程序,该自定义分配器允许将我的directshow视频捕获显示为directx纹理。 由于我在Windows 7上运行我的程序,它显示了一个白色框架而不是我的视频。自定义分配器无法在Windows 7上工作

如果我配置我的VMR9过滤器显示在控件上,它工作正常。

有没有人有线索来解决这个问题?

+0

这是太少的信息。您是否尝试过调试DirectX设置? – Christopher

+1

任何机会看到一些代码? – Goz

+0

是的,我会发送一些代码,并在稍后再次启动赏金。感谢您的关注! –

回答

1

我发现使用的DirectX控制面板使调试模式解自己。我意识到,在设置分配器时,我没有按照正确的顺序来做这件事。以下是我的部分代码:

filterConfig.SetRenderingMode(VMR9Mode.Renderless); 
// QueryInterface on the VMR-9 filter for the IVMRSurfaceAllocatorNotify9 interface. 
IVMRSurfaceAllocatorNotify9 san = (IVMRSurfaceAllocatorNotify9)_vmr9; 
// Call the IVMRSurfaceAllocatorNotify9::AdviseSurfaceAllocator method and pass in a pointer to your allocator-presenter's IVMRSurfaceAllocator9 method. 
san.AdviseSurfaceAllocator(IntPtr.Zero, allocator); 
// Call your allocator-presenter's IVMRSurfaceAllocator9::AdviseNotify method and pass in a pointer to the VMR-9 filter's IVMRSurfaceAllocatorNotify9 interface. 
allocator.AdviseNotify(san); 
// Change mixer prefs AFTER settings the allocator in order to support YUV mixing (best performance) 
IVMRMixerControl9 mixerControl = (IVMRMixerControl9)_vmr9; 
VMR9MixerPrefs prefs; 
mixerControl.GetMixingPrefs(out prefs); 
prefs &= ~VMR9MixerPrefs.RenderTargetMask; 
prefs |= VMR9MixerPrefs.RenderTargetYUV; 
mixerControl.SetMixingPrefs(prefs); 
+1

使用调音台的最后设置节省了我。 我在主渲染循环中渲染GUI以及来自VMR9的视频帧并发生闪烁。将调音台设置好后,不再闪烁。 –

0

DirectShow与vmr9中的自定义Allocator Presenter在Windows 7中可以正常工作。您的代码中可能有些东西坏了。 尝试在绘制到另一种颜色之前清除框架,例如红色。如果您看到红色,则表示您没有正确绘制框架。如果你不这样做,意味着你没有做正确的事情。

我建议你检查一下你的锁定机制,因为你的自定义AP是同时从3-5个线程访问的。

相关问题