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)]
|
||||
#[try_from_multipart(rename_all = "camelCase")]
|
||||
pub struct ConvertRequest {
|
||||
pub format: String,
|
||||
pub codec: String,
|
||||
pub codec_opts: Option<String>,
|
||||
pub bit_rate: usize,
|
||||
|
@ -76,6 +76,7 @@ async fn enqueue_file(
|
||||
|
||||
let task = Task::new(
|
||||
task_id,
|
||||
req.format,
|
||||
req.codec,
|
||||
req.codec_opts,
|
||||
req.bit_rate,
|
||||
|
@ -8,6 +8,7 @@ use tracing::{debug, error};
|
||||
pub struct Task {
|
||||
id: uuid::Uuid,
|
||||
codec: String,
|
||||
format: String,
|
||||
codec_opts: Option<String>,
|
||||
bit_rate: usize,
|
||||
max_bit_rate: usize,
|
||||
@ -21,6 +22,7 @@ pub struct Task {
|
||||
impl Task {
|
||||
pub fn new(
|
||||
id: uuid::Uuid,
|
||||
format: String,
|
||||
codec: String,
|
||||
codec_opts: Option<String>,
|
||||
bit_rate: usize,
|
||||
@ -33,6 +35,7 @@ impl Task {
|
||||
) -> Self {
|
||||
Task {
|
||||
id,
|
||||
format,
|
||||
codec,
|
||||
codec_opts,
|
||||
bit_rate,
|
||||
@ -62,11 +65,11 @@ impl Task {
|
||||
if self.codec_opts.is_some() {
|
||||
octx = format::output_as_with(
|
||||
&self.output_path,
|
||||
&self.codec,
|
||||
&self.format,
|
||||
params_to_avdictionary(&self.codec_opts.unwrap_or_default()),
|
||||
);
|
||||
} else {
|
||||
octx = format::output_as(&self.output_path, &self.codec);
|
||||
octx = format::output_as(&self.output_path, &self.format);
|
||||
}
|
||||
|
||||
let mut octx = match octx {
|
||||
|
Loading…
Reference in New Issue
Block a user