examples/metadata: update to new format API
This commit is contained in:
parent
1f80007e5e
commit
ffb193ac68
@ -1,9 +1,12 @@
|
||||
extern crate ffmpeg;
|
||||
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
|
||||
fn print_metadata(context: &ffmpeg::format::Context) {
|
||||
fn main() {
|
||||
ffmpeg::init().unwrap();
|
||||
|
||||
match ffmpeg::format::input(&env::args().nth(1).expect("missing file")) {
|
||||
Ok(context) => {
|
||||
for (k, v) in context.metadata().iter() {
|
||||
println!("{}: {}", k, v);
|
||||
}
|
||||
@ -67,20 +70,10 @@ fn print_metadata(context: &ffmpeg::format::Context) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
ffmpeg::init().unwrap();
|
||||
|
||||
if let Some(file) = env::args().nth(1) {
|
||||
let path = Path::new(&file);
|
||||
|
||||
match ffmpeg::format::open_input(&path) {
|
||||
Ok(context) => print_metadata(&context),
|
||||
Err(error) => println!("error: {}", error),
|
||||
}
|
||||
}
|
||||
else {
|
||||
println!("Usage: metadata <path>")
|
||||
|
||||
Err(error) =>
|
||||
println!("error: {}", error)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user