pipewire

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 Dmabuf

type Dmabuf interface {
	Fd() int
	Offset() uint32
	Stride() uint32
	Release()
}

Dmabuf is one GPU buffer's single plane.

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.

func Start

func Start(cfg Config) (*Producer, error)

Start connects the stream and returns once the server exported its node (the stream reached PAUSED: before that the node id is SPA_ID_INVALID and no consumer could link to it).

func (*Producer) Close

func (p *Producer) Close()

Close stops the stream and its loop.

func (*Producer) NodeID

func (p *Producer) NodeID() uint32

NodeID is the node the consumer connects to.

type Rect

type Rect struct{ X, Y, Width, Height int }

Rect is a damaged region in buffer pixels.

func ClampDamage

func ClampDamage(out, rects []Rect, width, height, max int) []Rect

ClampDamage clips rects to the frame into out; none, none left, or more than max collapse to the whole frame.

type Resizable

type Resizable interface {
	Source
	Size() (width, height, stride uint32)
}

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

type Source interface {
	Fill(dst []byte) (damage []Rect, ok bool)
}

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.

Directories

Path Synopsis
Package pwtest starts a private PipeWire daemon for tests, so producers and consumers link without touching the user's session.
Package pwtest starts a private PipeWire daemon for tests, so producers and consumers link without touching the user's session.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL