A set of extensions and utilities to work with CoreVideo types.
CVPixelFormat
While debuging Core Video objects, you need to understand what pixel format is used in them.
To do this using vanilla API you are forced to find a mathing OSType value, because OSType if basically a number.
This project uses CVPixelFormat enum istead of vanilla OSType public vars which is much more handy, and you can easyly get a description of a current pixel format.
let cvPixelFormat: CVPixelFormat = cvPixelBuffer.cvPixelFormat
let description = cvPixelFormat.description
Swifty API
There are a lot Swift wrappers over vanilla CVPixelBuffer C-style API:
Vanilla API:
let width = CVPixelBufferGetWidth(cvPixelBuffer)
let height = CVPixelBufferGetHeight(cvPixelBuffer)
// ...
let bytesPerElement = IOSurfaceGetBytesPerRow(ioSurface)
let bytesPerRow = IOSurfaceGetBytesPerRow(ioSurface)
Swifty API:
let width = cvPixelBuffer.width
let height = cvPixelBuffer.height
// ...
let bytesPerElement = ioSurface.bytesPerElement
let bytesPerRow = ioSurface.bytesPerRow
CVReturn Result & CVError
There are some functions in Core Video that return a code which helps if the operation succeeded.
This project aims to simplify this error checking. CVReturnResult and CVError types are used to wrap vanilla API with thowable functions.
Vanilla API:
let returnCode = CVPixelBufferLockBaseAddress(cvPixelBuffer, lockFlags)
guard returnCode == kCVReturnSuccess else { // handle the error ...
core-video-tools
A set of extensions and utilities to work with CoreVideo types.
CVPixelFormat
While debuging
Core Video
objects, you need to understand what pixel format is used in them. To do this using vanilla API you are forced to find a mathingOSType
value, becauseOSType
if basically a number. This project usesCVPixelFormat
enum istead of vanillaOSType
public vars which is much more handy, and you can easyly get adescription
of a current pixel format.Swifty API
There are a lot Swift wrappers over vanilla CVPixelBuffer C-style API:
Vanilla API:
Swifty API:
CVReturn Result & CVError
There are some functions in Core Video that return a code which helps if the operation succeeded. This project aims to simplify this error checking.
CVReturn
Result
andCVError
types are used to wrap vanilla API with thowable functions.Vanilla API:
Swifty API: