aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/lib/transcoding/create-transcoding-job.ts
blob: d78e68b8734e45cfff0de5bdd57359582f3d687e (plain) (tree)
1
2
3
4
5
6
7
8
9








                                                                                  
                                 






                                                                              
                                                                                      


















                                                                              
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
  videoFileAlreadyLocked: boolean
}) {
  return getJobBuilder().createOptimizeOrMergeAudioJobs(options)
}

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

export function createTranscodingJobs (options: {
  transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7
  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()
}