create-transcoding-job.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { CONFIG } from '@server/initializers/config.js'
  2. import { MUserId, MVideoFile, MVideoFullLight } from '@server/types/models/index.js'
  3. import { TranscodingJobQueueBuilder, TranscodingRunnerJobBuilder } from './shared/index.js'
  4. export function createOptimizeOrMergeAudioJobs (options: {
  5. video: MVideoFullLight
  6. videoFile: MVideoFile
  7. isNewVideo: boolean
  8. user: MUserId
  9. videoFileAlreadyLocked: boolean
  10. }) {
  11. return getJobBuilder().createOptimizeOrMergeAudioJobs(options)
  12. }
  13. // ---------------------------------------------------------------------------
  14. export function createTranscodingJobs (options: {
  15. transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7
  16. video: MVideoFullLight
  17. resolutions: number[]
  18. isNewVideo: boolean
  19. user: MUserId
  20. }) {
  21. return getJobBuilder().createTranscodingJobs(options)
  22. }
  23. // ---------------------------------------------------------------------------
  24. // Private
  25. // ---------------------------------------------------------------------------
  26. function getJobBuilder () {
  27. if (CONFIG.TRANSCODING.REMOTE_RUNNERS.ENABLED === true) {
  28. return new TranscodingRunnerJobBuilder()
  29. }
  30. return new TranscodingJobQueueBuilder()
  31. }