Documentation ¶
Overview ¶
Encoding plan configuration related abstractions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EncoderCmd ¶
type EncoderCmd struct { // Name of encoding Name string // SourceFile is uncompressed video source aka mezzanine file SourceFile string // CompressedFile is a result of compressing InputFile CompressedFile string // OutputFile contains text output generated from encoder (log output) OutputFile string // LogFile is additional log file that encoder may generate LogFile string // WorkDir contains current working directory (a.k.a CWD, PWD) WorkDir string // Cmd is a actual "executable" encoder commandline with parameters Cmd string }
EncoderCmd defines an encoder command struct.
func (*EncoderCmd) Run ¶
func (s *EncoderCmd) Run() RunResult
Run will run all encoding commands defined for this Plan.
Error is nil if all encoding commands succeed without errors.
TODO: After refactoring lost the ability to control output io.Writer. Maybe need to add option to pass in own io.Writer (for testing purposes?)
type Plan ¶
type Plan struct { // Embed PlanConfig struct PlanConfig // Executable encoder commands Commands []EncoderCmd // Output directory OutDir string // contains filtered or unexported fields }
func NewPlan ¶
func NewPlan(pc PlanConfig, outDir string) Plan
NewPlan will create Plan instance from given PlanConfig.
func (*Plan) Run ¶
func (s *Plan) Run() (PlanResult, error)
Run executes encoding commands part of this Plan.
type PlanConfig ¶
type PlanConfig struct { // List of source (mezzanine) video files. Inputs []string Schemes []Scheme }
PlanConfig holds configuration for new Plan creation.
func NewPlanConfigFromJSON ¶
func NewPlanConfigFromJSON(jdoc []byte) (PlanConfig, error)
NewPlanConfigFromJSON will unmarshal JSON into PlanConfig instance.
func (*PlanConfig) IsValid ¶
func (p *PlanConfig) IsValid() (bool, error)
type PlanConfigError ¶
type PlanConfigError struct {
// contains filtered or unexported fields
}
PlanConfigError error type defines PlanConfig validation failures.
func (*PlanConfigError) Error ¶
func (e *PlanConfigError) Error() string
func (*PlanConfigError) Reasons ¶
func (e *PlanConfigError) Reasons() []string
type PlanResult ¶
PlanResult holds Plan execution result state.
type RunResult ¶
type RunResult struct { EncoderCmd Errors []error Stats UsageStat VideoDuration float64 AvgEncodingSpeed float64 // contains filtered or unexported fields }
RunResult contains a status of a single encoding run.
type Scheme ¶
Scheme is an encoder string with input and output placeholders.
For now it is just an encoding command line string with placeholders for input and output file. Like ffmpeg command with flags.
A Name field will be used when generating output file, so use it sensibly - think of it as as part of some nomenclature scheme.
func (*Scheme) Expand ¶
func (s *Scheme) Expand(sourceFiles []string, outDir string) (cmds []EncoderCmd)
Expand will generate complete encoding commands based on provided "context".
"Context" being input/source files and output directory.
TODO: Not sure about the name Expand(). Also, function body looks busy.
func (*Scheme) MarshalJSON ¶ added in v0.3.7
MarshalJSON implement Marshaler interface for Scheme type.
func (*Scheme) UnmarshalJSON ¶
UnmarshalJSON implement Unmarshaler interface for Scheme type.
type UsageStat ¶
type UsageStat struct { // Human friendly representations of time duration HStime string HUtime string HElapsed string // time.Duration is nanoseconds Stime time.Duration Utime time.Duration Elapsed time.Duration // MaxRss is KB MaxRss int64 }
UsageStat contains process resource usage stats.
func NewUsageStat ¶
NewUsageStat will create UsageStat instance.
func (*UsageStat) CPUPercent ¶
CPUPercent calculates CPU usage in percent.