manual changes post ObjectExt::emit_by_name update

This commit is contained in:
Bilal Elmoussaoui 2021-11-21 09:39:31 +01:00
parent 86b07ce5b9
commit 1ffcea4da7
4 changed files with 33 additions and 46 deletions

View file

@ -75,8 +75,7 @@ fn example_main() {
// application is via properties, signals or action signals (or custom messages, events, queries).
// So what the following code does, is essentially asking playbin to tell us its already
// internally stored tag list for this stream index.
let tags = playbin.emit_by_name("get-audio-tags", &[&idx]).unwrap();
let tags = tags.get::<gst::TagList>().expect("tags");
let tags = playbin.emit_by_name::<gst::TagList>("get-audio-tags", &[&idx]);
if let Some(artist) = tags.get::<gst::tags::Artist>() {
println!(" Artist: {}", artist.get());

View file

@ -84,11 +84,7 @@ fn connect_rtpbin_srcpad(src_pad: &gst::Pad, sink: &gst::Element) -> Result<(),
fn make_fec_decoder(rtpbin: &gst::Element, sess_id: u32) -> Result<gst::Element, Error> {
let fecdec = make_element("rtpulpfecdec", None)?;
let internal_storage = rtpbin
.emit_by_name("get-internal-storage", &[&sess_id])
.unwrap()
.get::<glib::Object>()
.unwrap();
let internal_storage = rtpbin.emit_by_name::<glib::Object>("get-internal-storage", &[&sess_id]);
fecdec.set_property("storage", &internal_storage);
fecdec.set_property("pt", 100u32);

View file

@ -42,26 +42,24 @@ mod tutorial5 {
let x = playbin.property::<i32>(propname);
for i in 0..x {
let tags = playbin.emit_by_name(signame, &[&i]).unwrap();
let tags = playbin.emit_by_name::<gst::TagList>(signame, &[&i]);
if let Ok(Some(tags)) = tags.get::<Option<gst::TagList>>() {
textbuf.insert_at_cursor(&format!("{} stream {}:\n ", stype, i));
textbuf.insert_at_cursor(&format!("{} stream {}:\n ", stype, i));
if let Some(codec) = tags.get::<gst::tags::VideoCodec>() {
textbuf.insert_at_cursor(&format!(" codec: {} \n", codec.get()));
}
if let Some(codec) = tags.get::<gst::tags::VideoCodec>() {
textbuf.insert_at_cursor(&format!(" codec: {} \n", codec.get()));
}
if let Some(codec) = tags.get::<gst::tags::AudioCodec>() {
textbuf.insert_at_cursor(&format!(" codec: {} \n", codec.get()));
}
if let Some(codec) = tags.get::<gst::tags::AudioCodec>() {
textbuf.insert_at_cursor(&format!(" codec: {} \n", codec.get()));
}
if let Some(lang) = tags.get::<gst::tags::LanguageCode>() {
textbuf.insert_at_cursor(&format!(" language: {} \n", lang.get()));
}
if let Some(lang) = tags.get::<gst::tags::LanguageCode>() {
textbuf.insert_at_cursor(&format!(" language: {} \n", lang.get()));
}
if let Some(bitrate) = tags.get::<gst::tags::Bitrate>() {
textbuf.insert_at_cursor(&format!(" bitrate: {} \n", bitrate.get()));
}
if let Some(bitrate) = tags.get::<gst::tags::Bitrate>() {
textbuf.insert_at_cursor(&format!(" bitrate: {} \n", bitrate.get()));
}
}
}

View file

@ -21,41 +21,35 @@ fn analyze_streams(playbin: &gst::Element) {
);
for i in 0..n_video {
let tags = playbin.emit_by_name("get-video-tags", &[&i]).unwrap();
let tags = playbin.emit_by_name::<gst::TagList>("get-video-tags", &[&i]);
if let Ok(tags) = tags.get::<gst::TagList>() {
println!("video stream {}:", i);
if let Some(codec) = tags.get::<gst::tags::VideoCodec>() {
println!(" codec: {}", codec.get());
}
println!("video stream {}:", i);
if let Some(codec) = tags.get::<gst::tags::VideoCodec>() {
println!(" codec: {}", codec.get());
}
}
for i in 0..n_audio {
let tags = playbin.emit_by_name("get-audio-tags", &[&i]).unwrap();
let tags = playbin.emit_by_name::<gst::TagList>("get-audio-tags", &[&i]);
if let Ok(tags) = tags.get::<gst::TagList>() {
println!("audio stream {}:", i);
if let Some(codec) = tags.get::<gst::tags::AudioCodec>() {
println!(" codec: {}", codec.get());
}
if let Some(codec) = tags.get::<gst::tags::LanguageCode>() {
println!(" language: {}", codec.get());
}
if let Some(codec) = tags.get::<gst::tags::Bitrate>() {
println!(" bitrate: {}", codec.get());
}
println!("audio stream {}:", i);
if let Some(codec) = tags.get::<gst::tags::AudioCodec>() {
println!(" codec: {}", codec.get());
}
if let Some(codec) = tags.get::<gst::tags::LanguageCode>() {
println!(" language: {}", codec.get());
}
if let Some(codec) = tags.get::<gst::tags::Bitrate>() {
println!(" bitrate: {}", codec.get());
}
}
for i in 0..n_text {
let tags = playbin.emit_by_name("get-text-tags", &[&i]).unwrap();
let tags = playbin.emit_by_name::<gst::TagList>("get-text-tags", &[&i]);
if let Ok(tags) = tags.get::<gst::TagList>() {
println!("subtitle stream {}:", i);
if let Some(codec) = tags.get::<gst::tags::LanguageCode>() {
println!(" language: {}", codec.get());
}
println!("subtitle stream {}:", i);
if let Some(codec) = tags.get::<gst::tags::LanguageCode>() {
println!(" language: {}", codec.get());
}
}