예제 #1
0
        private void DoSetRate(double newRate)
        {
            int           hr;
            IMediaControl mc = (IMediaControl)currentFilterGraph;

            // Stop
            hr = mc.Stop();
            DsError.ThrowExceptionForHR(hr);
            // Stop ASFWriter
            hr = currentOutputFilter.Stop();
            DsError.ThrowExceptionForHR(hr);

            if (UsingSBEFilter)
            {
                IStreamBufferMediaSeeking mSeek = (IStreamBufferMediaSeeking)currentSBEfilter;
                DsLong lDouble = DsLong.FromInt64(Convert.ToInt64(newRate));
                hr = mSeek.SetRate(lDouble);
                DsError.ThrowExceptionForHR(hr);
            }
            else
            {
                // IMediaSeeking is used on the filter graph which distributes the calls
                IMediaSeeking mSeek = (IMediaSeeking)currentFilterGraph;
                hr = mSeek.SetRate(newRate);
                DsError.ThrowExceptionForHR(hr);
            }

            // Start ASF
            hr = currentOutputFilter.Run(0);
            DsError.ThrowExceptionForHR(hr);
            // Run again
            hr = mc.Run();
            DsError.ThrowExceptionForHR(hr);
        }
예제 #2
0
 public int SetMediaTime(DsLong pTimeStart, DsLong pTimeEnd)
 {
     m_MediaTimeStart = pTimeStart.ToInt64();
     m_MediaTimeEnd   = pTimeEnd.ToInt64();
     m_HasMediaTime   = true;
     return(0);
 }
예제 #3
0
 public void ResetMedia()
 {
     if (mediaSeeking != null)
     {
         mediaSeeking.SetPositions(DsLong.FromInt64(0), AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning);
     }
 }
예제 #4
0
        override public int SetTimeStamps(IMediaSample pSample)
        {
            DsLong rtStart = new DsLong(m_iFrameNumber * _fps);
            DsLong rtStop  = new DsLong(rtStart + _fps);

            int hr = pSample.SetTime(rtStart, rtStop);

            return(hr);
        }
예제 #5
0
    override public int SetTimeStamps(IMediaSample pSample, int iFrameNumber)
    {
        reader.ReadTimeStamps(iFrameNumber, out startFrameTime, out endFrameTime);

        DsLong rtStart = new DsLong(startFrameTime);
        DsLong rtStop  = new DsLong(endFrameTime);
        int    hr      = pSample.SetTime(rtStart, rtStop);

        return(hr);
    }
예제 #6
0
        /// <summary>
        /// Calculate the timestamps based on the frame number and the frames per second.
        /// </summary>
        /// <param name="sample">The <see cref="IMediaSample"/> to be timed.</param>
        /// <returns>0 = success, negative values for errors</returns>
        public override int SetTimeStamps(IMediaSample sample)
        {
            // Calculate the start/end times based on the current frame number
            // and frame rate
            DsLong start = new DsLong(this.FrameNumber * this.framesPerSecond);
            DsLong stop  = new DsLong(start + this.framesPerSecond);

            // Set the times into the sample
            int hr = sample.SetTime(start, stop);

            return(hr);
        }
예제 #7
0
        internal void SeekToCurrent()
        {
            DsLong poo = new DsLong((AudioEngine.Time - StartTime) * 10000);

            Console.WriteLine("seeking to " + (AudioEngine.Time - StartTime) + " offset " + video.offset +
                              " because of diff " + (Math.Abs(video.lastSample - (AudioEngine.Time - StartTimeOffset))));
            video.lastSample    = AudioEngine.Time - StartTime;
            video.offset        = -1;
            video.framesArrived = 0;
            video.mediaSeeking.SetPositions(poo, AMSeekingSeekingFlags.AbsolutePositioning, null,
                                            AMSeekingSeekingFlags.NoPositioning);
        }
예제 #8
0
        // Calculate the timestamps based on the frame number and the frames per second
        override public int SetTimeStamps(IMediaSample pSample)
        {
            // Calculate the start/end times based on the current frame number
            // and frame rate
            DsLong rtStart = new DsLong(m_iFrameNumber * m_FPS);
            DsLong rtStop  = new DsLong(rtStart + m_FPS);

            // Set the times into the sample
            int hr = pSample.SetTime(rtStart, rtStop);

            return(hr);
        }
예제 #9
0
        public void t再生位置を変更(double db再生位置ms)
        {
            if (this.MediaSeeking == null)
            {
                return;
            }

            int hr = this.MediaSeeking.SetPositions(
                DsLong.FromInt64((long)(db再生位置ms * 1000.0 * 10.0)),
                AMSeekingSeekingFlags.AbsolutePositioning,
                null,
                AMSeekingSeekingFlags.NoPositioning);

            DsError.ThrowExceptionForHR(hr);
        }
예제 #10
0
        public void HandleGraphEvent()
        {
            int       hr = 0;
            EventCode evCode;
            IntPtr    evParam1, evParam2;

            // Make sure that we don't access the media event interface
            // after it has already been released.
            if (mediaEventEx == null)
            {
                return;
            }

            // Process all queued events
            while (mediaEventEx.GetEvent(out evCode, out evParam1, out evParam2, 0) == 0)
            {
                // Free memory associated with callback, since we're not using it
                hr = mediaEventEx.FreeEventParams(evCode, evParam1, evParam2);

                // If this is the end of the clip, reset to beginning
                if (evCode == EventCode.Complete)
                {
                    if (!usePlayList)
                    {
                        DsLong pos = new DsLong(0);
                        // Reset to first frame of movie
                        hr = mediaSeeking.SetPositions(pos, AMSeekingSeekingFlags.AbsolutePositioning,
                                                       null, AMSeekingSeekingFlags.NoPositioning);
                        if (hr < 0)
                        {
                            // Some custom filters (like the Windows CE MIDI filter)
                            // may not implement seeking interfaces (IMediaSeeking)
                            // to allow seeking to the start.  In that case, just stop
                            // and restart for the same effect.  This should not be
                            // necessary in most cases.
                            hr = mediaControl.Stop();
                            hr = mediaControl.Run();
                        }
                    }
                    else if (usePlayList)
                    {
                        CloseClip();
                        StartFromPlayList();
                        break;
                    }
                }
            }
        }
예제 #11
0
        private void trackBar_ValueChanged(object sender, EventArgs e)
        {
            if (updating)
            {
                return;
            }

            updating = true;

            if (mediaSeeking != null && (seekingCapabilities & AMSeekingSeekingCapabilities.CanSeekAbsolute) != 0)
            {
                mediaSeeking.SetPositions(DsLong.FromInt64(trackBar.Value * timeScalingFactor), AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning);
            }

            updating = false;
        }
예제 #12
0
 public int StartAt(DsLong ptStart, int dwCookie)
 {
     lock (m_csPinLock)
     {
         if (ptStart != null && ptStart != MAX_LONG)
         {
             m_rtStartAt     = ptStart;
             m_dwStartCookie = dwCookie;
         }
         else
         {
             m_rtStartAt     = -1;
             m_dwStartCookie = 0;
         }
     }
     return(NOERROR);
 }
예제 #13
0
 public int StopAt(DsLong ptStop, bool bSendExtra, int dwCookie)
 {
     lock (m_csPinLock)
     {
         if (ptStop != null && ptStop != MAX_LONG)
         {
             m_rtStopAt     = ptStop;
             m_bShouldFlush = bSendExtra;
             m_dwStopCookie = dwCookie;
         }
         else
         {
             m_rtStopAt     = -1;
             m_bShouldFlush = false;
             m_dwStopCookie = 0;
         }
     }
     return(NOERROR);
 }
예제 #14
0
        // Set the position of the graph to a specified TimeSpan
        protected void SeekGraphToTime(TimeSpan seekTime)
        {
            SendDebugMessage("Seeking graph to time...");
            int           hr;
            IMediaControl mc = (IMediaControl)currentFilterGraph;
            // Stop graph if not stopped
            FilterState fs;

            mc.GetState(50, out fs);
            if (fs != FilterState.Stopped)
            {
                if (fs != FilterState.Stopped)
                {
                    mc.Stop();
                }
            }

            long   timeInSeconds          = (long)seekTime.TotalSeconds;
            DsLong dsTimeIn100NanoSeconds = DsLong.FromInt64(timeInSeconds * 10000000);

            SendDebugMessage("Setting position to " + dsTimeIn100NanoSeconds.ToInt64().ToString());
            long pos;

            if (UsingSBEFilter)
            {
                // IStreamBufferMediaSeeking is used directly on the source filter   http://msdn.microsoft.com/en-us/library/dd694950(v=vs.85).aspx
                IStreamBufferMediaSeeking mSeek = (IStreamBufferMediaSeeking)currentSBEfilter;
                hr = mSeek.SetPositions(dsTimeIn100NanoSeconds, AMSeekingSeekingFlags.AbsolutePositioning, 0, AMSeekingSeekingFlags.NoPositioning);
                DsError.ThrowExceptionForHR(hr);
                mSeek.GetCurrentPosition(out pos);
            }
            else
            {
                // IMediaSeeking is used on the filter graph which distributes the calls
                IMediaSeeking mSeek = (IMediaSeeking)currentFilterGraph;
                hr = mSeek.SetPositions(dsTimeIn100NanoSeconds, AMSeekingSeekingFlags.AbsolutePositioning, 0, AMSeekingSeekingFlags.NoPositioning);
                DsError.ThrowExceptionForHR(hr);
                mSeek.GetCurrentPosition(out pos);
            }

            SendDebugMessage("New pos is " + pos.ToString());
        }
예제 #15
0
        /// <summary>
        /// Stop the media stream.
        /// </summary>
        public void Stop()
        {
            int hr = 0;

            // Stop and reset postion to beginning
            if ((_currentState == PlayState.Paused) || (_currentState == PlayState.Running))
            {
                DsLong pos = new DsLong(0);

                hr = _mediaControl.Stop();
                DsError.ThrowExceptionForHR(hr);
                _currentState = PlayState.Stopped;

                // Seek to the beginning
                hr = _mediaSeeking.SetPositions(pos, AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning);
                DsError.ThrowExceptionForHR(hr);

                // Display the first frame to indicate the reset condition
                hr = _mediaControl.Pause();
                DsError.ThrowExceptionForHR(hr);
            }
        }
예제 #16
0
        public int StartAt(DsLong ptStart, int dwCookie)
        {
#if HAMED_LOG_METHOD_INFO
            MethodBase method = new StackTrace().GetFrame(0).GetMethod();
            Console.WriteLine(this.GetType().FullName + " - " + method.Name + " - " + method.ToString());
#endif

            lock (m_csPinLock)
            {
                if (ptStart != null && ptStart != MAX_LONG)
                {
                    m_rtStartAt     = ptStart;
                    m_dwStartCookie = dwCookie;
                }
                else
                {
                    m_rtStartAt     = -1;
                    m_dwStartCookie = 0;
                }
            }
            return(NOERROR);
        }
예제 #17
0
        /// <summary>
        /// Calculate and populate the timestamps
        /// </summary>
        /// <param name="pSample">The IMediaSample to set the timestamps on</param>
        /// <returns>HRESULT</returns>
        override public int SetTimeStamps(IMediaSample pSample)
        {
            // Time per frame
            int tpf = (UNIT / m_Fps);

            DsLong rtStart = new DsLong(m_rtSampleTime);

            m_rtSampleTime += tpf;

            DsLong rtStop = new DsLong(m_rtSampleTime);

            // Set the times into the sample
            int hr = pSample.SetTime(rtStart, rtStop);

            // Set TRUE on every sample for uncompressed frames
            if (hr >= 0)
            {
                hr = pSample.SetSyncPoint(true);
            }

            return(hr);
        }
예제 #18
0
 public virtual HRESULT StepBackward()
 {
     if (m_FrameStep != null)
     {
         if (!IsPaused)
         {
             Pause();
         }
         int    hr    = m_MediaSeeking.GetCurrentPosition(out long _time);
         DsLong _stop = (long)0;
         var    _ts   = new TimeSpan(0, 0, 1);
         _time -= _ts.Ticks / 20;
         if (_time < 0)
         {
             _time = 0;
         }
         DsLong _current = _time;
         hr = m_MediaSeeking.SetPositions(_current, AMSeekingSeekingFlags.AbsolutePositioning, _stop, AMSeekingSeekingFlags.NoPositioning);
         return((HRESULT)hr);
     }
     return((HRESULT)E_POINTER);
 }
예제 #19
0
 public virtual HRESULT StepForward()
 {
     if (m_FrameStep != null)
     {
         if (!IsPaused)
         {
             Pause();
         }
         int hr = m_FrameStep.Step(1, null);
         if (hr < 0)
         {
             long _time;
             hr = m_MediaSeeking.GetCurrentPosition(out _time);
             DsLong   _stop = (long)0;
             TimeSpan _ts   = new TimeSpan(0, 0, 1);
             _time += _ts.Ticks / 20;
             DsLong _current = _time;
             hr = m_MediaSeeking.SetPositions(_current, AMSeekingSeekingFlags.AbsolutePositioning, _stop, AMSeekingSeekingFlags.NoPositioning);
         }
         return((HRESULT)hr);
     }
     return((HRESULT)E_POINTER);
 }
예제 #20
0
        public void StopClip()
        {
            int    hr  = 0;
            DsLong pos = new DsLong(0);

            if ((mediaControl == null) || (mediaSeeking == null))
            {
                return;
            }

            // Stop and reset postion to beginning
            if ((currentState == PlayState.Paused) || (currentState == PlayState.Running))
            {
                hr           = mediaControl.Stop();
                currentState = PlayState.Stopped;

                // Seek to the beginning
                hr = mediaSeeking.SetPositions(pos, AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning);

                // Display the first frame to indicate the reset condition
                hr = mediaControl.Pause();
            }
        }
예제 #21
0
        // Seeking - Experimental, non-functional
        private void DoSeekToTime(TimeSpan seekTime)
        {
            int           hr;
            IMediaControl mc = (IMediaControl)currentFilterGraph;

            // Stop
            hr = mc.Stop();
            DsError.ThrowExceptionForHR(hr);
            // Stop ASFWriter
            hr = currentOutputFilter.Stop();
            DsError.ThrowExceptionForHR(hr);
            // Seek
            Int64  seekTimeNanoSeconds = Convert.ToInt64(seekTime.TotalSeconds * 10000000);
            DsLong dsTime = DsLong.FromInt64(seekTimeNanoSeconds);

            if (UsingSBEFilter)
            {
                IStreamBufferMediaSeeking mSeek = (IStreamBufferMediaSeeking)currentSBEfilter;  // StreamBufferMediaSeeking is used on the Source Filter, NOT the graph - see MSDN
                hr = mSeek.SetPositions(dsTime, AMSeekingSeekingFlags.AbsolutePositioning, 0, AMSeekingSeekingFlags.NoPositioning);
                DsError.ThrowExceptionForHR(hr);
            }
            else
            {
                // IMediaSeeking is used on the filter graph which distributes the calls
                IMediaSeeking mSeek = (IMediaSeeking)currentFilterGraph;
                hr = mSeek.SetPositions(dsTime, AMSeekingSeekingFlags.AbsolutePositioning, 0, AMSeekingSeekingFlags.NoPositioning);
                DsError.ThrowExceptionForHR(hr);
            }


            // Start ASF
            hr = currentOutputFilter.Run(0);
            DsError.ThrowExceptionForHR(hr);
            // Run again
            hr = mc.Run();
            DsError.ThrowExceptionForHR(hr);
        }
예제 #22
0
        /// <summary>
        ///   The revert.
        /// </summary>
        public override void Revert()
        {
            base.Revert();

            int hr           = 0;
            var zeroPosition = new DsLong((long)(Viana.Project.VideoData.SelectionStart / NanoSecsToMilliSecs));

            // if (zeroPosition <= 0)
            // {
            // zeroPosition = 1000;
            // }
            if (zeroPosition < 0)
            {
                zeroPosition = 0;
            }

            if ((this.mediaControl == null) || (this.mediaSeeking == null))
            {
                return;
            }

            // Seek to the beginning
            hr = this.mediaSeeking.SetPositions(
                zeroPosition, AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning);
            if (hr != 0)
            {
                ErrorLogger.WriteLine("Error while revert video. Message: " + DsError.GetErrorText(hr));
            }

            // Display the first frame to indicate the reset condition
            if (this.mediaControl.Pause() >= 0)
            {
                this.CurrentState = PlayState.Paused;
            }

            this.UpdateFrameIndex();
        }
예제 #23
0
        public void tReset()
        {
            if (this.dsBGV != null)
            {
                if (this.dsBGV.dshow != null)
                {
                    this.dsBGV.dshow.MediaSeeking.SetPositions(
                        DsLong.FromInt64((long)(0)),
                        AMSeekingSeekingFlags.AbsolutePositioning,
                        null,
                        AMSeekingSeekingFlags.NoPositioning);
                    this.dsBGV.dshow.MediaCtrl.Stop();
                }
            }
            if (this.tx描画用 != null && this.tx窓描画用 != null)
            {
                //2016.12.22 kairera0467 解放→生成というのもどうなのだろうか...
                TJAPlayer3.t安全にDisposeする(ref this.tx描画用);
                TJAPlayer3.t安全にDisposeする(ref this.tx窓描画用);

                this.tx描画用  = new CTexture(TJAPlayer3.app.Device, 1280, 720, TJAPlayer3.app.GraphicsDeviceManager.CurrentSettings.BackBufferFormat, Pool.Managed);
                this.tx窓描画用 = new CTexture(TJAPlayer3.app.Device, 1280, 720, TJAPlayer3.app.GraphicsDeviceManager.CurrentSettings.BackBufferFormat, Pool.Managed);
            }
        }
예제 #24
0
        /// <summary>
        /// Test the SetPosition function
        /// </summary>
        void TestSetPosition()
        {
            int    hr;
            DsLong pc;

            pc = new DsLong(1);

            // Move the start forward by one, use null
            // for stop position
            hr = m_ims.SetPositions(
                pc,
                AMSeekingSeekingFlags.AbsolutePositioning,
                null,
                AMSeekingSeekingFlags.NoPositioning);
            Marshal.ThrowExceptionForHR(hr);

            // Try setting the stop position to 1, and null the start
            hr = m_ims.SetPositions(
                null,
                AMSeekingSeekingFlags.NoPositioning,
                pc,
                AMSeekingSeekingFlags.AbsolutePositioning);
            Marshal.ThrowExceptionForHR(hr);
        }
예제 #25
0
    /// <summary>
    /// Calculate the timestamps based on the frame number and the frames per second.
    /// </summary>
    /// <param name="sample">The <see cref="IMediaSample"/> to be timed.</param>
    /// <returns>0 = success, negative values for errors</returns>
    public override int SetTimeStamps(IMediaSample sample)
    {
      // Calculate the start/end times based on the current frame number
      // and frame rate
      DsLong start = new DsLong(this.FrameNumber * this.framesPerSecond);
      DsLong stop = new DsLong(start + this.framesPerSecond);

      // Set the times into the sample
      int hr = sample.SetTime(start, stop);

      return hr;
    }
예제 #26
0
        public unsafe int t進行描画(int x, int y)
        {
            if (!base.b活性化してない)
            {
                Rectangle rectangle;
                Rectangle rectangle2;
                if (!this.bDShowクリップを再生している || (this.dsBGV.dshow == null || this.dsBGV == null))
                {
                    if (((this.n移動開始時刻ms == -1) || (this.rAVI == null)) || (this.rAVI.avi == null))
                    {
                        return(0);
                    }
                }
                if (this.tx描画用 == null)
                {
                    return(0);
                }
                int time            = (int)((CSound管理.rc演奏用タイマ.n現在時刻 - this.n移動開始時刻ms) * (((double)TJAPlayer3.ConfigIni.n演奏速度) / 20.0));
                int frameNoFromTime = 0;

                #region [ frameNoFromTime ]
                if ((this.dsBGV != null))
                {
                    if (this.fAVIアスペクト比 > 1.77f)
                    {
                        this.dsBGV.dshow.MediaSeeking.GetPositions(out this.lDshowPosition, out this.lStopPosition);
                        frameNoFromTime = (int)lDshowPosition;
                    }
                    else
                    {
                        frameNoFromTime = this.rAVI.avi.GetFrameNoFromTime(time);
                    }
                }
                #endregion

                if ((this.n総移動時間ms != 0) && (this.n総移動時間ms < time))
                {
                    this.n総移動時間ms  = 0;
                    this.n移動開始時刻ms = -1;
                    return(0);
                }

                //2014.11.17 kairera0467 AVIが無い状態でAVIのフレームカウントをさせるとエラーを吐くため、かなり雑ではあるが対策。
                if ((this.n総移動時間ms == 0) && this.rAVI.avi != null ? (frameNoFromTime >= this.rAVI.avi.GetMaxFrameCount()) : false)
                {
                    this.n移動開始時刻ms = -1L;
                }
                if ((((this.n前回表示したフレーム番号 != frameNoFromTime) || !this.bフレームを作成した)) && (fAVIアスペクト比 < 1.77f))
                {
                    this.pBmp          = this.rAVI.avi.GetFramePtr(frameNoFromTime);
                    this.n前回表示したフレーム番号 = frameNoFromTime;
                    this.bフレームを作成した    = true;
                }

                //ループ防止
                if (this.lDshowPosition >= this.lStopPosition && this.dsBGV != null)
                {
                    this.dsBGV.dshow.MediaSeeking.SetPositions(
                        DsLong.FromInt64((long)(0)),
                        AMSeekingSeekingFlags.AbsolutePositioning,
                        null,
                        AMSeekingSeekingFlags.NoPositioning);
                    this.dsBGV.dshow.MediaCtrl.Stop();
                    this.bDShowクリップを再生している = false;
                }

                #region [ フレーム幅 ]
                //uintじゃなくてint。DTXHDでは無駄に変換してたね。
                int nフレーム幅  = 0;
                int nフレーム高さ = 0;

                if (this.dsBGV != null)
                {
                    nフレーム幅  = this.dsBGV.dshow.n幅px;
                    nフレーム高さ = this.dsBGV.dshow.n高さpx;
                }
                else if (this.rAVI != null || this.rAVI.avi != null)
                {
                    nフレーム幅  = (int)this.rAVI.avi.nフレーム幅;
                    nフレーム高さ = (int)this.rAVI.avi.nフレーム高さ;
                }
                #endregion

                //2014.11.17 kairera0467 フレーム幅をrAVIから参照していたため、先にローカル関数で決めるよう変更。
                Size  szフレーム幅   = new Size(nフレーム幅, nフレーム高さ);
                Size  sz最大フレーム幅 = new Size(1280, 720);
                Size  size3     = new Size(this.n開始サイズW, this.n開始サイズH);
                Size  size4     = new Size(this.n終了サイズW, this.n終了サイズH);
                Point location  = new Point(this.n画像側開始位置X, this.n画像側終了位置Y);
                Point point2    = new Point(this.n画像側終了位置X, this.n画像側終了位置Y);
                Point point3    = new Point(this.n表示側開始位置X, this.n表示側開始位置Y);
                Point point4    = new Point(this.n表示側終了位置X, this.n表示側終了位置Y);
                long  num3      = this.n総移動時間ms;
                long  num4      = this.n移動開始時刻ms;
                if (CSound管理.rc演奏用タイマ.n現在時刻 < num4)
                {
                    num4 = CSound管理.rc演奏用タイマ.n現在時刻;
                }
                time = (int)((CSound管理.rc演奏用タイマ.n現在時刻 - num4) * (((double)TJAPlayer3.ConfigIni.n演奏速度) / 20.0));
                if (num3 == 0)
                {
                    rectangle  = new Rectangle(location, size3);
                    rectangle2 = new Rectangle(point3, size3);
                }
                else
                {
                    double num5  = ((double)time) / ((double)num3);
                    Size   size5 = new Size(size3.Width + ((int)((size4.Width - size3.Width) * num5)), size3.Height + ((int)((size4.Height - size3.Height) * num5)));
                    rectangle  = new Rectangle((int)((point2.X - location.X) * num5), (int)((point2.Y - location.Y) * num5), ((int)((point2.X - location.X) * num5)) + size5.Width, ((int)((point2.Y - location.Y) * num5)) + size5.Height);
                    rectangle2 = new Rectangle((int)((point4.X - point3.X) * num5), (int)((point4.Y - point3.Y) * num5), ((int)((point4.X - point3.X) * num5)) + size5.Width, ((int)((point4.Y - point3.Y) * num5)) + size5.Height);
                    if (((rectangle.Right <= 0) || (rectangle.Bottom <= 0)) || ((rectangle.Left >= szフレーム幅.Width) || (rectangle.Top >= szフレーム幅.Height)))
                    {
                        return(0);
                    }
                    if (((rectangle2.Right <= 0) || (rectangle2.Bottom <= 0)) || ((rectangle2.Left >= sz最大フレーム幅.Width) || (rectangle2.Top >= sz最大フレーム幅.Height)))
                    {
                        return(0);
                    }
                    if (rectangle.X < 0)
                    {
                        int num6 = -rectangle.X;
                        rectangle2.X     += num6;
                        rectangle2.Width -= num6;
                        rectangle.X       = 0;
                        rectangle.Width  -= num6;
                    }
                    if (rectangle.Y < 0)
                    {
                        int num7 = -rectangle.Y;
                        rectangle2.Y      += num7;
                        rectangle2.Height -= num7;
                        rectangle.Y        = 0;
                        rectangle.Height  -= num7;
                    }
                    if (rectangle.Right > szフレーム幅.Width)
                    {
                        int num8 = rectangle.Right - szフレーム幅.Width;
                        rectangle2.Width -= num8;
                        rectangle.Width  -= num8;
                    }
                    if (rectangle.Bottom > szフレーム幅.Height)
                    {
                        int num9 = rectangle.Bottom - szフレーム幅.Height;
                        rectangle2.Height -= num9;
                        rectangle.Height  -= num9;
                    }
                    if (rectangle2.X < 0)
                    {
                        int num10 = -rectangle2.X;
                        rectangle.X      += num10;
                        rectangle.Width  -= num10;
                        rectangle2.X      = 0;
                        rectangle2.Width -= num10;
                    }
                    if (rectangle2.Y < 0)
                    {
                        int num11 = -rectangle2.Y;
                        rectangle.Y       += num11;
                        rectangle.Height  -= num11;
                        rectangle2.Y       = 0;
                        rectangle2.Height -= num11;
                    }
                    if (rectangle2.Right > sz最大フレーム幅.Width)
                    {
                        int num12 = rectangle2.Right - sz最大フレーム幅.Width;
                        rectangle.Width  -= num12;
                        rectangle2.Width -= num12;
                    }
                    if (rectangle2.Bottom > sz最大フレーム幅.Height)
                    {
                        int num13 = rectangle2.Bottom - sz最大フレーム幅.Height;
                        rectangle.Height  -= num13;
                        rectangle2.Height -= num13;
                    }
                    if ((rectangle.X >= rectangle.Right) || (rectangle.Y >= rectangle.Bottom))
                    {
                        return(0);
                    }
                    if ((rectangle2.X >= rectangle2.Right) || (rectangle2.Y >= rectangle2.Bottom))
                    {
                        return(0);
                    }
                    if (((rectangle.Right < 0) || (rectangle.Bottom < 0)) || ((rectangle.X > szフレーム幅.Width) || (rectangle.Y > szフレーム幅.Height)))
                    {
                        return(0);
                    }
                    if (((rectangle2.Right < 0) || (rectangle2.Bottom < 0)) || ((rectangle2.X > sz最大フレーム幅.Width) || (rectangle2.Y > sz最大フレーム幅.Height)))
                    {
                        return(0);
                    }
                }
                if ((this.tx描画用 != null))
                {
                    if ((this.bDShowクリップを再生している == true) && this.dsBGV.dshow != null)
                    {
                        #region [ ワイドクリップ ]
                        this.dsBGV.dshow.t現時点における最新のスナップイメージをTextureに転写する(this.tx描画用);
                        this.dsBGV.dshow.t現時点における最新のスナップイメージをTextureに転写する(this.tx窓描画用);

                        if (TJAPlayer3.ConfigIni.eClipDispType == EClipDispType.背景のみ || TJAPlayer3.ConfigIni.eClipDispType == EClipDispType.両方)
                        {
                            if (this.dsBGV.dshow.b上下反転)
                            {
                                this.tx描画用.t2D上下反転描画(TJAPlayer3.app.Device, x, y);
                            }
                            else
                            {
                                this.tx描画用.t2D描画(TJAPlayer3.app.Device, x, y);
                            }
                        }
                        #endregion
                    }
                }
                else if ((this.tx描画用 != null) && (this.n総移動時間ms != -1))
                {
                    if (this.bフレームを作成した && (this.pBmp != IntPtr.Zero))
                    {
                        DataRectangle rectangle3 = this.tx描画用.texture.LockRectangle(0, LockFlags.None);
                        DataStream    data       = rectangle3.Data;
                        int           num14      = rectangle3.Pitch / this.tx描画用.szテクスチャサイズ.Width;
                        BitmapUtil.BITMAPINFOHEADER *pBITMAPINFOHEADER = (BitmapUtil.BITMAPINFOHEADER *) this.pBmp.ToPointer();
                        if (pBITMAPINFOHEADER->biBitCount == 0x18)
                        {
                            switch (num14)
                            {
                            case 2:
                                this.rAVI.avi.tBitmap24ToGraphicsStreamR5G6B5(pBITMAPINFOHEADER, data, this.tx描画用.szテクスチャサイズ.Width, this.tx描画用.szテクスチャサイズ.Height);
                                break;

                            case 4:
                                this.rAVI.avi.tBitmap24ToGraphicsStreamX8R8G8B8(pBITMAPINFOHEADER, data, this.tx描画用.szテクスチャサイズ.Width, this.tx描画用.szテクスチャサイズ.Height);
                                break;
                            }
                        }
                        this.tx描画用.texture.UnlockRectangle(0);
                        this.bフレームを作成した = false;
                    }
                    double dbAVI比率 = this.rAVI.avi.nフレーム幅 / this.rAVI.avi.nフレーム高さ;

                    //とりあえず16:9以外は再生しない。
                    if (dbAVI比率 < 1.77)
                    {
                        this.tx描画用.t2D描画(TJAPlayer3.app.Device, 0, 0);
                    }
                }

                #region [キー入力処理]
                //IInputDevice keyboard = CDTXMania.Input管理.Keyboard;
                //if ( keyboard.bキーが押された( (int) SlimDX.DirectInput.Key.F1 ) &&
                //    ( keyboard.bキーが押されている( (int) SlimDX.DirectInput.Key.RightShift ) || keyboard.bキーが押されている( (int) SlimDX.DirectInput.Key.LeftShift ) ) )
                //{
                //    if( this.b再生トグル == true )
                //    {
                //        if( this.dsBGV != null )
                //        {
                //            if( this.dsBGV.dshow != null )
                //                this.dsBGV.dshow.MediaCtrl.Pause();
                //        }
                //        this.b再生トグル = true;
                //    }
                //    else if( this.b再生トグル == false )
                //    {
                //        if(this.dsBGV != null )
                //        {
                //            if( this.dsBGV.dshow != null )
                //                this.dsBGV.dshow.MediaCtrl.Run();
                //        }
                //        this.b再生トグル = false;
                //    }
                //}
                #endregion
            }
            return(0);
        }
예제 #27
0
 public int SetTime(DsLong pTimeStart, DsLong pTimeEnd)
 {
     m_TimeStart = pTimeStart.ToInt64();
     m_TimeEnd   = pTimeEnd.ToInt64();
     return(0);
 }
예제 #28
0
        /// <summary>
        /// Calculate and populate the timestamps
        /// </summary>
        /// <param name="pSample">The IMediaSample to set the timestamps on</param>
        /// <returns>HRESULT</returns>
        public override int SetTimeStamps(IMediaSample pSample)
        {
            // Time per frame
            int tpf = (UNIT / m_Fps);

            DsLong rtStart = new DsLong(m_rtSampleTime);
            m_rtSampleTime += tpf;

            DsLong rtStop = new DsLong(m_rtSampleTime);

            // Set the times into the sample
            int hr = pSample.SetTime(rtStart, rtStop);

            // Set TRUE on every sample for uncompressed frames
            if (hr >= 0)
            {
                hr = pSample.SetSyncPoint(true);
            }

            return hr;
        }
예제 #29
0
        private void SelectFrame()
        {
            long iSecond = VideotrackBar.Value;

            IMediaEventEx mediaEvt = (IMediaEventEx)graphbuilder;
            IMediaSeeking mediaSeek = (IMediaSeeking)graphbuilder;
            IMediaControl mediaCtrl = (IMediaControl)graphbuilder;
            IBasicAudio basicAudio = (IBasicAudio)graphbuilder;
            IBasicVideo basicVideo = (IBasicVideo)graphbuilder;
            IVideoWindow videoWin = (IVideoWindow)graphbuilder;

            basicAudio.put_Volume(-10000);
            videoWin.put_AutoShow(OABool.False);

            samplegrabber.SetOneShot(true);
            samplegrabber.SetBufferSamples(true);

            DsLong rtStart, rtStop;
            rtStart = new DsLong(iSecond * 10000000);
            rtStop = rtStart;
            mediaSeek.SetPositions(rtStart, AMSeekingSeekingFlags.AbsolutePositioning, rtStop, AMSeekingSeekingFlags.AbsolutePositioning);

            mediaCtrl.Run();
            EventCode evcode;
            mediaEvt.WaitForCompletion(-1, out evcode);

            int width = 0;
            int height = 0;
            basicVideo.get_VideoWidth(out width);
            basicVideo.get_VideoHeight(out height);
            m_b = new Bitmap(width, height, PixelFormat.Format24bppRgb);

            uint bytesPerPixel = (uint)(24 >> 3);
            uint extraBytes = ((uint)width * bytesPerPixel) % 4;
            uint adjustedLineSize = bytesPerPixel * ((uint)width + extraBytes);
            uint sizeOfImageData = (uint)(height) * adjustedLineSize;

            BitmapData bd1 = m_b.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
            int bufsize = (int)sizeOfImageData;
            int n = samplegrabber.GetCurrentBuffer(ref bufsize, bd1.Scan0);
            m_b.UnlockBits(bd1);
            m_b.RotateFlip(RotateFlipType.RotateNoneFlipY);
            RedrawItems();
        }
예제 #30
0
        private void Analysebutton_Click(object sender, EventArgs e)
        {
            if(!System.IO.File.Exists(FiletextBox.Text))
            {
                MessageBox.Show("File is not selected");
                return;
            }
            int iSecStep = 0;
            if (!int.TryParse(SecondstextBox.Text, out iSecStep) || iSecStep <= 0)
            {
                MessageBox.Show("Step is not filled!");
                return;
            }
            FileInfo fi = new FileInfo(FiletextBox.Text);
            string fExt = fi.Extension;
            string fName = fi.FullName.Substring(0, fi.FullName.Length - fExt.Length);
            Analysebutton.Enabled = false;
            SelectFilebutton.Enabled = false;
            try
            {
                int hr = graphbuilder.RenderFile(FiletextBox.Text, null);

                IMediaEventEx mediaEvt = (IMediaEventEx)graphbuilder;
                IMediaSeeking mediaSeek = (IMediaSeeking)graphbuilder;
                IMediaControl mediaCtrl = (IMediaControl)graphbuilder;
                IBasicAudio basicAudio = (IBasicAudio)graphbuilder;
                IBasicVideo basicVideo = (IBasicVideo)graphbuilder;
                IVideoWindow videoWin = (IVideoWindow)graphbuilder;

                basicAudio.put_Volume(-10000);
                videoWin.put_AutoShow(OABool.False);

                samplegrabber.SetOneShot(true);
                samplegrabber.SetBufferSamples(true);

                long d = 0;
                mediaSeek.GetDuration(out d);
                long numSecs = d / 10000000;
                int iCount = (int)numSecs/iSecStep;
                Directory.CreateDirectory(fName);
                for (int i = 0; i < iCount; i++)
                {
                    Analysebutton.Text = GetSecondsText(i * iSecStep) + " of " + GetSecondsText((int)numSecs);
                    Console.WriteLine(Analysebutton.Text);
                    long secondstocapture = (long)i * iSecStep;
                    DsLong rtStart, rtStop;
                    rtStart = new DsLong(secondstocapture * 10000000);
                    rtStop = rtStart;
                    mediaSeek.SetPositions(rtStart, AMSeekingSeekingFlags.AbsolutePositioning, rtStop, AMSeekingSeekingFlags.AbsolutePositioning);

                    mediaCtrl.Run();
                    EventCode evcode;
                    mediaEvt.WaitForCompletion(-1, out evcode);

                    int width = 0;
                    int height = 0;
                    basicVideo.get_VideoWidth(out width);
                    basicVideo.get_VideoHeight(out height);
                    Bitmap b = new Bitmap(width, height, PixelFormat.Format24bppRgb);

                    uint bytesPerPixel = (uint)(24 >> 3);
                    uint extraBytes = ((uint)width * bytesPerPixel) % 4;
                    uint adjustedLineSize = bytesPerPixel * ((uint)width + extraBytes);
                    uint sizeOfImageData = (uint)(height) * adjustedLineSize;

                    BitmapData bd1 = b.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
                    int bufsize = (int)sizeOfImageData;
                    int n = samplegrabber.GetCurrentBuffer(ref bufsize, bd1.Scan0);
                    b.UnlockBits(bd1);
                    b.RotateFlip(RotateFlipType.RotateNoneFlipY);
                    BitmapAnalyser bma = new BitmapAnalyser(b,m_rtList);
                    ImagepictureBox.Image = b;
                    Graphics g = Graphics.FromImage(ImagepictureBox.Image);
                    foreach (var el in bma.m_bItemsDict)
                    {
                        Bitmap bmp = b.Clone(el.Key.Rect, PixelFormat.Format1bppIndexed);
                        g.DrawImage(bmp, el.Key.Rect);
                        string sName = el.Key.Name;
                        sName = sName.Replace("\\", "_").
                            Replace("/", "_").
                            Replace("*", "_").
                            Replace("?", "_").
                            Replace("\"", "_").
                            Replace("<", "_").
                            Replace(">", "_").
                            Replace("|", "_").
                            Replace(":", "_").
                            Trim();
                        el.Value.Save(fName + "\\" + GetSecondsText(i * iSecStep).Replace(":","_") + "-" + el.Key.Name + ".gif", ImageFormat.Gif);
                    }
                    g.Dispose();
                    Application.DoEvents();

                }
            }
            catch (System.Exception e1)
            {
                Console.WriteLine(e1.Message);
            }
            Analysebutton.Text = "Analysing values";
            ExecuteAnalyse(fName);
            if (DeleteFilescheckBox.Checked)
                Directory.Delete(fName, true);
            Analysebutton.Text = "Analyse";
            Analysebutton.Enabled = true;
            SelectFilebutton.Enabled = true;
            MessageBox.Show("Done");
        }
예제 #31
0
        private void StopClip()
        {
            int hr = 0;
            DsLong pos = new DsLong(0);

            if ((this.mediaControl == null) || (this.mediaSeeking == null))
                return;

            // Stop and reset postion to beginning
            if ((this.currentState == PlayState.Paused) || (this.currentState == PlayState.Running))
            {
                hr = this.mediaControl.Stop();
                this.currentState = PlayState.Stopped;

                // Seek to the beginning
                hr = this.mediaSeeking.SetPositions(pos, AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning);

                // Display the first frame to indicate the reset condition
                hr = this.mediaControl.Pause();

                // Display ">" on the play button rather than "||"
                playbutton.Text = "";
                playbutton.Image = global::QA.Properties.Resources.bt_play_12;
            }
            UpdateMainTitle();
            ClosePlayback();
        }
예제 #32
0
        private void HandleGraphEvent()
        {
            int hr = 0;
              EventCode evCode;
              IntPtr evParam1, evParam2;

              // Make sure that we don't access the media event interface
              // after it has already been released.
              if (this.mediaEventEx == null)
            return;

              // Process all queued events
              while(this.mediaEventEx.GetEvent(out evCode, out evParam1, out evParam2, 0) == 0)
              {
            // Free memory associated with callback, since we're not using it
            hr = this.mediaEventEx.FreeEventParams(evCode, evParam1, evParam2);

            // If this is the end of the clip, reset to beginning
            if(evCode == EventCode.Complete)
            {
              DsLong pos = new DsLong(0);
              // Reset to first frame of movie
              hr = this.mediaSeeking.SetPositions(pos, AMSeekingSeekingFlags.AbsolutePositioning,
            null, AMSeekingSeekingFlags.NoPositioning);
              if (hr < 0)
              {
            // Some custom filters (like the Windows CE MIDI filter)
            // may not implement seeking interfaces (IMediaSeeking)
            // to allow seeking to the start.  In that case, just stop
            // and restart for the same effect.  This should not be
            // necessary in most cases.
            hr = this.mediaControl.Stop();
            hr = this.mediaControl.Run();
              }
            }
              }
        }
예제 #33
0
 private void StopClip()
 {
     DsLong pCurrent = new DsLong(0L);
     if (((this.mediaControl != null) && (this.mediaSeeking != null)) && ((this.currentState == PlayState.Paused) || (this.currentState == PlayState.Running)))
     {
         this.mediaControl.Stop();
         this.currentState = PlayState.Stopped;
         this.mediaSeeking.SetPositions(pCurrent, AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning);
         Thread.Sleep(100); //Иначе в некоторых случаях будет зависание или вылет после сикинга
         this.mediaControl.Pause();
     }
     if (this.VideoElement.Source != null)
     {
         this.VideoElement.Stop();
         this.currentState = PlayState.Stopped;
     }
     this.SetPlayIcon();
 }
예제 #34
0
파일: Player.cs 프로젝트: babgvant/EVRPlay
        public void StopClip()
        {
            int hr = 0;
            DsLong pos = new DsLong(0);
            dvdPlayRate = 0.0;
            commList = new List<double[]>();

            if ((this.mediaControl == null) || (this.mediaSeeking == null))
                return;
            // Stop and reset postion to beginning
            if ((this.currentState == PlayState.Paused) || (this.currentState == PlayState.Running))
            {
                hr = this.mediaControl.Pause();

                SaveBookmark();

                hr = this.mediaControl.Stop();
                this.currentState = PlayState.Stopped;

                // Seek to the beginning
                //hr = this.mediaSeeking.SetPositions(pos, AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning);
                //hr = this.mediaControl.Run();
                //Thread.Sleep(100);
                hr = this.mediaControl.Pause();
            }
            //else if (this.currentState == PlayState.Stopped && wbSageServer.Url.ToString() != ABOUT_BLANK)
            //    wbSageServer.Visible = true;

            //UpdateMainTitle();

            StopDialog sd = new StopDialog();
            switch (sd.ShowDialog())
            {
                case DialogResult.OK:
                    PauseClip();
                    break;
                case DialogResult.Cancel:
                    container.Close();
                    Application.DoEvents();
                    break;
                case DialogResult.Retry:
                    hr = this.mediaSeeking.SetPositions(pos, AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning);
                    PauseClip();
                    break;
            }
        }
예제 #35
0
        public override int OnUpdateAndDraw()
        {
            if (!base.bNotActivated)
            {
                int num;
                if (base.bJustStartedUpdate)
                {
                    this.ct登場用 = new CCounter(0, 100, 5, CDTXMania.Timer);

                    //Check result to select the correct sound to play
                    int  l_outputSoundEnum = 0;                    //0: Stage Clear 1: FC 2: EXC
                    bool l_newRecord       = false;
                    for (int i = 0; i < 3; i++)
                    {
                        if ((((i != 0) || (CDTXMania.DTX.bチップがある.Drums && !CDTXMania.ConfigIni.bGuitarRevolutionMode)) &&
                             ((i != 1) || (CDTXMania.DTX.bチップがある.Guitar && CDTXMania.ConfigIni.bGuitarRevolutionMode))) &&
                            ((i != 2) || (CDTXMania.DTX.bチップがある.Bass && CDTXMania.ConfigIni.bGuitarRevolutionMode)))
                        {
                            if (bAuto[i] == false)
                            {
                                if (fPerfect率[i] == 100.0)
                                {
                                    l_outputSoundEnum = 2;                                     //Excellent
                                }
                                else if (fPoor率[i] == 0.0 && fMiss率[i] == 0.0)
                                {
                                    l_outputSoundEnum = 1;                                     //Full Combo
                                }
                            }

                            if (this.bNewRecordSkill[i] == true)
                            {
                                l_newRecord = true;
                            }
                        }
                    }

                    //Play the corresponding sound
                    if (l_outputSoundEnum == 1)
                    {
                        CDTXMania.Skin.soundFullCombo.tPlay();
                    }
                    else if (l_outputSoundEnum == 2)
                    {
                        CDTXMania.Skin.soundExcellent.tPlay();
                    }
                    else
                    {
                        CDTXMania.Skin.soundStageClear.tPlay();
                    }

                    //Create the delay timer of 150 x 10 = 1500 ms to play New Record
                    if (l_newRecord)
                    {
                        this.ctPlayNewRecord = new CCounter(0, 150, 10, CDTXMania.Timer);
                    }

                    this.actFI.tフェードイン開始(false);
                    base.ePhaseID           = CStage.EPhase.Common_FadeIn;
                    base.bJustStartedUpdate = false;
                }
                if (this.ds背景動画 != null)
                {
                    this.ds背景動画.t再生開始();
                    this.ds背景動画.MediaSeeking.GetPositions(out this.lDshowPosition, out this.lStopPosition);
                    this.ds背景動画.bループ再生 = true;

                    if (this.lDshowPosition == this.lStopPosition)
                    {
                        this.ds背景動画.MediaSeeking.SetPositions(
                            DsLong.FromInt64((long)(0)),
                            AMSeekingSeekingFlags.AbsolutePositioning,
                            0,
                            AMSeekingSeekingFlags.NoPositioning);
                    }

                    this.ds背景動画.t現時点における最新のスナップイメージをTextureに転写する(this.txBackground);
                }
                this.bAnimationComplete = true;
                if (this.ct登場用.b進行中)
                {
                    this.ct登場用.tUpdate();
                    if (this.ct登場用.bReachedEndValue)
                    {
                        this.ct登場用.tStop();
                    }
                    else
                    {
                        this.bAnimationComplete = false;
                    }
                }

                //Play new record if available
                if (this.ctPlayNewRecord != null && this.ctPlayNewRecord.b進行中)
                {
                    this.ctPlayNewRecord.tUpdate();
                    if (this.ctPlayNewRecord.bReachedEndValue)
                    {
                        CDTXMania.Skin.soundNewRecord.tPlay();
                        this.ctPlayNewRecord.tStop();
                    }
                }

                // 描画

                if (this.txBackground != null)
                {
                    if (this.ds背景動画 != null && this.ds背景動画.b上下反転)
                    {
                        this.txBackground.tDraw2DUpsideDown(CDTXMania.app.Device, 0, 0);
                    }
                    else
                    {
                        this.txBackground.tDraw2D(CDTXMania.app.Device, 0, 0);
                    }
                }
                if (this.ct登場用.b進行中 && (this.txTopPanel != null))
                {
                    double num2 = ((double)this.ct登場用.nCurrentValue) / 100.0;
                    double num3 = Math.Sin(Math.PI / 2 * num2);
                    num = ((int)(this.txTopPanel.szImageSize.Height * num3)) - this.txTopPanel.szImageSize.Height;
                }
                else
                {
                    num = 0;
                }
                if (this.txTopPanel != null)
                {
                    this.txTopPanel.tDraw2D(CDTXMania.app.Device, 0, num);
                }
                if (this.txBottomPanel != null)
                {
                    this.txBottomPanel.tDraw2D(CDTXMania.app.Device, 0, 720 - this.txBottomPanel.szImageSize.Height);
                }
                if (this.actResultImage.OnUpdateAndDraw() == 0)
                {
                    this.bAnimationComplete = false;
                }
                if (this.actParameterPanel.OnUpdateAndDraw() == 0)
                {
                    this.bAnimationComplete = false;
                }
                if (this.actRank.OnUpdateAndDraw() == 0)
                {
                    this.bAnimationComplete = false;
                }
                if (base.ePhaseID == CStage.EPhase.Common_FadeIn)
                {
                    if (this.actFI.OnUpdateAndDraw() != 0)
                    {
                        base.ePhaseID = CStage.EPhase.Common_DefaultState;
                    }
                }
                else if ((base.ePhaseID == CStage.EPhase.Common_FadeOut))                                       //&& ( this.actFO.OnUpdateAndDraw() != 0 ) )
                {
                    return((int)this.eReturnValueWhenFadeOutCompleted);
                }
                #region [ #24609 2011.3.14 yyagi ランク更新or演奏型スキル更新時、リザルト画像をpngで保存する ]
                if (this.bAnimationComplete == true && this.bIsCheckedWhetherResultScreenShouldSaveOrNot == false &&                    // #24609 2011.3.14 yyagi; to save result screen in case BestRank or HiSkill.
                    CDTXMania.ConfigIni.bScoreIniを出力する &&
                    CDTXMania.ConfigIni.bIsAutoResultCapture)                                                                           // #25399 2011.6.9 yyagi
                {
                    CheckAndSaveResultScreen(true);
                    this.bIsCheckedWhetherResultScreenShouldSaveOrNot = true;
                }
                #endregion

                // キー入力

                if (CDTXMania.actPluginOccupyingInput == null)
                {
                    if (CDTXMania.ConfigIni.bドラム打音を発声する && CDTXMania.ConfigIni.bDrumsEnabled)
                    {
                        for (int i = 0; i < 11; i++)
                        {
                            List <STInputEvent> events = CDTXMania.Pad.GetEvents(EInstrumentPart.DRUMS, (EPad)i);
                            if ((events != null) && (events.Count > 0))
                            {
                                foreach (STInputEvent event2 in events)
                                {
                                    if (!event2.b押された)
                                    {
                                        continue;
                                    }
                                    CDTX.CChip rChip = this.rEmptyDrumChip[i];
                                    if (rChip == null)
                                    {
                                        switch (((EPad)i))
                                        {
                                        case EPad.HH:
                                            rChip = this.rEmptyDrumChip[7];
                                            if (rChip == null)
                                            {
                                                rChip = this.rEmptyDrumChip[9];
                                            }
                                            break;

                                        case EPad.FT:
                                            rChip = this.rEmptyDrumChip[4];
                                            break;

                                        case EPad.CY:
                                            rChip = this.rEmptyDrumChip[8];
                                            break;

                                        case EPad.HHO:
                                            rChip = this.rEmptyDrumChip[0];
                                            if (rChip == null)
                                            {
                                                rChip = this.rEmptyDrumChip[9];
                                            }
                                            break;

                                        case EPad.RD:
                                            rChip = this.rEmptyDrumChip[6];
                                            break;

                                        case EPad.LC:
                                            rChip = this.rEmptyDrumChip[0];
                                            if (rChip == null)
                                            {
                                                rChip = this.rEmptyDrumChip[7];
                                            }
                                            break;
                                        }
                                    }
                                    if (((rChip != null) && (rChip.nChannelNumber >= 0x11)) && (rChip.nChannelNumber <= 0x1b))
                                    {
                                        int nLane = this.nチャンネル0Atoレーン07[rChip.nChannelNumber - 0x11];
                                        if ((nLane == 1) && ((rChip.nChannelNumber == 0x11) || ((rChip.nChannelNumber == 0x18) && (this.n最後に再生したHHのチャンネル番号 != 0x18))))
                                        {
                                            CDTXMania.DTX.tStopPlayingWav(this.n最後に再生したHHのWAV番号);
                                            this.n最後に再生したHHのWAV番号   = rChip.nIntegerValue_InternalNumber;
                                            this.n最後に再生したHHのチャンネル番号 = rChip.nChannelNumber;
                                        }
                                        CDTXMania.DTX.tPlayChip(rChip, CDTXMania.Timer.nシステム時刻, nLane, CDTXMania.ConfigIni.n手動再生音量, CDTXMania.ConfigIni.b演奏音を強調する.Drums);
                                    }
                                }
                            }
                        }
                    }
                    if (((CDTXMania.Pad.bPressedDGB(EPad.CY) || CDTXMania.Pad.bPressed(EInstrumentPart.DRUMS, EPad.RD)) || (CDTXMania.Pad.bPressed(EInstrumentPart.DRUMS, EPad.LC) || CDTXMania.InputManager.Keyboard.bKeyPressed((int)SlimDXKey.Return))) && !this.bAnimationComplete)
                    {
                        this.actFI.tフェードイン完了();                                                         // #25406 2011.6.9 yyagi
                        this.actResultImage.tアニメを完了させる();
                        this.actParameterPanel.tアニメを完了させる();
                        this.actRank.tアニメを完了させる();
                        this.ct登場用.tStop();
                    }
                    #region [ #24609 2011.4.7 yyagi リザルト画面で[F12]を押下すると、リザルト画像をpngで保存する機能は、CDTXManiaに移管。 ]
//					if ( CDTXMania.InputManager.Keyboard.bKeyPressed( (int) SlimDXKey.F12 ) &&
//						CDTXMania.ConfigIni.bScoreIniを出力する )
//					{
//						CheckAndSaveResultScreen(false);
//						this.bIsCheckedWhetherResultScreenShouldSaveOrNot = true;
//					}
                    #endregion
                    if (base.ePhaseID == CStage.EPhase.Common_DefaultState)
                    {
                        if (CDTXMania.InputManager.Keyboard.bKeyPressed((int)SlimDXKey.Escape))
                        {
                            CDTXMania.Skin.soundCancel.tPlay();
                            this.actFO.tStartFadeOut();
                            base.ePhaseID = CStage.EPhase.Common_FadeOut;
                            this.eReturnValueWhenFadeOutCompleted = EReturnValue.Complete;
                        }
                        if (((CDTXMania.Pad.bPressedDGB(EPad.CY) || CDTXMania.Pad.bPressed(EInstrumentPart.DRUMS, EPad.RD)) || (CDTXMania.Pad.bPressed(EInstrumentPart.DRUMS, EPad.LC) || CDTXMania.InputManager.Keyboard.bKeyPressed((int)SlimDXKey.Return))) && this.bAnimationComplete)
                        {
                            CDTXMania.Skin.soundCancel.tPlay();
                            base.ePhaseID = CStage.EPhase.Common_FadeOut;
                            this.eReturnValueWhenFadeOutCompleted = EReturnValue.Complete;
                        }
                    }
                }
            }
            return(0);
        }
예제 #36
0
파일: Player.cs 프로젝트: babgvant/EVRPlay
        private void ChangePosition(long changeBy, AMSeekingSeekingFlags seekType)
        {
            long cPos, cDuration;
            int hr;

            try
            {
                hr = this.mediaSeeking.GetCurrentPosition(out cPos);
                DsError.ThrowExceptionForHR(hr);

                hr = this.mediaSeeking.GetDuration(out cDuration);
                DsError.ThrowExceptionForHR(hr);

                long nPos = 0;

                if (seekType == AMSeekingSeekingFlags.RelativePositioning)
                    nPos = cPos + (changeBy * TICK_MULT);
                else if (seekType == AMSeekingSeekingFlags.AbsolutePositioning)
                    nPos = changeBy;

                if (nPos < cDuration && nPos >= 0)
                {
                    DsLong ndspos = new DsLong(nPos);
                    hr = this.mediaSeeking.SetPositions(nPos, AMSeekingSeekingFlags.AbsolutePositioning, 0, AMSeekingSeekingFlags.NoPositioning);//mediaPosition.put_CurrentPosition(nPos);
                    DsError.ThrowExceptionForHR(hr);
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show("Error skipping: {0}", ex.Message);
                using (EPDialog ed = new EPDialog())
                    ed.ShowDialog("Error", string.Format("Error skipping: {0}", ex.Message), 10);
            }
        }
예제 #37
0
        public void StopClip()
        {
            if (this.mediaControl != null && this.mediaSeeking != null)
            {
                // Stop and reset postion to beginning
                if (this.currentState == PlayState.Paused || this.currentState == PlayState.Running)
                {
                    int hr = this.mediaControl.Stop();

                    this.currentState = PlayState.Stopped;

                    // Seek to the beginning
                    DsLong pos = new DsLong(0);
                    hr = this.mediaSeeking.SetPositions(pos, AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning);

                    Thread.Sleep(100); //Иначе в некоторых случаях будет зависание или вылет после сикинга

                    // Display the first frame to indicate the reset condition
                    hr = this.mediaControl.Pause();
                    SetPlayIcon();
                }
            }

            if (this.VideoElement.Source != null)
            {
                VideoElement.Stop();
                this.currentState = PlayState.Stopped;
                SetPlayIcon();
            }

            if (avsPlayer != null)
            {
                avsPlayer.Stop();
                this.currentState = PlayState.Stopped;
                SetPlayIcon();
            }
        }
예제 #38
0
        // Calculate the timestamps based on the frame number and the frames per second
        public override int SetTimeStamps(IMediaSample pSample)
        {
            // Calculate the start/end times based on the current frame number
            // and frame rate
            DsLong rtStart = new DsLong(m_iFrameNumber * m_FPS);
            DsLong rtStop  = new DsLong(rtStart + m_FPS);

            // Set the times into the sample
            int hr = pSample.SetTime(rtStart, rtStop);

            return hr;
        }
예제 #39
0
파일: AudioPlayer.cs 프로젝트: DeSciL/Ogama
    private void StopClip()
    {
      int hr = 0;
      DsLong pos = new DsLong(0);

      if ((this.mediaControl == null) || (this.mediaSeeking == null))
        return;

      // Stop and reset postion to beginning
      if ((this.currentState == PlayState.Paused) || (this.currentState == PlayState.Running))
      {
        hr = this.mediaControl.Stop();
        this.currentState = PlayState.Stopped;

        // Seek to the beginning
        hr = this.mediaSeeking.SetPositions(pos, AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning);

        // Display the first frame to indicate the reset condition
        hr = this.mediaControl.Pause();
      }
    }
예제 #40
0
        private void StopClip(object notUsed)
        {
            if (this.InvokeRequired)
                this.Invoke(new TFS(StopClip), new object[] { null });
            else
            {
                int hr = 0;
                DsLong pos = new DsLong(0);
                dvdPlayRate = 0.0;
                tmPosition.Enabled = false;
                commList = new List<double[]>();

                if ((this.mediaControl == null) || (this.mediaSeeking == null))
                    return;
                // Stop and reset postion to beginning
                if ((this.currentState == PlayState.Paused) || (this.currentState == PlayState.Running))
                {
                    hr = this.mediaControl.Pause();

                    SaveBookmark();

                    hr = this.mediaControl.Stop();
                    this.currentState = PlayState.Stopped;

                    // Seek to the beginning
                    //hr = this.mediaSeeking.SetPositions(pos, AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning);
                    //hr = this.mediaControl.Run();
                    //Thread.Sleep(100);
                    hr = this.mediaControl.Pause();
                }
                //else if (this.currentState == PlayState.Stopped && wbSageServer.Url.ToString() != ABOUT_BLANK)
                //    wbSageServer.Visible = true;

                UpdateMainTitle();

                StopDialog sd = new StopDialog();
                switch (sd.ShowDialog())
                {
                    case DialogResult.OK:
                        PauseClip(null);
                        break;
                    case DialogResult.Cancel:
                        CloseClip();
                        //ToogleControls(true);
                        Application.DoEvents();
                        
                        //if (wbSageServer.Url.ToString() != ABOUT_BLANK)
                        //    wbSageServer.Visible = true;
                        //else
                        //{
                        //    wbSageServer.Navigate(ABOUT_BLANK);
                        //    wbSageServer.Hide();
                        //}
                        break;
                    case DialogResult.Retry:
                        hr = this.mediaSeeking.SetPositions(pos, AMSeekingSeekingFlags.AbsolutePositioning, null, AMSeekingSeekingFlags.NoPositioning);
                        PauseClip(null);
                        break;
                    case DialogResult.Abort:
                        CloseClip();
                        //ToogleControls(true);
                        this.Close();
                        break;
                }
            }
        }