diff options
author | Chocobozzz <me@florianbigard.com> | 2020-04-23 09:32:53 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-05-04 16:21:39 +0200 |
commit | 8dc8a34ee8428e7657414115d1c137592efa174d (patch) | |
tree | e9b5ef0d7446d1b7766eac18da5a759edc7a9040 /server/lib/job-queue/handlers/video-transcoding.ts | |
parent | 7fed637506043e4432cbebe041ada0625171cceb (diff) | |
download | PeerTube-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.ts | 42 |
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 @@ | |||
1 | import * as Bull from 'bull' | 1 | import * as Bull from 'bull' |
2 | import { VideoResolution } from '../../../../shared' | 2 | import { |
3 | MergeAudioTranscodingPayload, | ||
4 | NewResolutionTranscodingPayload, | ||
5 | OptimizeTranscodingPayload, | ||
6 | VideoTranscodingPayload | ||
7 | } from '../../../../shared' | ||
3 | import { logger } from '../../../helpers/logger' | 8 | import { logger } from '../../../helpers/logger' |
4 | import { VideoModel } from '../../../models/video/video' | 9 | import { VideoModel } from '../../../models/video/video' |
5 | import { JobQueue } from '../job-queue' | 10 | import { JobQueue } from '../job-queue' |
6 | import { federateVideoIfNeeded } from '../../activitypub' | 11 | import { federateVideoIfNeeded } from '../../activitypub/videos' |
7 | import { retryTransactionWrapper } from '../../../helpers/database-utils' | 12 | import { retryTransactionWrapper } from '../../../helpers/database-utils' |
8 | import { sequelizeTypescript } from '../../../initializers' | 13 | import { sequelizeTypescript } from '../../../initializers' |
9 | import { computeResolutionsToTranscode } from '../../../helpers/ffmpeg-utils' | 14 | import { computeResolutionsToTranscode } from '../../../helpers/ffmpeg-utils' |
@@ -12,39 +17,6 @@ import { Notifier } from '../../notifier' | |||
12 | import { CONFIG } from '../../../initializers/config' | 17 | import { CONFIG } from '../../../initializers/config' |
13 | import { MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/typings/models' | 18 | import { MVideoFullLight, MVideoUUID, MVideoWithFile } from '@server/typings/models' |
14 | 19 | ||
15 | interface BaseTranscodingPayload { | ||
16 | videoUUID: string | ||
17 | isNewVideo?: boolean | ||
18 | } | ||
19 | |||
20 | interface HLSTranscodingPayload extends BaseTranscodingPayload { | ||
21 | type: 'hls' | ||
22 | isPortraitMode?: boolean | ||
23 | resolution: VideoResolution | ||
24 | copyCodecs: boolean | ||
25 | } | ||
26 | |||
27 | interface NewResolutionTranscodingPayload extends BaseTranscodingPayload { | ||
28 | type: 'new-resolution' | ||
29 | isPortraitMode?: boolean | ||
30 | resolution: VideoResolution | ||
31 | } | ||
32 | |||
33 | interface MergeAudioTranscodingPayload extends BaseTranscodingPayload { | ||
34 | type: 'merge-audio' | ||
35 | resolution: VideoResolution | ||
36 | } | ||
37 | |||
38 | interface OptimizeTranscodingPayload extends BaseTranscodingPayload { | ||
39 | type: 'optimize' | ||
40 | } | ||
41 | |||
42 | export type VideoTranscodingPayload = | ||
43 | HLSTranscodingPayload | ||
44 | | NewResolutionTranscodingPayload | ||
45 | | OptimizeTranscodingPayload | ||
46 | | MergeAudioTranscodingPayload | ||
47 | |||
48 | async function processVideoTranscoding (job: Bull.Job) { | 20 | async 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) |