/// <summary> /// Called to handle DVD event window messages. /// </summary> private void OnDvdEvent() { if (_mediaEvt == null || _dvdCtrl == null) { return; } IntPtr p1, p2; try { int hr; do { IMediaEventEx eventEx = (IMediaEventEx)_graphBuilder; EventCode code; hr = eventEx.GetEvent(out code, out p1, out p2, 0); if (hr < 0) { break; } switch (code) { case EventCode.DvdPlaybackStopped: ServiceRegistration.Get <ILogger>().Debug("DVDPlayer DvdPlaybackStopped event: {0:X} {1:X}", p1.ToInt32(), p2.ToInt32()); break; case EventCode.DvdError: ServiceRegistration.Get <ILogger>().Debug("DVDPlayer DvdError event: {0:X} {1:X}", p1.ToInt32(), p2.ToInt32()); break; case EventCode.VMRReconnectionFailed: ServiceRegistration.Get <ILogger>().Debug("DVDPlayer VMRReconnectionFailed event: {0:X} {1:X}", p1.ToInt32(), p2.ToInt32()); break; case EventCode.DvdWarning: ServiceRegistration.Get <ILogger>().Debug("DVDPlayer DVD warning: {0} {1}", p1.ToInt32(), p2.ToInt32()); break; case EventCode.DvdSubPicictureStreamChange: ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: DvdSubPicture Changed to: {0} Enabled: {1}", p1.ToInt32(), p2.ToInt32()); break; case EventCode.DvdCurrentHmsfTime: SetCurrentTime(p1); break; case EventCode.DvdChapterStart: { ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: DvdChaptStart: {0}", p1.ToInt32()); lock (SyncObj) { _currChapter = p1.ToInt32(); CalculateDuration(); } ServiceRegistration.Get <ILogger>().Debug(" _duration: {0}", _currentTime); break; } case EventCode.DvdTitleChange: { OnTitleSelect(p1.ToInt32()); break; } case EventCode.DvdCmdStart: ServiceRegistration.Get <ILogger>().Debug(" DvdCmdStart with pending"); break; case EventCode.DvdCmdEnd: { OnCmdComplete(p1); break; } case EventCode.DvdStillOn: { ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: DvdStillOn: {0}", p1.ToInt32()); break; } case EventCode.DvdStillOff: { ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: DvdStillOff: {0}", p1.ToInt32()); break; } case EventCode.DvdButtonChange: { _buttonCount = p1.ToInt32(); _focusedButton = p2.ToInt32(); ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: DvdButtonChange: buttons: {0}, focused: {1}", _buttonCount, _focusedButton); break; } case EventCode.DvdNoFpPgc: { ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: DvdNoFpPgc: {0}", p1.ToInt32()); hr = _dvdCtrl.PlayTitle(1, DvdCmdFlags.None, out _cmdOption); break; } case EventCode.DvdAudioStreamChange: ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: DvdAudioStreamChange: {0}", p1.ToInt32()); break; case EventCode.DvdValidUopsChange: _UOPs = (ValidUOPFlag)p1.ToInt32(); ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: DvdValidUopsChange: {0}", _UOPs); break; case EventCode.DvdDomainChange: { _currDomain = (DvdDomain)p1; switch (_currDomain) { case DvdDomain.FirstPlay: ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: Domain=FirstPlay"); _handlesInput = false; break; case DvdDomain.Stop: ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: Domain=Stop"); Stop(); break; case DvdDomain.VideoManagerMenu: ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: Domain=VideoManagerMenu (menu)"); _handlesInput = true; break; case DvdDomain.VideoTitleSetMenu: ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: Domain=VideoTitleSetMenu (menu)"); _handlesInput = true; break; case DvdDomain.Title: _handlesInput = false; break; default: ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: Unhandled event DvdDomainChange: {0}", p1.ToInt32()); break; } break; } } eventEx.FreeEventParams(code, p1, p2); } while (hr == 0); } catch (Exception ex) { ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: Exception in OnDvdEvent()", ex); } }
/// <summary> /// Called to handle DVD event window messages. /// </summary> private void OnDvdEvent() { if (_mediaEvt == null || _dvdCtrl == null) return; IntPtr p1, p2; try { int hr; do { IMediaEventEx eventEx = (IMediaEventEx) _graphBuilder; EventCode code; hr = eventEx.GetEvent(out code, out p1, out p2, 0); if (hr < 0) break; switch (code) { case EventCode.DvdPlaybackStopped: ServiceRegistration.Get<ILogger>().Debug("DVDPlayer DvdPlaybackStopped event: {0:X} {1:X}", p1.ToInt32(), p2.ToInt32()); break; case EventCode.DvdError: ServiceRegistration.Get<ILogger>().Debug("DVDPlayer DvdError event: {0:X} {1:X}", p1.ToInt32(), p2.ToInt32()); break; case EventCode.VMRReconnectionFailed: ServiceRegistration.Get<ILogger>().Debug("DVDPlayer VMRReconnectionFailed event: {0:X} {1:X}", p1.ToInt32(), p2.ToInt32()); break; case EventCode.DvdWarning: ServiceRegistration.Get<ILogger>().Debug("DVDPlayer DVD warning: {0} {1}", p1.ToInt32(), p2.ToInt32()); break; case EventCode.DvdSubPicictureStreamChange: ServiceRegistration.Get<ILogger>().Debug("DVDPlayer: DvdSubPicture Changed to: {0} Enabled: {1}", p1.ToInt32(), p2.ToInt32()); break; case EventCode.DvdCurrentHmsfTime: SetCurrentTime(p1); break; case EventCode.DvdChapterStart: { ServiceRegistration.Get<ILogger>().Debug("DVDPlayer: DvdChaptStart: {0}", p1.ToInt32()); lock (SyncObj) { _currChapter = p1.ToInt32(); CalculateDuration(); } ServiceRegistration.Get<ILogger>().Debug(" _duration: {0}", _currentTime); break; } case EventCode.DvdTitleChange: { OnTitleSelect(p1.ToInt32()); break; } case EventCode.DvdCmdStart: ServiceRegistration.Get<ILogger>().Debug(" DvdCmdStart with pending"); break; case EventCode.DvdCmdEnd: { OnCmdComplete(p1); break; } case EventCode.DvdStillOn: { ServiceRegistration.Get<ILogger>().Debug("DVDPlayer: DvdStillOn: {0}", p1.ToInt32()); break; } case EventCode.DvdStillOff: { ServiceRegistration.Get<ILogger>().Debug("DVDPlayer: DvdStillOff: {0}", p1.ToInt32()); break; } case EventCode.DvdButtonChange: { _buttonCount = p1.ToInt32(); _focusedButton = p2.ToInt32(); ServiceRegistration.Get<ILogger>().Debug("DVDPlayer: DvdButtonChange: buttons: {0}, focused: {1}", _buttonCount, _focusedButton); break; } case EventCode.DvdNoFpPgc: { ServiceRegistration.Get<ILogger>().Debug("DVDPlayer: DvdNoFpPgc: {0}", p1.ToInt32()); hr = _dvdCtrl.PlayTitle(1, DvdCmdFlags.None, out _cmdOption); break; } case EventCode.DvdAudioStreamChange: ServiceRegistration.Get<ILogger>().Debug("DVDPlayer: DvdAudioStreamChange: {0}", p1.ToInt32()); break; case EventCode.DvdValidUopsChange: _UOPs = (ValidUOPFlag) p1.ToInt32(); ServiceRegistration.Get<ILogger>().Debug("DVDPlayer: DvdValidUopsChange: {0}", _UOPs); break; case EventCode.DvdDomainChange: { _currDomain = (DvdDomain) p1; switch (_currDomain) { case DvdDomain.FirstPlay: ServiceRegistration.Get<ILogger>().Debug("DVDPlayer: Domain=FirstPlay"); _handlesInput = false; break; case DvdDomain.Stop: ServiceRegistration.Get<ILogger>().Debug("DVDPlayer: Domain=Stop"); Stop(); break; case DvdDomain.VideoManagerMenu: ServiceRegistration.Get<ILogger>().Debug("DVDPlayer: Domain=VideoManagerMenu (menu)"); _handlesInput = true; break; case DvdDomain.VideoTitleSetMenu: ServiceRegistration.Get<ILogger>().Debug("DVDPlayer: Domain=VideoTitleSetMenu (menu)"); _handlesInput = true; break; case DvdDomain.Title: _handlesInput = false; break; default: ServiceRegistration.Get<ILogger>().Debug("DVDPlayer: Unhandled event DvdDomainChange: {0}", p1.ToInt32()); break; } break; } } eventEx.FreeEventParams(code, p1, p2); } while (hr == 0); } catch (Exception ex) { ServiceRegistration.Get<ILogger>().Debug("DVDPlayer: Exception in OnDvdEvent()", ex); } }