Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2022-10-23 23:03:22 +0300
committerSebastian Dröge <sebastian@centricular.com>2022-10-23 23:08:46 +0300
commit9a68f6e221576f94e153f5f20e499b22745621ec (patch)
tree776a587d54578bc7dff1fe432bf3008308bffb79 /tutorial
parent86776be58c5d7e8607653edcd719ac1f0ba8d992 (diff)
Move from `imp.instance()` to `imp.obj()`
It's doing the same thing and is shorter.
Diffstat (limited to 'tutorial')
-rw-r--r--tutorial/src/identity/imp.rs2
-rw-r--r--tutorial/src/progressbin/imp.rs2
-rw-r--r--tutorial/src/sinesrc/imp.rs36
3 files changed, 17 insertions, 23 deletions
diff --git a/tutorial/src/identity/imp.rs b/tutorial/src/identity/imp.rs
index 35442d87c..92d566291 100644
--- a/tutorial/src/identity/imp.rs
+++ b/tutorial/src/identity/imp.rs
@@ -181,7 +181,7 @@ impl ObjectImpl for Identity {
// Here we actually add the pads we created in Identity::new() to the
// element so that GStreamer is aware of their existence.
- let obj = self.instance();
+ let obj = self.obj();
obj.add_pad(&self.sinkpad).unwrap();
obj.add_pad(&self.srcpad).unwrap();
}
diff --git a/tutorial/src/progressbin/imp.rs b/tutorial/src/progressbin/imp.rs
index 5dad12323..3811c0bef 100644
--- a/tutorial/src/progressbin/imp.rs
+++ b/tutorial/src/progressbin/imp.rs
@@ -139,7 +139,7 @@ impl ObjectImpl for ProgressBin {
// Here we actually add the pads we created in ProgressBin::new() to the
// element so that GStreamer is aware of their existence.
- let obj = self.instance();
+ let obj = self.obj();
// Add the progressreport element to the bin.
obj.add(&self.progress).unwrap();
diff --git a/tutorial/src/sinesrc/imp.rs b/tutorial/src/sinesrc/imp.rs
index 2fdba9e7f..42be86d26 100644
--- a/tutorial/src/sinesrc/imp.rs
+++ b/tutorial/src/sinesrc/imp.rs
@@ -212,7 +212,7 @@ impl ObjectImpl for SineSrc {
// Call the parent class' ::constructed() implementation first
self.parent_constructed();
- let obj = self.instance();
+ let obj = self.obj();
// Initialize live-ness and notify the base class that
// we'd like to operate in Time format
obj.set_live(DEFAULT_IS_LIVE);
@@ -236,11 +236,9 @@ impl ObjectImpl for SineSrc {
settings.samples_per_buffer = samples_per_buffer;
drop(settings);
- let _ = self.instance().post_message(
- gst::message::Latency::builder()
- .src(&*self.instance())
- .build(),
- );
+ let _ = self
+ .obj()
+ .post_message(gst::message::Latency::builder().src(&*self.obj()).build());
}
"freq" => {
let mut settings = self.settings.lock().unwrap();
@@ -380,8 +378,7 @@ impl ElementImpl for SineSrc {
) -> Result<gst::StateChangeSuccess, gst::StateChangeError> {
// Configure live'ness once here just before starting the source
if let gst::StateChange::ReadyToPaused = transition {
- self.instance()
- .set_live(self.settings.lock().unwrap().is_live);
+ self.obj().set_live(self.settings.lock().unwrap().is_live);
}
// Call the parent class' implementation of ::change_state()
@@ -406,7 +403,7 @@ impl BaseSrcImpl for SineSrc {
gst::debug!(CAT, imp: self, "Configuring for caps {}", caps);
- self.instance()
+ self.obj()
.set_blocksize(info.bpf() * (*self.settings.lock().unwrap()).samples_per_buffer);
let settings = *self.settings.lock().unwrap();
@@ -442,11 +439,9 @@ impl BaseSrcImpl for SineSrc {
drop(state);
- let _ = self.instance().post_message(
- gst::message::Latency::builder()
- .src(&*self.instance())
- .build(),
- );
+ let _ = self
+ .obj()
+ .post_message(gst::message::Latency::builder().src(&*self.obj()).build());
Ok(())
}
@@ -748,15 +743,14 @@ impl PushSrcImpl for SineSrc {
// Waiting happens based on the pipeline clock, which means that a real live source
// with its own clock would require various translations between the two clocks.
// This is out of scope for the tutorial though.
- if self.instance().is_live() {
- let (clock, base_time) =
- match Option::zip(self.instance().clock(), self.instance().base_time()) {
- None => return Ok(CreateSuccess::NewBuffer(buffer)),
- Some(res) => res,
- };
+ if self.obj().is_live() {
+ let (clock, base_time) = match Option::zip(self.obj().clock(), self.obj().base_time()) {
+ None => return Ok(CreateSuccess::NewBuffer(buffer)),
+ Some(res) => res,
+ };
let segment = self
- .instance()
+ .obj()
.segment()
.downcast::<gst::format::Time>()
.unwrap();