Microsoft DirectX 9.0

Supplying a Custom Allocator-Presenter for VMR-9

To use a custom allocator-presenter with the Video Mixing Renderer 9 (VMR-9) filter, perform the following steps:

  1. Implement a class that supports the IVMRSurfaceAllocator9 and IVMRImagePresenter9 interfaces.
  2. Query the VMR-9 for the IVMRFilterConfig9 and IVMRSurfaceAllocatorNotify9 interfaces.
  3. Call the IVMRFilterConfig9::SetRenderingMode method with the VMR9Mode_Renderless flag.
  4. Call the IVMRSurfaceAllocatorNotify9::AdviseSurfaceAllocator method with a pointer to your allocator-presenter.
  5. Call the allocator-presenter's IVMRSurfaceAllocator9::AdviseNotify method with a pointer to the VMR-9 filter's IVMRSurfaceAllocatorNotify9 interface. This step and the previous step establish a communication link between the VMR-9 and the allocator-presenter.
  6. Allocate surfaces in the IVMRSurfaceAllocator9::InitializeDevice callback method:
  7. The VMR-9 gets a surface from the allocator-presenter by calling the IVMRSurfaceAllocator9::GetSurface method.
  8. Present the image when the VMR-9 calls the IVMRImagePresenter9::PresentImage method. The parameters include a pointer to the Direct3D surface that contains the video image.
  9. If the Direct3D device is lost at any time, it is necessary to restore the device and the surfaces. For example, the device can be lost if the display mode changes or the user moves the window to another monitor.
  10. If the Direct3D device changes, call the VMR-9 filter's IVMRSurfaceAllocatorNotify9::ChangeD3DDevice method.
  11. When streaming stops, the VMR-9 calls the IVMRSurfaceAllocator9::TerminateDevice method. The allocator-presenter should release all of its Direct3D resources.

There are some differences between the VMR-7 and the VMR-9 in the way custom allocator-presenters are managed: