Setting the Compositor on the VMR


Once the compositor has been implemented, attaching it to the VMR is easy. Just call IVMRFilterConfig9::SetImageCompositor with a pointer to the compositor s IVMRImageCompositor9 interface.

 // Create a new instance of the compositor.  m_pMixer = new CMixer();  // CMixer inherits IVMRImageCompositor9.  if (!m_pMixer)  {      return E_OUTOFMEMORY;  }  // Increment the reference count.  m_pMixer->AddRef();  // Query the VMR for the IVMRFilterConfig9 interface.  CComQIPtr<IVMRFilterConfig9> pConfig(m_pWC);  // Assign the custom compositor.  pConfig->SetImageCompositor(pMix); 

One minor point to keep in mind is that the VMR does not automatically load the compositor when you call SetImageCompositor. Instead, it merely stores a copy of the IVMRImageCompositor9 pointer. It will load the compositor if it switches to mixing mode, but not if it remains in pass-through mode. So if video starts playing but the VMR never calls any methods on your compositor, check to make sure that your application calls IVMRFilterConfig9::SetNumberOfStreams to activate mixing mode.




Fundamentals of Audio and Video Programming for Games
Fundamentals of Audio and Video Programming for Games (Pro-Developer)
ISBN: 073561945X
EAN: 2147483647
Year: 2003
Pages: 120

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net