nativecapture

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxVideoWidth  = 2560
	MaxVideoHeight = 1440
)

Variables

This section is empty.

Functions

func PackagedExecutable

func PackagedExecutable() string

func PreviewSource

func PreviewSource(parent context.Context, executable string, target CaptureTarget) ([]byte, error)

func ValidDeviceID added in v1.6.0

func ValidDeviceID(id string) bool

func ValidVideoSize added in v1.9.0

func ValidVideoSize(width, height uint32) bool

ValidVideoSize bounds the decoded picture in the current capture contract.

Types

type Adapter

type Adapter struct {
	Index        uint32    `json:"index"`
	Name         string    `json:"name"`
	Identity     string    `json:"identity"`
	HardwareH264 []Encoder `json:"hardwareH264"`
}

type Capabilities

type Capabilities struct {
	Protocol              int       `json:"protocol"`
	Platform              string    `json:"platform"`
	PlatformBuild         string    `json:"platformBuild"`
	VideoCapture          bool      `json:"videoCapture"`
	CaptureBorderControl  bool      `json:"captureBorderControl,omitempty"`
	Microphone            bool      `json:"microphone,omitempty"`
	ProcessAudio          bool      `json:"processAudio"`
	ProcessAudioExclusion bool      `json:"processAudioExclusion,omitempty"`
	SystemAudio           bool      `json:"systemAudio"`
	SoftwareVP8           bool      `json:"softwareVP8"`
	Adapters              []Adapter `json:"adapters"`
}

func Discover

func Discover(parent context.Context, executable string) (Capabilities, error)

func (Capabilities) Summary

func (capabilities Capabilities) Summary() Summary

type CaptureTarget

type CaptureTarget struct {
	Kind         string `json:"kind"`
	SourceID     string `json:"sourceId"`
	PID          uint32 `json:"pid,omitempty"`
	CreationTime string `json:"creationTime,omitempty"`
	Title        string `json:"title"`
}

func ListSources

func ListSources(parent context.Context, executable string) ([]CaptureTarget, error)

func (CaptureTarget) Valid

func (target CaptureTarget) Valid() bool

type EncodedVideoOptions

type EncodedVideoOptions struct {
	Codec        string
	AdapterIndex uint32
	EncoderIndex uint32
	Preference   string
	Outputs      []OutputProfile
}

type Encoder

type Encoder struct {
	Index    uint32 `json:"index"`
	Name     string `json:"name"`
	Identity string `json:"identity"`
}

type Frame

type Frame struct {
	Kind FrameKind
	// KeyFrame denotes independent recovery, including H264 SPS/PPS when needed.
	KeyFrame  bool
	Layer     int
	Width     uint32
	Height    uint32
	Timestamp time.Duration
	Duration  time.Duration
	Data      []byte
}

type FrameKind

type FrameKind uint8
const (
	FramePCM              FrameKind = 1
	FrameH264             FrameKind = 2
	FrameStatus           FrameKind = 3
	FrameVP8              FrameKind = 4
	FrameBegin            FrameKind = 5
	FrameLayerUnavailable FrameKind = 6
	FrameControl          FrameKind = 7
)

type Microphone added in v1.6.0

type Microphone struct {
	ID    string `json:"id"`
	Label string `json:"label"`
}

Device identities remain local to the authenticated App control connection.

func ListMicrophones added in v1.6.0

func ListMicrophones(parent context.Context, executable string) ([]Microphone, error)

type OutputProfile

type OutputProfile struct {
	Width     uint32 `json:"width"`
	Height    uint32 `json:"height"`
	Framerate uint32 `json:"fps"`
	Bitrate   uint32 `json:"bitrate"`
}

OutputProfile describes one codec output, not a selectable product preset.

func ScreenShareOutputs

func ScreenShareOutputs(profile VideoProfile) []OutputProfile

ScreenShareOutputs follows LiveKit 2.22.1's screen-share simulcast construction, with even derived dimensions for NV12. The source profile has already passed Valid.

func (OutputProfile) Valid

func (profile OutputProfile) Valid() bool

type Stream

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

func StartAudio

func StartAudio(parent context.Context, executable string, target CaptureTarget, exclude bool) (*Stream, error)

func StartEncodedVideo

func StartEncodedVideo(parent context.Context, executable string, options EncodedVideoOptions) (*Stream, error)

func StartMicrophone added in v1.6.0

func StartMicrophone(parent context.Context, executable, deviceID string) (*Stream, error)

func StartSystemAudio

func StartSystemAudio(parent context.Context, executable string) (*Stream, error)

func StartVideo

func StartVideo(parent context.Context, executable string, options VideoOptions) (*Stream, error)

func (*Stream) Close

func (stream *Stream) Close() error

func (*Stream) Done

func (stream *Stream) Done() <-chan error

func (*Stream) Outputs

func (stream *Stream) Outputs() []OutputProfile

func (*Stream) Read

func (stream *Stream) Read() (Frame, error)

func (*Stream) RequestKeyFrame

func (stream *Stream) RequestKeyFrame(layer int) error

func (*Stream) SetOutputActive

func (stream *Stream) SetOutputActive(layer int, active bool) error

func (*Stream) SetOutputBitrate

func (stream *Stream) SetOutputBitrate(layer int, bitrate uint32) error

func (*Stream) WriteFrame

func (stream *Stream) WriteFrame(frame Frame) error

WriteFrame shares the existing stdin lock with control. Only encoded video crosses this input boundary; capture status and PCM remain producer outputs.

type Summary

type Summary struct {
	Video                 bool
	CaptureBorderControl  bool
	Microphone            bool
	ProcessAudio          bool
	ProcessAudioExclusion bool
	SystemAudio           bool
	HardwareH264          bool
	SoftwareVP8           bool
}

func (Summary) AudioFor

func (summary Summary) AudioFor(kind string) bool

type VideoOptions

type VideoOptions struct {
	Target            CaptureTarget
	Codec             string
	AdapterIndex      uint32
	EncoderIndex      uint32
	Profile           VideoProfile
	RestoreToken      string
	OutputGroups      int
	ShowCaptureBorder bool
}

type VideoProfile

type VideoProfile struct {
	Width      uint32
	Height     uint32
	Framerate  uint32
	Bitrate    uint32
	Preference string
}

func (VideoProfile) Valid

func (profile VideoProfile) Valid() bool

Jump to

Keyboard shortcuts

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