omxplayer

package module
v0.0.0-...-ce812c8 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: MIT Imports: 6 Imported by: 0

README

go-omxplayer

A basic module for controlling OMXPlayer from Go

Table of Contents

Example

omx := NewOMXPlayer("file.mp4", false, false, nil)

waiting := make(chan string)
defer close(waiting)

// Returned errors are ignored for brevity.
_ := omx.Open(waiting)
_ := omx.Pause()
_ := omx.Play()
_ := omx.Quit()

// Wait for OMXPlayer process to end.
_ := <-waiting

References

This module was originally published as a package of pi-player.
This standalone version has been re-written, and some parts have been inspired by another great OMXPlayer library

License

The go-omxplayer module is available under the MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OMXPlayer

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

OMXPlayer is a go interface for raspbian's OMXPlayer.

func NewOMXPlayer

func NewOMXPlayer(filename string, testing bool, debug bool, cmd spyCmd) (*OMXPlayer, error)

NewOMXPlayer returns a pointer to a new OMXPlayer instance. cmd should always be nil, unless a mock is being sent in for a test.

func (*OMXPlayer) AudioStream

func (o *OMXPlayer) AudioStream(index int) int

AudioStream sets the audio stream and returns the current audio stream.

func (*OMXPlayer) Chapter

func (o *OMXPlayer) Chapter(chapter int) int

Chapter seeks the video position to a specific chapter and returns the current chapter.

func (*OMXPlayer) Close

func (o *OMXPlayer) Close() error

Close ends the OMXPlayer process.

func (*OMXPlayer) Open

func (o *OMXPlayer) Open(waiting chan string) error

Open starts the OMXPlayer process.

func (*OMXPlayer) Pause

func (o *OMXPlayer) Pause() error

Pause the video. If the video is playing, it will be paused, if it is paused it will stay in pause (no effect).

func (*OMXPlayer) Play

func (o *OMXPlayer) Play() error

Play the video. If the video is playing, it has no effect, if it is paused it will play from current position.

func (*OMXPlayer) PlaybackRate

func (o *OMXPlayer) PlaybackRate(rate float64) float64

PlaybackRate sets the playback rate of the video and returns the current playback rate.

func (*OMXPlayer) Position

func (o *OMXPlayer) Position(microseconds int64) int64

Position seeks the video to a certain position in the video, in microseconds, and returns the current positon of the video.

func (*OMXPlayer) Seek

func (o *OMXPlayer) Seek(microseconds int64, whence int) (int64, error)

Seek seeks the video forward or backward in microseconds and returns the current position of the video.

func (*OMXPlayer) Stop

func (o *OMXPlayer) Stop()

Stop stops playback and quits the application.

func (*OMXPlayer) SubtitleStream

func (o *OMXPlayer) SubtitleStream(index int) int

SubtitleStream sets the subtitle stream and returns the current subtitle stream.

func (*OMXPlayer) VideoStream

func (o *OMXPlayer) VideoStream(index int) int

VideoStream sets the video stream and returns the current video stream.

func (*OMXPlayer) Volume

func (o *OMXPlayer) Volume(volume float64) float64

Volume sets the volume and returns the current volume.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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