]>
Commit | Line | Data |
---|---|---|
1 | import { logger } from 'packages/peertube-runner/shared/logger' | |
2 | import { | |
3 | RunnerJobLiveRTMPHLSTranscodingPayload, | |
4 | RunnerJobStudioTranscodingPayload, | |
5 | RunnerJobVODAudioMergeTranscodingPayload, | |
6 | RunnerJobVODHLSTranscodingPayload, | |
7 | RunnerJobVODWebVideoTranscodingPayload | |
8 | } from '@shared/models' | |
9 | import { processAudioMergeTranscoding, processHLSTranscoding, ProcessOptions, processWebVideoTranscoding } from './shared' | |
10 | import { ProcessLiveRTMPHLSTranscoding } from './shared/process-live' | |
11 | import { processStudioTranscoding } from './shared/process-studio' | |
12 | ||
13 | export async function processJob (options: ProcessOptions) { | |
14 | const { server, job } = options | |
15 | ||
16 | logger.info(`[${server.url}] Processing job of type ${job.type}: ${job.uuid}`, { payload: job.payload }) | |
17 | ||
18 | if (job.type === 'vod-audio-merge-transcoding') { | |
19 | await processAudioMergeTranscoding(options as ProcessOptions<RunnerJobVODAudioMergeTranscodingPayload>) | |
20 | } else if (job.type === 'vod-web-video-transcoding') { | |
21 | await processWebVideoTranscoding(options as ProcessOptions<RunnerJobVODWebVideoTranscodingPayload>) | |
22 | } else if (job.type === 'vod-hls-transcoding') { | |
23 | await processHLSTranscoding(options as ProcessOptions<RunnerJobVODHLSTranscodingPayload>) | |
24 | } else if (job.type === 'live-rtmp-hls-transcoding') { | |
25 | await new ProcessLiveRTMPHLSTranscoding(options as ProcessOptions<RunnerJobLiveRTMPHLSTranscodingPayload>).process() | |
26 | } else if (job.type === 'video-studio-transcoding') { | |
27 | await processStudioTranscoding(options as ProcessOptions<RunnerJobStudioTranscodingPayload>) | |
28 | } else { | |
29 | logger.error(`Unknown job ${job.type} to process`) | |
30 | return | |
31 | } | |
32 | ||
33 | logger.info(`[${server.url}] Finished processing job of type ${job.type}: ${job.uuid}`) | |
34 | } |