1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Add plugin hook on transcoding resolutions building

This commit is contained in:
Chocobozzz 2022-08-02 16:05:44 +02:00
parent 22df69fdec
commit ebb9e53ada
No known key found for this signature in database
GPG key ID: 583A612D890159BE
6 changed files with 51 additions and 6 deletions

View file

@ -26,6 +26,7 @@ import {
optimizeOriginalVideofile,
transcodeNewWebTorrentResolution
} from '../../transcoding/transcoding'
import { Hooks } from '@server/lib/plugins/hooks'
type HandlerFunction = (job: Job, payload: VideoTranscodingPayload, video: MVideoFullLight, user: MUser) => Promise<void>
@ -269,7 +270,12 @@ async function createLowerResolutionsJobs (options: {
const { video, user, videoFileResolution, isPortraitMode, isNewVideo, hasAudio, type } = options
// Create transcoding jobs if there are enabled resolutions
const resolutionsEnabled = computeLowerResolutionsToTranscode(videoFileResolution, 'vod')
const resolutionsEnabled = await Hooks.wrapObject(
computeLowerResolutionsToTranscode(videoFileResolution, 'vod'),
'filter:transcoding.auto.lower-resolutions-to-transcode.result',
options
)
const resolutionCreated: string[] = []
for (const resolution of resolutionsEnabled) {