AppKitWindow

class AppKitWindow(title: String, width: Int, height: Int, surface: AppKitSurface)

A window to draw video into.

Deliberately the smallest thing that puts a picture on screen. AppKit owns the main thread and its run loop, so the shape below is not a choice: the window is created on the main thread, runEventLoop blocks there, and playback happens on other threads and hands frames over through AppKitVideoRenderer.

This is the tier 0 presentation path, and it ships rather than being scaffolding: it is the fallback when a GPU path fails, and the reference a GPU renderer is compared against. It is also slow. Converting a frame on the CPU and building an image from it costs several milliseconds at 1080p, which is fine for a small clip and not enough for 4K. A Metal renderer that uploads planes as textures and converts in a shader is the tier 1 replacement.

Constructors

Link copied to clipboard
constructor(title: String, width: Int, height: Int, surface: AppKitSurface)
constructor(title: String, width: Int, height: Int, useMetalLayer: Boolean = false)

The window with an image view, or with a platform.QuartzCore.CAMetalLayer when useMetalLayer is true, for MetalVideoRenderer. The image view stays the CG fallback's home.

Properties

Link copied to clipboard
val metalLayer: CAMetalLayer?

The layer a MetalVideoRenderer draws into; null unless built with AppKitSurface.Metal.

Link copied to clipboard

Called on the main thread when this window is closing, whatever closed it.

Link copied to clipboard
val sampleBufferLayer: AVSampleBufferDisplayLayer?

The layer a SampleBufferVideoRenderer and a picture in picture controller share. Null unless built with AppKitSurface.SampleBuffer.

Functions

Link copied to clipboard

Hands the main thread to AppKit.

Link copied to clipboard
fun stop()

Ends the event loop, which lets runEventLoop return.