AVImage
public final class AVImage
Undocumented
-
Undocumented
Declaration
Swift
public let data: UnsafeMutableBufferPointer<UnsafeMutablePointer<UInt8>?> -
Undocumented
Declaration
Swift
public let size: Int -
Undocumented
Declaration
Swift
public let linesizes: UnsafeMutableBufferPointer<Int32> -
Undocumented
Declaration
Swift
public let width: Int -
Undocumented
Declaration
Swift
public let height: Int -
Undocumented
Declaration
Swift
public let pixelFormat: AVPixelFormat -
Allocate an image with size and pixel format.
Declaration
Swift
public init(width: Int, height: Int, pixelFormat: AVPixelFormat, align: Int = 1)Parameters
widthimage width
heightimage height
pixelFormatimage pixel format
alignthe value to use for buffer size alignment, e.g. 1(no alignment), 16, 32, 64
-
Create an image from the given frame.
Declaration
Swift
public init(frame: AVFrame) -
Copy image from the given pixel buffer.
Declaration
Swift
public func copy( from buffer: UnsafeMutablePointer<UnsafePointer<UInt8>?>, linesizes: UnsafePointer<Int32> ) -
Copy image from the given frame.
Declaration
Swift
public func copy(from frame: AVFrame) -
Reformat image using the given
SwsContext.Throws
AVErrorDeclaration
Swift
@discardableResult public func reformat(using context: SwsContext, to image: AVImage) throws -> IntReturn Value
the height of the output slice
-
Compute the size of an image line with format and width for the plane.
Throws
AVErrorDeclaration
Swift
public static func getLinesize(pixelFormat: AVPixelFormat, width: Int, plane: Int) throws -> IntReturn Value
the computed size in bytes
-
Fill plane linesizes for an image with pixel format and width.
Throws
AVErrorDeclaration
Swift
public static func fillLinesizes( _ linesizes: UnsafeMutablePointer<Int32>, pixelFormat: AVPixelFormat, width: Int ) throws -
Fill plane data pointers for an image with pixel format and height.
Throws
AVErrorDeclaration
Swift
@discardableResult public static func fillPointers( _ data: UnsafeMutablePointer<UnsafeMutablePointer<UInt8>?>, pixelFormat: AVPixelFormat, height: Int, buffer: UnsafeMutablePointer<UInt8>?, linesizes: UnsafePointer<Int32>? ) throws -> IntParameters
datapointers array to be filled with the pointer for each image plane
pixelFormatthe pixel format of the image
heightthe height of the image
bufferthe pointer to a buffer which will contain the image
linesizesthe array containing the linesize for each plane, should be filled by
fillLinesizes(_:pixelFormat:width:)Return Value
the size in bytes required for the image buffer
-
Return the size in bytes of the amount of data required to store an image with the given parameters.
Throws
AVErrorDeclaration
Swift
public static func getBufferSize( pixelFormat: AVPixelFormat, width: Int, height: Int, align: Int ) throws -> IntParameters
pixelFormatthe pixel format of the image
widththe width of the image in pixels
heightthe height of the image in pixels
alignthe assumed linesize alignment
Return Value
the buffer size in bytes
-
Copy image data from an frame into a buffer.
Throws
AVErrorDeclaration
Swift
@discardableResult public static func copyImageData( from frame: AVFrame, to buffer: UnsafeMutablePointer<UInt8>, size: Int, align: Int = 1 ) throws -> IntParameters
framethe source frame
buffera buffer into which picture data will be copied
sizethe size in bytes of dst
alignthe assumed linesize alignment for dst
Return Value
the number of bytes written to dst
-
Create a pixel buffer and copy image data from an frame into the buffer.
Throws
AVErrorDeclaration
Swift
public static func makePixelBuffer( from frame: AVFrame, align: Int = 1 ) throws -> UnsafeMutableBufferPointer<UInt8>Parameters
framethe source frame
alignthe assumed linesize alignment for dst
Return Value
a buffer into which picture data will be copied
View on GitHub
Install in Dash
AVImage Class Reference