Esempio n. 1
0
        public override void SetSubtitle(string subtitle)
        {
            StreamInfoHandler subtitleStreams;

            lock (SyncObj)
                subtitleStreams = _streamInfoSubtitles;

            if (subtitleStreams == null)
            {
                return;
            }

            StreamInfo selectedSubtitle = subtitleStreams.FindStream(subtitle);

            if (selectedSubtitle == null)
            {
                return;
            }

            int iLanguage;

            ServiceRegistration.Get <ILogger>().Debug("DvdPlayer: Select subtitle: {0}", subtitle);
            _dvdCtrl.SelectSubpictureStream(selectedSubtitle.StreamIndex, DvdCmdFlags.None, out _cmdOption);
            _dvdCtrl.SetSubpictureState(true, DvdCmdFlags.None, out _cmdOption);
            _dvdInfo.GetSubpictureLanguage(selectedSubtitle.StreamIndex, out iLanguage);

            VideoSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <VideoSettings>();

            settings.PreferredSubtitleLanguage = iLanguage;
            settings.EnableSubtitles           = true;
            ServiceRegistration.Get <ISettingsManager>().Save(settings);
        }
Esempio n. 2
0
        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");
        }
Esempio n. 3
0
        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);
            }
        }