Documentation ¶
Index ¶
- Constants
- Variables
- func ListProviders(c *config.Config) []string
- func Register(name string, provider Factory) error
- type AWSCloudRegion
- type Capabilities
- type Cloud
- type Description
- type Factory
- type GCPCloudRegion
- type Health
- type InvalidConfigError
- type JobNotFoundError
- type JobOutput
- type JobStatus
- type OutputFile
- type SourceInfo
- type Status
- type TranscodingProvider
Constants ¶
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 ¶
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 ¶
ListProviders returns the list of currently registered providers, alphabetically ordered.
Types ¶
type AWSCloudRegion ¶
type AWSCloudRegion = string
const ( AWSRegionUSEast1 AWSCloudRegion = "us-east-1" AWSRegionUSEast2 AWSCloudRegion = "us-east-2" AWSRegionUSWest1 AWSCloudRegion = "us-west-1" AWSRegionUSWest2 AWSCloudRegion = "us-west-2" )
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 ¶
GetProviderFactory looks up the list of registered providers and returns the factory function for the given provider name, if it's available.
type GCPCloudRegion ¶
type GCPCloudRegion = string
const ( GCPRegionUSEast1 GCPCloudRegion = "us-east1" GCPRegionUSEast4 GCPCloudRegion = "us-east4" GCPRegionUSWest1 GCPCloudRegion = "us-west1" GCPRegionUSWest2 GCPCloudRegion = "us-west2" GCPRegionUSCentral1 GCPCloudRegion = "us-central1" )
type Health ¶
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"` Labels []string `json:"labels,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,omitempty"` Height int64 `json:"height,omitempty"` Width int64 `json:"width,omitempty"` FileSize int64 `json:"fileSize,omitempty"` }
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 TranscodingProvider ¶
type TranscodingProvider interface { Transcode(context.Context, *db.Job) (*JobStatus, error) JobStatus(context.Context, *db.Job) (*JobStatus, error) CancelJob(ctx context.Context, id string) error CreatePreset(context.Context, db.Preset) (string, error) DeletePreset(ctx context.Context, presetID string) error GetPreset(ctx context.Context, 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.