Documentation
¶
Index ¶
- Constants
- Variables
- func ListProviders(c *config.Config) []string
- func Register(name string, provider Factory) error
- type Capabilities
- type Description
- type Factory
- 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 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 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"`
}
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 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 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. |