public bool AddFrame( int width, int height, int rowBytes, TextureFormat format, NativeArray <byte> data) { if (_encoderPtr == IntPtr.Zero) { // Error will have been triggered earlier return(false); } // Validate the pixel format var expectedFormat = _hasAlpha ? TextureFormat.ARGB32 : TextureFormat.RGB24; if (format != expectedFormat) { Debug.LogError($"Unexpected pixel format {format} (expected {expectedFormat})"); } bool success = ProResWrapper.AddVideoFrame(_encoderPtr, data.ToArray()); if (!success) { Debug.LogError("Failed to add video frame to ProRes encoder"); } return(success); }
public bool AddFrame(Texture2D tex) { if (_encoderPtr == IntPtr.Zero) { // Error will have been triggered earlier return(false); } // Validate the pixel format var expectedFormat = _hasAlpha ? TextureFormat.ARGB32 : TextureFormat.RGB24; if (tex.format != expectedFormat) { Debug.LogError($"Unexpected pixel format {tex.format} (expected {expectedFormat})"); } var pixels = tex.GetRawTextureData(); bool success = ProResWrapper.AddVideoFrame(_encoderPtr, pixels); if (!success) { Debug.LogError("Failed to add video frame to ProRes encoder"); } return(success); }