player

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: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackendUndefined = types.BackendUndefined
	BackendLibVLC    = types.BackendLibVLC
	BackendMPV       = types.BackendMPV
	BackendBuiltin   = types.BackendBuiltin
)
View Source
const SupportedBuiltin = true
View Source
const SupportedLibVLC = false
View Source
const SupportedMPV = true

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend = types.Backend

func SupportedBackends

func SupportedBackends() []Backend

type Builtin

type Builtin = builtin.Player

func NewBuiltin

func NewBuiltin(
	ctx context.Context,
	title string,
) (*Builtin, error)

type LibVLC

type LibVLC struct{}

func NewLibVLC

func NewLibVLC(ctx context.Context, title string) (*LibVLC, error)

func (*LibVLC) Close

func (*LibVLC) Close(ctx context.Context) error

func (*LibVLC) EndChan

func (*LibVLC) EndChan(
	ctx context.Context,
) (<-chan struct{}, error)

func (*LibVLC) GetLength

func (p *LibVLC) GetLength(
	ctx context.Context,
) (time.Duration, error)
func (p *LibVLC) GetLink(
	ctx context.Context,
) (string, error)

func (*LibVLC) GetPause

func (*LibVLC) GetPause(
	ctx context.Context,
) (bool, error)

func (*LibVLC) GetPosition

func (p *LibVLC) GetPosition(
	ctx context.Context,
) (time.Duration, error)

func (*LibVLC) GetSpeed

func (*LibVLC) GetSpeed(
	ctx context.Context,
) (float64, error)

func (*LibVLC) IsEnded

func (*LibVLC) IsEnded(
	ctx context.Context,
) (bool, error)

func (*LibVLC) OpenURL

func (*LibVLC) OpenURL(
	ctx context.Context,
	link string,
) error

func (*LibVLC) ProcessTitle

func (p *LibVLC) ProcessTitle(
	ctx context.Context,
) (string, error)

func (*LibVLC) SetPause

func (*LibVLC) SetPause(
	ctx context.Context,
	pause bool,
) error

func (*LibVLC) SetSpeed

func (*LibVLC) SetSpeed(
	ctx context.Context,
	speed float64,
) error

func (*LibVLC) SetupForStreaming

func (*LibVLC) SetupForStreaming(
	ctx context.Context,
) error

func (*LibVLC) Stop

func (*LibVLC) Stop(
	ctx context.Context,
) error

type MPV

type MPV struct {
	PlayerCommon
	PathToMPV  string
	SocketPath string
	Cmd        *exec.Cmd
	IPCClient  *mpv.IPCClient
	MPVClient  *mpv.Client
	MPVConn    *mpvipc.Connection
	CancelFunc context.CancelFunc

	EndChInitialized bool
	EndChMutex       xsync.Mutex
	EndCh            chan struct{}

	OpenLinkOnRerun string
	// contains filtered or unexported fields
}

func NewMPV

func NewMPV(
	ctx context.Context,
	title string,
	pathToMPV string,
) (_ret *MPV, _err error)

func (*MPV) Close

func (p *MPV) Close(ctx context.Context) (_err error)

func (*MPV) EndChan

func (p *MPV) EndChan(
	ctx context.Context,
) (<-chan struct{}, error)

func (*MPV) GetDisplayScale

func (p *MPV) GetDisplayScale(ctx context.Context) (float64, error)

func (*MPV) GetLength

func (p *MPV) GetLength(
	ctx context.Context,
) (time.Duration, error)
func (p *MPV) GetLink(
	ctx context.Context,
) (string, error)

func (*MPV) GetPause

func (p *MPV) GetPause(
	ctx context.Context,
) (bool, error)

func (*MPV) GetPosition

func (p *MPV) GetPosition(
	ctx context.Context,
) (time.Duration, error)

func (*MPV) GetSpeed

func (p *MPV) GetSpeed(
	ctx context.Context,
) (float64, error)

func (*MPV) IsEnded

func (p *MPV) IsEnded(
	ctx context.Context,
) (bool, error)

func (*MPV) OpenURL

func (p *MPV) OpenURL(
	ctx context.Context,
	link string,
) error

func (*MPV) Quit

func (p *MPV) Quit(ctx context.Context, exitCode uint8) error

func (*MPV) SetDisplayScale

func (p *MPV) SetDisplayScale(ctx context.Context, scale float64) error

func (*MPV) SetPause

func (p *MPV) SetPause(
	ctx context.Context,
	pause bool,
) error

func (*MPV) SetSpeed

func (p *MPV) SetSpeed(
	ctx context.Context,
	speed float64,
) error

func (*MPV) SetupForStreaming

func (p *MPV) SetupForStreaming(
	ctx context.Context,
) (_err error)

func (*MPV) Stop

func (p *MPV) Stop(
	ctx context.Context,
) error

type Manager

type Manager struct {
	Config types.Config

	PlayersLocker xsync.Mutex
	Players       []Player
}

func NewManager

func NewManager(opts ...types.Option) *Manager

func (*Manager) NewBuiltin

func (m *Manager) NewBuiltin(
	ctx context.Context,
	title string,
) (*Builtin, error)

func (*Manager) NewLibVLC

func (*Manager) NewLibVLC(ctx context.Context, title string) (*LibVLC, error)

func (*Manager) NewMPV

func (m *Manager) NewMPV(
	ctx context.Context,
	title string,
) (*MPV, error)

func (*Manager) NewPlayer

func (m *Manager) NewPlayer(
	ctx context.Context,
	title string,
	backend Backend,
) (Player, error)

func (*Manager) SupportedBackends

func (m *Manager) SupportedBackends() []Backend

type Player

type Player = types.Player

type PlayerCommon

type PlayerCommon = types.PlayerCommon

Directories

Path Synopsis
cmd
protobuf

Jump to

Keyboard shortcuts

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