mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
refactor(media-proxy): split into modules and harden streaming (#2437)
This commit is contained in:
1 parent
16ae98e189
commit
d7d4e8da03
214 files changed
+47213
-18092
No files matched your search
@@ -1,21 +1,32 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
use fluxer_media_proxy::constants::AssetExtension;
|
||||
use fluxer_media_proxy::media_process::{ImageOptions, transform_image};
|
||||
use fluxer_media_proxy::media_process::{
|
||||
AnimationLimits, AnimationMode, ImageOptions, ImageQuality, MediaLimits, ResizeMode,
|
||||
transform_image,
|
||||
};
|
||||
use fluxer_media_proxy::metrics::Metrics;
|
||||
use fluxer_media_proxy::output_format::OutputFormat;
|
||||
|
||||
fn main() {
|
||||
let metrics = Metrics::new();
|
||||
let media_limits = MediaLimits::default_from_config();
|
||||
let animation = AnimationMode::Animated(
|
||||
AnimationLimits::new(20_000, 30_000).expect("valid animation limits"),
|
||||
);
|
||||
let input = std::fs::read("/tmp/source.bin").expect("read source");
|
||||
let out = transform_image(
|
||||
&input,
|
||||
&ImageOptions {
|
||||
width: Some(240),
|
||||
height: Some(240),
|
||||
format: AssetExtension::Gif,
|
||||
quality: "high".to_owned(),
|
||||
animated: true,
|
||||
cover_crop: false,
|
||||
format: OutputFormat::GIF,
|
||||
quality: ImageQuality::High,
|
||||
animation,
|
||||
resize_mode: ResizeMode::Fit,
|
||||
..Default::default()
|
||||
},
|
||||
&media_limits,
|
||||
&metrics.transform(),
|
||||
)
|
||||
.expect("transform");
|
||||
std::fs::write("/tmp/out_current.gif", &out.bytes).expect("write");
|
||||
|
||||
Reference in new issue
Block a user