protected override void OnGraphRunning() { base.OnGraphRunning(); VideoSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <VideoSettings>(); int hr = _dvdCtrl.SelectVideoModePreference(_videoPref); if (hr != 0) { ServiceRegistration.Get <ILogger>().Error("DVDPlayer: Unable to set DVD video mode preference 0x{0:X}", hr); } hr = _dvdInfo.GetCurrentVideoAttributes(out _videoAttr); if (hr != 0) { ServiceRegistration.Get <ILogger>().Error("DVDPlayer: Unable to get DVD video attributes 0x{0:X}", hr); } DvdDiscSide side; int titles, numOfVolumes, volume; hr = _dvdInfo.GetDVDVolumeInfo(out numOfVolumes, out volume, out side, out titles); if (hr < 0) { ServiceRegistration.Get <ILogger>().Error("DVDPlayer: Unable to get DVD volume info 0x{0:X}", hr); } if (titles <= 0) { ServiceRegistration.Get <ILogger>().Error("DVDPlayer: DVD does not contain any titles? (# titles = {0})", titles); } _pendingCmd = false; _dvdCtrl.SetSubpictureState(settings.EnableSubtitles, DvdCmdFlags.None, out _cmdOption); _line21Decoder = FilterGraphTools.FindFilterByInterface <IAMLine21Decoder>(_graphBuilder); if (_line21Decoder != null) { AMLine21CCState state = settings.EnableClosedCaption ? AMLine21CCState.On : AMLine21CCState.Off; if (_line21Decoder.SetServiceState(state) == 0) { ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: {0} Closed Captions", settings.EnableClosedCaption ? "Enabled" : "Disabled"); } else { ServiceRegistration.Get <ILogger>().Debug("DVDPlayer: Failed to set Closed Captions state."); } } }
void TestSelectSubpictureStream() { int hr; IDvdCmd ppCmd; int avail, current; bool dis; AllowPlay(); hr = m_idc2.PlayChapterInTitle(1, 2, DvdCmdFlags.Flush | DvdCmdFlags.SendEvents, out ppCmd); DsError.ThrowExceptionForHR(hr); Thread.Sleep(500); hr = m_idc2.SelectSubpictureStream(1, DvdCmdFlags.None, out ppCmd); DsError.ThrowExceptionForHR(hr); hr = m_idc2.SetSubpictureState(true, DvdCmdFlags.None, out ppCmd); DsError.ThrowExceptionForHR(hr); hr = m_idi2.GetCurrentSubpicture(out avail, out current, out dis); DsError.ThrowExceptionForHR(hr); hr = m_idc2.Stop(); DsError.ThrowExceptionForHR(hr); Debug.Assert(current == 1, "TestSelectSubpictureStream"); }
protected override void DoSetSubtitleStream(int sid) { try { int hr = dvdControl2.SelectSubpictureStream(sid, DvdCmdFlags.None, _lastCmd); DsError.ThrowExceptionForHR(hr); hr = dvdControl2.SetSubpictureState(true, DvdCmdFlags.None, _lastCmd); DsError.ThrowExceptionForHR(hr); } catch (Exception exception) { Logger.LogException(exception); } }