LavaUI docs GitHub

protocol VideoFrameHost

Swift

protocol VideoFrameHost : AnyObject, Sendable

A host that can sample a client's dma-bufs. See the top of this file.

All of it blocks, and all of it may be called from any thread — a player calls show from the thread it renders on, so a frame never waits for the UI loop to come round.

Sources/LavaUI/VideoFrames.swift:65

Methods

func attachVideoBuffer(fd: Int32, layout: VideoBufferLayout) -> UInt32?

Hands the buffer to the renderer. fd is borrowed — the host sends a duplicate — so the caller still closes its own. Nil if refused.

Sources/LavaUI/VideoFrames.swift:73

func detachVideoBuffer(_ handle: UInt32)

Not documented.

Sources/LavaUI/VideoFrames.swift:83

func showVideoBuffer(_ handle: UInt32) -> VideoFrame?

"This buffer holds a finished frame." The caller has already waited for its own rendering to complete. When this returns the renderer has copied it, and the buffer may be rendered into again.

Draw the id this returns, every time: it is usually the same for the same buffer, and not always.

Sources/LavaUI/VideoFrames.swift:81

func videoTarget() -> VideoTarget?

Nil when the host has no video path at all: a compositor too old for the call, a connection that cannot carry a descriptor, or a renderer with no render node to name.

Sources/LavaUI/VideoFrames.swift:69