Handling DVD Event Notifications
[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.]
The DVD Navigator sends notifications to an application-specified window when certain events take place, such as when the DVD domain changes, when a new parental management level is encountered, and when the DVD Navigator is about to enter an angle block. The event parameters can contain additional information related to the event. Error messages and warnings are also sent in this way. The application specifies the window that will handle the event notifications by using the IMediaEventEx pointer to call SetNotifyWindow, as follows:
const DWORD WM_DVD_EVENT = WM_USER + 100;
hr = m_pIME->SetNotifyWindow(reinterpret_cast<OAHWND>(m_hWnd), WM_DVD_EVENT, 0);
In the preceding example, m_hWnd is the HWND of the window to receive the messages and WM_DVD_EVENT is the application-defined message (greater than WM_USER) that will signal that a DVD event has taken place. The event itself is retrieved by the application through a call to IMediaEvent::GetEvent. Because more than one event might be in the event queue at any given time, the application must call GetEvent within a loop that repeats until all queued events have been retrieved, as shown in the following code example.
while (SUCCEEDED(m_pIME->GetEvent(&lEvent, &lParam1, &lParam2, lTimeOut)))
{
HRESULT hr;
switch (lEvent)
{
case EC_DVD_CURRENT_HMSF_TIME:
{
DVD_HMSF_TIMECODE *pTC = reinterpret_cast<DVD_HMSF_TIMECODE *>(&lParam1);
m_CurTime = *pTC;
...
}
break;
...
} // switch
}
DVD events might contain additional information in the lParam1 or lParam2 parameters, as illustrated above where the current time is contained in lParam1. The preceding code example is from the DVD sample application in Dvdcore.cpp. For a complete list of all DVD events and their parameters, see DVD Event Notification Codes.
Related topics