aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/job-queue/handlers/video-transcoding.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-23 09:32:53 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-05-04 16:21:39 +0200
commit8dc8a34ee8428e7657414115d1c137592efa174d (patch)
treee9b5ef0d7446d1b7766eac18da5a759edc7a9040 /server/lib/job-queue/handlers/video-transcoding.ts
parent7fed637506043e4432cbebe041ada0625171cceb (diff)
downloadPeerTube-8dc8a34ee8428e7657414115d1c137592efa174d.tar.gz
PeerTube-8dc8a34ee8428e7657414115d1c137592efa174d.tar.zst
PeerTube-8dc8a34ee8428e7657414115d1c137592efa174d.zip
Avoir some circular dependencies
Diffstat (limited to 'server/lib/job-queue/handlers/video-transcoding.ts')
-rw-r--r--server/lib/job-queue/handlers/video-transcoding.ts42
1 files changed, 7 insertions, 35 deletions
diff --git a/server/lib/job-queue/handlers/video-transcoding.ts b/server/lib/job-queue/handlers/video-transcoding.ts
index c020057c9..46add57d4 100644
--- a/server/lib/job-queue/handlers/video-transcoding.ts
+++ b/server/lib/job-queue/handlers/video-transcoding.ts
@@ -1,9 +1,14 @@
1import * as Bull from 'bull' 1import * as Bull from 'bull'
2import { VideoResolution } from '../../../../shared' 2import {
3 MergeAudioTranscodingPayload,
4 NewResolutionTranscodingPayload,
5 OptimizeTranscodingPayload,
6 VideoTranscodingPayload
7} from '../../../../shared'
3import { logger } from '../../../helpers/logger' 8import { logger } from '../../../helpers/logger'
4import { VideoModel } from '../../../models/video/video' 9import { VideoModel } from '../../../models/video/video'
5import { JobQueue } from '../job-queue' 10import { JobQueue } from '../job-queue'
6import { federateVideoIfNeeded } from '../../activitypub' 11import { federateVideoIfNeeded } from '../../activitypub/videos'
7import { retryTransactionWrapper } from '../../../helpers/database-utils' 12import { retryTransactionWrapper } from '../../../helpers/database-utils'
8import { sequelizeTypescript } from '../../../initializers' 13import { sequelizeTypescript } from '../../../initializers'
9import { computeResolutionsToTranscode } from '../../../helpers/ffmpeg-utils' 14import { computeResolutionsToTranscode } from '../../../helpers/ffmpeg-utils'
@@ -12,39 +17,6 @@ import { Notifier } from '../../notifier'
12import { CONFIG } from '../../../initializers/config' 17import { CONFIG } from '../../../initializers/config'
13import { MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/typings/models' 18import { MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/typings/models'
14 19
15interface BaseTranscodingPayload {
16 videoUUID: string
17 isNewVideo?: boolean
18}
19
20interface HLSTranscodingPayload extends BaseTranscodingPayload {
21 type: 'hls'
22 isPortraitMode?: boolean
23 resolution: VideoResolution
24 copyCodecs: boolean
25}
26
27interface NewResolutionTranscodingPayload extends BaseTranscodingPayload {
28 type: 'new-resolution'
29 isPortraitMode?: boolean
30 resolution: VideoResolution
31}
32
33interface MergeAudioTranscodingPayload extends BaseTranscodingPayload {
34 type: 'merge-audio'
35 resolution: VideoResolution
36}
37
38interface OptimizeTranscodingPayload extends BaseTranscodingPayload {
39 type: 'optimize'
40}
41
42export type VideoTranscodingPayload =
43 HLSTranscodingPayload
44 | NewResolutionTranscodingPayload
45 | OptimizeTranscodingPayload
46 | MergeAudioTranscodingPayload
47
48async function processVideoTranscoding (job: Bull.Job) { 20async function processVideoTranscoding (job: Bull.Job) {
49 const payload = job.data as VideoTranscodingPayload 21 const payload = job.data as VideoTranscodingPayload
50 logger.info('Processing video file in job %d.', job.id) 22 logger.info('Processing video file in job %d.', job.id)