private void CreateExternalTexture() { System.IntPtr texPtr = AVProWindowsMediaPlugin.GetTexturePointer(_movieHandle); if (texPtr != System.IntPtr.Zero) { int texWidth = _width; TextureFormat textureFormat = TextureFormat.ARGB32; switch (_sourceVideoFormat) { case AVProWindowsMediaPlugin.VideoFrameFormat.Hap_RGBA: case AVProWindowsMediaPlugin.VideoFrameFormat.Hap_RGB_HQ: textureFormat = TextureFormat.DXT5; break; case AVProWindowsMediaPlugin.VideoFrameFormat.Hap_RGB: textureFormat = TextureFormat.DXT1; break; case AVProWindowsMediaPlugin.VideoFrameFormat.YUV_422_YUY2: case AVProWindowsMediaPlugin.VideoFrameFormat.YUV_422_UYVY: case AVProWindowsMediaPlugin.VideoFrameFormat.YUV_422_YVYU: case AVProWindowsMediaPlugin.VideoFrameFormat.YUV_422_HDYC: texWidth = _width / 2; break; } _usedTextureWidth = texWidth; _usedTextureHeight = _height; _rawTexture = Texture2D.CreateExternalTexture(texWidth, _height, textureFormat, false, false, texPtr); _rawTexture.wrapMode = TextureWrapMode.Clamp; _rawTexture.filterMode = FilterMode.Point; _rawTexture.name = "AVProWindowsMedia-RawExternal"; _isExternalTexture = true; } }