util

package
v0.0.0-...-d98fde6 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Argument parsing and utility functions

Index

Constants

This section is empty.

Variables

View Source
var (
	MissingProgramError = errors.New("program name is invalid")
	InvalidPath         = errors.New("bad path supplied")
)
View Source
var ErrNoArgs = errors.New("At least 1 arg must be provided")
View Source
var ErrScaleOutOfRange = errors.New("ScaleType not recognized")
View Source
var ErrTwoArgs = errors.New("2 args must be provided")
View Source
var HelpMessage = `` /* 2782-byte string literal not displayed */
View Source
var ShortHelp = `See 'seneca -h' for help`

Functions

func DecodeSpeed

func DecodeSpeed(arg string) (string, error)

Converts speed specification to ffmpeg option

 speedup: -vf "setpts=(1/X)*PTS"
slowdown: -vf "setpts=(X/1)*PTS"

func IsEmpty

func IsEmpty(arg string) bool

func IsExistProgram

func IsExistProgram(execName string) (bool, error)

func ParseStartTime

func ParseStartTime(ss string, total time.Duration) (time.Duration, error)

total - total time of the video ss - string representation of an instant to start the capture

func SanitizeFile

func SanitizeFile(path string) (string, error)

func ToPort

func ToPort(port int) string

func ValidatePort

func ValidatePort(port int) error

Types

type Arguments

type Arguments struct {
	Help    bool
	Version bool
	DryRun  bool
	Verbose bool
	VideoIn string
	Port    int

	NeedScaling bool
	ScaleFilter string
	Fps         int
	SpeedSpec   string

	From   TimeCode
	Length time.Duration
}

func NewArguments

func NewArguments() *Arguments

func (*Arguments) Parse

func (a *Arguments) Parse(arguments []string) error

func (*Arguments) Validate

func (a *Arguments) Validate() error

type Instant

type Instant []time.Duration

@deprecated

func (*Instant) Set

func (i *Instant) Set(value string) error

@deprecated

func (*Instant) String

func (i *Instant) String() string

@deprecated

type ScaleType

type ScaleType uint16
const (
	// -scale width:_
	//   height scaled to keep aspect ratio
	WidthOnly ScaleType = 1 << iota

	// -scale _:height
	//   Width scaled to keep aspect ratio
	HeightOnly

	// -scale width:height
	WidthHeight
)

func (ScaleType) Decode

func (s ScaleType) Decode(args ...uint16) (string, error)

A priori - arguments have been checked to not exceed the

respective dimensions of the input video

type TimeCode

type TimeCode time.Time

func ParseFrom

func ParseFrom(arg string) (*TimeCode, error)

func (TimeCode) String

func (tc TimeCode) String() string

Jump to

Keyboard shortcuts

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