examples/tutorials: Change from emit() to emit_by_name()

And set_property_generic() to set_property_with_value()
This commit is contained in:
Sebastian Dröge 2021-02-22 17:14:27 +02:00
parent 2b0b3910ee
commit b5d5838d96
4 changed files with 7 additions and 4 deletions

View file

@ -77,7 +77,10 @@ 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("get-audio-tags", &[&idx]).unwrap().unwrap(); let tags = playbin
.emit_by_name("get-audio-tags", &[&idx])
.unwrap()
.unwrap();
let tags = tags.get::<gst::TagList>().expect("tags").unwrap(); let tags = tags.get::<gst::TagList>().expect("tags").unwrap();
if let Some(artist) = tags.get::<gst::tags::Artist>() { if let Some(artist) = tags.get::<gst::tags::Artist>() {

View file

@ -83,7 +83,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("get-internal-storage", &[&sess_id]) .emit_by_name("get-internal-storage", &[&sess_id])
.unwrap() .unwrap()
.unwrap() .unwrap()
.get::<glib::Object>() .get::<glib::Object>()

View file

@ -44,7 +44,7 @@ mod tutorial5 {
match playbin.get_property(propname).unwrap().get() { match playbin.get_property(propname).unwrap().get() {
Ok(Some(x)) => { Ok(Some(x)) => {
for i in 0..x { for i in 0..x {
let tags = playbin.emit(signame, &[&i]).unwrap().unwrap(); let tags = playbin.emit_by_name(signame, &[&i]).unwrap().unwrap();
if let Ok(Some(tags)) = tags.get::<gst::TagList>() { if let Ok(Some(tags)) = tags.get::<gst::TagList>() {
textbuf.insert_at_cursor(&format!("{} stream {}:\n ", stype, i)); textbuf.insert_at_cursor(&format!("{} stream {}:\n ", stype, i));

View file

@ -31,7 +31,7 @@ fn tutorial_main() -> Result<(), Error> {
.set_by_nick("download") .set_by_nick("download")
.build() .build()
.unwrap(); .unwrap();
pipeline.set_property_generic("flags", &flags).unwrap(); pipeline.set_property_with_value("flags", &flags).unwrap();
// Uncomment this line to limit the amount of downloaded data. // Uncomment this line to limit the amount of downloaded data.
// pipeline.set_property("ring-buffer-max-size", &4_000_000u64)?; // pipeline.set_property("ring-buffer-max-size", &4_000_000u64)?;