obs

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package obs provides a basic obs-websocket 5.0 client. It supports all of the API calls needed for resetti to function.

See https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md for more detailed documentation on the websocket protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

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

Batch contains multiple requests which are to be submitted and executed at once.

func (*Batch) SetItemBounds

func (b *Batch) SetItemBounds(scene, name string, x, y, w, h float64)

func (*Batch) SetItemIndex

func (b *Batch) SetItemIndex(scene, name string, index int)

func (*Batch) SetItemVisibility

func (b *Batch) SetItemVisibility(scene, name string, visible bool)

func (*Batch) SetSourceFilterEnabled

func (b *Batch) SetSourceFilterEnabled(source, filter string, enabled bool)

func (*Batch) SetSourceSettings

func (b *Batch) SetSourceSettings(source string, settings StringMap, keep bool)

type BatchMode

type BatchMode int

BatchMode contains the mode the requests of a batch are to be executed in.

const (
	SerialRealtime BatchMode = iota
	SerialFrame
	Parallel
)

Request batch modes.

type Client

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

Client manages an OBS websocket connection.

func (*Client) Batch

func (c *Client) Batch(mode BatchMode, fn func(*Batch)) error

Batch creates and *synchronously* submits a new request batch. The provided closure can be used to add requests to the batch. If the closure returns an error or panics, the batch will not be submitted.

func (*Client) BatchAsync

func (c *Client) BatchAsync(mode BatchMode, fn func(*Batch))

BatchAsync creates and submits a new request batch in another goroutine. If the batch errors, the error will be logged.

func (*Client) Connect

func (c *Client) Connect(ctx context.Context, port uint16, pw string) (<-chan error, error)

Connect attempts to connect to an OBS instance at the given address. If authentication is required, the given password will be used.

func (*Client) GetCanvasSize

func (c *Client) GetCanvasSize() (width, height int, err error)

GetCanvasSize returns the base resolution (canvas size) of the current OBS profile.

func (*Client) GetSceneItemIndex

func (c *Client) GetSceneItemIndex(scene, name string) (int, error)

GetSceneItemIndex returns the index of the given scene item.

func (*Client) GetSceneItemTransform

func (c *Client) GetSceneItemTransform(scene, name string) (x, y, w, h float64, err error)

GetSceneItemTransform returns the size and position of the given scene item.

func (*Client) GetSourceFilterList

func (c *Client) GetSourceFilterList(source string) ([]string, error)

GetSourceFilterList gets a list of all source filters on a given source.

func (*Client) SetScene

func (c *Client) SetScene(name string)

SetScene sets the current scene and logs any errors that occur.

func (*Client) SetSceneItemBounds

func (c *Client) SetSceneItemBounds(scene, name string, x, y, w, h float64)

SetSceneItemBounds moves and resizes the given scene item and logs any errors that occur.

func (*Client) SetSceneItemVisible

func (c *Client) SetSceneItemVisible(scene, name string, visible bool)

SetSceneItemVisible hides or shows the given scene item and logs any errors that occur.

func (*Client) SetSourceFilterEnabled

func (c *Client) SetSourceFilterEnabled(source, filter string, enabled bool)

SetSourceFilterEnabled enables or disables a given filter and logs any errors that occur.

type SourceKind

type SourceKind string

SourceKind contains the input type for a given source.

const (
	KindWindow SourceKind = "xcomposite_input"
	KindImage  SourceKind = "image_source"
)

Source kinds.

type StringMap

type StringMap map[string]any

StringMap represents a JSON object.

Jump to

Keyboard shortcuts

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