mpv

package
v0.12.8 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package mpv provides a github.com/frizinak/libym/player.Backend implementation for both libmpv and mpv through rpc.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Init(chan<- Event) error
	Close() error

	GetPropertyDouble(string) (float64, error)
	SetPropertyDouble(string, float64) error

	SetPropertyString(string, string) error

	GetPropertyBool(string) (bool, error)
	SetPropertyBool(string, bool) error

	Command(...string) error
}

Backend is a generic mpv interface. Applicable to both libmpv and mpv through rpc.

type Event

type Event struct {
	ID EventID
}

Event represents an mpv event.

type EventID

type EventID byte

EventID represents an mpv event type.

const (
	EventEndFile EventID = 1 + iota
	EventStartFile
	EventPropertyChange
)

type MPV

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

MPV is an abstraction of Backend to provide the same interface to multiple mpv implementations.

func New

func New(log *log.Logger, backend Backend) *MPV

New creates a new mpv wrapper that interfaces with any Backend implementations.

func (*MPV) Close

func (m *MPV) Close() error

func (*MPV) Duration

func (m *MPV) Duration() time.Duration

func (*MPV) IncreaseVolume

func (m *MPV) IncreaseVolume(n float64)

func (*MPV) Init

func (m *MPV) Init() error

Init initializes the backend and starts listening for events.

func (*MPV) Pause

func (m *MPV) Pause(pause bool)

func (*MPV) Paused

func (m *MPV) Paused() bool

func (*MPV) Play

func (m *MPV) Play(file string) (chan struct{}, error)

func (*MPV) Position

func (m *MPV) Position() time.Duration

func (*MPV) Seek

func (m *MPV) Seek(adjustment time.Duration, whence int)

func (*MPV) SeekTo

func (m *MPV) SeekTo(to float64)

func (*MPV) SetVolume

func (m *MPV) SetVolume(n float64)

func (*MPV) Stop

func (m *MPV) Stop()

func (*MPV) TogglePause

func (m *MPV) TogglePause()

func (*MPV) Volume

func (m *MPV) Volume() float64

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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