streamd

package
v0.0.0-...-646ff60 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: CC0-1.0 Imports: 61 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotChanged = errors.New("not changed")
View Source
var ErrSkipBackend = streamd.ErrSkipBackend

Functions

This section is empty.

Types

type ErrNoVariable

type ErrNoVariable struct{}

func (ErrNoVariable) Error

func (ErrNoVariable) Error() string

type ErrVariableWrongType

type ErrVariableWrongType struct{}

func (ErrVariableWrongType) Error

func (ErrVariableWrongType) Error() string

type Event

type Event interface{}

type OBSInstanceID

type OBSInstanceID = streamtypes.OBSInstanceID

type OBSState

type OBSState = streamtypes.OBSState

type SaveConfigFunc

type SaveConfigFunc func(context.Context, config.Config) error

type SceneElementIdentifier

type SceneElementIdentifier struct {
	Name *string
	UUID *string
}

type StreamControllers

type StreamControllers struct {
	OBS     *obs.OBS
	Twitch  *twitch.Twitch
	Kick    *kick.Kick
	YouTube *youtube.YouTube
}

type StreamD

type StreamD struct {
	UI ui.UI

	P2PNetwork p2p.P2P

	SaveConfigFunc SaveConfigFunc
	ConfigLock     xsync.Gorex
	Config         config.Config

	CacheLock xsync.Mutex
	Cache     *cache.Cache

	GitStorage *repository.GIT

	CancelGitSyncer context.CancelFunc
	GitSyncerMutex  xsync.Mutex
	GitInitialized  bool

	StreamControllers StreamControllers

	Variables sync.Map

	OAuthListenPortsLocker xsync.Mutex
	OAuthListenPorts       map[uint16]struct{}

	ControllersLocker xsync.RWMutex

	StreamServerLocker xsync.RWMutex
	StreamServer       streamserver.StreamServer

	StreamStatusCache *memoize.MemoizeData
	OBSState          OBSState

	EventBus eventbus.Bus

	TimersLocker xsync.Mutex
	NextTimerID  uint64
	Timers       map[api.TimerID]*Timer

	ImageHash xsync.Map[string, imageHash]
	// contains filtered or unexported fields
}

func New

func New(
	cfg config.Config,
	ui ui.UI,
	saveCfgFunc SaveConfigFunc,
	b *belt.Belt,
) (_ret *StreamD, _err error)

func (*StreamD) AddIncomingStream

func (d *StreamD) AddIncomingStream(
	ctx context.Context,
	streamID api.StreamID,
) error

func (*StreamD) AddOAuthListenPort

func (d *StreamD) AddOAuthListenPort(port uint16)

func (*StreamD) AddStreamDestination

func (d *StreamD) AddStreamDestination(
	ctx context.Context,
	destinationID api.DestinationID,
	url string,
	streamKey string,
) error

func (*StreamD) AddStreamForward

func (d *StreamD) AddStreamForward(
	ctx context.Context,
	streamID api.StreamID,
	destinationID api.DestinationID,
	enabled bool,
	quirks api.StreamForwardingQuirks,
) error

func (*StreamD) AddStreamPlayer

func (d *StreamD) AddStreamPlayer(
	ctx context.Context,
	streamID streamtypes.StreamID,
	playerType player.Backend,
	disabled bool,
	streamPlaybackConfig sptypes.Config,
) error

func (*StreamD) AddTimer

func (d *StreamD) AddTimer(
	ctx context.Context,
	triggerAt time.Time,
	action api.Action,
) (api.TimerID, error)

func (*StreamD) AddTriggerRule

func (d *StreamD) AddTriggerRule(
	ctx context.Context,
	triggerRule *api.TriggerRule,
) (api.TriggerRuleID, error)

func (*StreamD) ApplyProfile

func (d *StreamD) ApplyProfile(
	ctx context.Context,
	platID streamcontrol.PlatformName,
	profile streamcontrol.AbstractStreamProfile,
	customArgs ...any,
) error

func (*StreamD) BanUser

func (d *StreamD) BanUser(
	ctx context.Context,
	platID streamcontrol.PlatformName,
	userID streamcontrol.ChatUserID,
	reason string,
	deadline time.Time,
) error

func (*StreamD) DialContext

func (d *StreamD) DialContext(
	ctx context.Context,
	network string,
	addr string,
) (net.Conn, error)

func (*StreamD) EXPERIMENTAL_ReinitStreamControllers

func (d *StreamD) EXPERIMENTAL_ReinitStreamControllers(ctx context.Context) (_err error)

func (*StreamD) EndStream

func (d *StreamD) EndStream(ctx context.Context, platID streamcontrol.PlatformName) error

func (*StreamD) GetBackendInfo

func (d *StreamD) GetBackendInfo(
	ctx context.Context,
	platID streamcontrol.PlatformName,
) (*api.BackendInfo, error)

func (*StreamD) GetConfig

func (d *StreamD) GetConfig(ctx context.Context) (*config.Config, error)

func (*StreamD) GetLoggingLevel

func (d *StreamD) GetLoggingLevel(ctx context.Context) (logger.Level, error)

func (*StreamD) GetOAuthListenPorts

func (d *StreamD) GetOAuthListenPorts() []uint16

func (*StreamD) GetStreamPlayer

func (d *StreamD) GetStreamPlayer(
	ctx context.Context,
	streamID streamtypes.StreamID,
) (*api.StreamPlayer, error)

func (*StreamD) GetStreamStatus

func (d *StreamD) GetStreamStatus(
	ctx context.Context,
	platID streamcontrol.PlatformName,
) (*streamcontrol.StreamStatus, error)

func (*StreamD) GetVariable

func (d *StreamD) GetVariable(
	ctx context.Context,
	key consts.VarKey,
) ([]byte, error)

func (*StreamD) GetVariableHash

func (d *StreamD) GetVariableHash(
	ctx context.Context,
	key consts.VarKey,
	hashType crypto.Hash,
) ([]byte, error)

func (*StreamD) InitCache

func (d *StreamD) InitCache(ctx context.Context) error

func (*StreamD) InitStreamServer

func (d *StreamD) InitStreamServer(ctx context.Context) (_err error)

func (*StreamD) IsBackendEnabled

func (d *StreamD) IsBackendEnabled(
	ctx context.Context,
	id streamcontrol.PlatformName,
) (bool, error)

func (*StreamD) ListIncomingStreams

func (d *StreamD) ListIncomingStreams(
	ctx context.Context,
) ([]api.IncomingStream, error)

func (*StreamD) ListStreamDestinations

func (d *StreamD) ListStreamDestinations(
	ctx context.Context,
) ([]api.StreamDestination, error)

func (*StreamD) ListStreamForwards

func (d *StreamD) ListStreamForwards(
	ctx context.Context,
) ([]api.StreamForward, error)

func (*StreamD) ListStreamPlayers

func (d *StreamD) ListStreamPlayers(
	ctx context.Context,
) ([]api.StreamPlayer, error)

func (*StreamD) ListStreamServers

func (d *StreamD) ListStreamServers(
	ctx context.Context,
) ([]api.StreamServer, error)

func (*StreamD) ListTimers

func (d *StreamD) ListTimers(
	ctx context.Context,
) ([]api.Timer, error)

func (*StreamD) ListTriggerRules

func (d *StreamD) ListTriggerRules(
	ctx context.Context,
) (api.TriggerRules, error)

func (*StreamD) OBS

func (*StreamD) OBSElementSetShow

func (d *StreamD) OBSElementSetShow(
	ctx context.Context,
	elID SceneElementIdentifier,
	shouldShow bool,
) error

func (*StreamD) OBSOLETE_IsGITInitialized

func (d *StreamD) OBSOLETE_IsGITInitialized(ctx context.Context) (bool, error)

func (*StreamD) P2P

func (d *StreamD) P2P() p2p.P2P

func (*StreamD) RemoveChatMessage

func (d *StreamD) RemoveChatMessage(
	ctx context.Context,
	platID streamcontrol.PlatformName,
	msgID streamcontrol.ChatMessageID,
) error

func (*StreamD) RemoveIncomingStream

func (d *StreamD) RemoveIncomingStream(
	ctx context.Context,
	streamID api.StreamID,
) error

func (*StreamD) RemoveOAuthListenPort

func (d *StreamD) RemoveOAuthListenPort(port uint16)

func (*StreamD) RemoveStreamDestination

func (d *StreamD) RemoveStreamDestination(
	ctx context.Context,
	destinationID api.DestinationID,
) error

func (*StreamD) RemoveStreamForward

func (d *StreamD) RemoveStreamForward(
	ctx context.Context,
	streamID api.StreamID,
	destinationID api.DestinationID,
) error

func (*StreamD) RemoveStreamPlayer

func (d *StreamD) RemoveStreamPlayer(
	ctx context.Context,
	streamID streamtypes.StreamID,
) error

func (*StreamD) RemoveTimer

func (d *StreamD) RemoveTimer(
	ctx context.Context,
	timerID api.TimerID,
) error

func (*StreamD) RemoveTriggerRule

func (d *StreamD) RemoveTriggerRule(
	ctx context.Context,
	ruleID api.TriggerRuleID,
) error

func (*StreamD) ResetCache

func (d *StreamD) ResetCache(ctx context.Context) error

func (*StreamD) Run

func (d *StreamD) Run(ctx context.Context) (_ret error)

func (*StreamD) SaveConfig

func (d *StreamD) SaveConfig(ctx context.Context) error

func (*StreamD) SendChatMessage

func (d *StreamD) SendChatMessage(
	ctx context.Context,
	platID streamcontrol.PlatformName,
	message string,
) (_err error)

func (*StreamD) SetConfig

func (d *StreamD) SetConfig(ctx context.Context, cfg *config.Config) error

func (*StreamD) SetDescription

func (d *StreamD) SetDescription(
	ctx context.Context,
	platID streamcontrol.PlatformName,
	description string,
) error

func (*StreamD) SetLoggingLevel

func (d *StreamD) SetLoggingLevel(ctx context.Context, level logger.Level) error

func (*StreamD) SetTitle

func (d *StreamD) SetTitle(
	ctx context.Context,
	platID streamcontrol.PlatformName,
	title string,
) error

func (*StreamD) SetVariable

func (d *StreamD) SetVariable(
	ctx context.Context,
	key consts.VarKey,
	value []byte,
) error

func (*StreamD) StartStream

func (d *StreamD) StartStream(
	ctx context.Context,
	platID streamcontrol.PlatformName,
	title string, description string,
	profile streamcontrol.AbstractStreamProfile,
	customArgs ...any,
) (_err error)

func (*StreamD) StartStreamServer

func (d *StreamD) StartStreamServer(
	ctx context.Context,
	serverType api.StreamServerType,
	listenAddr string,
	opts ...streamportserver.Option,
) error

func (*StreamD) StopStreamServer

func (d *StreamD) StopStreamServer(
	ctx context.Context,
	listenAddr string,
) error

func (*StreamD) StreamPlayerClose

func (d *StreamD) StreamPlayerClose(
	ctx context.Context,
	streamID streamtypes.StreamID,
) error

func (*StreamD) StreamPlayerEndChan

func (d *StreamD) StreamPlayerEndChan(
	ctx context.Context,
	streamID streamtypes.StreamID,
) (<-chan struct{}, error)

func (*StreamD) StreamPlayerGetLength

func (d *StreamD) StreamPlayerGetLength(
	ctx context.Context,
	streamID streamtypes.StreamID,
) (time.Duration, error)
func (d *StreamD) StreamPlayerGetLink(
	ctx context.Context,
	streamID streamtypes.StreamID,
) (string, error)

func (*StreamD) StreamPlayerGetPosition

func (d *StreamD) StreamPlayerGetPosition(
	ctx context.Context,
	streamID streamtypes.StreamID,
) (time.Duration, error)

func (*StreamD) StreamPlayerIsEnded

func (d *StreamD) StreamPlayerIsEnded(
	ctx context.Context,
	streamID streamtypes.StreamID,
) (bool, error)

func (*StreamD) StreamPlayerOpenURL

func (d *StreamD) StreamPlayerOpenURL(
	ctx context.Context,
	streamID streamtypes.StreamID,
	link string,
) error

func (*StreamD) StreamPlayerProcessTitle

func (d *StreamD) StreamPlayerProcessTitle(
	ctx context.Context,
	streamID streamtypes.StreamID,
) (string, error)

func (*StreamD) StreamPlayerSetPause

func (d *StreamD) StreamPlayerSetPause(
	ctx context.Context,
	streamID streamtypes.StreamID,
	pause bool,
) error

func (*StreamD) StreamPlayerSetSpeed

func (d *StreamD) StreamPlayerSetSpeed(
	ctx context.Context,
	streamID streamtypes.StreamID,
	speed float64,
) error

func (*StreamD) StreamPlayerStop

func (d *StreamD) StreamPlayerStop(
	ctx context.Context,
	streamID streamtypes.StreamID,
) error

func (*StreamD) SubmitEvent

func (d *StreamD) SubmitEvent(
	ctx context.Context,
	ev event.Event,
) error

func (*StreamD) SubscribeToChatMessages

func (d *StreamD) SubscribeToChatMessages(
	ctx context.Context,
) (<-chan api.ChatMessage, error)

func (*StreamD) SubscribeToConfigChanges

func (d *StreamD) SubscribeToConfigChanges(
	ctx context.Context,
) (<-chan api.DiffConfig, error)

func (*StreamD) SubscribeToDashboardChanges

func (d *StreamD) SubscribeToDashboardChanges(
	ctx context.Context,
) (<-chan api.DiffDashboard, error)

func (*StreamD) SubscribeToIncomingStreamsChanges

func (d *StreamD) SubscribeToIncomingStreamsChanges(
	ctx context.Context,
) (<-chan api.DiffIncomingStreams, error)

func (*StreamD) SubscribeToStreamDestinationsChanges

func (d *StreamD) SubscribeToStreamDestinationsChanges(
	ctx context.Context,
) (<-chan api.DiffStreamDestinations, error)

func (*StreamD) SubscribeToStreamForwardsChanges

func (d *StreamD) SubscribeToStreamForwardsChanges(
	ctx context.Context,
) (<-chan api.DiffStreamForwards, error)

func (*StreamD) SubscribeToStreamPlayersChanges

func (d *StreamD) SubscribeToStreamPlayersChanges(
	ctx context.Context,
) (<-chan api.DiffStreamPlayers, error)

func (*StreamD) SubscribeToStreamServersChanges

func (d *StreamD) SubscribeToStreamServersChanges(
	ctx context.Context,
) (<-chan api.DiffStreamServers, error)

func (*StreamD) SubscribeToStreamsChanges

func (d *StreamD) SubscribeToStreamsChanges(
	ctx context.Context,
) (<-chan api.DiffStreams, error)

func (*StreamD) UpdateStream

func (d *StreamD) UpdateStream(
	ctx context.Context,
	platID streamcontrol.PlatformName,
	title string, description string,
	profile streamcontrol.AbstractStreamProfile,
	customArgs ...any,
) error

func (*StreamD) UpdateStreamDestination

func (d *StreamD) UpdateStreamDestination(
	ctx context.Context,
	destinationID api.DestinationID,
	url string,
	streamKey string,
) error

func (*StreamD) UpdateStreamForward

func (d *StreamD) UpdateStreamForward(
	ctx context.Context,
	streamID api.StreamID,
	destinationID api.DestinationID,
	enabled bool,
	quirks api.StreamForwardingQuirks,
) error

func (*StreamD) UpdateStreamPlayer

func (d *StreamD) UpdateStreamPlayer(
	ctx context.Context,
	streamID streamtypes.StreamID,
	playerType player.Backend,
	disabled bool,
	streamPlaybackConfig sptypes.Config,
) (_err error)

func (*StreamD) UpdateTriggerRule

func (d *StreamD) UpdateTriggerRule(
	ctx context.Context,
	ruleID api.TriggerRuleID,
	triggerRule *api.TriggerRule,
) error

func (*StreamD) WaitForStreamPublisher

func (d *StreamD) WaitForStreamPublisher(
	ctx context.Context,
	streamID api.StreamID,
) (<-chan struct{}, error)

type Timer

type Timer struct {
	api.Timer
	xsync.Mutex
	StreamD      *StreamD
	RunningTimer *time.Timer
}

func NewTimer

func NewTimer(
	streamD *StreamD,
	timerID api.TimerID,
	triggerAt time.Time,
	action api.Action,
) *Timer

func (*Timer) Start

func (t *Timer) Start(ctx context.Context)

func (*Timer) Stop

func (t *Timer) Stop(ctx context.Context)

func (*Timer) Trigger

func (t *Timer) Trigger(ctx context.Context)

Jump to

Keyboard shortcuts

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