]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - server/lib/transcoding/create-transcoding-job.ts
Add runner jobs openapi
[github/Chocobozzz/PeerTube.git] / server / lib / transcoding / create-transcoding-job.ts
1 import { CONFIG } from '@server/initializers/config'
2 import { MUserId, MVideoFile, MVideoFullLight } from '@server/types/models'
3 import { TranscodingJobQueueBuilder, TranscodingRunnerJobBuilder } from './shared'
4
5 export 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
16 export 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
30 function getJobBuilder () {
31 if (CONFIG.TRANSCODING.REMOTE_RUNNERS.ENABLED === true) {
32 return new TranscodingRunnerJobBuilder()
33 }
34
35 return new TranscodingJobQueueBuilder()
36 }