public CVMetalTexture TextureFromImage(CVImageBuffer imageBuffer, MTLPixelFormat format, nint width, nint height, nint planeIndex, out CVReturn errorCode) { if (imageBuffer == null) { throw new ArgumentNullException("imageBuffer"); } IntPtr texture; errorCode = CVMetalTextureCacheCreateTextureFromImage( allocator: IntPtr.Zero, textureCache: handle, /* textureCache dict, one day we might add it */ sourceImage: imageBuffer.Handle, textureAttr: IntPtr.Zero, format: (nuint)(ulong)format, width: width, height: height, planeIndex: planeIndex, textureOut: out texture); if (errorCode != 0) { return(null); } return(new CVMetalTexture(texture)); }
public static CMSampleBuffer CreateReadyWithImageBuffer (CVImageBuffer imageBuffer, CMFormatDescription formatDescription, CMSampleTimingInfo[] sampleTiming, out CMSampleBufferError error) { if (imageBuffer == null) throw new ArgumentNullException ("imageBuffer"); if (formatDescription == null) throw new ArgumentNullException ("formatDescription"); IntPtr buffer; error = CMSampleBufferCreateReadyWithImageBuffer (IntPtr.Zero, imageBuffer.handle, formatDescription.Handle, sampleTiming, out buffer); if (error != CMSampleBufferError.None) return null; return new CMSampleBuffer (buffer, true); }
public static CMSampleBuffer CreateForImageBuffer (CVImageBuffer imageBuffer, bool dataReady, CMVideoFormatDescription formatDescription, CMSampleTimingInfo sampleTiming, out CMSampleBufferError error) { if (imageBuffer == null) throw new ArgumentNullException ("imageBuffer"); if (formatDescription == null) throw new ArgumentNullException ("formatDescription"); IntPtr buffer; error = CMSampleBufferCreateForImageBuffer (IntPtr.Zero, imageBuffer.handle, dataReady, IntPtr.Zero, IntPtr.Zero, formatDescription.handle, ref sampleTiming, out buffer); if (error != CMSampleBufferError.None) return null; return new CMSampleBuffer (buffer, true); }
public bool VideoMatchesImageBuffer(CVImageBuffer imageBuffer) { if (imageBuffer == null) throw new ArgumentNullException ("imageBuffer"); return CMVideoFormatDescriptionMatchesImageBuffer (handle, imageBuffer.Handle); }
public static CMVideoFormatDescription CreateForImageBuffer(CVImageBuffer imageBuffer, out CMFormatDescriptionError error) { if (imageBuffer == null) throw new ArgumentNullException ("imageBuffer"); IntPtr desc; error = CMVideoFormatDescriptionCreateForImageBuffer (IntPtr.Zero, imageBuffer.handle, out desc); if (error != CMFormatDescriptionError.None) return null; return new CMVideoFormatDescription (desc, true); }
public VTStatus EncodeFrame (CVImageBuffer imageBuffer, CMTime presentationTimestamp, CMTime duration, NSDictionary frameProperties, IntPtr sourceFrame, out VTEncodeInfoFlags infoFlags, VTCompressionOutputHandler outputHandler) { if (Handle == IntPtr.Zero) throw new ObjectDisposedException ("CompressionSession"); if (imageBuffer == null) throw new ArgumentNullException ("imageBuffer"); if (outputHandler == null) throw new ArgumentNullException ("outputHandler"); unsafe { var block = new BlockLiteral (); var blockPtr = █ block.SetupBlock (compressionOutputHandlerTrampoline, outputHandler); try { return VTCompressionSessionEncodeFrameWithOutputHandler (Handle, imageBuffer.Handle, presentationTimestamp, duration, frameProperties == null ? IntPtr.Zero : frameProperties.Handle, out infoFlags, blockPtr); } finally { blockPtr->CleanupBlock (); } } }
public VTStatus EncodeFrame (CVImageBuffer imageBuffer, CMTime presentationTimestampe, CMTime duration, NSDictionary frameProperties, IntPtr sourceFrame, out VTEncodeInfoFlags infoFlags) { if (Handle == IntPtr.Zero) throw new ObjectDisposedException ("CompressionSession"); if (imageBuffer == null) throw new ArgumentNullException ("imageBuffer"); return VTCompressionSessionEncodeFrame (Handle, imageBuffer.Handle, presentationTimestampe, duration, frameProperties == null ? IntPtr.Zero : frameProperties.Handle, sourceFrame, out infoFlags); }
public CVMetalTexture TextureFromImage(CVImageBuffer imageBuffer, MTLPixelFormat format, nint width, nint height, nint planeIndex, out CVReturn errorCode) { if (imageBuffer == null) throw new ArgumentNullException ("imageBuffer"); IntPtr texture; errorCode = CVMetalTextureCacheCreateTextureFromImage ( allocator: IntPtr.Zero, textureCache: handle, /* textureCache dict, one day we might add it */ sourceImage: imageBuffer.Handle, textureAttr: IntPtr.Zero, format: (nuint) (ulong) format, width: width, height: height, planeIndex: planeIndex, textureOut: out texture); if (errorCode != 0) return null; return new CVMetalTexture (texture); }