]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/lib/transcoding/create-transcoding-job.ts
Implement remote runner jobs in server
[github/Chocobozzz/PeerTube.git] / server / lib / transcoding / create-transcoding-job.ts
CommitLineData
0c9668f7
C
1import { CONFIG } from '@server/initializers/config'
2import { MUserId, MVideoFile, MVideoFullLight } from '@server/types/models'
3import { TranscodingJobQueueBuilder, TranscodingRunnerJobBuilder } from './shared'
4
5export function createOptimizeOrMergeAudioJobs (options: {
6 video: MVideoFullLight
7 videoFile: MVideoFile
8 isNewVideo: boolean
9 user: MUserId
10}) {
11 return getJobBuilder().createOptimizeOrMergeAudioJobs(options)
12}
13
14// ---------------------------------------------------------------------------
15
16export function createTranscodingJobs (options: {
17 transcodingType: 'hls' | 'webtorrent'
18 video: MVideoFullLight
19 resolutions: number[]
20 isNewVideo: boolean
21 user: MUserId
22}) {
23 return getJobBuilder().createTranscodingJobs(options)
24}
25
26// ---------------------------------------------------------------------------
27// Private
28// ---------------------------------------------------------------------------
29
30function getJobBuilder () {
31 if (CONFIG.TRANSCODING.REMOTE_RUNNERS.ENABLED === true) {
32 return new TranscodingRunnerJobBuilder()
33 }
34
35 return new TranscodingJobQueueBuilder()
36}