aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/transcoding.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos/transcoding.ts')
-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()