public CVPixelBuffer CreatePixelBuffer() { IntPtr pixelBufferOut = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(IntPtr))); CVReturn ret = CVPixelBufferPoolCreatePixelBuffer(IntPtr.Zero, handle, pixelBufferOut); if (ret != CVReturn.Success) { Marshal.FreeHGlobal(pixelBufferOut); throw new Exception("CVPixelBufferPoolCreatePixelBuffer returned " + ret.ToString()); } CVPixelBuffer pixelBuffer = new CVPixelBuffer(Marshal.ReadIntPtr(pixelBufferOut)); Marshal.FreeHGlobal(pixelBufferOut); return(pixelBuffer); }
public CVPixelBuffer CreatePixelBuffer() { IntPtr pixelBufferOut = Marshal.AllocHGlobal (Marshal.SizeOf (typeof (IntPtr))); CVReturn ret = CVPixelBufferPoolCreatePixelBuffer (IntPtr.Zero, handle, pixelBufferOut); if (ret != CVReturn.Success) { Marshal.FreeHGlobal (pixelBufferOut); throw new Exception ("CVPixelBufferPoolCreatePixelBuffer returned " + ret.ToString ()); } CVPixelBuffer pixelBuffer = new CVPixelBuffer (Marshal.ReadIntPtr (pixelBufferOut)); Marshal.FreeHGlobal (pixelBufferOut); return pixelBuffer; }