provider

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StatusQueued is the status for a job that is in the queue for
	// execution.
	StatusQueued = Status("queued")

	// StatusStarted is the status for a job that is being executed.
	StatusStarted = Status("started")

	// StatusFinished is the status for a job that finished successfully.
	StatusFinished = Status("finished")

	// StatusFailed is the status for a job that has failed.
	StatusFailed = Status("failed")

	// StatusCanceled is the status for a job that has been canceled.
	StatusCanceled = Status("canceled")

	// StatusUnknown is an unexpected status for a job.
	StatusUnknown = Status("unknown")
)

Variables

View Source
var (
	// ErrProviderAlreadyRegistered is the error returned when trying to register a
	// provider twice.
	ErrProviderAlreadyRegistered = errors.New("provider is already registered")

	// ErrProviderNotFound is the error returned when asking for a provider
	// that is not registered.
	ErrProviderNotFound = errors.New("provider not found")

	// ErrPresetMapNotFound is the error returned when the given preset is not
	// found in the provider.
	ErrPresetMapNotFound = errors.New("preset not found in provider")
)

Functions

func ListProviders

func ListProviders(c *config.Config) []string

ListProviders returns the list of currently registered providers, alphabetically ordered.

func Register

func Register(name string, provider Factory) error

Register register a new provider in the internal list of providers.

Types

type Capabilities

type Capabilities struct {
	InputFormats  []string `json:"input"`
	OutputFormats []string `json:"output"`
	Destinations  []string `json:"destinations"`
}

Capabilities describes the available features in the provider. It specificie which input and output formats the provider supports, along with supported destinations.

type Description

type Description struct {
	Name         string       `json:"name"`
	Capabilities Capabilities `json:"capabilities"`
	Health       Health       `json:"health"`
	Enabled      bool         `json:"enabled"`
}

Description fully describes a provider.

It contains the name of the provider, along with its current heath status and its capabilities.

func DescribeProvider

func DescribeProvider(name string, c *config.Config) (*Description, error)

DescribeProvider describes the given provider. It includes information about the provider's capabilities and its current health state.

type Factory

type Factory func(cfg *config.Config) (TranscodingProvider, error)

Factory is the function responsible for creating the instance of a provider.

func GetProviderFactory

func GetProviderFactory(name string) (Factory, error)

GetProviderFactory looks up the list of registered providers and returns the factory function for the given provider name, if it's available.

type Health

type Health struct {
	OK      bool   `json:"ok"`
	Message string `json:"message,omitempty"`
}

Health describes the current health status of the provider. If indicates whether the provider is healthy or not, and if it's not healthy, it includes a message explaining what's wrong.

type InvalidConfigError

type InvalidConfigError string

InvalidConfigError is returned if a provider could not be configured properly

func (InvalidConfigError) Error

func (err InvalidConfigError) Error() string

type JobNotFoundError

type JobNotFoundError struct {
	ID string
}

JobNotFoundError is returned if a job with a given id could not be found by the provider

func (JobNotFoundError) Error

func (err JobNotFoundError) Error() string

type JobOutput

type JobOutput struct {
	Destination string       `json:"destination,omitempty"`
	Files       []OutputFile `json:"files,omitempty"`
}

JobOutput represents information about a job output.

type JobStatus

type JobStatus struct {
	ProviderJobID  string                 `json:"providerJobId,omitempty"`
	Status         Status                 `json:"status,omitempty"`
	ProviderName   string                 `json:"providerName,omitempty"`
	StatusMessage  string                 `json:"statusMessage,omitempty"`
	Progress       float64                `json:"progress"`
	ProviderStatus map[string]interface{} `json:"providerStatus,omitempty"`
	Output         JobOutput              `json:"output"`
	SourceInfo     SourceInfo             `json:"sourceInfo,omitempty"`
}

JobStatus is the representation of the status as the provide sees it. The provider is able to add customized information in the ProviderStatus field.

swagger:model

type OutputFile

type OutputFile struct {
	Path       string `json:"path"`
	Container  string `json:"container"`
	VideoCodec string `json:"videoCodec"`
	Height     int64  `json:"height"`
	Width      int64  `json:"width"`
	FileSize   int64  `json:"fileSize"`
}

OutputFile represents an output file in a given job.

type SourceInfo

type SourceInfo struct {
	// Duration of the media
	Duration time.Duration `json:"duration,omitempty"`

	// Dimension of the media, in pixels
	Height int64 `json:"height,omitempty"`
	Width  int64 `json:"width,omitempty"`

	// Codec used for video medias
	VideoCodec string `json:"videoCodec,omitempty"`
}

SourceInfo contains information about media transcoded using the Transcoding API.

type Status

type Status string

Status is the status of a transcoding job.

type TranscodingProvider

type TranscodingProvider interface {
	Transcode(*db.Job) (*JobStatus, error)
	JobStatus(*db.Job) (*JobStatus, error)
	CancelJob(id string) error
	CreatePreset(db.Preset) (string, error)
	DeletePreset(presetID string) error
	GetPreset(presetID string) (interface{}, error)

	// Healthcheck should return nil if the provider is currently available
	// for transcoding videos, otherwise it should return an error
	// explaining what's going on.
	Healthcheck() error

	// Capabilities describes the capabilities of the provider.
	Capabilities() Capabilities
}

TranscodingProvider represents a provider of transcoding.

It defines a basic API for transcoding a media and query the status of a Job. The underlying provider should handle the profileSpec as desired (it might be a JSON, or an XML, or anything else.

Directories

Path Synopsis
Package elastictranscoder provides a implementation of the provider that uses AWS Elastic Transcoder for transcoding media files.
Package elastictranscoder provides a implementation of the provider that uses AWS Elastic Transcoder for transcoding media files.
Package elementalconductor provides a implementation of the provider that uses the Elemental Conductor API for transcoding media files.
Package elementalconductor provides a implementation of the provider that uses the Elemental Conductor API for transcoding media files.
Package encodingcom provides a implementation of the provider that uses the Encoding.com API for transcoding media files.
Package encodingcom provides a implementation of the provider that uses the Encoding.com API for transcoding media files.
Package zencoder provides a implementation of the provider that uses the Zencoder API for transcoding media files.
Package zencoder provides a implementation of the provider that uses the Zencoder API for transcoding media files.

Jump to

Keyboard shortcuts

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