forked from mirrors/gstreamer-rs
manual changes post ObjectExt::emit_by_name update
This commit is contained in:
parent
86b07ce5b9
commit
1ffcea4da7
4 changed files with 33 additions and 46 deletions
|
@ -75,8 +75,7 @@ fn example_main() {
|
||||||
// application is via properties, signals or action signals (or custom messages, events, queries).
|
// 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
|
// So what the following code does, is essentially asking playbin to tell us its already
|
||||||
// internally stored tag list for this stream index.
|
// internally stored tag list for this stream index.
|
||||||
let tags = playbin.emit_by_name("get-audio-tags", &[&idx]).unwrap();
|
let tags = playbin.emit_by_name::<gst::TagList>("get-audio-tags", &[&idx]);
|
||||||
let tags = tags.get::<gst::TagList>().expect("tags");
|
|
||||||
|
|
||||||
if let Some(artist) = tags.get::<gst::tags::Artist>() {
|
if let Some(artist) = tags.get::<gst::tags::Artist>() {
|
||||||
println!(" Artist: {}", artist.get());
|
println!(" Artist: {}", artist.get());
|
||||||
|
|
|
@ -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> {
|
fn make_fec_decoder(rtpbin: &gst::Element, sess_id: u32) -> Result<gst::Element, Error> {
|
||||||
let fecdec = make_element("rtpulpfecdec", None)?;
|
let fecdec = make_element("rtpulpfecdec", None)?;
|
||||||
let internal_storage = rtpbin
|
let internal_storage = rtpbin.emit_by_name::<glib::Object>("get-internal-storage", &[&sess_id]);
|
||||||
.emit_by_name("get-internal-storage", &[&sess_id])
|
|
||||||
.unwrap()
|
|
||||||
.get::<glib::Object>()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
fecdec.set_property("storage", &internal_storage);
|
fecdec.set_property("storage", &internal_storage);
|
||||||
fecdec.set_property("pt", 100u32);
|
fecdec.set_property("pt", 100u32);
|
||||||
|
|
|
@ -42,26 +42,24 @@ mod tutorial5 {
|
||||||
|
|
||||||
let x = playbin.property::<i32>(propname);
|
let x = playbin.property::<i32>(propname);
|
||||||
for i in 0..x {
|
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>() {
|
if let Some(codec) = tags.get::<gst::tags::VideoCodec>() {
|
||||||
textbuf.insert_at_cursor(&format!(" codec: {} \n", codec.get()));
|
textbuf.insert_at_cursor(&format!(" codec: {} \n", codec.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(codec) = tags.get::<gst::tags::AudioCodec>() {
|
if let Some(codec) = tags.get::<gst::tags::AudioCodec>() {
|
||||||
textbuf.insert_at_cursor(&format!(" codec: {} \n", codec.get()));
|
textbuf.insert_at_cursor(&format!(" codec: {} \n", codec.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(lang) = tags.get::<gst::tags::LanguageCode>() {
|
if let Some(lang) = tags.get::<gst::tags::LanguageCode>() {
|
||||||
textbuf.insert_at_cursor(&format!(" language: {} \n", lang.get()));
|
textbuf.insert_at_cursor(&format!(" language: {} \n", lang.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(bitrate) = tags.get::<gst::tags::Bitrate>() {
|
if let Some(bitrate) = tags.get::<gst::tags::Bitrate>() {
|
||||||
textbuf.insert_at_cursor(&format!(" bitrate: {} \n", bitrate.get()));
|
textbuf.insert_at_cursor(&format!(" bitrate: {} \n", bitrate.get()));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,41 +21,35 @@ fn analyze_streams(playbin: &gst::Element) {
|
||||||
);
|
);
|
||||||
|
|
||||||
for i in 0..n_video {
|
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);
|
||||||
println!("video stream {}:", i);
|
if let Some(codec) = tags.get::<gst::tags::VideoCodec>() {
|
||||||
if let Some(codec) = tags.get::<gst::tags::VideoCodec>() {
|
println!(" codec: {}", codec.get());
|
||||||
println!(" codec: {}", codec.get());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in 0..n_audio {
|
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);
|
||||||
println!("audio stream {}:", i);
|
if let Some(codec) = tags.get::<gst::tags::AudioCodec>() {
|
||||||
if let Some(codec) = tags.get::<gst::tags::AudioCodec>() {
|
println!(" codec: {}", codec.get());
|
||||||
println!(" codec: {}", codec.get());
|
}
|
||||||
}
|
if let Some(codec) = tags.get::<gst::tags::LanguageCode>() {
|
||||||
if let Some(codec) = tags.get::<gst::tags::LanguageCode>() {
|
println!(" language: {}", codec.get());
|
||||||
println!(" language: {}", codec.get());
|
}
|
||||||
}
|
if let Some(codec) = tags.get::<gst::tags::Bitrate>() {
|
||||||
if let Some(codec) = tags.get::<gst::tags::Bitrate>() {
|
println!(" bitrate: {}", codec.get());
|
||||||
println!(" bitrate: {}", codec.get());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in 0..n_text {
|
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);
|
||||||
println!("subtitle stream {}:", i);
|
if let Some(codec) = tags.get::<gst::tags::LanguageCode>() {
|
||||||
if let Some(codec) = tags.get::<gst::tags::LanguageCode>() {
|
println!(" language: {}", codec.get());
|
||||||
println!(" language: {}", codec.get());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue