Example #1
0
        public void GetNowFrame(ref CTexture Texture)
        {
            if (this.bPlaying && decodedframes.Count != 0)
            {
                CTimer.t更新();
                if (decodedframes.TryPeek(out CDecodedFrame frame))
                {
                    while (frame.Time <= (CTimer.n現在時刻ms * _dbPlaySpeed))
                    {
                        if (decodedframes.TryDequeue(out CDecodedFrame cdecodedframe))
                        {
                            if (decodedframes.Count != 0)
                            {
                                if (decodedframes.TryPeek(out frame))
                                {
                                    if (frame.Time <= (CTimer.n現在時刻ms * _dbPlaySpeed))
                                    {
                                        continue;
                                    }
                                }
                            }

                            if (lastTexture != null)
                            {
                                lastTexture.Dispose();
                            }
                            lastTexture = GeneFrmTx(cdecodedframe.Bitmap);
                        }
                        break;
                    }
                }

                if (DS == DecodingState.Stopped)
                {
                    this.EnqueueFrames();
                }
            }

            if (lastTexture == null)
            {
                lastTexture = GeneFrmTx(new Bitmap(1, 1));
            }

            if (Texture == lastTexture)
            {
                return;
            }

            Texture = lastTexture;
        }
Example #2
0
        public void GetNowFrame(ref CTexture Texture)
        {
            if (this.bPlaying && decodedframes.Count != 0)
            {
                CTimer.t更新();
                if (decodedframes.TryPeek(out CDecodedFrame frame))
                {
                    while (frame.Time <= (CTimer.n現在時刻ms * _dbPlaySpeed))
                    {
                        if (decodedframes.TryDequeue(out CDecodedFrame cdecodedframe))
                        {
                            if (decodedframes.Count != 0)
                            {
                                if (decodedframes.TryPeek(out frame))
                                {
                                    if (frame.Time <= (CTimer.n現在時刻ms * _dbPlaySpeed))
                                    {
                                        cdecodedframe.Dispose();
                                        continue;
                                    }
                                }
                            }

                            lastTexture.UpdateTexture(cdecodedframe.Tex, cdecodedframe.size);

                            cdecodedframe.Dispose();
                        }
                        break;
                    }
                }

                if (DS == DecodingState.Stopped)
                {
                    this.EnqueueFrames();
                }
            }

            if (lastTexture == null)
            {
                lastTexture = new CTexture(new Device(), new Image <Rgba32>(FrameSize.Width, FrameSize.Height), false);
            }

            if (Texture == lastTexture)
            {
                return;
            }

            Texture = lastTexture;
        }