Function VTCompressionSessionCreate

Source
pub unsafe extern "C-unwind" fn VTCompressionSessionCreate(
    allocator: Option<&CFAllocator>,
    width: i32,
    height: i32,
    codec_type: CMVideoCodecType,
    encoder_specification: Option<&CFDictionary>,
    source_image_buffer_attributes: Option<&CFDictionary>,
    compressed_data_allocator: Option<&CFAllocator>,
    output_callback: VTCompressionOutputCallback,
    output_callback_ref_con: *mut c_void,
    compression_session_out: NonNull<*mut VTCompressionSession>,
) -> i32
Available on crate features VTErrors and objc2-core-media and VTCompressionSession only.
Expand description

Creates a session for compressing video frames.

Compressed frames will be emitted through calls to outputCallback.

Parameter allocator: An allocator for the session. Pass NULL to use the default allocator.

Parameter width: The width of frames, in pixels. If the video encoder cannot support the provided width and height it may change them.

Parameter height: The height of frames in pixels.

Parameter codecType: The codec type.

Parameter encoderSpecification: Specifies a particular video encoder that must be used. Pass NULL to let the video toolbox choose a encoder.

Parameter sourceImageBufferAttributes: Required attributes for source pixel buffers, used when creating a pixel buffer pool for source frames. If you do not want the Video Toolbox to create one for you, pass NULL. (Using pixel buffers not allocated by the Video Toolbox may increase the chance that it will be necessary to copy image data.)

Parameter compressedDataAllocator: An allocator for the compressed data. Pass NULL to use the default allocator. Note: on MacOS 10.12 and later, using a compressedDataAllocator may trigger an extra buffer copy.

Parameter outputCallback: The callback to be called with compressed frames. This function may be called asynchronously, on a different thread from the one that calls VTCompressionSessionEncodeFrame. Pass NULL if and only if you will be calling VTCompressionSessionEncodeFrameWithOutputHandler for encoding frames.

Parameter outputCallbackRefCon: Client-defined reference value for the output callback.

Parameter compressionSessionOut: Points to a variable to receive the new compression session.