Esempio n. 1
0
        /// <summary>
        /// Sets the current audio stream.
        /// </summary>
        /// <param name="audioStream">audio stream</param>
        public override void SetAudioStream(string audioStream)
        {
            StreamInfoHandler audioStreams;

            lock (SyncObj)
                audioStreams = _streamInfoAudio;

            if (audioStreams == null)
            {
                return;
            }

            StreamInfo selectedAudio = audioStreams.FindStream(audioStream);

            if (selectedAudio == null)
            {
                return;
            }

            int audioLanguage;

            ServiceRegistration.Get <ILogger>().Debug("DvdPlayer: Select audio stream: {0}", audioStream);
            _dvdCtrl.SelectAudioStream(selectedAudio.StreamIndex, DvdCmdFlags.None, out _cmdOption);
            _dvdInfo.GetAudioLanguage(selectedAudio.StreamIndex, out audioLanguage);

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

            settings.PreferredAudioLanguage = audioLanguage;
            ServiceRegistration.Get <ISettingsManager>().Save(settings);
        }
Esempio n. 2
0
        void TestSelectAudioStream()
        {
            int     hr;
            IDvdCmd ppCmd;

            AllowPlay();
            hr = m_idc2.PlayChapterInTitle(2, 1, DvdCmdFlags.Flush | DvdCmdFlags.SendEvents, out ppCmd);
            DsError.ThrowExceptionForHR(hr);

            int maxstreams, curstream;

            hr = m_idi2.GetCurrentAudio(out maxstreams, out curstream);
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(curstream == 0, "TestSelectAudioStream");

            hr = m_idc2.SelectAudioStream(maxstreams - 1, DvdCmdFlags.None, out ppCmd);
            DsError.ThrowExceptionForHR(hr);

            hr = m_idi2.GetCurrentAudio(out maxstreams, out curstream);
            DsError.ThrowExceptionForHR(hr);

            hr = m_idc2.Stop();
            DsError.ThrowExceptionForHR(hr);

            Debug.Assert(curstream == maxstreams - 1, "TestSelectAudioStream2");
        }