コード例 #1
0
        /// <summary>
        /// Stops playing the video
        /// </summary>
        public void Stop()
        {
            StoppingEvent.Set();

            // Stop the FilterGraph
            DsError.ThrowExceptionForHR(FG_MediaControl.Stop());

            // Reset the current position
            DsError.ThrowExceptionForHR(FG_MediaSeeking.SetPositions(0, AMSeekingSeekingFlags.AbsolutePositioning, 0, AMSeekingSeekingFlags.NoPositioning));

            // Update VideoState
            currentState = VideoState.Stopped;
        }
コード例 #2
0
        /// <summary>
        /// Updates the Output Frame data using data from the video stream. Call this in Game.Update().
        /// </summary>
        public void Update()
        {
            // Remove the OutputFrame from the GraphicsDevice to prevent an InvalidOperationException on the SetData line.
            if (outputFrame.GraphicsDevice.Textures[0] == outputFrame)
            {
                outputFrame.GraphicsDevice.Textures[0] = null;
            }

            // Set video data into the Output Frame
            outputFrame.SetData <byte>(videoFrameBytes);

            // Update current position read-out
            DsError.ThrowExceptionForHR(FG_MediaSeeking.GetCurrentPosition(out currentPosition));
            if (currentPosition >= Duration * 10000000)
            {
                DsError.ThrowExceptionForHR(FG_MediaSeeking.SetPositions(0, AMSeekingSeekingFlags.AbsolutePositioning, 0, AMSeekingSeekingFlags.NoPositioning));
            }
        }