sck

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 11 Imported by: ? 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

Rendered for darwin/amd64

Overview

Package sck captures a macOS display with ScreenCaptureKit through purego, with no cgo. ScreenCaptureKit calls back on a GCD serial queue thread; the callback runs Go code directly on that foreign thread.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoDisplay = errors.New("sck: display not in shareable content")

ErrNoDisplay means the display is not in ScreenCaptureKit's shareable content (disconnected, or the process lacks Screen Recording permission).

Functions

func Allowed

func Allowed() bool

Allowed reports whether this process (or its responsible parent) holds the Screen Recording permission.

func Displays

func Displays() ([]capture.Display, error)

Displays lists the displays ScreenCaptureKit can capture, in pixels at their current mode. ID is the CGDirectDisplayID in decimal.

Types

type Sample

type Sample struct {
	Pixels      uintptr
	DisplayTime int64 // mach-clock ns when the frame was shown
	Delivered   int64 // mach-clock ns when the callback started
}

Sample is one delivered frame. Pixels is a retained CVPixelBufferRef that the receiver must release with apple.CFRelease.

type Source

type Source struct {
	// contains filtered or unexported fields
}

func Open

func Open(width, height, fps int, format uint32) (*Source, error)

Open starts capturing the main display scaled to width x height at up to fps, in pixel format (vt.PixelBGRA or vt.Pixel420v).

func OpenDisplay

func OpenDisplay(id uint32, width, height, fps int, format uint32) (*Source, error)

OpenDisplay is Open for the display with this CGDirectDisplayID.

func (*Source) Close

func (s *Source) Close() error

func (*Source) Next

func (s *Source) Next(timeout time.Duration) (capture.Frame, error)

Next adapts NextSample to capture.Source. Presented and Acquired are mach-clock nanoseconds.

func (*Source) NextSample

func (s *Source) NextSample(timeout time.Duration) (Sample, error)

NextSample waits for the next complete frame.

func (*Source) Release

func (s *Source) Release() error

func (*Source) Stats

func (s *Source) Stats() Stats

type Stats

type Stats struct {
	Complete, Idle, Other, Dropped int
}

Jump to

Keyboard shortcuts

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