Exemplo n.º 1
0
        public virtual void OnRender()
        {
            lock (lockObject)
            {
                if (isVideoStopped)
                {
                    return;
                }

                if (mediaEngineEx != null)
                {
                    long pts;
                    if (mediaEngineEx.OnVideoStreamTick(out pts))
                    {
                        if (OutputVideoTexture != null)
                        {
                            var desc        = OutputVideoTexture.Description;
                            var dxgiSurface = OutputVideoTexture.QueryInterface <SharpDX.DXGI.Surface>();
                            var region      = new SharpDX.Mathematics.Interop.RawRectangle(0, 0, desc.Width, desc.Height);

                            try
                            {
                                // Blit the frame to the supplied rendertarget
                                mediaEngineEx.TransferVideoFrame(dxgiSurface, null, region, null);
                            }
                            catch (Exception)
                            {
                                // This exception can be worked around by using DirectX 9 only (see configuration)
                                Debug.WriteLine("Exception during TransferVideoFrame");
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public virtual void OnRender(TargetBase targetBase)
        {
            lock (lockObject)
            {
                if (isVideoStopped)
                {
                    return;
                }

                if (mediaEngineEx != null)
                {
                    long pts;
                    if (mediaEngineEx.OnVideoStreamTick(out pts))
                    {
                        var backBuffer = OutputVideoTexture ?? targetBase.BackBuffer;

                        if (backBuffer != null)
                        {
                            var desc   = backBuffer.Description;
                            var region = new Rectangle(0, 0, desc.Width, desc.Height);

                            mediaEngineEx.TransferVideoFrame(backBuffer, null, region, (ColorBGRA)BackgroundColor);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        public virtual void OnRender()
        {
            lock (lockObject)
            {
                if (isVideoStopped)
                {
                    return;
                }

                if (mediaEngineEx != null)
                {
                    long pts;
                    if (mediaEngineEx.OnVideoStreamTick(out pts))
                    {
                        if (OutputVideoTexture != null)
                        {
                            var desc   = OutputVideoTexture.Description;
                            var region = new Rectangle(0, 0, desc.Width, desc.Height);

                            try
                            {
                                // Blit the frame to the supplied rendertarget
                                mediaEngineEx.TransferVideoFrame(OutputVideoTexture, null, region, (ColorBGRA)BackgroundColor);
                            }
                            catch (Exception)
                            {
                                // This exception can be worked around by using DirectX 9 only (see configuration)
                                Debug.WriteLine("Exception during TransferVideoFrame");
                            }
                        }
                    }
                }
            }
        }