mpv

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: GPL-3.0 Imports: 4 Imported by: 2

README

go-mpv

Go bindings for libmpv.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CNodeList

func CNodeList(nodelist []*Node) *C.mpv_node_list

CNodeList turns a list of Go Nodes into an mpv_node_list

func CNodeMap

func CNodeMap(nodemap map[string]*Node) *C.mpv_node_list

CNodeMap turns a map of strings to Go nodes into an mpv_node_list.

func NewError

func NewError(err int) error

NewError turns an integer MPV error code into an error type.

func NewNodeMap

func NewNodeMap(n *C.mpv_node_list) map[string]*Node

NewNodeMap turns an mpv_node_list into a map of strings to Go Nodes.

Types

type Error

type Error int

Error type.

const (
	ERROR_SUCCESS              Error = C.MPV_ERROR_SUCCESS
	ERROR_EVENT_QUEUE_FULL     Error = C.MPV_ERROR_EVENT_QUEUE_FULL
	ERROR_NOMEM                Error = C.MPV_ERROR_NOMEM
	ERROR_UNINITIALIZED        Error = C.MPV_ERROR_UNINITIALIZED
	ERROR_INVALID_PARAMETER    Error = C.MPV_ERROR_INVALID_PARAMETER
	ERROR_OPTION_NOT_FOUND     Error = C.MPV_ERROR_OPTION_NOT_FOUND
	ERROR_OPTION_FORMAT        Error = C.MPV_ERROR_OPTION_FORMAT
	ERROR_OPTION_ERROR         Error = C.MPV_ERROR_OPTION_ERROR
	ERROR_PROPERTY_NOT_FOUND   Error = C.MPV_ERROR_PROPERTY_NOT_FOUND
	ERROR_PROPERTY_FORMAT      Error = C.MPV_ERROR_PROPERTY_FORMAT
	ERROR_PROPERTY_UNAVAILABLE Error = C.MPV_ERROR_PROPERTY_UNAVAILABLE
	ERROR_PROPERTY_ERROR       Error = C.MPV_ERROR_PROPERTY_ERROR
	ERROR_COMMAND              Error = C.MPV_ERROR_COMMAND
	ERROR_LOADING_FAILED       Error = C.MPV_ERROR_LOADING_FAILED
	ERROR_AO_INIT_FAILED       Error = C.MPV_ERROR_AO_INIT_FAILED
	ERROR_VO_INIT_FAILED       Error = C.MPV_ERROR_VO_INIT_FAILED
	ERROR_NOTHING_TO_PLAY      Error = C.MPV_ERROR_NOTHING_TO_PLAY
	ERROR_UNKNOWN_FORMAT       Error = C.MPV_ERROR_UNKNOWN_FORMAT
	ERROR_UNSUPPORTED          Error = C.MPV_ERROR_UNSUPPORTED
	ERROR_NOT_IMPLEMENTED      Error = C.MPV_ERROR_NOT_IMPLEMENTED
)

Errors .

func (Error) Error

func (e Error) Error() string

Error method provides a string representation of the Error type.

type Event

type Event struct {
	Event_Id       EventId
	Error          error
	Reply_Userdata uint64
	Data           unsafe.Pointer
}

Event represents an mpv_event struct.

func (*Event) Message

func (e *Event) Message() string

Message .

type EventId

type EventId int

EventId type.

const (
	EVENT_NONE               EventId = C.MPV_EVENT_NONE
	EVENT_SHUTDOWN           EventId = C.MPV_EVENT_SHUTDOWN
	EVENT_LOG_MESSAGE        EventId = C.MPV_EVENT_LOG_MESSAGE
	EVENT_GET_PROPERTY_REPLY EventId = C.MPV_EVENT_GET_PROPERTY_REPLY
	EVENT_SET_PROPERTY_REPLY EventId = C.MPV_EVENT_SET_PROPERTY_REPLY
	EVENT_COMMAND_REPLY      EventId = C.MPV_EVENT_COMMAND_REPLY
	EVENT_START_FILE         EventId = C.MPV_EVENT_START_FILE
	EVENT_END_FILE           EventId = C.MPV_EVENT_END_FILE
	EVENT_FILE_LOADED        EventId = C.MPV_EVENT_FILE_LOADED
	EVENT_IDLE               EventId = C.MPV_EVENT_IDLE
	EVENT_TICK               EventId = C.MPV_EVENT_TICK
	EVENT_CLIENT_MESSAGE     EventId = C.MPV_EVENT_CLIENT_MESSAGE
	EVENT_VIDEO_RECONFIG     EventId = C.MPV_EVENT_VIDEO_RECONFIG
	EVENT_AUDIO_RECONFIG     EventId = C.MPV_EVENT_AUDIO_RECONFIG
	EVENT_SEEK               EventId = C.MPV_EVENT_SEEK
	EVENT_PLAYBACK_RESTART   EventId = C.MPV_EVENT_PLAYBACK_RESTART
	EVENT_PROPERTY_CHANGE    EventId = C.MPV_EVENT_PROPERTY_CHANGE
	EVENT_QUEUE_OVERFLOW     EventId = C.MPV_EVENT_QUEUE_OVERFLOW
)

Events .

func (EventId) String

func (e EventId) String() string

String .

type Format

type Format int

Format .

const (
	FORMAT_NONE       Format = C.MPV_FORMAT_NONE
	FORMAT_STRING     Format = C.MPV_FORMAT_STRING
	FORMAT_OSD_STRING Format = C.MPV_FORMAT_OSD_STRING
	FORMAT_FLAG       Format = C.MPV_FORMAT_FLAG
	FORMAT_INT64      Format = C.MPV_FORMAT_INT64
	FORMAT_DOUBLE     Format = C.MPV_FORMAT_DOUBLE
	FORMAT_NODE       Format = C.MPV_FORMAT_NODE
	FORMAT_NODE_ARRAY Format = C.MPV_FORMAT_NODE_ARRAY
	FORMAT_NODE_MAP   Format = C.MPV_FORMAT_NODE_MAP
	FORMAT_BYTE_ARRAY Format = C.MPV_FORMAT_BYTE_ARRAY
)

type Mpv

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

Mpv represents an mpv client.

func Create

func Create() *Mpv

Create creates a new MPV struct.

func (*Mpv) ClientName

func (m *Mpv) ClientName() string

ClientName .

func (*Mpv) Command

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

Command runs the specified command, returning an error if something goes wrong.

func (*Mpv) CommandAsync

func (m *Mpv) CommandAsync(replyUserdata uint64, command []string) error

CommandAsync .

func (*Mpv) CommandNode

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

CommandNode runs the given command node.

func (*Mpv) CommandNodeAsync

func (m *Mpv) CommandNodeAsync(replyUserdata uint64, args Node) error

CommandNodeAsync .

func (*Mpv) CommandString

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

CommandString runs the given command string, this string is parsed internally by mpv.

func (*Mpv) GetProperty

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

GetProperty returns the value of the property according to the given format.

func (*Mpv) GetPropertyAsync

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

GetPropertyAsync .

func (*Mpv) GetPropertyOsdString

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

GetPropertyOsdString returns the value of the property as a string formatted for mpv's on-screen display.

func (*Mpv) GetPropertyString

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

GetPropertyString returns the value of the property as a string. If the property is empty, an empty string is returned.

func (*Mpv) GetTimeUS

func (m *Mpv) GetTimeUS() int64

GetTimeUS .

func (*Mpv) GetWakeupPipe

func (m *Mpv) GetWakeupPipe() int

GetWakeupPipe .

func (*Mpv) Initialize

func (m *Mpv) Initialize() error

Initialize runs mpv_initialize and returns any errors that might occur.

func (*Mpv) LoadConfigFile

func (m *Mpv) LoadConfigFile(fn string) error

LoadConfigFile loads the given config file.

func (*Mpv) MPVHandle

func (m *Mpv) MPVHandle() unsafe.Pointer

MPVHandle returns the pointer to the mpv_handle struct for invoking native MPV APIs

func (*Mpv) ObserveProperty

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

ObserveProperty .

func (*Mpv) RequestEvent

func (m *Mpv) RequestEvent(event EventId, enable bool) error

RequestEvent .

func (*Mpv) RequestLogMessages

func (m *Mpv) RequestLogMessages(level string) error

RequestLogMessages .

func (*Mpv) SetOption

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

SetOption sets the given option according to the given format.

func (*Mpv) SetOptionString

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

SetOptionString sets the option to the given string.

func (*Mpv) SetProperty

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

SetProperty sets the client property according to the given format.

func (*Mpv) SetPropertyAsync

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

SetPropertyAsync .

func (*Mpv) SetPropertyString

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

SetPropertyString sets the property to the given string.

func (*Mpv) TerminateDestroy

func (m *Mpv) TerminateDestroy()

TerminateDestroy terminates mpv and destroys the client.

func (*Mpv) UnobserveProperty

func (m *Mpv) UnobserveProperty(replyUserdata uint64) error

UnobserveProperty .

func (*Mpv) WaitEvent

func (m *Mpv) WaitEvent(timeout float32) *Event

WaitEvent calls mpv_wait_event and returns the result as an Event struct.

func (*Mpv) Wakeup

func (m *Mpv) Wakeup()

Wakeup .

type Node

type Node struct {
	Data   interface{}
	Format Format
}

Node type.

func NewNode

func NewNode(n *C.mpv_node) *Node

NewNode takes a pointer to an mpv_node struct and returns a pointer to a native Go Node struct. The data is converted into Go data according to mpv_node.format.

func NewNodeList

func NewNodeList(n *C.mpv_node_list) []*Node

NewNodeList turns an mpv_node_list into a list of Go Nodes.

func (*Node) CNode

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

CNode turns a Go Node into an mpv_node struct.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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