fix: build error
This commit is contained in:
parent
244cbbeeab
commit
49f4b27a46
|
|
@ -5679,6 +5679,7 @@ dependencies = [
|
||||||
"criterion",
|
"criterion",
|
||||||
"dirs 5.0.1",
|
"dirs 5.0.1",
|
||||||
"serde",
|
"serde",
|
||||||
|
"serde_json",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror 1.0.69",
|
"thiserror 1.0.69",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ categories = ["multimedia::video", "multimedia::images"]
|
||||||
tokio = { version = "1.0", features = ["full"] }
|
tokio = { version = "1.0", features = ["full"] }
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
serde_json = "1.0"
|
||||||
uuid = { version = "1.0", features = ["v4"] }
|
uuid = { version = "1.0", features = ["v4"] }
|
||||||
tempfile = "3.0"
|
tempfile = "3.0"
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ impl FilterProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 执行 CPE
|
// 执行 CPE
|
||||||
let mut cpe_cmd = vec![
|
let cpe_cmd = vec![
|
||||||
"-y", "-hide_banner", "-nostdin",
|
"-y", "-hide_banner", "-nostdin",
|
||||||
"-i", input_path.to_str().unwrap(),
|
"-i", input_path.to_str().unwrap(),
|
||||||
"-filter_complex", &cpe_filter,
|
"-filter_complex", &cpe_filter,
|
||||||
|
|
@ -313,7 +313,7 @@ impl FilterProcessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 添加编码参数
|
/// 添加编码参数
|
||||||
fn add_encoding_args(&self, args: &mut Vec<&str>, quality: &QualityLevel, options: &ProcessOptions) {
|
fn add_encoding_args(&self, args: &mut Vec<&str>, quality: &QualityLevel, _options: &ProcessOptions) {
|
||||||
// 根据质量等级选择编码参数
|
// 根据质量等级选择编码参数
|
||||||
match quality {
|
match quality {
|
||||||
QualityLevel::Fast => {
|
QualityLevel::Fast => {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ use crate::core::{TvaiError, TvaiProcessor, ProcessResult, ProgressCallback};
|
||||||
use crate::config::UpscaleModel;
|
use crate::config::UpscaleModel;
|
||||||
|
|
||||||
/// 滤镜组合类型
|
/// 滤镜组合类型
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||||
pub enum FilterCombination {
|
pub enum FilterCombination {
|
||||||
/// 超分辨率放大
|
/// 超分辨率放大
|
||||||
Upscale {
|
Upscale {
|
||||||
|
|
@ -50,7 +50,7 @@ pub enum FilterCombination {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 质量等级
|
/// 质量等级
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize)]
|
||||||
pub enum QualityLevel {
|
pub enum QualityLevel {
|
||||||
/// 快速处理
|
/// 快速处理
|
||||||
Fast,
|
Fast,
|
||||||
|
|
@ -63,7 +63,7 @@ pub enum QualityLevel {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 处理选项
|
/// 处理选项
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct ProcessOptions {
|
pub struct ProcessOptions {
|
||||||
/// 输出格式 (mp4, mov, avi 等)
|
/// 输出格式 (mp4, mov, avi 等)
|
||||||
pub output_format: Option<String>,
|
pub output_format: Option<String>,
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ impl PresetBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 自定义预设
|
/// 自定义预设
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||||
pub struct CustomPreset {
|
pub struct CustomPreset {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub description: String,
|
pub description: String,
|
||||||
|
|
|
||||||
|
|
@ -231,8 +231,7 @@ impl ModelManager {
|
||||||
guide.push_str(&format!("```\n\"{}\"\n```\n", topaz_exe.display()));
|
guide.push_str(&format!("```\n\"{}\"\n```\n", topaz_exe.display()));
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::write(output_path, guide)
|
fs::write(output_path, guide)?;
|
||||||
.map_err(|e| TvaiError::IoError(format!("Failed to write guide: {}", e)))?;
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
@ -242,7 +241,7 @@ impl ModelManager {
|
||||||
if let Some(topaz_exe) = &self.topaz_exe {
|
if let Some(topaz_exe) = &self.topaz_exe {
|
||||||
Command::new(topaz_exe)
|
Command::new(topaz_exe)
|
||||||
.spawn()
|
.spawn()
|
||||||
.map_err(|e| TvaiError::ProcessError(format!("Failed to launch Topaz: {}", e)))?;
|
.map_err(|e| TvaiError::ProcessingError(format!("Failed to launch Topaz: {}", e)))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(TvaiError::TopazNotFound("Topaz Video AI executable not found".to_string()))
|
Err(TvaiError::TopazNotFound("Topaz Video AI executable not found".to_string()))
|
||||||
|
|
@ -274,7 +273,7 @@ impl ModelManager {
|
||||||
let output = Command::new(&self.topaz_ffmpeg)
|
let output = Command::new(&self.topaz_ffmpeg)
|
||||||
.args(&args)
|
.args(&args)
|
||||||
.output()
|
.output()
|
||||||
.map_err(|e| TvaiError::ProcessError(format!("Failed to execute FFmpeg: {}", e)))?;
|
.map_err(|e| TvaiError::ProcessingError(format!("Failed to execute FFmpeg: {}", e)))?;
|
||||||
|
|
||||||
// 清理临时文件
|
// 清理临时文件
|
||||||
let _ = fs::remove_file(&output_file);
|
let _ = fs::remove_file(&output_file);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue