aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/transcoding/create-transcoding-job.ts
blob: 46831a912d0625613268740b17a8840902377208 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { CONFIG } from '@server/initializers/config'
import { MUserId, MVideoFile, MVideoFullLight } from '@server/types/models'
import { TranscodingJobQueueBuilder, TranscodingRunnerJobBuilder } from './shared'

export function createOptimizeOrMergeAudioJobs (options: {
  video: MVideoFullLight
  videoFile: MVideoFile
  isNewVideo: boolean
  user: MUserId
}) {
  return getJobBuilder().createOptimizeOrMergeAudioJobs(options)
}

// ---------------------------------------------------------------------------

export function createTranscodingJobs (options: {
  transcodingType: 'hls' | 'webtorrent'
  video: MVideoFullLight
  resolutions: number[]
  isNewVideo: boolean
  user: MUserId
}) {
  return getJobBuilder().createTranscodingJobs(options)
}

// ---------------------------------------------------------------------------
// Private
// ---------------------------------------------------------------------------

function getJobBuilder () {
  if (CONFIG.TRANSCODING.REMOTE_RUNNERS.ENABLED === true) {
    return new TranscodingRunnerJobBuilder()
  }

  return new TranscodingJobQueueBuilder()
}