public VideoDecoder(string path) { decoder = new MFDecoder.Decoder(path); checkVideo = new ManualResetEvent(false); checkAudio = new ManualResetEvent(false); checkQueue = new ManualResetEvent(false); state = State.Initialized; width = decoder.GetWidth(); height = decoder.GetHeight(); lumaTexture = new Texture2D(); chromaTexture = new Texture2D(); texture = new RenderTexture(width, height); audioQueue = new Queue <Sample>(); videoQueue = new Queue <Sample>(); if (material == null) { material = new YUVtoRGBMaterial(); mesh = new Mesh <VertexPosUV>(); mesh.Indices = new ushort[] { 0, 1, 2, 2, 3, 0 }; mesh.Vertices = new VertexPosUV[] { new VertexPosUV() { UV1 = new Vector2(0, 0), Pos = new Vector2(-1, 1) }, new VertexPosUV() { UV1 = new Vector2(1, 0), Pos = new Vector2(1, 1) }, new VertexPosUV() { UV1 = new Vector2(1, 1), Pos = new Vector2(1, -1) }, new VertexPosUV() { UV1 = new Vector2(0, 1), Pos = new Vector2(-1, -1) }, }; mesh.AttributeLocations = new[] { ShaderPrograms.Attributes.Pos1, ShaderPrograms.Attributes.UV1 }; mesh.DirtyFlags = MeshDirtyFlags.All; } audioPlayer = new AudioPlayer(); Window.Current.InvokeOnRendering(() => { var rt = PlatformRenderer.CurrentRenderTarget; try { PlatformRenderer.SetRenderTarget(texture); PlatformRenderer.Clear(ClearOptions.All, new Color4(0, 0, 0, 0)); } finally { PlatformRenderer.SetRenderTarget(rt); } }); }
public void RestoreRenderTarget() { Renderer.Flush(); PlatformRenderer.SetRenderTarget(renderTargetStack.Pop()); }
public void SetAsRenderTarget() { Renderer.Flush(); renderTargetStack.Push(PlatformRenderer.CurrentRenderTarget); PlatformRenderer.SetRenderTarget(this); }