Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
operutka committed Jan 13, 2025
1 parent 78692e9 commit fed0bcd
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 41 deletions.
2 changes: 1 addition & 1 deletion ac-ffmpeg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ version = "=0.1"
path = "../ac-ffmpeg-features"

[dev-dependencies]
clap = "2.33"
clap = "4"
9 changes: 4 additions & 5 deletions ac-ffmpeg/examples/decoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ac_ffmpeg::{
},
Error,
};
use clap::{App, Arg};
use clap::{Arg, Command};

/// Open a given input file.
fn open_input(path: &str) -> Result<DemuxerWithStreamInfo<File>, Error> {
Expand Down Expand Up @@ -61,17 +61,16 @@ fn print_video_frame_info(input: &str) -> Result<(), Error> {
}

fn main() {
let matches = App::new("decoding")
let matches = Command::new("decoding")
.arg(
Arg::with_name("input")
Arg::new("input")
.required(true)
.takes_value(true)
.value_name("INPUT")
.help("Input file"),
)
.get_matches();

let input_filename = matches.value_of("input").unwrap();
let input_filename = matches.get_one::<String>("input").unwrap();

if let Err(err) = print_video_frame_info(input_filename) {
eprintln!("ERROR: {}", err);
Expand Down
9 changes: 4 additions & 5 deletions ac-ffmpeg/examples/demuxing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ac_ffmpeg::{
time::Timestamp,
Error,
};
use clap::{App, Arg};
use clap::{Arg, Command};

/// Open a given input file.
fn open_input(path: &str) -> Result<DemuxerWithStreamInfo<File>, Error> {
Expand Down Expand Up @@ -68,17 +68,16 @@ fn print_info(input: &str) -> Result<(), Error> {
}

fn main() {
let matches = App::new("demuxing")
let matches = Command::new("demuxing")
.arg(
Arg::with_name("input")
Arg::new("input")
.required(true)
.takes_value(true)
.value_name("INPUT")
.help("Input file"),
)
.get_matches();

let input_filename = matches.value_of("input").unwrap();
let input_filename = matches.get_one::<String>("input").unwrap();

if let Err(err) = print_info(input_filename) {
eprintln!("ERROR: {}", err);
Expand Down
39 changes: 19 additions & 20 deletions ac-ffmpeg/examples/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ac_ffmpeg::{
time::{TimeBase, Timestamp},
Error,
};
use clap::{App, Arg};
use clap::{Arg, Command};

/// Open a given output file.
fn open_output(path: &str, elementary_streams: &[CodecParameters]) -> Result<Muxer<File>, Error> {
Expand Down Expand Up @@ -89,44 +89,43 @@ fn encode_black_video(
}

fn main() {
let matches = App::new("encoding")
let matches = Command::new("encoding")
.arg(
Arg::with_name("output")
Arg::new("output")
.required(true)
.takes_value(true)
.value_name("OUTPUT")
.help("Output file"),
)
.arg(
Arg::with_name("width")
.short("w")
.takes_value(true)
Arg::new("width")
.short('W')
.value_name("WIDTH")
.help("width")
.default_value("640"),
.default_value("640")
.value_parser(clap::value_parser!(u32)),
)
.arg(
Arg::with_name("height")
.short("h")
.takes_value(true)
Arg::new("height")
.short('H')
.value_name("HEIGHT")
.help("height")
.default_value("480"),
.default_value("480")
.value_parser(clap::value_parser!(u32)),
)
.arg(
Arg::with_name("duration")
.short("d")
.takes_value(true)
Arg::new("duration")
.short('D')
.value_name("DURATION")
.help("duration in seconds")
.default_value("10"),
.default_value("10")
.value_parser(clap::value_parser!(f32)),
)
.get_matches();

let output_filename = matches.value_of("output").unwrap();
let width = matches.value_of("width").unwrap().parse().unwrap();
let height = matches.value_of("height").unwrap().parse().unwrap();
let duration = matches.value_of("duration").unwrap().parse().unwrap();
let output_filename = matches.get_one::<String>("output").unwrap();
let width = *matches.get_one("width").unwrap();
let height = *matches.get_one("height").unwrap();
let duration = *matches.get_one("duration").unwrap();

let duration = Duration::from_secs_f32(duration);

Expand Down
14 changes: 6 additions & 8 deletions ac-ffmpeg/examples/muxing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use ac_ffmpeg::{
},
Error,
};
use clap::{App, Arg};
use clap::{Arg, Command};

/// Open a given input file.
fn open_input(path: &str) -> Result<DemuxerWithStreamInfo<File>, Error> {
Expand Down Expand Up @@ -65,25 +65,23 @@ fn convert(input: &str, output: &str) -> Result<(), Error> {
}

fn main() {
let matches = App::new("muxing")
let matches = Command::new("muxing")
.arg(
Arg::with_name("input")
Arg::new("input")
.required(true)
.takes_value(true)
.value_name("INPUT")
.help("Input file"),
)
.arg(
Arg::with_name("output")
Arg::new("output")
.required(true)
.takes_value(true)
.value_name("OUTPUT")
.help("Output file"),
)
.get_matches();

let input_filename = matches.value_of("input").unwrap();
let output_filename = matches.value_of("output").unwrap();
let input_filename = matches.get_one::<String>("input").unwrap();
let output_filename = matches.get_one::<String>("output").unwrap();

if let Err(err) = convert(input_filename, output_filename) {
eprintln!("ERROR: {}", err);
Expand Down
2 changes: 1 addition & 1 deletion ac-ffmpeg/src/format/demuxer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::{
borrow::{Borrow, BorrowMut},
convert::TryInto,
ffi::{CString, CStr},
ffi::{CStr, CString},
io::Read,
ops::{Deref, DerefMut},
os::raw::{c_char, c_int, c_uint, c_void},
Expand Down
6 changes: 5 additions & 1 deletion ac-ffmpeg/src/format/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ where
}

/// A WritePacketCallback function for the IO.
extern "C" fn io_write_packet<T>(opaque: *mut c_void, buffer: *const u8, buffer_size: c_int) -> c_int
extern "C" fn io_write_packet<T>(
opaque: *mut c_void,
buffer: *const u8,
buffer_size: c_int,
) -> c_int
where
T: Write,
{
Expand Down

0 comments on commit fed0bcd

Please sign in to comment.