From 1395d773c3f0314af851896c81fda265168fa790 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Tue, 20 Apr 2021 15:12:36 +0200 Subject: [PATCH] manual fixes remove get prefix round 2 --- examples/src/bin/encodebin.rs | 4 ++-- examples/src/bin/glfilter.rs | 2 +- examples/src/bin/rtpfecclient.rs | 2 +- examples/src/bin/rtpfecserver.rs | 2 +- examples/src/bin/transmux.rs | 2 +- examples/src/glupload.rs | 8 ++++---- gstreamer-sdp/src/sdp_media.rs | 6 +++--- gstreamer-sdp/src/sdp_message.rs | 12 ++++++------ gstreamer/src/buffer.rs | 4 ++-- gstreamer/src/bufferlist.rs | 7 ++++--- gstreamer/src/caps.rs | 4 ++-- gstreamer/src/miniobject.rs | 2 +- gstreamer/src/promise.rs | 4 ++-- tutorials/src/bin/basic-tutorial-7.rs | 4 ++-- tutorials/src/bin/basic-tutorial-8.rs | 6 +++--- 15 files changed, 35 insertions(+), 34 deletions(-) diff --git a/examples/src/bin/encodebin.rs b/examples/src/bin/encodebin.rs index d0dd1fdc8..530d9a1d2 100644 --- a/examples/src/bin/encodebin.rs +++ b/examples/src/bin/encodebin.rs @@ -185,7 +185,7 @@ fn example_main() -> Result<(), Error> { // The encodebin will then automatically create an internal pipeline, that encodes // the audio stream in the format we specified in the EncodingProfile. let enc_sink_pad = encodebin - .request_pad("audio_%u") + .request_pad_simple("audio_%u") .expect("Could not get audio pad from encodebin"); let src_pad = resample.static_pad("src").expect("resample has no srcpad"); src_pad.link(&enc_sink_pad)?; @@ -216,7 +216,7 @@ fn example_main() -> Result<(), Error> { // The encodebin will then automatically create an internal pipeline, that encodes // the audio stream in the format we specified in the EncodingProfile. let enc_sink_pad = encodebin - .request_pad("video_%u") + .request_pad_simple("video_%u") .expect("Could not get video pad from encodebin"); let src_pad = scale.static_pad("src").expect("videoscale has no srcpad"); src_pad.link(&enc_sink_pad)?; diff --git a/examples/src/bin/glfilter.rs b/examples/src/bin/glfilter.rs index 9676e3033..34c6a28e6 100644 --- a/examples/src/bin/glfilter.rs +++ b/examples/src/bin/glfilter.rs @@ -129,7 +129,7 @@ mod mirror { fn gl_start(&self, filter: &Self::Type) -> Result<(), gst::LoggableError> { // Create a shader when GL is started, knowing that the OpenGL context is // available. - let context = filter.context().unwrap(); + let context = GLBaseFilterExt::context(filter).unwrap(); self.create_shader(filter, &context)?; self.parent_gl_start(filter) } diff --git a/examples/src/bin/rtpfecclient.rs b/examples/src/bin/rtpfecclient.rs index 9af57ad5a..579405614 100644 --- a/examples/src/bin/rtpfecclient.rs +++ b/examples/src/bin/rtpfecclient.rs @@ -55,7 +55,7 @@ fn static_pad(element: &gst::Element, pad_name: &'static str) -> Result Result { - match element.request_pad(pad_name) { + match element.request_pad_simple(pad_name) { Some(pad) => Ok(pad), None => { let element_name = element.name(); diff --git a/examples/src/bin/rtpfecserver.rs b/examples/src/bin/rtpfecserver.rs index 48cf4b5e2..a8b92e4a9 100644 --- a/examples/src/bin/rtpfecserver.rs +++ b/examples/src/bin/rtpfecserver.rs @@ -51,7 +51,7 @@ fn static_pad(element: &gst::Element, pad_name: &'static str) -> Result Result { - match element.request_pad(pad_name) { + match element.request_pad_simple(pad_name) { Some(pad) => Ok(pad), None => { let element_name = element.name(); diff --git a/examples/src/bin/transmux.rs b/examples/src/bin/transmux.rs index 9f1fbbde0..9c3c8fa87 100644 --- a/examples/src/bin/transmux.rs +++ b/examples/src/bin/transmux.rs @@ -195,7 +195,7 @@ fn handle_demux_pad_added( // For that, we need to request a sink pad that fits our needs. let link_to_muxer = || -> Result<(), Error> { let queue_sink_pad = queue - .request_pad("sink_%u") + .request_pad_simple("sink_%u") .expect("If this happened, something is terribly wrong"); demux_src_pad.link(&queue_sink_pad)?; // Now that we requested a sink pad fitting our needs from the multiqueue, diff --git a/examples/src/glupload.rs b/examples/src/glupload.rs index 18c838fe5..9cb4848b0 100644 --- a/examples/src/glupload.rs +++ b/examples/src/glupload.rs @@ -190,7 +190,7 @@ impl Gl { } fn load(gl_context: &glutin::WindowedContext) -> Gl { - let gl = gl::Gl::load_with(|ptr| gl_context.proc_address(ptr) as *const _); + let gl = gl::Gl::load_with(|ptr| gl_context.get_proc_address(ptr) as *const _); let version = unsafe { let data = CStr::from_ptr(gl.GetString(gl::VERSION) as *const _) @@ -353,7 +353,7 @@ impl App { use glutin::platform::unix::WindowExtUnix; use glutin::platform::ContextTraitExt; - let api = App::map_gl_api(windowed_context.api()); + let api = App::map_gl_api(windowed_context.get_api()); let (gl_context, gl_display, platform) = match unsafe { windowed_context.raw_handle() } { @@ -362,7 +362,7 @@ impl App { let mut gl_display = None; #[cfg(feature = "gst-gl-egl")] - if let Some(display) = unsafe { windowed_context.egl_display() } { + if let Some(display) = unsafe { windowed_context.get_egl_display() } { gl_display = Some( unsafe { gst_gl_egl::GLDisplayEGL::with_egl_display(display as usize) } .unwrap() @@ -625,7 +625,7 @@ pub(crate) fn main_loop(app: App) -> Result<(), Error> { println!( "Pixel format of the window's GL context {:?}", - app.windowed_context.pixel_format() + app.windowed_context.get_pixel_format() ); let gl = load(&app.windowed_context); diff --git a/gstreamer-sdp/src/sdp_media.rs b/gstreamer-sdp/src/sdp_media.rs index ddd0a03fb..4c42a6014 100644 --- a/gstreamer-sdp/src/sdp_media.rs +++ b/gstreamer-sdp/src/sdp_media.rs @@ -606,7 +606,7 @@ macro_rules! define_iter( impl<'a> $name<'a> { fn new(media: &'a SDPMediaRef) -> $name<'a> { skip_assert_initialized!(); - let len = $len(media); + let len = $get_len(media); $name { media, @@ -624,7 +624,7 @@ macro_rules! define_iter( return None; } - let item = $item(self.media, self.idx)?; + let item = $get_item(self.media, self.idx)?; self.idx += 1; Some(item) } @@ -648,7 +648,7 @@ macro_rules! define_iter( self.len -= 1; - $item(self.media, self.len) + $get_item(self.media, self.len) } } diff --git a/gstreamer-sdp/src/sdp_message.rs b/gstreamer-sdp/src/sdp_message.rs index 7c1ef0ce7..485e6a27e 100644 --- a/gstreamer-sdp/src/sdp_message.rs +++ b/gstreamer-sdp/src/sdp_message.rs @@ -927,7 +927,7 @@ macro_rules! define_iter( impl<'a> $name<'a> { fn new(message: &'a SDPMessageRef) -> $name<'a> { skip_assert_initialized!(); - let len = $len(message); + let len = $get_len(message); $name { message, @@ -945,7 +945,7 @@ macro_rules! define_iter( return None; } - let item = $item(self.message, self.idx)?; + let item = $get_item(self.message, self.idx)?; self.idx += 1; Some(item) } @@ -969,7 +969,7 @@ macro_rules! define_iter( self.len -= 1; - $item(self.message, self.len) + $get_item(self.message, self.len) } } @@ -989,7 +989,7 @@ macro_rules! define_iter_mut( impl<'a> $name<'a> { fn new(message: &'a mut SDPMessageRef) -> $name<'a> { skip_assert_initialized!(); - let len = $len(message); + let len = $get_len(message); $name { message, @@ -1019,7 +1019,7 @@ macro_rules! define_iter_mut( return None; } - let item = $item(message, self.idx)?; + let item = $get_item(message, self.idx)?; self.idx += 1; Some(item) } @@ -1046,7 +1046,7 @@ macro_rules! define_iter_mut( self.len -= 1; - $item(message, self.len) + $get_item(message, self.len) } } diff --git a/gstreamer/src/buffer.rs b/gstreamer/src/buffer.rs index a51057fdd..b5514845f 100644 --- a/gstreamer/src/buffer.rs +++ b/gstreamer/src/buffer.rs @@ -797,7 +797,7 @@ macro_rules! define_iter( #[allow(unused_unsafe)] unsafe { - let item = $item(self.buffer, self.idx)?; + let item = $get_item(self.buffer, self.idx)?; self.idx += 1; Some(item) } @@ -824,7 +824,7 @@ macro_rules! define_iter( #[allow(unused_unsafe)] unsafe { - $item(self.buffer, self.n_memory) + $get_item(self.buffer, self.n_memory) } } } diff --git a/gstreamer/src/bufferlist.rs b/gstreamer/src/bufferlist.rs index 2ac5c4c97..e20030e7b 100644 --- a/gstreamer/src/bufferlist.rs +++ b/gstreamer/src/bufferlist.rs @@ -62,7 +62,8 @@ impl BufferListRef { #[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] - pub fn writable(&mut self, idx: u32) -> Option<&mut BufferRef> { + #[doc(alias = "gst_buffer_list_get_writable")] + pub fn get_mut(&mut self, idx: u32) -> Option<&mut BufferRef> { unsafe { let ptr = ffi::gst_buffer_list_get_writable(self.as_mut_ptr(), idx); if ptr.is_null() { @@ -218,7 +219,7 @@ macro_rules! define_iter( return None; } - let item = $item(self.list, self.idx)?; + let item = $get_item(self.list, self.idx)?; self.idx += 1; Some(item) @@ -242,7 +243,7 @@ macro_rules! define_iter( } self.size -= 1; - $item(self.list, self.size) + $get_item(self.list, self.size) } } diff --git a/gstreamer/src/caps.rs b/gstreamer/src/caps.rs index 17b970cc3..f22c19620 100644 --- a/gstreamer/src/caps.rs +++ b/gstreamer/src/caps.rs @@ -422,7 +422,7 @@ macro_rules! define_iter( } unsafe { - let item = $item(self.caps, self.idx)?; + let item = $get_item(self.caps, self.idx)?; self.idx += 1; Some(item) } @@ -448,7 +448,7 @@ macro_rules! define_iter( self.n_structures -= 1; unsafe { - $item(self.caps, self.n_structures) + $get_item(self.caps, self.n_structures) } } } diff --git a/gstreamer/src/miniobject.rs b/gstreamer/src/miniobject.rs index 42140ef07..6825a0f82 100644 --- a/gstreamer/src/miniobject.rs +++ b/gstreamer/src/miniobject.rs @@ -420,7 +420,7 @@ macro_rules! mini_object_wrapper ( impl $crate::glib::types::StaticType for $ref_name { fn static_type() -> $crate::glib::types::Type { - unsafe { $crate::glib::translate::from_glib($type_()) } + unsafe { $crate::glib::translate::from_glib($get_type()) } } } diff --git a/gstreamer/src/promise.rs b/gstreamer/src/promise.rs index b7062478f..b0c880ad7 100644 --- a/gstreamer/src/promise.rs +++ b/gstreamer/src/promise.rs @@ -53,7 +53,7 @@ impl Promise { let promise: Borrowed = from_glib_borrow(promise); let res = match promise.wait() { - PromiseResult::Replied => Ok(promise.reply()), + PromiseResult::Replied => Ok(promise.get_reply()), PromiseResult::Interrupted => Err(PromiseError::Interrupted), PromiseResult::Expired => Err(PromiseError::Expired), PromiseResult::Pending => { @@ -103,7 +103,7 @@ impl Promise { } } - pub fn reply(&self) -> Option<&StructureRef> { + pub fn get_reply(&self) -> Option<&StructureRef> { unsafe { let s = ffi::gst_promise_get_reply(self.to_glib_none().0); if s.is_null() { diff --git a/tutorials/src/bin/basic-tutorial-7.rs b/tutorials/src/bin/basic-tutorial-7.rs index 6341c4649..8aa5f0d93 100644 --- a/tutorials/src/bin/basic-tutorial-7.rs +++ b/tutorials/src/bin/basic-tutorial-7.rs @@ -47,7 +47,7 @@ fn tutorial_main() { gst::Element::link_many(&[&audio_queue, &audio_convert, &audio_resample, &audio_sink]).unwrap(); gst::Element::link_many(&[&video_queue, &visual, &video_convert, &video_sink]).unwrap(); - let tee_audio_pad = tee.request_pad("src_%u").unwrap(); + let tee_audio_pad = tee.request_pad_simple("src_%u").unwrap(); println!( "Obtained request pad {} for audio branch", tee_audio_pad.name() @@ -55,7 +55,7 @@ fn tutorial_main() { let queue_audio_pad = audio_queue.static_pad("sink").unwrap(); tee_audio_pad.link(&queue_audio_pad).unwrap(); - let tee_video_pad = tee.request_pad("src_%u").unwrap(); + let tee_video_pad = tee.request_pad_simple("src_%u").unwrap(); println!( "Obtained request pad {} for video branch", tee_video_pad.name() diff --git a/tutorials/src/bin/basic-tutorial-8.rs b/tutorials/src/bin/basic-tutorial-8.rs index d7f3841bf..034708087 100644 --- a/tutorials/src/bin/basic-tutorial-8.rs +++ b/tutorials/src/bin/basic-tutorial-8.rs @@ -98,7 +98,7 @@ fn main() { .unwrap(); gst::Element::link_many(&[&app_queue, &appsink]).unwrap(); - let tee_audio_pad = tee.request_pad("src_%u").unwrap(); + let tee_audio_pad = tee.request_pad_simple("src_%u").unwrap(); println!( "Obtained request pad {} for audio branch", tee_audio_pad.name() @@ -106,14 +106,14 @@ fn main() { let queue_audio_pad = audio_queue.static_pad("sink").unwrap(); tee_audio_pad.link(&queue_audio_pad).unwrap(); - let tee_video_pad = tee.request_pad("src_%u").unwrap(); + let tee_video_pad = tee.request_pad_simple("src_%u").unwrap(); println!( "Obtained request pad {} for video branch", tee_video_pad.name() ); let queue_video_pad = video_queue.static_pad("sink").unwrap(); tee_video_pad.link(&queue_video_pad).unwrap(); - let tee_app_pad = tee.request_pad("src_%u").unwrap(); + let tee_app_pad = tee.request_pad_simple("src_%u").unwrap(); let queue_app_pad = app_queue.static_pad("sink").unwrap(); tee_app_pad.link(&queue_app_pad).unwrap();