mpv

package
v0.0.0-...-4ed47f1 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrSuccess             = 0
	ErrEventQueueFull      = -1
	ErrNomem               = -2
	ErrUninitialized       = -3
	ErrInvalidParameter    = -4
	ErrOptionNotFound      = -5
	ErrOptionFormat        = -6
	ErrOptionError         = -7
	ErrPropertyNotFound    = -8
	ErrPropertyFormat      = -9
	ErrPropertyUnavailable = -10
	ErrPropertyError       = -11
	ErrCommand             = -12
	ErrLoadingFailed       = -13
	ErrAoInitFailed        = -14
	ErrVoInitFailed        = -15
	ErrNothingToPlay       = -16
	ErrUnknownFormat       = -17
	ErrUnsupported         = -18
	ErrNotImplemented      = -19
	ErrGeneric             = -20
)

Variables

This section is empty.

Functions

func ClientApiVersion

func ClientApiVersion() uint64

ClientApiVersion returns version of compiled mpv

func EventName

func EventName(event EventID) string

Types

type EClientMessage

type EClientMessage []string

type ECommandReply

type ECommandReply *Node

type EEndFile

type EEndFile struct {
	PlaylistEntryID       int64
	PlaylistInsertID      int64
	PlaylistInsertEntries int
	Error                 Error
	Reason                EndFileReason
}

type EHook

type EHook struct {
	Name string
	ID   uint64
}

type ELogMessage

type ELogMessage struct {
	Prefix, Text string
	Level        LogLevel
}

type EProperty

type EProperty struct {
	Name     string
	Format   Format
	Property interface{}
}

type EStartFile

type EStartFile int64

type EndFileReason

type EndFileReason int
const (
	EndFileReasonEof      EndFileReason = 0
	EndFileReasonStop     EndFileReason = 2
	EndFileReasonQuit     EndFileReason = 3
	EndFileReasonError    EndFileReason = 4
	EndFileReasonRedirect EndFileReason = 5
)

type Error

type Error int

Error this is not used anywhere, but maybe someone finds use case for it

Every error code is wrapped with go standard error package

func (Error) Err

func (e Error) Err() error

type Event

type Event struct {
	ID      uint64
	Error   Error
	Data    interface{}
	EventID EventID
}

type EventID

type EventID int
const (
	EventNone             EventID = 0
	EventShutdown         EventID = 1
	EventLogMessage       EventID = 2
	EventGetPropertyReply EventID = 3
	EventSetPropertyReply EventID = 4
	EventCommandReply     EventID = 5
	EventStartFile        EventID = 6
	EventEndFile          EventID = 7
	EventFileLoaded       EventID = 8
	EventIdle             EventID = 11 // Deprecated: use ObserveProperty("idle-activity") instead
	EventPause            EventID = 12 // Deprecated: use ObserveProperty("pause") instead
	EventUnpause          EventID = 13 // Deprecated: use ObserveProperty("unpause") instead
	EventTick             EventID = 14 // Deprecated: use for example ObserveProperty("playback-time") instead
	EventClientMessage    EventID = 16
	EventVideoReconfig    EventID = 17
	EventAudioReconfig    EventID = 18
	EventSeek             EventID = 20
	EventPlaybackRestart  EventID = 21
	EventPropertyChange   EventID = 22
	EventQueueOverflow    EventID = 24
	EventHook             EventID = 25
)

type Format

type Format int

Format represents supported formats by mpv API used for retrieving and setting options and properties.

const (
	FormatNone      Format = 0 // FormatNone is used to represent invalid or in some cases empty values.
	FormatString    Format = 1 // FormatString is used for string values
	FormatOsdString Format = 2 // FormatOsdString is used for OSD string values
	FormatFlag      Format = 3 // FormatFlag is used for boolean values
	FormatBoolean   Format = 3 // FormatBoolean is alias for FormatFlag
	FormatInt64     Format = 4 // FormatInt64 is used for integer values
	FormatDouble    Format = 5 // FormatDouble is used for floating point values
	FormatFloat64   Format = 5 // FormatFloat64 is alias for FormatDouble
	FormatNode      Format = 6 // FormatNode is used for Node values
	FormatNodeArray Format = 7 // FormatNodeArray is used for NodeList values
	FormatNodeMap   Format = 8 // FormatNodeMap is used for NodeMap values
	FormatByteArray Format = 9 // FormatByteArray is used for byte array values
)

type LogLevel

type LogLevel int
const (
	LogLevelNone  LogLevel = 0  // "no"    - disable absolutely all messages
	LogLevelFatal LogLevel = 10 // "fatal" - critical/aborting errors
	LogLevelError LogLevel = 20 // "error" - simple errors
	LogLevelWarn  LogLevel = 30 // "warn"  - possible problems
	LogLevelInfo  LogLevel = 40 // "info"  - informational message
	LogLevelV     LogLevel = 50 // "v"     - noisy informational message
	LogLevelDebug LogLevel = 60 // "debug" - very noisy technical information
	LogLevelTrace LogLevel = 70 // "trace" - extremely noisy
)

func (LogLevel) String

func (l LogLevel) String() string

type Mpv

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

func Create

func Create() (*Mpv, error)

Create creates new mpv instance and client API handle to control the mpv instance.

func (*Mpv) AbortAsyncCommand

func (m *Mpv) AbortAsyncCommand(id uint64)

func (*Mpv) ClientID

func (m *Mpv) ClientID() int64

ClientID returns the ID of current client handle

func (*Mpv) ClientName

func (m *Mpv) ClientName() string

ClientName returns the name of current client handle

func (*Mpv) Command

func (m *Mpv) Command(args []string) error

func (*Mpv) CommandAsync

func (m *Mpv) CommandAsync(args []string, id uint64) error

func (*Mpv) CommandAsyncNode

func (m *Mpv) CommandAsyncNode(args *Node, id uint64) error

func (*Mpv) CommandNode

func (m *Mpv) CommandNode(args *Node) (*Node, error)

func (*Mpv) CommandReturn

func (m *Mpv) CommandReturn(args []string) (*Node, error)

func (*Mpv) CommandString

func (m *Mpv) CommandString(command string) error

func (*Mpv) CreateClient

func (m *Mpv) CreateClient(name string) (*Mpv, error)

CreateClient creates a new client handle connected to the same player core as current client.

func (*Mpv) CreateWeakClient

func (m *Mpv) CreateWeakClient(name string) (*Mpv, error)

CreateWeakClient creates weak handle reference.

If all handles are weak references, core is automatically destroyed.

func (*Mpv) Destroy

func (m *Mpv) Destroy()

Destroy disconnects and destroys mpv handle

func (Mpv) EventWait

func (m Mpv) EventWait(timeout float64) *Event

func (*Mpv) GetProperty

func (m *Mpv) GetProperty(name string, format Format) (interface{}, error)

func (*Mpv) GetPropertyAsync

func (m *Mpv) GetPropertyAsync(name string, id uint64, format Format) error

func (*Mpv) GetPropertyOsdString

func (m *Mpv) GetPropertyOsdString(name string) (string, error)

func (*Mpv) GetPropertyString

func (m *Mpv) GetPropertyString(name string) (string, error)

func (Mpv) HookAdd

func (m Mpv) HookAdd(name string, priority int, id uint64) error

func (Mpv) HookContinue

func (m Mpv) HookContinue(id uint64) error

func (*Mpv) Initialize

func (m *Mpv) Initialize() error

Initialize initializes uninitialized mpv instance

func (*Mpv) InternalTime

func (m *Mpv) InternalTime() int64

InternalTime returns internal time in microseconds. This has an arbitrary start offset, but will never wrap or go backwards.

func (*Mpv) LoadConfig

func (m *Mpv) LoadConfig(filename string) error

LoadConfig loads and parse provided file.

filename should be absolute path to file

func (*Mpv) ObserveProperty

func (m *Mpv) ObserveProperty(name string, id uint64, format Format) error

func (Mpv) RequestEvent

func (m Mpv) RequestEvent(event EventID, status bool) error

RequestEvent

status = true means enabled, otherwise disabled

func (Mpv) RequestLogMessages

func (m Mpv) RequestLogMessages(level LogLevel) error

func (*Mpv) SetOption

func (m *Mpv) SetOption(name string, option interface{}, format Format) error

func (*Mpv) SetOptionString

func (m *Mpv) SetOptionString(name, option string) error

func (*Mpv) SetProperty

func (m *Mpv) SetProperty(name string, property interface{}, format Format) error

func (*Mpv) SetPropertyAsync

func (m *Mpv) SetPropertyAsync(name string, property interface{}, id uint64, format Format) error

func (*Mpv) SetPropertyString

func (m *Mpv) SetPropertyString(name, property string) error

func (Mpv) SetWakeupCallback

func (m Mpv) SetWakeupCallback()

func (*Mpv) Terminate

func (m *Mpv) Terminate()

Terminate terminates the player and all clients, and waits until all of them are destroyed

func (*Mpv) UnObserveProperty

func (m *Mpv) UnObserveProperty(id uint64) (int, error)

func (Mpv) WaitAsyncRequests

func (m Mpv) WaitAsyncRequests()

func (Mpv) Wakeup

func (m Mpv) Wakeup()

type Node

type Node struct {
	Data   interface{}
	Format Format
}

func (*Node) CNode

func (n *Node) CNode() *C.mpv_node

type NodeList

type NodeList []Node

type NodeMap

type NodeMap map[string]Node

Jump to

Keyboard shortcuts

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