aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-02 16:05:44 +0200
committerChocobozzz <me@florianbigard.com>2022-08-02 16:05:44 +0200
commitebb9e53ada156249ed8e8cfd1de74097d3eb49d7 (patch)
tree094873e9f09a30eedf48617d4af3d4a3232df0fb /server/controllers
parent22df69fdecf299c8be6acaa25f086249ea9a0085 (diff)
downloadPeerTube-ebb9e53ada156249ed8e8cfd1de74097d3eb49d7.tar.gz
PeerTube-ebb9e53ada156249ed8e8cfd1de74097d3eb49d7.tar.zst
PeerTube-ebb9e53ada156249ed8e8cfd1de74097d3eb49d7.zip
Add plugin hook on transcoding resolutions building
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/videos/transcoding.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/server/controllers/api/videos/transcoding.ts b/server/controllers/api/videos/transcoding.ts
index da3ea3c9c..a360a8b6a 100644
--- a/server/controllers/api/videos/transcoding.ts
+++ b/server/controllers/api/videos/transcoding.ts
@@ -4,6 +4,7 @@ import { logger, loggerTagsFactory } from '@server/helpers/logger'
4import { addTranscodingJob } from '@server/lib/video' 4import { addTranscodingJob } from '@server/lib/video'
5import { HttpStatusCode, UserRight, VideoState, VideoTranscodingCreate } from '@shared/models' 5import { HttpStatusCode, UserRight, VideoState, VideoTranscodingCreate } from '@shared/models'
6import { asyncMiddleware, authenticate, createTranscodingValidator, ensureUserHasRight } from '../../../middlewares' 6import { asyncMiddleware, authenticate, createTranscodingValidator, ensureUserHasRight } from '../../../middlewares'
7import { Hooks } from '@server/lib/plugins/hooks'
7 8
8const lTags = loggerTagsFactory('api', 'video') 9const lTags = loggerTagsFactory('api', 'video')
9const transcodingRouter = express.Router() 10const transcodingRouter = express.Router()
@@ -30,7 +31,15 @@ async function createTranscoding (req: express.Request, res: express.Response) {
30 const body: VideoTranscodingCreate = req.body 31 const body: VideoTranscodingCreate = req.body
31 32
32 const { resolution: maxResolution, isPortraitMode, audioStream } = await video.probeMaxQualityFile() 33 const { resolution: maxResolution, isPortraitMode, audioStream } = await video.probeMaxQualityFile()
33 const resolutions = computeLowerResolutionsToTranscode(maxResolution, 'vod').concat([ maxResolution ]) 34 const resolutions = await Hooks.wrapObject(
35 computeLowerResolutionsToTranscode(maxResolution, 'vod').concat([ maxResolution ]),
36 'filter:transcoding.manual.lower-resolutions-to-transcode.result',
37 body
38 )
39
40 if (resolutions.length === 0) {
41 return res.sendStatus(HttpStatusCode.NO_CONTENT_204)
42 }
34 43
35 video.state = VideoState.TO_TRANSCODE 44 video.state = VideoState.TO_TRANSCODE
36 await video.save() 45 await video.save()