Versions in this module Expand all Collapse all v4 v4.2.9 Oct 24, 2026 v4.2.8 Oct 24, 2026 Changes in this version + const MaxActiveJobsPerUser + const MaxPendingJobs + const MaxSegmentBytes + const ProtocolVersion + var ErrInvalidJobID = errors.New("invalid job id") + var ErrInvalidProfile = errors.New("invalid profile name") + var ErrInvalidSegment = errors.New("invalid segment seq") + var ErrJobNotFound = errors.New("transcode job not found") + var ErrQueueFull = errors.New("transcode queue is full, try again later") + var ErrSegmentTooLarge = errors.New("segment too large") + var ErrUserQuota = errors.New("too many active transcode jobs for this user") + func IsEnabled() bool + func ProtocolWhitelistFor(source string) string + func ValidProfileName(profile string) bool + func ValidSourceInput(source string) bool + func VerifyWorkerSecret(token string) bool + type Cache struct + func NewCache(rootDir string, maxGB int64) *Cache + func (c *Cache) BuildPlaylist(jobID, profile string, segDur int, completed bool, baseURL string, ...) string + func (c *Cache) Cleanup(jobID string) + func (c *Cache) EnforceLRU() error + func (c *Cache) GetSegment(jobID, profile string, seq int) (*SegmentInfo, error) + func (c *Cache) Init() error + func (c *Cache) MasterPlaylist(profiles []Profile, baseURL string) string + func (c *Cache) PutSegment(jobID, profile string, seq int, duration float64, body io.Reader, isFinal bool) (*SegmentInfo, error) + func (c *Cache) SegmentCount(jobID, profile string) int + func (c *Cache) WaitForSegment(jobID, profile string, seq int, timeout time.Duration) (*SegmentInfo, error) + type Chunk struct + Duration float64 + EndSeq int + Error string + Index int + LastAccess time.Time + StartSeq int + StartTime float64 + StartedAt time.Time + State ChunkState + type ChunkManager struct + func NewChunkManager(mgr *Manager) *ChunkManager + func (cm *ChunkManager) CancelAllForJob(jobID string) + func (cm *ChunkManager) CancelSession(jobID, profile string) + func (cm *ChunkManager) EnsureChunkRunningForSeg(jobID, profile string, seq int) int + func (cm *ChunkManager) StartSession(job *Job, profile Profile, outDir string) (*ChunkSession, error) + func (cm *ChunkManager) Stop() + type ChunkSession struct + ChunkDur int + IdleSec int + Job *Job + JobID string + MaxConcurrent int + OutDir string + Prefetch bool + ProfDef Profile + Profile string + SegDur int + TotalDuration float64 + func (s *ChunkSession) WaitDone() <-chan struct{} + type ChunkState int + const ChunkDone + const ChunkFailed + const ChunkIdle + const ChunkKilled + const ChunkRunning + type ClaimRequest struct + Slots int + Wait int + WorkerID string + type ClaimResponse struct + Jobs []*Job + type DecideRequest struct + FileName string + FileSize int64 + Probe SourceProbe + type DecideResult struct + NeedTranscode bool + Reason string + func Decide(r DecideRequest) DecideResult + type ErrorResponse struct + Code int + Message string + type FinishRequest struct + Error string + JobID string + Stats JobStats + Status JobStatus + type HWAccel string + const HWAMF + const HWAuto + const HWNVENC + const HWNone + const HWQSV + const HWVAAPI + const HWVideoToolbox + type HeartbeatRequest struct + FreeSlots int + Load float64 + Running []string + WorkerID string + type HeartbeatResponse struct + Cancel []string + Kick bool + OK bool + type Job struct + CallbackToken string + CreatedAt time.Time + Deadline int64 + Error string + FinishedAt time.Time + ID string + LastAccessAt time.Time + Output OutputSpec + OwnerID string + Path string + PlayToken string + Probe SourceProbe + Profiles []Profile + SourceURL string + StartedAt time.Time + Status JobStatus + WorkerID string + func NewJob() *Job + func (j *Job) GetLastAccess() time.Time + func (j *Job) GetStatus() JobStatus + func (j *Job) MarkReady() + func (j *Job) Touch() + func (j *Job) WaitReady() <-chan struct{} + type JobCache struct + BaseDir string + JobID string + Profile string + type JobStats struct + BytesOut int64 + Elapsed float64 + FPS float64 + Speed float64 + type JobStatus string + const JobCancelled + const JobFailed + const JobFinished + const JobPending + const JobReady + const JobRunning + type LocalRunner struct + func NewLocalRunner(mgr *Manager) *LocalRunner + func (r *LocalRunner) CancelJob(jobID string) bool + func (r *LocalRunner) RunningJobIDs() []string + func (r *LocalRunner) Start() error + func (r *LocalRunner) Stop() + type Manager struct + Cache *Cache + Chunks *ChunkManager + Registry *WorkerRegistry + Scheduler *Scheduler + func Default() *Manager + func (m *Manager) Start() + func (m *Manager) Stop() + type OutputFormat string + const FormatDASH + const FormatHLS + const FormatMP4 + type OutputSpec struct + Format OutputFormat + SegmentDuration int + func BuildOutputSpec() OutputSpec + type Profile struct + AudioBitrate string + AudioCodec string + HWAccel string + Name string + Scale string + VideoBitrate string + VideoCodec string + func BuildProfile() Profile + type RegisterRequest struct + Capacity int + CodecsDecode []string + CodecsEncode []string + Endpoint string + HWAccel []string + MaxResolution string + Name string + Tags []string + Version string + type RegisterResponse struct + ClaimStrategy string + HeartbeatInterval int + ProtocolVersion string + WorkerID string + type Scheduler struct + func NewScheduler(reg *WorkerRegistry) *Scheduler + func (s *Scheduler) Cancel(jobID string) + func (s *Scheduler) Capacity(ownerID string) error + func (s *Scheduler) Claim(workerID string, slots int, wait time.Duration) []*Job + func (s *Scheduler) FindReusable(ownerID string, path string) (*Job, bool) + func (s *Scheduler) Finish(req *FinishRequest) error + func (s *Scheduler) Get(id string) (*Job, bool) + func (s *Scheduler) ListActiveJobs() []*Job + func (s *Scheduler) ListJobs() []*Job + func (s *Scheduler) PopCancellations(workerID string) []string + func (s *Scheduler) PurgeBefore(t time.Time) []string + func (s *Scheduler) Reactivate(jobID string) (*Job, error) + func (s *Scheduler) SetOnCancel(fn func(jobID string)) + func (s *Scheduler) Submit(j *Job) *Job + func (s *Scheduler) SubmitLimited(j *Job) (*Job, bool, error) + type SegmentInfo struct + Duration float64 + Path string + Seq int + Size int64 + type SourceProbe struct + AudioBitrate int64 + AudioCodec string + Duration float64 + Height int + Size int64 + VideoBitrate int64 + VideoCodec string + Width int + func ProbeSource(url string) (SourceProbe, error) + type Worker struct + Capacity int + CodecsDecode []string + CodecsEncode []string + Endpoint string + FreeSlots int + HWAccel []string + ID string + LastSeen time.Time + Load float64 + Local bool + MaxResolution string + Name string + RegisteredAt time.Time + Running []string + Tags []string + Version string + type WorkerRegistry struct + func NewWorkerRegistry() *WorkerRegistry + func (r *WorkerRegistry) Get(id string) (*Worker, bool) + func (r *WorkerRegistry) HasAvailable() bool + func (r *WorkerRegistry) Heartbeat(req *HeartbeatRequest) (*Worker, bool) + func (r *WorkerRegistry) List() []*Worker + func (r *WorkerRegistry) Register(req *RegisterRequest, local bool) *Worker + func (r *WorkerRegistry) Sweep() []string + func (r *WorkerRegistry) Unregister(id string)