From a820b817bf4bfbf7e8978ffc427ccbf75a74309a Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 10 Apr 2024 19:51:37 +0200 Subject: pretranscode poster buutton --- server/src/routes/ui/assets.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'server/src/routes/ui/assets.rs') diff --git a/server/src/routes/ui/assets.rs b/server/src/routes/ui/assets.rs index 115c02a..c278a31 100644 --- a/server/src/routes/ui/assets.rs +++ b/server/src/routes/ui/assets.rs @@ -20,6 +20,9 @@ use log::info; use rocket::{get, http::ContentType, response::Redirect, State}; use std::path::PathBuf; +pub const AVIF_QUALITY: f32 = 50.; +pub const AVIF_SPEED: u8 = 5; + #[get("/asset/?")] pub async fn r_asset( _session: Session, @@ -43,8 +46,7 @@ pub async fn r_asset( // fit the resolution into a finite set so the maximum cache is finite too. let width = 2usize.pow(width.clamp(128, 2048).ilog2()); - // TODO configure avif quality and speed. - jellytranscoder::image::transcode(source, 50., 5, width) + jellytranscoder::image::transcode(source, AVIF_QUALITY, AVIF_SPEED, width) .await .context("transcoding asset")? }; -- cgit v1.2.3-70-g09d2