aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/runners/job-handlers/runner-job-handlers.ts
blob: 7bad1bc777fdff1ee31deab90fd8668a85277b30 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { MRunnerJob } from '@server/types/models/runners'
import { RunnerJobSuccessPayload, RunnerJobType, RunnerJobUpdatePayload } from '@shared/models'
import { AbstractJobHandler } from './abstract-job-handler'
import { LiveRTMPHLSTranscodingJobHandler } from './live-rtmp-hls-transcoding-job-handler'
import { VODAudioMergeTranscodingJobHandler } from './vod-audio-merge-transcoding-job-handler'
import { VODHLSTranscodingJobHandler } from './vod-hls-transcoding-job-handler'
import { VODWebVideoTranscodingJobHandler } from './vod-web-video-transcoding-job-handler'

const processors: Record<RunnerJobType, new() => AbstractJobHandler<unknown, RunnerJobUpdatePayload, RunnerJobSuccessPayload>> = {
  'vod-web-video-transcoding': VODWebVideoTranscodingJobHandler,
  'vod-hls-transcoding': VODHLSTranscodingJobHandler,
  'vod-audio-merge-transcoding': VODAudioMergeTranscodingJobHandler,
  'live-rtmp-hls-transcoding': LiveRTMPHLSTranscodingJobHandler
}

export function getRunnerJobHandlerClass (job: MRunnerJob) {
  return processors[job.type]
}