PDD Monitors the Time

The first and most accurate method of event detection is to retrieve the time from the actual physical device. Interfaces are provided through the use of DDCMD_STATUS, which requests the current stream time from the physical device driver. When an application requests an event, the stream handler issues a DDCMD_STATUS command to the PDD to detect the event time. (There are also additional DDCMD messages that allow the PDD to inform the stream handler of the time. Refer to the OS/2 Multimedia Programming Reference for details.) When the time arrives, the PDD calls back to the stream handler through the SHDEntryPoint using the SHD_REPORT_EVENT message. At this time, the stream handler looks through its table, and identifies which event has now come due. In turn, the stream handler reports the event through the SMHEntryPoint on the SMH_REPORTEVENT call to the Sync/Stream Manager. Once received, the SSM reports the event back to the application as shown in the following example.

RC  SHDReportEvent(PSHD_REPORTEVENT pRptEvent)
{
   PSTREAM         pSTREAM;
   ulRC            rc;

   if (rc = GetStreamEntry(&pSTREAM, pRptEvent->hStream))
           return(rc);

   pSTREAM->ulStreamTime = pRptEvent->ulStreamTime;
   /* Update stream time */

   /*********************************************************/
   /* PDD detected an event and notified the stream handler */
   /*********************************************************/

   while (pEVENT != NULL) {
      if (pEVENT->hEvent == pRptEvent->hEvent) {
                   RptEvent.ulFunction = SMH_REPORTEVENT;
                   RptEvent.hid = pSTREAM->hid;
                   RptEvent.hevent = pEVENT->hEvent;
                   RptEvent.pevcbEvent = &(pEVENT->evcb);
                   /************************************/
                   /* call SSM to report event arrival */
                   /************************************/
                   VideoSH.pSMHEntryPoint(&RptEvent);     /* report it */
                   break;   /* process only one event and break out */
     }
         pEVENT = pEVENT->pNext;

   } /* end while */

   return(NO_ERROR);
}


[Back: Event Detection]
[Next: Stream Handler Monitors the Time]