Pausing
[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
All filter state changes must hold the filter lock. In the Pause method, create any resources the filter needs:
HRESULT CMyFilter::Pause()
{
CAutoLock lock_it(m_pLock);
/* Create filter resources. */
return CBaseFilter::Pause();
}
The CBaseFilter::Pause method sets the correct state on the filter (State_Paused) and calls the CBasePin::Active method on every connected pin in the filter. The Active method informs the pin that the filter has become active. If the pin creates resources, override the Active method, as follows:
HRESULT CMyInputPin::Active()
{
// You do not need to hold the filter lock here. It is already held in Pause.
/* Create pin resources. */
return CBaseInputPin::Active()
}