コード例 #1
0
        void TestPlayAtTime()
        {
            int                  hr;
            DvdHMSFTimeCode      pStartTime = new DvdHMSFTimeCode();
            IDvdCmd              ppCmd;
            DvdPlaybackLocation2 pLocation;

            AllowPlay();
            pStartTime.bHours   = 0;
            pStartTime.bMinutes = 0;
            pStartTime.bSeconds = 1;
            pStartTime.bFrames  = 0;

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

            Thread.Sleep(2000);

            hr = m_idc2.PlayAtTime(pStartTime, DvdCmdFlags.Flush | DvdCmdFlags.SendEvents, out ppCmd);
            DsError.ThrowExceptionForHR(hr);

            hr = m_idi2.GetCurrentLocation(out pLocation);
            DsError.ThrowExceptionForHR(hr);

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

            Debug.Assert(pLocation.TitleNum == 2, "TestPlayAtTime");
            Debug.Assert(pLocation.TimeCode.bMinutes == 0, "TestPlayAtTime2");
            Debug.Assert(pLocation.TimeCode.bSeconds == 2, "TestPlayAtTime3");
        }
コード例 #2
0
ファイル: Grabber.cs プロジェクト: RoChess/mvcentral
        private void RunGraph()
        {
            try
            {
                int hr = 0;
                if (mvs.LocalMedia[0].IsDVD)
                {
                    hr = _mediaCtrl.Run();
//                    hr = _dvdCtrl.PlayTitle(1, DvdCmdFlags.Flush | DvdCmdFlags.Block, out _cmdOption);
//                    hr = _dvdCtrl.ShowMenu(DvdMenuId.Chapter, DvdCmdFlags.Flush | DvdCmdFlags.Block, out _cmdOption);
//                    hr = _mediaCtrl.Stop();
//                    hr = _mediaCtrl.Stop();
//                    hr = _mediaCtrl.Run();
//                   hr = _mediaCtrl.Pause();
                    _offsetseek = (ulong)seekbar.Value;
                    TimeSpan t1 = TimeSpan.FromMilliseconds(seekbar.Value);
                    TimeSpan t2 = TimeSpan.Parse(mvs.OffsetTime);
                    t1 = t1.Add(t2);
                    t2 = t2.Add(TimeSpan.Parse(mvs.PlayTime));
                    DvdHMSFTimeCode t3 = mvCentralUtils.ConvertToDvdHMSFTimeCode(t1);
                    DvdHMSFTimeCode t4 = mvCentralUtils.ConvertToDvdHMSFTimeCode(t2);
                    //                if (state == FilterState.Stopped)
//                    hr = _dvdCtrl.PlayPeriodInTitleAutoStop(1, t3, t4, DvdCmdFlags.Flush | DvdCmdFlags.Block, out _cmdOption);


                    hr = _dvdCtrl.PlayTitle(mvs.TitleID, DvdCmdFlags.Flush | DvdCmdFlags.Block, out _cmdOption);
                    hr = _dvdCtrl.PlayAtTime(t3, DvdCmdFlags.Flush | DvdCmdFlags.Block, out _cmdOption);


//                    hr = _dvdCtrl.PlayAtTimeInTitle(mvs.TitleID, t3, DvdCmdFlags.Flush | DvdCmdFlags.Block, out _cmdOption);
                    DsError.ThrowExceptionForHR(hr);
                    //                   hr = _mediaCtrl.Run();
                    label1.Text = t1.ToString();
                    label2.Text = t2.ToString();
                    //               if (state == FilterState.Stopped) hr = _dvdCtrl.PlayChaptersAutoStop(1, mvs.ChapterID, 1, 0, out _cmdOption);
                    DsError.ThrowExceptionForHR(hr);
                    return;
                }

                if (_mediaCtrl != null)
                {
                    hr = _mediaCtrl.Run();
                    DsError.ThrowExceptionForHR(hr);
                }
            }
            catch (Exception ex)
            {
                logger.ErrorException("Error in play : \r\n\r\n", ex);
            }
        }
コード例 #3
0
        protected override void SetMediaPosition(double pos)
        {
            TimeSpan tsNewPos = TimeSpan.FromSeconds(pos);

            DvdHMSFTimeCode timeCode = new DvdHMSFTimeCode();

            timeCode.bHours   = (byte)tsNewPos.TotalHours;
            timeCode.bMinutes = (byte)tsNewPos.Minutes;
            timeCode.bSeconds = (byte)tsNewPos.Seconds;
            timeCode.bFrames  = 1;

            int hr = dvdControl2.PlayAtTime(ref timeCode, DvdCmdFlags.None, _lastCmd);

            DsError.ThrowExceptionForHR(hr);
        }