wip: transcoder (now it works, but the code is still very bad)
This commit is contained in:
parent
b78f1efecf
commit
aa6681a64d
@ -16,6 +16,7 @@ pub struct ConvertResponse {
|
|||||||
#[derive(TryFromMultipart)]
|
#[derive(TryFromMultipart)]
|
||||||
#[try_from_multipart(rename_all = "camelCase")]
|
#[try_from_multipart(rename_all = "camelCase")]
|
||||||
pub struct ConvertRequest {
|
pub struct ConvertRequest {
|
||||||
|
pub format: String,
|
||||||
pub codec: String,
|
pub codec: String,
|
||||||
pub codec_opts: Option<String>,
|
pub codec_opts: Option<String>,
|
||||||
pub bit_rate: usize,
|
pub bit_rate: usize,
|
||||||
|
@ -76,6 +76,7 @@ async fn enqueue_file(
|
|||||||
|
|
||||||
let task = Task::new(
|
let task = Task::new(
|
||||||
task_id,
|
task_id,
|
||||||
|
req.format,
|
||||||
req.codec,
|
req.codec,
|
||||||
req.codec_opts,
|
req.codec_opts,
|
||||||
req.bit_rate,
|
req.bit_rate,
|
||||||
|
@ -8,6 +8,7 @@ use tracing::{debug, error};
|
|||||||
pub struct Task {
|
pub struct Task {
|
||||||
id: uuid::Uuid,
|
id: uuid::Uuid,
|
||||||
codec: String,
|
codec: String,
|
||||||
|
format: String,
|
||||||
codec_opts: Option<String>,
|
codec_opts: Option<String>,
|
||||||
bit_rate: usize,
|
bit_rate: usize,
|
||||||
max_bit_rate: usize,
|
max_bit_rate: usize,
|
||||||
@ -21,6 +22,7 @@ pub struct Task {
|
|||||||
impl Task {
|
impl Task {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
id: uuid::Uuid,
|
id: uuid::Uuid,
|
||||||
|
format: String,
|
||||||
codec: String,
|
codec: String,
|
||||||
codec_opts: Option<String>,
|
codec_opts: Option<String>,
|
||||||
bit_rate: usize,
|
bit_rate: usize,
|
||||||
@ -33,6 +35,7 @@ impl Task {
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
Task {
|
Task {
|
||||||
id,
|
id,
|
||||||
|
format,
|
||||||
codec,
|
codec,
|
||||||
codec_opts,
|
codec_opts,
|
||||||
bit_rate,
|
bit_rate,
|
||||||
@ -62,11 +65,11 @@ impl Task {
|
|||||||
if self.codec_opts.is_some() {
|
if self.codec_opts.is_some() {
|
||||||
octx = format::output_as_with(
|
octx = format::output_as_with(
|
||||||
&self.output_path,
|
&self.output_path,
|
||||||
&self.codec,
|
&self.format,
|
||||||
params_to_avdictionary(&self.codec_opts.unwrap_or_default()),
|
params_to_avdictionary(&self.codec_opts.unwrap_or_default()),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
octx = format::output_as(&self.output_path, &self.codec);
|
octx = format::output_as(&self.output_path, &self.format);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut octx = match octx {
|
let mut octx = match octx {
|
||||||
|
Loading…
Reference in New Issue
Block a user