build: update deps

This commit is contained in:
2022-02-24 21:26:57 +01:00
parent 605fa5c15b
commit 9c86cdcc62
5 changed files with 141 additions and 164 deletions

View File

@@ -117,44 +117,44 @@ struct TranscodeMatchFile {
}
pub fn config() -> Result<Config> {
use clap::{App, Arg, SubCommand};
use clap::{Command, Arg};
let arg_matches = App::new("audio-conv")
let arg_matches = Command::new("audio-conv")
.version(clap::crate_version!())
.about("Converts audio files")
.arg(
Arg::with_name("config")
.short("c")
Arg::new("config")
.short('c')
.long("config")
.required(false)
.takes_value(true)
.help("Path to an audio-conv config file, defaults to \"audio-conv.yaml\""),
)
.arg(
Arg::with_name("from")
.short("f")
Arg::new("from")
.short('f')
.long("from")
.required(false)
.takes_value(true)
.help("\"from\" directory path"),
)
.arg(
Arg::with_name("to")
.short("t")
Arg::new("to")
.short('t')
.long("to")
.required(false)
.takes_value(true)
.help("\"to\" directory path"),
)
.arg(
Arg::with_name("jobs")
.short("j")
Arg::new("jobs")
.short('j')
.long("jobs")
.required(false)
.takes_value(true)
.help("Allow N jobs/transcodes at once. Defaults to number of logical cores"),
)
.subcommand(SubCommand::with_name("init").about("writes an example config"))
.subcommand(Command::new("init").about("writes an example config"))
.get_matches();
let current_dir = std::env::current_dir().context("Could not get current directory")?;

View File

@@ -5,7 +5,7 @@ mod ui;
use crate::config::{Config, Transcode};
use anyhow::{Context, Error, Result};
use futures::{pin_mut, prelude::*};
use glib::{GBoxed, GString};
use glib::{Boxed, GString};
use gstreamer::{element_error, prelude::*, Element};
use gstreamer_base::prelude::*;
use std::{
@@ -20,8 +20,8 @@ use std::{
};
use tokio::{fs, io::AsyncWriteExt, task, time::interval};
#[derive(Clone, Debug, GBoxed)]
#[gboxed(type_name = "GBoxErrorWrapper")]
#[derive(Clone, Debug, Boxed)]
#[boxed_type(name = "GBoxErrorWrapper")]
struct GBoxErrorWrapper(Arc<Error>);
impl GBoxErrorWrapper {
@@ -329,7 +329,7 @@ async fn transcode_gstreamer(
queue: &ui::MsgQueue,
) -> Result<()> {
let file_src: Element = gmake("filesrc")?;
file_src.set_property("location", &path_to_gstring(&from_path))?;
file_src.try_set_property("location", &path_to_gstring(&from_path))?;
let decodebin: Element = gmake("decodebin")?;
@@ -376,7 +376,7 @@ async fn transcode_gstreamer(
let resample: Element = gmake("audioresample")?;
// quality from 0 to 10
resample.set_property("quality", &10)?;
resample.try_set_property("quality", &10i32)?;
let mut dest_elems = vec![
resample,
@@ -390,7 +390,7 @@ async fn transcode_gstreamer(
bitrate_type,
} => {
let encoder: Element = gmake("opusenc")?;
encoder.set_property(
encoder.try_set_property(
"bitrate",
&i32::from(*bitrate)
.checked_mul(1_000)
@@ -421,8 +421,8 @@ async fn transcode_gstreamer(
let encoder: Element = gmake("lamemp3enc")?;
// target: "1" = "bitrate"
encoder.set_property_from_str("target", "1");
encoder.set_property("bitrate", &i32::from(*bitrate))?;
encoder.set_property(
encoder.try_set_property("bitrate", &i32::from(*bitrate))?;
encoder.try_set_property(
"cbr",
match bitrate_type {
config::BitrateType::Vbr => &false,
@@ -441,7 +441,7 @@ async fn transcode_gstreamer(
};
let file_dest: gstreamer_base::BaseSink = gmake("filesink")?;
file_dest.set_property("location", &path_to_gstring(&to_path_clone))?;
file_dest.try_set_property("location", &path_to_gstring(&to_path_clone))?;
file_dest.set_sync(false);
dest_elems.push(file_dest.upcast());