Documentation
¶
Overview ¶
Package pipewire is the PipeWire video producer lys-shell's ScreenCast portal streams through (lys-shell-portal screencast/pipewire.rs): an output stream on its own pw_thread_loop, fed one captured frame per cycle the consumer drives, stamped with the header, transform and damage metas. libpipewire is bound through purego, so the binary stays CGO_ENABLED=0.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Name is the node name the consumer sees.
Name string
Width, Height, Stride uint32
Format VideoFormat
// FPS is the advertised and paced frame rate.
FPS uint32
// Transform is the constant spa_meta_videotransform value (the
// output's wl_output transform; 0 for a window).
Transform uint32
Source Source
}
Config is one producer's fixed stream geometry.
type DmabufSource ¶
type DmabufSource interface {
Source
Modifier() uint64
// DmabufVideoFormat is the GPU buffers' format, which need not be
// the shared-memory one (a GPU compositor hands out 24-bit shm and
// 32-bit dmabufs).
DmabufVideoFormat() VideoFormat
AllocDmabuf() (Dmabuf, error)
FillDmabuf(Dmabuf) (damage []Rect, ok bool)
}
DmabufSource is a Source that also fills GPU buffers: the producer offers its modifier's format first and, when the consumer takes it, binds one buffer from AllocDmabuf to each PipeWire buffer for the stream's life and fills it in place (zero copy). A consumer that takes the plain format gets producer-allocated shared memory, filled through Fill.
type Producer ¶
type Producer struct {
// contains filtered or unexported fields
}
Producer is one running PipeWire video output stream.
type Rect ¶
type Rect struct{ X, Y, Width, Height int }
Rect is a damaged region in buffer pixels.
func ClampDamage ¶
ClampDamage clips rects to the frame into out; none, none left, or more than max collapse to the whole frame.
type Resizable ¶
Resizable is a Source whose frames change size (a window being resized): Size is the layout of the frames it has now. When that differs from the stream's, the producer offers the new size and holds frames back until the consumer has renegotiated.
type Source ¶
Source fills one frame: Fill copies stride-byte rows into dst and reports what changed (nil or empty is the whole frame); ok false skips this cycle (nothing new, or the capture failed).
type VideoFormat ¶
type VideoFormat uint32
VideoFormat is an spa_video_format.
const ( VideoRGBx VideoFormat = 7 VideoBGRx VideoFormat = 8 VideoRGBA VideoFormat = 11 VideoBGRA VideoFormat = 12 // The packed 24-bit formats GPU renderers offer over shm. VideoRGB VideoFormat = 15 VideoBGR VideoFormat = 16 )
The packed 8-bit formats compositors hand out.