apple

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 4 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

Rendered for darwin/amd64

Overview

Package apple loads the CoreFoundation, CoreMedia, CoreVideo, and VideoToolbox entry points Planck needs through purego, with no cgo.

Index

Constants

View Source
const QoSUserInteractive = 0x21

QoSUserInteractive is QOS_CLASS_USER_INTERACTIVE of <sys/qos.h>.

Variables

View Source
var (
	System         = open("/usr/lib/libSystem.B.dylib")
	CoreFoundation = open("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation")
	CoreMedia      = open("/System/Library/Frameworks/CoreMedia.framework/CoreMedia")
	CoreVideo      = open("/System/Library/Frameworks/CoreVideo.framework/CoreVideo")
	VideoToolbox   = open("/System/Library/Frameworks/VideoToolbox.framework/VideoToolbox")
	IOSurface      = open("/System/Library/Frameworks/IOSurface.framework/IOSurface")
	CoreGraphics   = open("/System/Library/Frameworks/CoreGraphics.framework/CoreGraphics")
)
View Source
var (
	CFRelease                 func(uintptr)
	CFRetain                  func(uintptr) uintptr
	CFStringCreateWithCString func(alloc uintptr, s string, enc uint32) uintptr
	CFNumberCreate            func(alloc uintptr, typ int, v unsafe.Pointer) uintptr
	CFNumberGetValue          func(n uintptr, typ int, v unsafe.Pointer) bool
	CFDictionaryCreateMutable func(alloc uintptr, cap int, keyCB, valueCB uintptr) uintptr
	CFDictionarySetValue      func(d, k, v uintptr)
	CFDictionaryGetValue      func(d, k uintptr) uintptr
	CFArrayGetCount           func(a uintptr) int
	CFArrayGetValueAtIndex    func(a uintptr, i int) uintptr
	CFGetRetainCount          func(uintptr) int

	MachAbsoluteTime func() uint64

	KCFBooleanTrue  uintptr
	KCFBooleanFalse uintptr
)

Functions

func Bool

func Bool(v bool) uintptr

func Const

func Const(lib uintptr, name string) uintptr

Const reads a global CFTypeRef constant such as kVTCompressionPropertyKey_RealTime.

func Dict

func Dict(kv ...uintptr) uintptr

Dict builds a CFMutableDictionary from alternating keys and values. Values passed here are retained by the dictionary; the caller keeps its own refs.

func Float

func Float(v float64) uintptr

func HasSym

func HasSym(lib uintptr, name string) bool

HasSym reports whether a symbol exists, for APIs newer than some macOS versions.

func Int

func Int(v int64) uintptr

func Nanos

func Nanos(ticks uint64) int64

Nanos converts mach_absolute_time ticks to nanoseconds.

func Now

func Now() int64

Now is the mach clock in nanoseconds.

func NumberInt64

func NumberInt64(n uintptr) (int64, bool)

NumberInt64 reads a CFNumber as int64.

func Register

func Register(fptr any, lib uintptr, name string)

func RunWithAnimator

func RunWithAnimator(x, y, size float64, work func())

RunWithAnimator runs work on a goroutine while the main thread drives a small borderless window that changes color on every timer tick, so screen capture sees motion. The app uses the accessory activation policy: no Dock icon, no focus change, mouse events pass through. It must be called on the main thread and returns after work does.

func SetThreadQoS

func SetThreadQoS(class uint32) error

SetThreadQoS sets the calling OS thread's quality of service class, so the scheduler keeps it on the performance cores under load. The caller must hold runtime.LockOSThread for as long as the class should last.

func String

func String(s string) uintptr

func Sym

func Sym(lib uintptr, name string) uintptr

Sym returns a function or data address, panicking when it is missing.

Types

type CMTime

type CMTime struct {
	Value     int64
	Timescale int32
	Flags     uint32
	Epoch     int64
}

CMTime mirrors CoreMedia's 24-byte time struct.

func Time

func Time(value int64, timescale int32) CMTime

Jump to

Keyboard shortcuts

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