diff --git a/examples/src/bin/playbin.rs b/examples/src/bin/playbin.rs index b0c0b4770..8a9cb192a 100644 --- a/examples/src/bin/playbin.rs +++ b/examples/src/bin/playbin.rs @@ -30,6 +30,35 @@ fn main() { // .unwrap(); // playbin.set_property("flags", &flags).unwrap(); + playbin + .connect("audio-tags-changed", false, |values| { + let playbin = values[0].get::().unwrap(); + let idx = values[1].get::().unwrap(); + + println!("audio tags of audio stream {} changed:", idx); + + let tags = playbin + .emit("get-audio-tags", &[&idx.to_value()]) + .unwrap() + .unwrap(); + let tags = tags.get::().unwrap(); + + if let Some(artist) = tags.get::() { + println!(" Artist: {}", artist.get().unwrap()); + } + + if let Some(title) = tags.get::() { + println!(" Title: {}", title.get().unwrap()); + } + + if let Some(album) = tags.get::() { + println!(" Album: {}", album.get().unwrap()); + } + + None + }) + .unwrap(); + let bus = playbin.get_bus().unwrap(); let ret = playbin.set_state(gst::State::Playing);