manual fixes remove get prefix round 2

This commit is contained in:
François Laignel 2021-04-20 15:12:36 +02:00
parent 6ab9164dca
commit 1395d773c3
15 changed files with 35 additions and 34 deletions

View file

@ -185,7 +185,7 @@ fn example_main() -> Result<(), Error> {
// The encodebin will then automatically create an internal pipeline, that encodes // The encodebin will then automatically create an internal pipeline, that encodes
// the audio stream in the format we specified in the EncodingProfile. // the audio stream in the format we specified in the EncodingProfile.
let enc_sink_pad = encodebin let enc_sink_pad = encodebin
.request_pad("audio_%u") .request_pad_simple("audio_%u")
.expect("Could not get audio pad from encodebin"); .expect("Could not get audio pad from encodebin");
let src_pad = resample.static_pad("src").expect("resample has no srcpad"); let src_pad = resample.static_pad("src").expect("resample has no srcpad");
src_pad.link(&enc_sink_pad)?; 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 encodebin will then automatically create an internal pipeline, that encodes
// the audio stream in the format we specified in the EncodingProfile. // the audio stream in the format we specified in the EncodingProfile.
let enc_sink_pad = encodebin let enc_sink_pad = encodebin
.request_pad("video_%u") .request_pad_simple("video_%u")
.expect("Could not get video pad from encodebin"); .expect("Could not get video pad from encodebin");
let src_pad = scale.static_pad("src").expect("videoscale has no srcpad"); let src_pad = scale.static_pad("src").expect("videoscale has no srcpad");
src_pad.link(&enc_sink_pad)?; src_pad.link(&enc_sink_pad)?;

View file

@ -129,7 +129,7 @@ mod mirror {
fn gl_start(&self, filter: &Self::Type) -> Result<(), gst::LoggableError> { fn gl_start(&self, filter: &Self::Type) -> Result<(), gst::LoggableError> {
// Create a shader when GL is started, knowing that the OpenGL context is // Create a shader when GL is started, knowing that the OpenGL context is
// available. // available.
let context = filter.context().unwrap(); let context = GLBaseFilterExt::context(filter).unwrap();
self.create_shader(filter, &context)?; self.create_shader(filter, &context)?;
self.parent_gl_start(filter) self.parent_gl_start(filter)
} }

View file

@ -55,7 +55,7 @@ fn static_pad(element: &gst::Element, pad_name: &'static str) -> Result<gst::Pad
} }
fn request_pad(element: &gst::Element, pad_name: &'static str) -> Result<gst::Pad, Error> { fn request_pad(element: &gst::Element, pad_name: &'static str) -> Result<gst::Pad, Error> {
match element.request_pad(pad_name) { match element.request_pad_simple(pad_name) {
Some(pad) => Ok(pad), Some(pad) => Ok(pad),
None => { None => {
let element_name = element.name(); let element_name = element.name();

View file

@ -51,7 +51,7 @@ fn static_pad(element: &gst::Element, pad_name: &'static str) -> Result<gst::Pad
} }
fn request_pad(element: &gst::Element, pad_name: &'static str) -> Result<gst::Pad, Error> { fn request_pad(element: &gst::Element, pad_name: &'static str) -> Result<gst::Pad, Error> {
match element.request_pad(pad_name) { match element.request_pad_simple(pad_name) {
Some(pad) => Ok(pad), Some(pad) => Ok(pad),
None => { None => {
let element_name = element.name(); let element_name = element.name();

View file

@ -195,7 +195,7 @@ fn handle_demux_pad_added(
// For that, we need to request a sink pad that fits our needs. // For that, we need to request a sink pad that fits our needs.
let link_to_muxer = || -> Result<(), Error> { let link_to_muxer = || -> Result<(), Error> {
let queue_sink_pad = queue let queue_sink_pad = queue
.request_pad("sink_%u") .request_pad_simple("sink_%u")
.expect("If this happened, something is terribly wrong"); .expect("If this happened, something is terribly wrong");
demux_src_pad.link(&queue_sink_pad)?; demux_src_pad.link(&queue_sink_pad)?;
// Now that we requested a sink pad fitting our needs from the multiqueue, // Now that we requested a sink pad fitting our needs from the multiqueue,

View file

@ -190,7 +190,7 @@ impl Gl {
} }
fn load(gl_context: &glutin::WindowedContext<glutin::PossiblyCurrent>) -> Gl { fn load(gl_context: &glutin::WindowedContext<glutin::PossiblyCurrent>) -> 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 version = unsafe {
let data = CStr::from_ptr(gl.GetString(gl::VERSION) as *const _) 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::unix::WindowExtUnix;
use glutin::platform::ContextTraitExt; 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() } let (gl_context, gl_display, platform) = match unsafe { windowed_context.raw_handle() }
{ {
@ -362,7 +362,7 @@ impl App {
let mut gl_display = None; let mut gl_display = None;
#[cfg(feature = "gst-gl-egl")] #[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( gl_display = Some(
unsafe { gst_gl_egl::GLDisplayEGL::with_egl_display(display as usize) } unsafe { gst_gl_egl::GLDisplayEGL::with_egl_display(display as usize) }
.unwrap() .unwrap()
@ -625,7 +625,7 @@ pub(crate) fn main_loop(app: App) -> Result<(), Error> {
println!( println!(
"Pixel format of the window's GL context {:?}", "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); let gl = load(&app.windowed_context);

View file

@ -606,7 +606,7 @@ macro_rules! define_iter(
impl<'a> $name<'a> { impl<'a> $name<'a> {
fn new(media: &'a SDPMediaRef) -> $name<'a> { fn new(media: &'a SDPMediaRef) -> $name<'a> {
skip_assert_initialized!(); skip_assert_initialized!();
let len = $len(media); let len = $get_len(media);
$name { $name {
media, media,
@ -624,7 +624,7 @@ macro_rules! define_iter(
return None; return None;
} }
let item = $item(self.media, self.idx)?; let item = $get_item(self.media, self.idx)?;
self.idx += 1; self.idx += 1;
Some(item) Some(item)
} }
@ -648,7 +648,7 @@ macro_rules! define_iter(
self.len -= 1; self.len -= 1;
$item(self.media, self.len) $get_item(self.media, self.len)
} }
} }

View file

@ -927,7 +927,7 @@ macro_rules! define_iter(
impl<'a> $name<'a> { impl<'a> $name<'a> {
fn new(message: &'a SDPMessageRef) -> $name<'a> { fn new(message: &'a SDPMessageRef) -> $name<'a> {
skip_assert_initialized!(); skip_assert_initialized!();
let len = $len(message); let len = $get_len(message);
$name { $name {
message, message,
@ -945,7 +945,7 @@ macro_rules! define_iter(
return None; return None;
} }
let item = $item(self.message, self.idx)?; let item = $get_item(self.message, self.idx)?;
self.idx += 1; self.idx += 1;
Some(item) Some(item)
} }
@ -969,7 +969,7 @@ macro_rules! define_iter(
self.len -= 1; 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> { impl<'a> $name<'a> {
fn new(message: &'a mut SDPMessageRef) -> $name<'a> { fn new(message: &'a mut SDPMessageRef) -> $name<'a> {
skip_assert_initialized!(); skip_assert_initialized!();
let len = $len(message); let len = $get_len(message);
$name { $name {
message, message,
@ -1019,7 +1019,7 @@ macro_rules! define_iter_mut(
return None; return None;
} }
let item = $item(message, self.idx)?; let item = $get_item(message, self.idx)?;
self.idx += 1; self.idx += 1;
Some(item) Some(item)
} }
@ -1046,7 +1046,7 @@ macro_rules! define_iter_mut(
self.len -= 1; self.len -= 1;
$item(message, self.len) $get_item(message, self.len)
} }
} }

View file

@ -797,7 +797,7 @@ macro_rules! define_iter(
#[allow(unused_unsafe)] #[allow(unused_unsafe)]
unsafe { unsafe {
let item = $item(self.buffer, self.idx)?; let item = $get_item(self.buffer, self.idx)?;
self.idx += 1; self.idx += 1;
Some(item) Some(item)
} }
@ -824,7 +824,7 @@ macro_rules! define_iter(
#[allow(unused_unsafe)] #[allow(unused_unsafe)]
unsafe { unsafe {
$item(self.buffer, self.n_memory) $get_item(self.buffer, self.n_memory)
} }
} }
} }

View file

@ -62,7 +62,8 @@ impl BufferListRef {
#[cfg(any(feature = "v1_14", feature = "dox"))] #[cfg(any(feature = "v1_14", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v1_14")))] #[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 { unsafe {
let ptr = ffi::gst_buffer_list_get_writable(self.as_mut_ptr(), idx); let ptr = ffi::gst_buffer_list_get_writable(self.as_mut_ptr(), idx);
if ptr.is_null() { if ptr.is_null() {
@ -218,7 +219,7 @@ macro_rules! define_iter(
return None; return None;
} }
let item = $item(self.list, self.idx)?; let item = $get_item(self.list, self.idx)?;
self.idx += 1; self.idx += 1;
Some(item) Some(item)
@ -242,7 +243,7 @@ macro_rules! define_iter(
} }
self.size -= 1; self.size -= 1;
$item(self.list, self.size) $get_item(self.list, self.size)
} }
} }

View file

@ -422,7 +422,7 @@ macro_rules! define_iter(
} }
unsafe { unsafe {
let item = $item(self.caps, self.idx)?; let item = $get_item(self.caps, self.idx)?;
self.idx += 1; self.idx += 1;
Some(item) Some(item)
} }
@ -448,7 +448,7 @@ macro_rules! define_iter(
self.n_structures -= 1; self.n_structures -= 1;
unsafe { unsafe {
$item(self.caps, self.n_structures) $get_item(self.caps, self.n_structures)
} }
} }
} }

View file

@ -420,7 +420,7 @@ macro_rules! mini_object_wrapper (
impl $crate::glib::types::StaticType for $ref_name { impl $crate::glib::types::StaticType for $ref_name {
fn static_type() -> $crate::glib::types::Type { fn static_type() -> $crate::glib::types::Type {
unsafe { $crate::glib::translate::from_glib($type_()) } unsafe { $crate::glib::translate::from_glib($get_type()) }
} }
} }

View file

@ -53,7 +53,7 @@ impl Promise {
let promise: Borrowed<Promise> = from_glib_borrow(promise); let promise: Borrowed<Promise> = from_glib_borrow(promise);
let res = match promise.wait() { let res = match promise.wait() {
PromiseResult::Replied => Ok(promise.reply()), PromiseResult::Replied => Ok(promise.get_reply()),
PromiseResult::Interrupted => Err(PromiseError::Interrupted), PromiseResult::Interrupted => Err(PromiseError::Interrupted),
PromiseResult::Expired => Err(PromiseError::Expired), PromiseResult::Expired => Err(PromiseError::Expired),
PromiseResult::Pending => { PromiseResult::Pending => {
@ -103,7 +103,7 @@ impl Promise {
} }
} }
pub fn reply(&self) -> Option<&StructureRef> { pub fn get_reply(&self) -> Option<&StructureRef> {
unsafe { unsafe {
let s = ffi::gst_promise_get_reply(self.to_glib_none().0); let s = ffi::gst_promise_get_reply(self.to_glib_none().0);
if s.is_null() { if s.is_null() {

View file

@ -47,7 +47,7 @@ fn tutorial_main() {
gst::Element::link_many(&[&audio_queue, &audio_convert, &audio_resample, &audio_sink]).unwrap(); 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(); 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!( println!(
"Obtained request pad {} for audio branch", "Obtained request pad {} for audio branch",
tee_audio_pad.name() tee_audio_pad.name()
@ -55,7 +55,7 @@ fn tutorial_main() {
let queue_audio_pad = audio_queue.static_pad("sink").unwrap(); let queue_audio_pad = audio_queue.static_pad("sink").unwrap();
tee_audio_pad.link(&queue_audio_pad).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!( println!(
"Obtained request pad {} for video branch", "Obtained request pad {} for video branch",
tee_video_pad.name() tee_video_pad.name()

View file

@ -98,7 +98,7 @@ fn main() {
.unwrap(); .unwrap();
gst::Element::link_many(&[&app_queue, &appsink]).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!( println!(
"Obtained request pad {} for audio branch", "Obtained request pad {} for audio branch",
tee_audio_pad.name() tee_audio_pad.name()
@ -106,14 +106,14 @@ fn main() {
let queue_audio_pad = audio_queue.static_pad("sink").unwrap(); let queue_audio_pad = audio_queue.static_pad("sink").unwrap();
tee_audio_pad.link(&queue_audio_pad).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!( println!(
"Obtained request pad {} for video branch", "Obtained request pad {} for video branch",
tee_video_pad.name() tee_video_pad.name()
); );
let queue_video_pad = video_queue.static_pad("sink").unwrap(); let queue_video_pad = video_queue.static_pad("sink").unwrap();
tee_video_pad.link(&queue_video_pad).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(); let queue_app_pad = app_queue.static_pad("sink").unwrap();
tee_app_pad.link(&queue_app_pad).unwrap(); tee_app_pad.link(&queue_app_pad).unwrap();