Replace Foo::from_instance(foo) with foo.imp()

This commit is contained in:
Sebastian Dröge 2022-01-17 19:36:41 +02:00
parent 75d348709c
commit b2d0172422
19 changed files with 72 additions and 72 deletions

View file

@ -130,7 +130,7 @@ impl ObjectImpl for EbuR128Level {
.action() .action()
.class_handler(|_token, args| { .class_handler(|_token, args| {
let this = args[0].get::<super::EbuR128Level>().unwrap(); let this = args[0].get::<super::EbuR128Level>().unwrap();
let imp = EbuR128Level::from_instance(&this); let imp = this.imp();
gst_info!(CAT, obj: &this, "Resetting measurements",); gst_info!(CAT, obj: &this, "Resetting measurements",);
imp.reset.store(true, atomic::Ordering::SeqCst); imp.reset.store(true, atomic::Ordering::SeqCst);

View file

@ -586,7 +586,7 @@ impl ObjectImpl for AppSrc {
.class_handler(|_, args| { .class_handler(|_, args| {
let element = args[0].get::<super::AppSrc>().expect("signal arg"); let element = args[0].get::<super::AppSrc>().expect("signal arg");
let buffer = args[1].get::<gst::Buffer>().expect("signal arg"); let buffer = args[1].get::<gst::Buffer>().expect("signal arg");
let appsrc = AppSrc::from_instance(&element); let appsrc = element.imp();
Some(appsrc.push_buffer(&element, buffer).to_value()) Some(appsrc.push_buffer(&element, buffer).to_value())
}) })
@ -595,7 +595,7 @@ impl ObjectImpl for AppSrc {
.action() .action()
.class_handler(|_, args| { .class_handler(|_, args| {
let element = args[0].get::<super::AppSrc>().expect("signal arg"); let element = args[0].get::<super::AppSrc>().expect("signal arg");
let appsrc = AppSrc::from_instance(&element); let appsrc = element.imp();
Some(appsrc.end_of_stream(&element).to_value()) Some(appsrc.end_of_stream(&element).to_value())
}) })

View file

@ -95,7 +95,7 @@ impl InputSelectorPadSinkHandler {
element: &super::InputSelector, element: &super::InputSelector,
mut buffer: gst::Buffer, mut buffer: gst::Buffer,
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
let inputselector = InputSelector::from_instance(element); let inputselector = element.imp();
let (stickies, is_active, sync_future, switched_pad) = { let (stickies, is_active, sync_future, switched_pad) = {
let mut state = inputselector.state.lock().unwrap(); let mut state = inputselector.state.lock().unwrap();

View file

@ -304,7 +304,7 @@ impl SinkHandler {
element: &super::JitterBuffer, element: &super::JitterBuffer,
buffer: gst::Buffer, buffer: gst::Buffer,
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
let jb = JitterBuffer::from_instance(element); let jb = element.imp();
let mut state = jb.state.lock().unwrap(); let mut state = jb.state.lock().unwrap();
let (max_misorder_time, max_dropout_time) = { let (max_misorder_time, max_dropout_time) = {
@ -499,7 +499,7 @@ impl SinkHandler {
if let Err(err) = self.store(&mut inner, pad, element, buf) { if let Err(err) = self.store(&mut inner, pad, element, buf) {
match err { match err {
gst::FlowError::CustomError => { gst::FlowError::CustomError => {
let jb = JitterBuffer::from_instance(element); let jb = element.imp();
let mut state = jb.state.lock().unwrap(); let mut state = jb.state.lock().unwrap();
for gap_packet in self.reset(&mut inner, &mut state, element) { for gap_packet in self.reset(&mut inner, &mut state, element) {
buffers.push_back(gap_packet.buffer); buffers.push_back(gap_packet.buffer);
@ -510,7 +510,7 @@ impl SinkHandler {
} }
} }
let jb = JitterBuffer::from_instance(element); let jb = element.imp();
let mut state = jb.state.lock().unwrap(); let mut state = jb.state.lock().unwrap();
let (latency, context_wait) = { let (latency, context_wait) = {
@ -611,7 +611,7 @@ impl PadSinkHandler for SinkHandler {
gst_log!(CAT, obj: pad.gst_pad(), "Handling {:?}", event); gst_log!(CAT, obj: pad.gst_pad(), "Handling {:?}", event);
let jb = JitterBuffer::from_instance(&element); let jb = element.imp();
let mut forward = true; let mut forward = true;
match event.view() { match event.view() {
@ -669,7 +669,7 @@ impl SrcHandler {
discont: &mut bool, discont: &mut bool,
) -> Vec<gst::Event> { ) -> Vec<gst::Event> {
let (latency, do_lost) = { let (latency, do_lost) = {
let jb = JitterBuffer::from_instance(element); let jb = element.imp();
let settings = jb.settings.lock().unwrap(); let settings = jb.settings.lock().unwrap();
(settings.latency, settings.do_lost) (settings.latency, settings.do_lost)
}; };
@ -755,7 +755,7 @@ impl SrcHandler {
&self, &self,
element: &super::JitterBuffer, element: &super::JitterBuffer,
) -> Result<gst::FlowSuccess, gst::FlowError> { ) -> Result<gst::FlowSuccess, gst::FlowError> {
let jb = JitterBuffer::from_instance(element); let jb = element.imp();
let (lost_events, buffer, seq) = { let (lost_events, buffer, seq) = {
let mut state = jb.state.lock().unwrap(); let mut state = jb.state.lock().unwrap();
@ -1061,7 +1061,7 @@ impl TaskImpl for JitterBufferTask {
self.src_pad_handler.clear(); self.src_pad_handler.clear();
self.sink_pad_handler.clear(); self.sink_pad_handler.clear();
let jb = JitterBuffer::from_instance(&self.element); let jb = self.element.imp();
*jb.state.lock().unwrap() = State::default(); *jb.state.lock().unwrap() = State::default();
gst_log!(CAT, obj: &self.element, "Task started"); gst_log!(CAT, obj: &self.element, "Task started");
@ -1072,7 +1072,7 @@ impl TaskImpl for JitterBufferTask {
fn iterate(&mut self) -> BoxFuture<'_, Result<(), gst::FlowError>> { fn iterate(&mut self) -> BoxFuture<'_, Result<(), gst::FlowError>> {
async move { async move {
let jb = JitterBuffer::from_instance(&self.element); let jb = self.element.imp();
let (latency, context_wait) = { let (latency, context_wait) = {
let settings = jb.settings.lock().unwrap(); let settings = jb.settings.lock().unwrap();
(settings.latency, settings.context_wait) (settings.latency, settings.context_wait)
@ -1208,7 +1208,7 @@ impl TaskImpl for JitterBufferTask {
async move { async move {
gst_log!(CAT, obj: &self.element, "Stopping task"); gst_log!(CAT, obj: &self.element, "Stopping task");
let jb = JitterBuffer::from_instance(&self.element); let jb = self.element.imp();
let mut jb_state = jb.state.lock().unwrap(); let mut jb_state = jb.state.lock().unwrap();
if let Some((_, abort_handle)) = jb_state.wait_handle.take() { if let Some((_, abort_handle)) = jb_state.wait_handle.take() {
@ -1405,7 +1405,7 @@ impl ObjectImpl for JitterBuffer {
.action() .action()
.class_handler(|_, args| { .class_handler(|_, args| {
let element = args[0].get::<super::JitterBuffer>().expect("signal arg"); let element = args[0].get::<super::JitterBuffer>().expect("signal arg");
let jb = JitterBuffer::from_instance(&element); let jb = element.imp();
jb.clear_pt_map(&element); jb.clear_pt_map(&element);
None None
}) })

View file

@ -228,7 +228,7 @@ impl PadSinkHandler for ProxySinkPadHandler {
async move { async move {
let pad = pad_weak.upgrade().expect("PadSink no longer exists"); let pad = pad_weak.upgrade().expect("PadSink no longer exists");
gst_log!(SINK_CAT, obj: pad.gst_pad(), "Handling {:?}", buffer); gst_log!(SINK_CAT, obj: pad.gst_pad(), "Handling {:?}", buffer);
let proxysink = ProxySink::from_instance(&element); let proxysink = element.imp();
proxysink proxysink
.enqueue_item(&element, DataQueueItem::Buffer(buffer)) .enqueue_item(&element, DataQueueItem::Buffer(buffer))
.await .await
@ -248,7 +248,7 @@ impl PadSinkHandler for ProxySinkPadHandler {
async move { async move {
let pad = pad_weak.upgrade().expect("PadSink no longer exists"); let pad = pad_weak.upgrade().expect("PadSink no longer exists");
gst_log!(SINK_CAT, obj: pad.gst_pad(), "Handling {:?}", list); gst_log!(SINK_CAT, obj: pad.gst_pad(), "Handling {:?}", list);
let proxysink = ProxySink::from_instance(&element); let proxysink = element.imp();
proxysink proxysink
.enqueue_item(&element, DataQueueItem::BufferList(list)) .enqueue_item(&element, DataQueueItem::BufferList(list))
.await .await
@ -306,7 +306,7 @@ impl PadSinkHandler for ProxySinkPadHandler {
let element = element.clone().downcast::<super::ProxySink>().unwrap(); let element = element.clone().downcast::<super::ProxySink>().unwrap();
async move { async move {
let pad = pad_weak.upgrade().expect("PadSink no longer exists"); let pad = pad_weak.upgrade().expect("PadSink no longer exists");
let proxysink = ProxySink::from_instance(&element); let proxysink = element.imp();
match event.view() { match event.view() {
EventView::Eos(..) => { EventView::Eos(..) => {
@ -873,7 +873,7 @@ impl TaskImpl for ProxySrcTask {
async move { async move {
gst_log!(SRC_CAT, obj: &self.element, "Starting task"); gst_log!(SRC_CAT, obj: &self.element, "Starting task");
let proxysrc = ProxySrc::from_instance(&self.element); let proxysrc = self.element.imp();
let proxy_ctx = proxysrc.proxy_ctx.lock().unwrap(); let proxy_ctx = proxysrc.proxy_ctx.lock().unwrap();
let mut shared_ctx = proxy_ctx.as_ref().unwrap().lock_shared(); let mut shared_ctx = proxy_ctx.as_ref().unwrap().lock_shared();
@ -904,7 +904,7 @@ impl TaskImpl for ProxySrcTask {
}; };
let pad = self.src_pad.upgrade().expect("PadSrc no longer exists"); let pad = self.src_pad.upgrade().expect("PadSrc no longer exists");
let proxysrc = ProxySrc::from_instance(&self.element); let proxysrc = self.element.imp();
let res = ProxySrcPadHandler::push_item(&pad, proxysrc, item).await; let res = ProxySrcPadHandler::push_item(&pad, proxysrc, item).await;
match res { match res {
Ok(()) => { Ok(()) => {
@ -948,7 +948,7 @@ impl TaskImpl for ProxySrcTask {
async move { async move {
gst_log!(SRC_CAT, obj: &self.element, "Stopping task"); gst_log!(SRC_CAT, obj: &self.element, "Stopping task");
let proxysrc = ProxySrc::from_instance(&self.element); let proxysrc = self.element.imp();
let proxy_ctx = proxysrc.proxy_ctx.lock().unwrap(); let proxy_ctx = proxysrc.proxy_ctx.lock().unwrap();
let mut shared_ctx = proxy_ctx.as_ref().unwrap().lock_shared(); let mut shared_ctx = proxy_ctx.as_ref().unwrap().lock_shared();
@ -971,7 +971,7 @@ impl TaskImpl for ProxySrcTask {
async move { async move {
gst_log!(SRC_CAT, obj: &self.element, "Starting task flush"); gst_log!(SRC_CAT, obj: &self.element, "Starting task flush");
let proxysrc = ProxySrc::from_instance(&self.element); let proxysrc = self.element.imp();
let proxy_ctx = proxysrc.proxy_ctx.lock().unwrap(); let proxy_ctx = proxysrc.proxy_ctx.lock().unwrap();
let mut shared_ctx = proxy_ctx.as_ref().unwrap().lock_shared(); let mut shared_ctx = proxy_ctx.as_ref().unwrap().lock_shared();

View file

@ -96,7 +96,7 @@ impl PadSinkHandler for QueuePadSinkHandler {
async move { async move {
let pad = pad_weak.upgrade().expect("PadSink no longer exists"); let pad = pad_weak.upgrade().expect("PadSink no longer exists");
gst_log!(CAT, obj: pad.gst_pad(), "Handling {:?}", buffer); gst_log!(CAT, obj: pad.gst_pad(), "Handling {:?}", buffer);
let queue = Queue::from_instance(&element); let queue = element.imp();
queue queue
.enqueue_item(&element, DataQueueItem::Buffer(buffer)) .enqueue_item(&element, DataQueueItem::Buffer(buffer))
.await .await
@ -116,7 +116,7 @@ impl PadSinkHandler for QueuePadSinkHandler {
async move { async move {
let pad = pad_weak.upgrade().expect("PadSink no longer exists"); let pad = pad_weak.upgrade().expect("PadSink no longer exists");
gst_log!(CAT, obj: pad.gst_pad(), "Handling {:?}", list); gst_log!(CAT, obj: pad.gst_pad(), "Handling {:?}", list);
let queue = Queue::from_instance(&element); let queue = element.imp();
queue queue
.enqueue_item(&element, DataQueueItem::BufferList(list)) .enqueue_item(&element, DataQueueItem::BufferList(list))
.await .await
@ -167,7 +167,7 @@ impl PadSinkHandler for QueuePadSinkHandler {
let element = element.clone().downcast::<super::Queue>().unwrap(); let element = element.clone().downcast::<super::Queue>().unwrap();
async move { async move {
let pad = pad_weak.upgrade().expect("PadSink no longer exists"); let pad = pad_weak.upgrade().expect("PadSink no longer exists");
let queue = Queue::from_instance(&element); let queue = element.imp();
if let EventView::FlushStop(..) = event.view() { if let EventView::FlushStop(..) = event.view() {
if let Err(err) = queue.task.flush_stop() { if let Err(err) = queue.task.flush_stop() {
@ -342,7 +342,7 @@ impl TaskImpl for QueueTask {
async move { async move {
gst_log!(CAT, obj: &self.element, "Starting task"); gst_log!(CAT, obj: &self.element, "Starting task");
let queue = Queue::from_instance(&self.element); let queue = self.element.imp();
let mut last_res = queue.last_res.lock().unwrap(); let mut last_res = queue.last_res.lock().unwrap();
self.dataqueue.start(); self.dataqueue.start();
@ -368,7 +368,7 @@ impl TaskImpl for QueueTask {
}; };
let pad = self.src_pad.upgrade().expect("PadSrc no longer exists"); let pad = self.src_pad.upgrade().expect("PadSrc no longer exists");
let queue = Queue::from_instance(&self.element); let queue = self.element.imp();
let res = QueuePadSrcHandler::push_item(&pad, queue, item).await; let res = QueuePadSrcHandler::push_item(&pad, queue, item).await;
match res { match res {
Ok(()) => { Ok(()) => {
@ -405,7 +405,7 @@ impl TaskImpl for QueueTask {
async move { async move {
gst_log!(CAT, obj: &self.element, "Stopping task"); gst_log!(CAT, obj: &self.element, "Stopping task");
let queue = Queue::from_instance(&self.element); let queue = self.element.imp();
let mut last_res = queue.last_res.lock().unwrap(); let mut last_res = queue.last_res.lock().unwrap();
self.dataqueue.stop(); self.dataqueue.stop();
@ -427,7 +427,7 @@ impl TaskImpl for QueueTask {
async move { async move {
gst_log!(CAT, obj: &self.element, "Starting task flush"); gst_log!(CAT, obj: &self.element, "Starting task flush");
let queue = Queue::from_instance(&self.element); let queue = self.element.imp();
let mut last_res = queue.last_res.lock().unwrap(); let mut last_res = queue.last_res.lock().unwrap();
self.dataqueue.clear(); self.dataqueue.clear();

View file

@ -617,7 +617,7 @@ impl PadSinkHandler for UdpSinkPadHandler {
async move { async move {
if let EventView::FlushStop(_) = event.view() { if let EventView::FlushStop(_) = event.view() {
let udpsink = UdpSink::from_instance(&element); let udpsink = element.imp();
return udpsink.task.flush_stop().is_ok(); return udpsink.task.flush_stop().is_ok();
} else if let Some(sender) = sender.lock().await.as_mut() { } else if let Some(sender) = sender.lock().await.as_mut() {
if sender.send(TaskItem::Event(event)).await.is_err() { if sender.send(TaskItem::Event(event)).await.is_err() {
@ -1128,7 +1128,7 @@ impl ObjectImpl for UdpSink {
let port = args[2].get::<i32>().expect("signal arg"); let port = args[2].get::<i32>().expect("signal arg");
if let Ok(addr) = try_into_socket_addr(&element, &host, port) { if let Ok(addr) = try_into_socket_addr(&element, &host, port) {
let udpsink = UdpSink::from_instance(&element); let udpsink = element.imp();
udpsink.add_client(addr); udpsink.add_client(addr);
} }
@ -1147,7 +1147,7 @@ impl ObjectImpl for UdpSink {
let port = args[2].get::<i32>().expect("signal arg"); let port = args[2].get::<i32>().expect("signal arg");
if let Ok(addr) = try_into_socket_addr(&element, &host, port) { if let Ok(addr) = try_into_socket_addr(&element, &host, port) {
let udpsink = UdpSink::from_instance(&element); let udpsink = element.imp();
udpsink.remove_client(addr); udpsink.remove_client(addr);
} }
@ -1159,7 +1159,7 @@ impl ObjectImpl for UdpSink {
.class_handler(|_, args| { .class_handler(|_, args| {
let element = args[0].get::<super::UdpSink>().expect("signal arg"); let element = args[0].get::<super::UdpSink>().expect("signal arg");
let udpsink = UdpSink::from_instance(&element); let udpsink = element.imp();
udpsink.clear_clients(std::iter::empty()); udpsink.clear_clients(std::iter::empty());
None None

View file

@ -488,7 +488,7 @@ mod imp_sink {
.downcast::<super::ElementSinkTest>() .downcast::<super::ElementSinkTest>()
.unwrap(); .unwrap();
async move { async move {
let elem_sink_test = ElementSinkTest::from_instance(&element); let elem_sink_test = element.imp();
elem_sink_test elem_sink_test
.forward_item(&element, Item::Buffer(buffer)) .forward_item(&element, Item::Buffer(buffer))
.await .await
@ -508,7 +508,7 @@ mod imp_sink {
.downcast::<super::ElementSinkTest>() .downcast::<super::ElementSinkTest>()
.unwrap(); .unwrap();
async move { async move {
let elem_sink_test = ElementSinkTest::from_instance(&element); let elem_sink_test = element.imp();
elem_sink_test elem_sink_test
.forward_item(&element, Item::BufferList(list)) .forward_item(&element, Item::BufferList(list))
.await .await
@ -548,7 +548,7 @@ mod imp_sink {
.downcast::<super::ElementSinkTest>() .downcast::<super::ElementSinkTest>()
.unwrap(); .unwrap();
async move { async move {
let elem_sink_test = ElementSinkTest::from_instance(&element); let elem_sink_test = element.imp();
if let EventView::FlushStop(..) = event.view() { if let EventView::FlushStop(..) = event.view() {
elem_sink_test.start(&element); elem_sink_test.start(&element);
@ -806,7 +806,7 @@ fn nominal_scenario(
src_element: ElementSrcTest, src_element: ElementSrcTest,
mut receiver: mpsc::Receiver<Item>, mut receiver: mpsc::Receiver<Item>,
) { ) {
let elem_src_test = imp_src::ElementSrcTest::from_instance(&src_element); let elem_src_test = src_element.imp();
pipeline.set_state(gst::State::Playing).unwrap(); pipeline.set_state(gst::State::Playing).unwrap();
@ -1018,7 +1018,7 @@ fn start_pause_start() {
let (pipeline, src_element, _sink_element, mut receiver) = setup(scenario_name, None, None); let (pipeline, src_element, _sink_element, mut receiver) = setup(scenario_name, None, None);
let elem_src_test = imp_src::ElementSrcTest::from_instance(&src_element); let elem_src_test = src_element.imp();
pipeline.set_state(gst::State::Playing).unwrap(); pipeline.set_state(gst::State::Playing).unwrap();
@ -1096,7 +1096,7 @@ fn start_stop_start() {
let (pipeline, src_element, _sink_element, mut receiver) = setup(scenario_name, None, None); let (pipeline, src_element, _sink_element, mut receiver) = setup(scenario_name, None, None);
let elem_src_test = imp_src::ElementSrcTest::from_instance(&src_element); let elem_src_test = src_element.imp();
pipeline.set_state(gst::State::Playing).unwrap(); pipeline.set_state(gst::State::Playing).unwrap();
@ -1209,7 +1209,7 @@ fn start_flush() {
let (pipeline, src_element, sink_element, mut receiver) = setup(scenario_name, None, None); let (pipeline, src_element, sink_element, mut receiver) = setup(scenario_name, None, None);
let elem_src_test = imp_src::ElementSrcTest::from_instance(&src_element); let elem_src_test = src_element.imp();
pipeline.set_state(gst::State::Playing).unwrap(); pipeline.set_state(gst::State::Playing).unwrap();
@ -1249,7 +1249,7 @@ fn start_flush() {
.try_push(Item::Buffer(gst::Buffer::from_slice(vec![1, 2, 3, 4]))) .try_push(Item::Buffer(gst::Buffer::from_slice(vec![1, 2, 3, 4])))
.unwrap(); .unwrap();
let elem_sink_test = imp_sink::ElementSinkTest::from_instance(&sink_element); let elem_sink_test = sink_element.imp();
elem_sink_test.push_flush_start(&sink_element); elem_sink_test.push_flush_start(&sink_element);

View file

@ -577,7 +577,7 @@ impl ObjectImpl for HlsSink3 {
.expect("playlist-stream signal arg"); .expect("playlist-stream signal arg");
let playlist_location = let playlist_location =
args[1].get::<String>().expect("playlist-stream signal arg"); args[1].get::<String>().expect("playlist-stream signal arg");
let hlssink3 = HlsSink3::from_instance(&element); let hlssink3 = element.imp();
Some( Some(
hlssink3 hlssink3
@ -603,7 +603,7 @@ impl ObjectImpl for HlsSink3 {
.expect("fragment-stream signal arg"); .expect("fragment-stream signal arg");
let fragment_location = let fragment_location =
args[1].get::<String>().expect("fragment-stream signal arg"); args[1].get::<String>().expect("fragment-stream signal arg");
let hlssink3 = HlsSink3::from_instance(&element); let hlssink3 = element.imp();
Some( Some(
hlssink3 hlssink3
@ -626,7 +626,7 @@ impl ObjectImpl for HlsSink3 {
.class_handler(|_, args| { .class_handler(|_, args| {
let element = args[0].get::<super::HlsSink3>().expect("signal arg"); let element = args[0].get::<super::HlsSink3>().expect("signal arg");
let fragment_location = args[1].get::<String>().expect("signal arg"); let fragment_location = args[1].get::<String>().expect("signal arg");
let hlssink3 = HlsSink3::from_instance(&element); let hlssink3 = element.imp();
hlssink3.delete_fragment(&element, &fragment_location); hlssink3.delete_fragment(&element, &fragment_location);
Some(true.to_value()) Some(true.to_value())
@ -676,7 +676,7 @@ impl ObjectImpl for HlsSink3 {
Some(element) => element, Some(element) => element,
None => return Some(None::<String>.to_value()), None => return Some(None::<String>.to_value()),
}; };
let hlssink3 = HlsSink3::from_instance(&element); let hlssink3 = element.imp();
let fragment_id = args[1].get::<u32>().unwrap(); let fragment_id = args[1].get::<u32>().unwrap();

View file

@ -599,7 +599,7 @@ impl Transcriber {
} }
}; };
let transcribe = Self::from_instance(&element); let transcribe = element.imp();
if let Err(err) = transcribe.loop_fn(&element, &mut receiver) { if let Err(err) = transcribe.loop_fn(&element, &mut receiver) {
element_error!( element_error!(
&element, &element,
@ -963,7 +963,7 @@ impl Transcriber {
let element_weak = element.downgrade(); let element_weak = element.downgrade();
let future = async move { let future = async move {
while let Some(element) = element_weak.upgrade() { while let Some(element) = element_weak.upgrade() {
let transcribe = Self::from_instance(&element); let transcribe = element.imp();
let msg = match ws_stream.next().await { let msg = match ws_stream.next().await {
Some(msg) => msg, Some(msg) => msg,
None => { None => {

View file

@ -394,7 +394,7 @@ impl JsonGstParse {
} }
}; };
let parse = Self::from_instance(&element); let parse = element.imp();
parse.loop_fn(&element); parse.loop_fn(&element);
}); });
if res.is_err() { if res.is_err() {

View file

@ -208,7 +208,7 @@ impl CustomSource {
None => return, None => return,
Some(element) => element, Some(element) => element,
}; };
let src = CustomSource::from_instance(&element); let src = element.imp();
if let Err(msg) = src.handle_source_pad_added(&element, pad) { if let Err(msg) = src.handle_source_pad_added(&element, pad) {
element.post_error_message(msg); element.post_error_message(msg);
@ -220,7 +220,7 @@ impl CustomSource {
None => return, None => return,
Some(element) => element, Some(element) => element,
}; };
let src = CustomSource::from_instance(&element); let src = element.imp();
src.handle_source_pad_removed(&element, pad); src.handle_source_pad_removed(&element, pad);
}); });
@ -231,7 +231,7 @@ impl CustomSource {
None => return, None => return,
Some(element) => element, Some(element) => element,
}; };
let src = CustomSource::from_instance(&element); let src = element.imp();
src.handle_source_no_more_pads(&element); src.handle_source_no_more_pads(&element);
}); });

View file

@ -612,7 +612,7 @@ impl ObjectImpl for FallbackSrc {
.action() .action()
.class_handler(|_token, args| { .class_handler(|_token, args| {
let element = args[0].get::<super::FallbackSrc>().expect("signal arg"); let element = args[0].get::<super::FallbackSrc>().expect("signal arg");
let src = FallbackSrc::from_instance(&element); let src = element.imp();
let mut state_guard = src.state.lock().unwrap(); let mut state_guard = src.state.lock().unwrap();
let state = match &mut *state_guard { let state = match &mut *state_guard {
None => { None => {
@ -840,7 +840,7 @@ impl FallbackSrc {
None => return, None => return,
Some(element) => element, Some(element) => element,
}; };
let src = FallbackSrc::from_instance(&element); let src = element.imp();
if let Err(msg) = src.handle_source_pad_added(&element, pad) { if let Err(msg) = src.handle_source_pad_added(&element, pad) {
element.post_error_message(msg); element.post_error_message(msg);
@ -852,7 +852,7 @@ impl FallbackSrc {
None => return, None => return,
Some(element) => element, Some(element) => element,
}; };
let src = FallbackSrc::from_instance(&element); let src = element.imp();
src.handle_source_pad_removed(&element, pad); src.handle_source_pad_removed(&element, pad);
}); });
@ -936,7 +936,7 @@ impl FallbackSrc {
Some(element) => element, Some(element) => element,
}; };
let src = FallbackSrc::from_instance(&element); let src = element.imp();
src.handle_switch_active_pad_change(&element); src.handle_switch_active_pad_change(&element);
}); });
switch.set_property("timeout", timeout.nseconds()); switch.set_property("timeout", timeout.nseconds());
@ -962,7 +962,7 @@ impl FallbackSrc {
Some(element) => element, Some(element) => element,
}; };
let src = FallbackSrc::from_instance(&element); let src = element.imp();
src.proxy_pad_chain(&element, pad, buffer) src.proxy_pad_chain(&element, pad, buffer)
} }
}) })
@ -1350,7 +1350,7 @@ impl FallbackSrc {
Some(element) => element, Some(element) => element,
}; };
let src = FallbackSrc::from_instance(&element); let src = element.imp();
match info.data { match info.data {
Some(gst::PadProbeData::Event(ref ev)) if ev.type_() == gst::EventType::Eos => { Some(gst::PadProbeData::Event(ref ev)) if ev.type_() == gst::EventType::Eos => {
@ -1446,7 +1446,7 @@ impl FallbackSrc {
_ => unreachable!(), _ => unreachable!(),
}; };
let src = FallbackSrc::from_instance(&element); let src = element.imp();
if let Err(msg) = src.handle_pad_blocked(&element, pad, pts) { if let Err(msg) = src.handle_pad_blocked(&element, pad, pts) {
element.post_error_message(msg); element.post_error_message(msg);
@ -2066,7 +2066,7 @@ impl FallbackSrc {
let source_weak = state.source.downgrade(); let source_weak = state.source.downgrade();
element.call_async(move |element| { element.call_async(move |element| {
let src = FallbackSrc::from_instance(element); let src = element.imp();
let source = match source_weak.upgrade() { let source = match source_weak.upgrade() {
None => return, None => return,
@ -2150,7 +2150,7 @@ impl FallbackSrc {
gst_debug!(CAT, obj: &element, "Woke up, retrying"); gst_debug!(CAT, obj: &element, "Woke up, retrying");
element.call_async(|element| { element.call_async(|element| {
let src = FallbackSrc::from_instance(element); let src = element.imp();
let mut state_guard = src.state.lock().unwrap(); let mut state_guard = src.state.lock().unwrap();
let state = match &mut *state_guard { let state = match &mut *state_guard {
@ -2288,7 +2288,7 @@ impl FallbackSrc {
}; };
element.call_async(move |element| { element.call_async(move |element| {
let src = FallbackSrc::from_instance(element); let src = element.imp();
gst_debug!(CAT, obj: element, "Source restart timeout triggered"); gst_debug!(CAT, obj: element, "Source restart timeout triggered");
let mut state_guard = src.state.lock().unwrap(); let mut state_guard = src.state.lock().unwrap();

View file

@ -840,7 +840,7 @@ impl BinImpl for UriPlaylistBin {
} }
gst::MessageView::Error(error) => { gst::MessageView::Error(error) => {
// find item which raised the error // find item which raised the error
let self_ = UriPlaylistBin::from_instance(element); let self_ = element.imp();
let mut state_guard = self_.state.lock().unwrap(); let mut state_guard = self_.state.lock().unwrap();
let state = state_guard.as_mut().unwrap(); let state = state_guard.as_mut().unwrap();
@ -1050,7 +1050,7 @@ impl UriPlaylistBin {
Some(element) => element, Some(element) => element,
None => return, None => return,
}; };
let self_ = UriPlaylistBin::from_instance(&element); let self_ = element.imp();
let item = { let item = {
let mut state_guard = self_.state.lock().unwrap(); let mut state_guard = self_.state.lock().unwrap();
@ -1289,7 +1289,7 @@ impl UriPlaylistBin {
Some(element) => element, Some(element) => element,
None => return gst::PadProbeReturn::Remove, None => return gst::PadProbeReturn::Remove,
}; };
let self_ = UriPlaylistBin::from_instance(&element); let self_ = element.imp();
let item = { let item = {
let mut state_guard = self_.state.lock().unwrap(); let mut state_guard = self_.state.lock().unwrap();
@ -1427,7 +1427,7 @@ impl UriPlaylistBin {
item.index() item.index()
); );
let self_ = UriPlaylistBin::from_instance(&element); let self_ = element.imp();
{ {
let mut state_guard = self_.state.lock().unwrap(); let mut state_guard = self_.state.lock().unwrap();
let state = state_guard.as_mut().unwrap(); let state = state_guard.as_mut().unwrap();

View file

@ -626,7 +626,7 @@ impl MccParse {
} }
}; };
let parse = Self::from_instance(&element); let parse = element.imp();
parse.loop_fn(&element); parse.loop_fn(&element);
}); });
if res.is_err() { if res.is_err() {

View file

@ -514,7 +514,7 @@ impl SccParse {
} }
}; };
let parse = Self::from_instance(&element); let parse = element.imp();
parse.loop_fn(&element); parse.loop_fn(&element);
}); });
if res.is_err() { if res.is_err() {

View file

@ -302,7 +302,7 @@ impl TranscriberBin {
Some(element) => element, Some(element) => element,
}; };
let this = TranscriberBin::from_instance(&element); let this = element.imp();
this.disable_transcription_bin(&element); this.disable_transcription_bin(&element);
@ -858,7 +858,7 @@ impl BinImpl for TranscriberBin {
bin.notify("passthrough"); bin.notify("passthrough");
drop(settings); drop(settings);
bin.call_async(move |bin| { bin.call_async(move |bin| {
let thiz = TranscriberBin::from_instance(bin); let thiz = bin.imp();
thiz.block_and_update(bin, true); thiz.block_and_update(bin, true);
}); });
} else { } else {

View file

@ -46,7 +46,7 @@ impl PaintableSink {
} }
fn pending_frame(&self) -> Option<Frame> { fn pending_frame(&self) -> Option<Frame> {
let self_ = imp::PaintableSink::from_instance(self); let self_ = self.imp();
self_.pending_frame.lock().unwrap().take() self_.pending_frame.lock().unwrap().take()
} }
@ -84,12 +84,12 @@ impl PaintableSink {
**paintable_storage = Some(paintable); **paintable_storage = Some(paintable);
let self_ = imp::PaintableSink::from_instance(self); let self_ = self.imp();
*self_.sender.lock().unwrap() = Some(sender); *self_.sender.lock().unwrap() = Some(sender);
} }
fn do_action(&self, action: SinkEvent) -> glib::Continue { fn do_action(&self, action: SinkEvent) -> glib::Continue {
let self_ = imp::PaintableSink::from_instance(self); let self_ = self.imp();
let paintable = self_.paintable.lock().unwrap().clone(); let paintable = self_.paintable.lock().unwrap().clone();
let paintable = match paintable { let paintable = match paintable {
Some(paintable) => paintable, Some(paintable) => paintable,

View file

@ -35,7 +35,7 @@ impl Default for SinkPaintable {
impl SinkPaintable { impl SinkPaintable {
pub(crate) fn handle_frame_changed(&self, frame: Option<Frame>) { pub(crate) fn handle_frame_changed(&self, frame: Option<Frame>) {
let self_ = imp::SinkPaintable::from_instance(self); let self_ = self.imp();
self_.handle_frame_changed(self, frame); self_.handle_frame_changed(self, frame);
} }
} }