Documentation
¶
Overview ¶
Package recorder is the screen recorder service (wayle-shell-core services/recorder and the wayle-recorder engine): the lifecycle state machine (idle, starting, recording, stopping), the elapsed timer, options from the [modules.recorder] config, and an engine that negotiates the ScreenCast portal and records through GStreamer.
Index ¶
- Constants
- func ChoiceIndex(choices []DeviceChoice, id string) int
- func ChoiceLabels(choices []DeviceChoice) []string
- func FormatElapsed(totalSecs uint32) string
- func OutputPath(configuredDir string, format Format, now time.Time) string
- func VideosDir() string
- func WebcamMargin(w, h int32) int32
- type Built
- type Cast
- type Change
- type Daemon
- type DeviceChoice
- type Engine
- type Format
- type GstEngine
- type Hooks
- type Options
- type Recording
- type Session
- type Source
- type State
- type Status
- type Webcam
Constants ¶
const ( ServiceName = "dev.stubbe.lys.Recorder1" ServicePath = "/dev/stubbe/lys/Recorder" )
D-Bus identity (the Rust RecorderService's registration).
Variables ¶
This section is empty.
Functions ¶
func ChoiceIndex ¶
func ChoiceIndex(choices []DeviceChoice, id string) int
ChoiceIndex is index_of: the saved id's index, else the default 0.
func ChoiceLabels ¶
func ChoiceLabels(choices []DeviceChoice) []string
ChoiceLabels are the picker rows.
func FormatElapsed ¶
FormatElapsed is format_elapsed: H:MM:SS above the hour, M:SS within.
func OutputPath ¶
OutputPath is output_path: lys-shell-<local timestamp>.<ext> in the configured directory, else the videos directory.
func VideosDir ¶
func VideosDir() string
VideosDir is videos_dir: $XDG_VIDEOS_DIR, else $HOME/Videos.
func WebcamMargin ¶
WebcamMargin is webcam_margin: the uniform inset, a percentage of the shorter side. The dropdown's position preview uses it too.
Types ¶
type Built ¶
Built is a pipeline description and whether its video encoder is hardware (pipeline.rs's Built).
func BuildPipeline ¶
func BuildPipeline(opts Options, cast Cast, allowHardware bool, threads int, hasFactory func(string) bool) Built
BuildPipeline is pipeline.rs's build_with: the portal's pipewiresrc, optionally composited with a letterboxed webcam, encoded and muxed, with system audio and the microphone mixed into one track. A hardware H.264 encoder is used when allowHardware and hasFactory reports its element; threads is the encoder thread count.
type Cast ¶
Cast is the negotiated screen: the PipeWire remote fd, the node, and the size (zero when unknown).
type Change ¶
type Change struct {
Status Status
Active bool
Paused bool
Preparing bool
ElapsedSecs uint32
OutputPath string
}
Change is the state the bar module, the dropdown, and the daemon read.
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon is the dev.stubbe.lys.Recorder1 object (wayle-shell-core/src/services/recorder/dbus.rs).
type DeviceChoice ¶
type DeviceChoice struct {
ID, Label string
}
DeviceChoice is DeviceChoice: ID is what the pipeline consumes ("" is the default or automatic entry), Label what a picker shows.
func Cameras ¶
func Cameras() []DeviceChoice
Cameras is cameras(): "Automatic", then one entry per distinct card name at its lowest capture node.
func MicrophoneChoices ¶
func MicrophoneChoices(sources []Source) []DeviceChoice
MicrophoneChoices is microphone_sources: "Default", then every named non-monitor source by description (else name).
func WithSaved ¶
func WithSaved(choices []DeviceChoice, id string) []DeviceChoice
WithSaved keeps a saved device the list does not offer (unplugged, or not enumerated yet) selectable: it is appended, labelled by its id. The default "" needs no entry.
type Engine ¶
type Engine interface {
// OpenSession negotiates the source, showing the picker when no
// grant is cached; ctx cancels it.
OpenSession(ctx context.Context, showCursor bool) (Session, error)
// Start records session with opts; term reports an unexpected end
// (a source disconnect, a full disk), never a requested Stop.
Start(session Session, opts Options, term func(reason string)) (Recording, error)
}
Engine opens capture sessions and records them (wayle-recorder's Recorder: open_session, start).
type GstEngine ¶
GstEngine is the production Engine: the ScreenCast portal on the session bus and an in-process GStreamer pipeline.
func (GstEngine) OpenSession ¶
OpenSession implements Engine: one monitor through the portal, the restore token in lys-shell's state dir.
type Hooks ¶
type Hooks struct {
Toast func(label, icon string, durationMS uint32)
Notify func(appName, summary, body, icon string)
}
Hooks are the user-facing reports: an OSD toast and a desktop notification. Nil hooks are skipped.
type Options ¶
type Options struct {
OutputPath string
Format Format
Framerate uint32
ShowCursor bool
// Microphone captures MicrophoneDevice ("" the default source);
// SystemAudio the default sink's monitor.
Microphone bool
MicrophoneDevice string
SystemAudio bool
// Webcam is the overlay, nil for none.
Webcam *Webcam
}
Options is one recording's settings (RecordOptions).
func BuildOptions ¶
func BuildOptions(cfg config.RecorderConfig, now time.Time) Options
BuildOptions is build_options: the recording's options from the config, the output named for now.
type Recording ¶
type Recording interface {
// SetPaused pauses or resumes the capture.
SetPaused(paused bool) error
// Stop finalizes the file, blocking until the muxer is done.
Stop()
}
Recording is one running capture.
type Session ¶
type Session interface {
Cast() Cast
Close()
}
Session is a negotiated capture source, held across the start delay and closed when the recording ends.
type Source ¶
type Source struct {
Name, Description string
// Monitor is a sink's monitor, never a microphone.
Monitor bool
}
Source is an audio input as the microphone pickers see it.
type State ¶
type State struct {
// contains filtered or unexported fields
}
State is the recorder service. Safe for concurrent use.
func NewState ¶
func NewState(engine Engine, cfg func() config.RecorderConfig, hooks Hooks) *State
NewState builds the service over an engine, reading options from cfg at each start.
func (*State) Changes ¶
Changes delivers a snapshot on every change and elapsed second to every subscriber; stop ends the feed.
func (*State) SetPaused ¶
SetPaused pauses or resumes an active recording; an engine failure leaves the state as it was.
func (*State) Start ¶
func (s *State) Start()
Start begins a recording with the current config. The Idle→Starting claim is synchronous, so a second call while one is in flight is a no-op; the rest (portal, delay, pipeline) runs off the caller.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package recordertest is the scripted recorder.Engine every recorder test drives: sessions and recordings that record their calls, an optional gate that holds OpenSession (the portal picker), and a hook that ends a recording as a failed pipeline would.
|
Package recordertest is the scripted recorder.Engine every recorder test drives: sessions and recordings that record their calls, an optional gate that holds OpenSession (the portal picker), and a hook that ends a recording as a failed pipeline would. |