Fix various needless-borrow clippy warnings

This commit is contained in:
Sebastian Dröge 2021-07-30 13:19:24 +03:00
parent 044a72d9f6
commit b1afc4804a
38 changed files with 257 additions and 252 deletions

View file

@ -216,7 +216,7 @@ fn example_main() -> Result<(), Error> {
None => return, None => return,
}; };
match connect_rtpbin_srcpad(&src_pad, &depay) { match connect_rtpbin_srcpad(src_pad, &depay) {
Ok(_) => (), Ok(_) => (),
Err(err) => { Err(err) => {
element_error!( element_error!(

View file

@ -63,7 +63,7 @@ fn request_pad(element: &gst::Element, pad_name: &'static str) -> Result<gst::Pa
} }
fn connect_decodebin_pad(src_pad: &gst::Pad, sink: &gst::Element) -> Result<(), Error> { fn connect_decodebin_pad(src_pad: &gst::Pad, sink: &gst::Element) -> Result<(), Error> {
let sinkpad = static_pad(&sink, "sink")?; let sinkpad = static_pad(sink, "sink")?;
src_pad.link(&sinkpad)?; src_pad.link(&sinkpad)?;
Ok(()) Ok(())
@ -136,7 +136,7 @@ fn example_main() -> Result<(), Error> {
srcpad.link(&sinkpad)?; srcpad.link(&sinkpad)?;
src.connect_pad_added( src.connect_pad_added(
move |decodebin, src_pad| match connect_decodebin_pad(&src_pad, &conv) { move |decodebin, src_pad| match connect_decodebin_pad(src_pad, &conv) {
Ok(_) => (), Ok(_) => (),
Err(err) => { Err(err) => {
element_error!( element_error!(

View file

@ -134,11 +134,11 @@ impl AppSinkCallbacksBuilder {
fn post_panic_error_message(element: &AppSink, err: &dyn std::any::Any) { fn post_panic_error_message(element: &AppSink, err: &dyn std::any::Any) {
skip_assert_initialized!(); skip_assert_initialized!();
if let Some(cause) = err.downcast_ref::<&str>() { if let Some(cause) = err.downcast_ref::<&str>() {
gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]); gst::element_error!(element, gst::LibraryError::Failed, ["Panicked: {}", cause]);
} else if let Some(cause) = err.downcast_ref::<String>() { } else if let Some(cause) = err.downcast_ref::<String>() {
gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]); gst::element_error!(element, gst::LibraryError::Failed, ["Panicked: {}", cause]);
} else { } else {
gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]);
} }
} }
@ -148,7 +148,7 @@ unsafe extern "C" fn trampoline_eos(appsink: *mut ffi::GstAppSink, callbacks: gp
if callbacks.panicked.load(Ordering::Relaxed) { if callbacks.panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]);
return; return;
} }
@ -175,7 +175,7 @@ unsafe extern "C" fn trampoline_new_preroll(
if callbacks.panicked.load(Ordering::Relaxed) { if callbacks.panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]);
return gst::FlowReturn::Error.into_glib(); return gst::FlowReturn::Error.into_glib();
} }
@ -208,7 +208,7 @@ unsafe extern "C" fn trampoline_new_sample(
if callbacks.panicked.load(Ordering::Relaxed) { if callbacks.panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSink> = from_glib_borrow(appsink); let element: Borrowed<AppSink> = from_glib_borrow(appsink);
gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]);
return gst::FlowReturn::Error.into_glib(); return gst::FlowReturn::Error.into_glib();
} }
@ -533,7 +533,7 @@ impl AppSink {
f: glib::ffi::gpointer, f: glib::ffi::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) f(AppSink::from_glib_borrow(this).unsafe_cast_ref())
} }
unsafe { unsafe {
let f: Box<F> = Box::new(f); let f: Box<F> = Box::new(f);
@ -561,7 +561,7 @@ impl AppSink {
f: glib::ffi::gpointer, f: glib::ffi::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) f(AppSink::from_glib_borrow(this).unsafe_cast_ref())
} }
unsafe { unsafe {
let f: Box<F> = Box::new(f); let f: Box<F> = Box::new(f);
@ -589,7 +589,7 @@ impl AppSink {
f: glib::ffi::gpointer, f: glib::ffi::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) f(AppSink::from_glib_borrow(this).unsafe_cast_ref())
} }
unsafe { unsafe {
let f: Box<F> = Box::new(f); let f: Box<F> = Box::new(f);
@ -617,7 +617,7 @@ impl AppSink {
f: glib::ffi::gpointer, f: glib::ffi::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) f(AppSink::from_glib_borrow(this).unsafe_cast_ref())
} }
unsafe { unsafe {
let f: Box<F> = Box::new(f); let f: Box<F> = Box::new(f);
@ -645,7 +645,7 @@ impl AppSink {
f: glib::ffi::gpointer, f: glib::ffi::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) f(AppSink::from_glib_borrow(this).unsafe_cast_ref())
} }
unsafe { unsafe {
let f: Box<F> = Box::new(f); let f: Box<F> = Box::new(f);
@ -673,7 +673,7 @@ impl AppSink {
f: glib::ffi::gpointer, f: glib::ffi::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) f(AppSink::from_glib_borrow(this).unsafe_cast_ref())
} }
unsafe { unsafe {
let f: Box<F> = Box::new(f); let f: Box<F> = Box::new(f);
@ -703,7 +703,7 @@ impl AppSink {
f: glib::ffi::gpointer, f: glib::ffi::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) f(AppSink::from_glib_borrow(this).unsafe_cast_ref())
} }
unsafe { unsafe {
let f: Box<F> = Box::new(f); let f: Box<F> = Box::new(f);
@ -729,7 +729,7 @@ impl AppSink {
f: glib::ffi::gpointer, f: glib::ffi::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) f(AppSink::from_glib_borrow(this).unsafe_cast_ref())
} }
unsafe { unsafe {
let f: Box<F> = Box::new(f); let f: Box<F> = Box::new(f);
@ -757,7 +757,7 @@ impl AppSink {
f: glib::ffi::gpointer, f: glib::ffi::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) f(AppSink::from_glib_borrow(this).unsafe_cast_ref())
} }
unsafe { unsafe {
let f: Box<F> = Box::new(f); let f: Box<F> = Box::new(f);
@ -785,7 +785,7 @@ impl AppSink {
f: glib::ffi::gpointer, f: glib::ffi::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) f(AppSink::from_glib_borrow(this).unsafe_cast_ref())
} }
unsafe { unsafe {
let f: Box<F> = Box::new(f); let f: Box<F> = Box::new(f);
@ -811,7 +811,7 @@ impl AppSink {
f: glib::ffi::gpointer, f: glib::ffi::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) f(AppSink::from_glib_borrow(this).unsafe_cast_ref())
} }
unsafe { unsafe {
let f: Box<F> = Box::new(f); let f: Box<F> = Box::new(f);
@ -839,7 +839,7 @@ impl AppSink {
f: glib::ffi::gpointer, f: glib::ffi::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) f(AppSink::from_glib_borrow(this).unsafe_cast_ref())
} }
unsafe { unsafe {
let f: Box<F> = Box::new(f); let f: Box<F> = Box::new(f);
@ -867,7 +867,7 @@ impl AppSink {
f: glib::ffi::gpointer, f: glib::ffi::gpointer,
) { ) {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&AppSink::from_glib_borrow(this).unsafe_cast_ref()) f(AppSink::from_glib_borrow(this).unsafe_cast_ref())
} }
unsafe { unsafe {
let f: Box<F> = Box::new(f); let f: Box<F> = Box::new(f);

View file

@ -111,11 +111,11 @@ impl AppSrcCallbacksBuilder {
fn post_panic_error_message(element: &AppSrc, err: &dyn std::any::Any) { fn post_panic_error_message(element: &AppSrc, err: &dyn std::any::Any) {
skip_assert_initialized!(); skip_assert_initialized!();
if let Some(cause) = err.downcast_ref::<&str>() { if let Some(cause) = err.downcast_ref::<&str>() {
gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]); gst::element_error!(element, gst::LibraryError::Failed, ["Panicked: {}", cause]);
} else if let Some(cause) = err.downcast_ref::<String>() { } else if let Some(cause) = err.downcast_ref::<String>() {
gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked: {}", cause]); gst::element_error!(element, gst::LibraryError::Failed, ["Panicked: {}", cause]);
} else { } else {
gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]);
} }
} }
@ -129,7 +129,7 @@ unsafe extern "C" fn trampoline_need_data(
if callbacks.panicked.load(Ordering::Relaxed) { if callbacks.panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc); let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]);
return; return;
} }
@ -153,7 +153,7 @@ unsafe extern "C" fn trampoline_enough_data(appsrc: *mut ffi::GstAppSrc, callbac
if callbacks.panicked.load(Ordering::Relaxed) { if callbacks.panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc); let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]);
return; return;
} }
@ -179,7 +179,7 @@ unsafe extern "C" fn trampoline_seek_data(
if callbacks.panicked.load(Ordering::Relaxed) { if callbacks.panicked.load(Ordering::Relaxed) {
let element: Borrowed<AppSrc> = from_glib_borrow(appsrc); let element: Borrowed<AppSrc> = from_glib_borrow(appsrc);
gst::element_error!(&element, gst::LibraryError::Failed, ["Panicked"]); gst::element_error!(element, gst::LibraryError::Failed, ["Panicked"]);
return false.into_glib(); return false.into_glib();
} }

View file

@ -23,6 +23,7 @@ macro_rules! skip_assert_initialized {
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
#[allow(clippy::match_same_arms)] #[allow(clippy::match_same_arms)]
#[allow(clippy::use_self)] #[allow(clippy::use_self)]
#[allow(clippy::needless_borrow)]
mod auto; mod auto;
pub use crate::auto::*; pub use crate::auto::*;

View file

@ -555,7 +555,7 @@ unsafe extern "C" fn audio_decoder_open<T: AudioDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.open(wrap.unsafe_cast_ref()) { match imp.open(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -574,7 +574,7 @@ unsafe extern "C" fn audio_decoder_close<T: AudioDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.close(wrap.unsafe_cast_ref()) { match imp.close(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -593,7 +593,7 @@ unsafe extern "C" fn audio_decoder_start<T: AudioDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -612,7 +612,7 @@ unsafe extern "C" fn audio_decoder_stop<T: AudioDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -632,7 +632,7 @@ unsafe extern "C" fn audio_decoder_set_format<T: AudioDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.set_format(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) { match imp.set_format(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -654,7 +654,7 @@ unsafe extern "C" fn audio_decoder_parse<T: AudioDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
match imp.parse(wrap.unsafe_cast_ref(), &from_glib_borrow(adapter)) { match imp.parse(wrap.unsafe_cast_ref(), &from_glib_borrow(adapter)) {
Ok((new_offset, new_len)) => { Ok((new_offset, new_len)) => {
assert!(new_offset <= std::i32::MAX as u32); assert!(new_offset <= std::i32::MAX as u32);
@ -680,7 +680,7 @@ unsafe extern "C" fn audio_decoder_handle_frame<T: AudioDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.handle_frame( imp.handle_frame(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
Option::<gst::Buffer>::from_glib_none(buffer).as_ref(), Option::<gst::Buffer>::from_glib_none(buffer).as_ref(),
@ -698,7 +698,7 @@ unsafe extern "C" fn audio_decoder_pre_push<T: AudioDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
match imp.pre_push(wrap.unsafe_cast_ref(), from_glib_full(*buffer)) { match imp.pre_push(wrap.unsafe_cast_ref(), from_glib_full(*buffer)) {
Ok(Some(new_buffer)) => { Ok(Some(new_buffer)) => {
*buffer = new_buffer.into_ptr(); *buffer = new_buffer.into_ptr();
@ -723,7 +723,7 @@ unsafe extern "C" fn audio_decoder_flush<T: AudioDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), (), { gst::panic_to_error!(&wrap, imp.panicked(), (), {
AudioDecoderImpl::flush(imp, wrap.unsafe_cast_ref(), from_glib(hard)) AudioDecoderImpl::flush(imp, wrap.unsafe_cast_ref(), from_glib(hard))
}) })
} }
@ -735,7 +735,7 @@ unsafe extern "C" fn audio_decoder_negotiate<T: AudioDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.negotiate(wrap.unsafe_cast_ref()) { match imp.negotiate(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -755,7 +755,7 @@ unsafe extern "C" fn audio_decoder_getcaps<T: AudioDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), {
AudioDecoderImpl::caps( AudioDecoderImpl::caps(
imp, imp,
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
@ -775,7 +775,7 @@ unsafe extern "C" fn audio_decoder_sink_event<T: AudioDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.into_glib() .into_glib()
@ -789,7 +789,7 @@ unsafe extern "C" fn audio_decoder_sink_query<T: AudioDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.into_glib() .into_glib()
@ -803,7 +803,7 @@ unsafe extern "C" fn audio_decoder_src_event<T: AudioDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.into_glib() .into_glib()
@ -817,7 +817,7 @@ unsafe extern "C" fn audio_decoder_src_query<T: AudioDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.into_glib() .into_glib()
@ -832,7 +832,7 @@ unsafe extern "C" fn audio_decoder_propose_allocation<T: AudioDecoderImpl>(
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -853,7 +853,7 @@ unsafe extern "C" fn audio_decoder_decide_allocation<T: AudioDecoderImpl>(
let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioDecoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {

View file

@ -504,7 +504,7 @@ unsafe extern "C" fn audio_encoder_open<T: AudioEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.open(wrap.unsafe_cast_ref()) { match imp.open(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -523,7 +523,7 @@ unsafe extern "C" fn audio_encoder_close<T: AudioEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.close(wrap.unsafe_cast_ref()) { match imp.close(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -542,7 +542,7 @@ unsafe extern "C" fn audio_encoder_start<T: AudioEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -561,7 +561,7 @@ unsafe extern "C" fn audio_encoder_stop<T: AudioEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -581,7 +581,7 @@ unsafe extern "C" fn audio_encoder_set_format<T: AudioEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.set_format(wrap.unsafe_cast_ref(), &from_glib_none(info)) { match imp.set_format(wrap.unsafe_cast_ref(), &from_glib_none(info)) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -603,7 +603,7 @@ unsafe extern "C" fn audio_encoder_handle_frame<T: AudioEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.handle_frame( imp.handle_frame(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
Option::<gst::Buffer>::from_glib_none(buffer).as_ref(), Option::<gst::Buffer>::from_glib_none(buffer).as_ref(),
@ -621,7 +621,7 @@ unsafe extern "C" fn audio_encoder_pre_push<T: AudioEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
match imp.pre_push(wrap.unsafe_cast_ref(), from_glib_full(*buffer)) { match imp.pre_push(wrap.unsafe_cast_ref(), from_glib_full(*buffer)) {
Ok(Some(new_buffer)) => { Ok(Some(new_buffer)) => {
*buffer = new_buffer.into_ptr(); *buffer = new_buffer.into_ptr();
@ -643,7 +643,7 @@ unsafe extern "C" fn audio_encoder_flush<T: AudioEncoderImpl>(ptr: *mut ffi::Gst
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), (), { gst::panic_to_error!(&wrap, imp.panicked(), (), {
AudioEncoderImpl::flush(imp, wrap.unsafe_cast_ref()) AudioEncoderImpl::flush(imp, wrap.unsafe_cast_ref())
}) })
} }
@ -655,7 +655,7 @@ unsafe extern "C" fn audio_encoder_negotiate<T: AudioEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.negotiate(wrap.unsafe_cast_ref()) { match imp.negotiate(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -675,7 +675,7 @@ unsafe extern "C" fn audio_encoder_getcaps<T: AudioEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), {
AudioEncoderImpl::caps( AudioEncoderImpl::caps(
imp, imp,
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
@ -695,7 +695,7 @@ unsafe extern "C" fn audio_encoder_sink_event<T: AudioEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.into_glib() .into_glib()
@ -709,7 +709,7 @@ unsafe extern "C" fn audio_encoder_sink_query<T: AudioEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.into_glib() .into_glib()
@ -723,7 +723,7 @@ unsafe extern "C" fn audio_encoder_src_event<T: AudioEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.into_glib() .into_glib()
@ -737,7 +737,7 @@ unsafe extern "C" fn audio_encoder_src_query<T: AudioEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.into_glib() .into_glib()
@ -752,7 +752,7 @@ unsafe extern "C" fn audio_encoder_propose_allocation<T: AudioEncoderImpl>(
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -773,7 +773,7 @@ unsafe extern "C" fn audio_encoder_decide_allocation<T: AudioEncoderImpl>(
let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<AudioEncoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {

View file

@ -207,7 +207,7 @@ unsafe extern "C" fn audiosink_close<T: AudioSinkImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.close(wrap.unsafe_cast_ref()) { match imp.close(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -224,7 +224,7 @@ unsafe extern "C" fn audiosink_delay<T: AudioSinkImpl>(ptr: *mut ffi::GstAudioSi
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), 0, { gst::panic_to_error!(&wrap, imp.panicked(), 0, {
imp.delay(wrap.unsafe_cast_ref()) imp.delay(wrap.unsafe_cast_ref())
}) })
} }
@ -236,7 +236,7 @@ unsafe extern "C" fn audiosink_open<T: AudioSinkImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.open(wrap.unsafe_cast_ref()) { match imp.open(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -258,7 +258,7 @@ unsafe extern "C" fn audiosink_prepare<T: AudioSinkImpl>(
let spec = &mut *(spec as *mut AudioRingBufferSpec); let spec = &mut *(spec as *mut AudioRingBufferSpec);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match AudioSinkImpl::prepare(imp, wrap.unsafe_cast_ref(), spec) { match AudioSinkImpl::prepare(imp, wrap.unsafe_cast_ref(), spec) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -277,7 +277,7 @@ unsafe extern "C" fn audiosink_unprepare<T: AudioSinkImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.unprepare(wrap.unsafe_cast_ref()) { match imp.unprepare(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -299,7 +299,7 @@ unsafe extern "C" fn audiosink_write<T: AudioSinkImpl>(
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
let data_slice = std::slice::from_raw_parts(data as *const u8, length as usize); let data_slice = std::slice::from_raw_parts(data as *const u8, length as usize);
gst::panic_to_error!(&wrap, &imp.panicked(), -1, { gst::panic_to_error!(&wrap, imp.panicked(), -1, {
imp.write(wrap.unsafe_cast_ref(), data_slice).unwrap_or(-1) imp.write(wrap.unsafe_cast_ref(), data_slice).unwrap_or(-1)
}) })
} }
@ -309,7 +309,7 @@ unsafe extern "C" fn audiosink_reset<T: AudioSinkImpl>(ptr: *mut ffi::GstAudioSi
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSink> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), (), { gst::panic_to_error!(&wrap, imp.panicked(), (), {
imp.reset(wrap.unsafe_cast_ref()); imp.reset(wrap.unsafe_cast_ref());
}); });
} }

View file

@ -223,7 +223,7 @@ unsafe extern "C" fn audiosrc_close<T: AudioSrcImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.close(wrap.unsafe_cast_ref()) { match imp.close(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -240,7 +240,7 @@ unsafe extern "C" fn audiosrc_delay<T: AudioSrcImpl>(ptr: *mut ffi::GstAudioSrc)
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), 0, { gst::panic_to_error!(&wrap, imp.panicked(), 0, {
imp.delay(wrap.unsafe_cast_ref()) imp.delay(wrap.unsafe_cast_ref())
}) })
} }
@ -252,7 +252,7 @@ unsafe extern "C" fn audiosrc_open<T: AudioSrcImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.open(wrap.unsafe_cast_ref()) { match imp.open(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -274,7 +274,7 @@ unsafe extern "C" fn audiosrc_prepare<T: AudioSrcImpl>(
let spec = &mut *(spec as *mut AudioRingBufferSpec); let spec = &mut *(spec as *mut AudioRingBufferSpec);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match AudioSrcImpl::prepare(imp, wrap.unsafe_cast_ref(), spec) { match AudioSrcImpl::prepare(imp, wrap.unsafe_cast_ref(), spec) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -293,7 +293,7 @@ unsafe extern "C" fn audiosrc_unprepare<T: AudioSrcImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.unprepare(wrap.unsafe_cast_ref()) { match imp.unprepare(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -316,7 +316,7 @@ unsafe extern "C" fn audiosrc_read<T: AudioSrcImpl>(
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
let data_slice = std::slice::from_raw_parts_mut(data as *mut u8, length as usize); let data_slice = std::slice::from_raw_parts_mut(data as *mut u8, length as usize);
gst::panic_to_error!(&wrap, &imp.panicked(), 0, { gst::panic_to_error!(&wrap, imp.panicked(), 0, {
let (res, timestamp_res) = imp let (res, timestamp_res) = imp
.read(wrap.unsafe_cast_ref(), data_slice) .read(wrap.unsafe_cast_ref(), data_slice)
.unwrap_or((0, gst::ClockTime::NONE)); .unwrap_or((0, gst::ClockTime::NONE));
@ -331,7 +331,7 @@ unsafe extern "C" fn audiosrc_reset<T: AudioSrcImpl>(ptr: *mut ffi::GstAudioSrc)
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr); let wrap: Borrowed<AudioSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), (), { gst::panic_to_error!(&wrap, imp.panicked(), (), {
imp.reset(wrap.unsafe_cast_ref()); imp.reset(wrap.unsafe_cast_ref());
}); });
} }

View file

@ -249,7 +249,7 @@ impl<O: IsA<Aggregator>> AggregatorExtManual for O {
{ {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f( f(
&Aggregator::from_glib_borrow(this).unsafe_cast_ref(), Aggregator::from_glib_borrow(this).unsafe_cast_ref(),
&gst::Segment::from_glib_borrow(segment), &gst::Segment::from_glib_borrow(segment),
from_glib(pts), from_glib(pts),
from_glib(dts), from_glib(dts),
@ -286,5 +286,5 @@ unsafe extern "C" fn notify_min_upstream_latency_trampoline<P, F: Fn(&P) + Send
P: IsA<Aggregator>, P: IsA<Aggregator>,
{ {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&Aggregator::from_glib_borrow(this).unsafe_cast_ref()) f(Aggregator::from_glib_borrow(this).unsafe_cast_ref())
} }

View file

@ -739,7 +739,7 @@ unsafe extern "C" fn aggregator_flush<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.flush(wrap.unsafe_cast_ref()).into() imp.flush(wrap.unsafe_cast_ref()).into()
}) })
.into_glib() .into_glib()
@ -754,7 +754,7 @@ unsafe extern "C" fn aggregator_clip<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
let ret = gst::panic_to_error!(&wrap, &imp.panicked(), None, { let ret = gst::panic_to_error!(&wrap, imp.panicked(), None, {
imp.clip( imp.clip(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad), &from_glib_borrow(aggregator_pad),
@ -773,7 +773,7 @@ unsafe extern "C" fn aggregator_finish_buffer<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.finish_buffer(wrap.unsafe_cast_ref(), from_glib_full(buffer)) imp.finish_buffer(wrap.unsafe_cast_ref(), from_glib_full(buffer))
.into() .into()
}) })
@ -790,7 +790,7 @@ unsafe extern "C" fn aggregator_finish_buffer_list<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.finish_buffer_list(wrap.unsafe_cast_ref(), from_glib_full(buffer_list)) imp.finish_buffer_list(wrap.unsafe_cast_ref(), from_glib_full(buffer_list))
.into() .into()
}) })
@ -806,7 +806,7 @@ unsafe extern "C" fn aggregator_sink_event<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(wrap, &imp.panicked(), false, { gst::panic_to_error!(wrap, imp.panicked(), false, {
imp.sink_event( imp.sink_event(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad), &from_glib_borrow(aggregator_pad),
@ -827,7 +827,7 @@ unsafe extern "C" fn aggregator_sink_event_pre_queue<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.sink_event_pre_queue( imp.sink_event_pre_queue(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad), &from_glib_borrow(aggregator_pad),
@ -847,7 +847,7 @@ unsafe extern "C" fn aggregator_sink_query<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.sink_query( imp.sink_query(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad), &from_glib_borrow(aggregator_pad),
@ -868,7 +868,7 @@ unsafe extern "C" fn aggregator_sink_query_pre_queue<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.sink_query_pre_queue( imp.sink_query_pre_queue(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(aggregator_pad), &from_glib_borrow(aggregator_pad),
@ -886,7 +886,7 @@ unsafe extern "C" fn aggregator_src_event<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.into_glib() .into_glib()
@ -900,7 +900,7 @@ unsafe extern "C" fn aggregator_src_query<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.into_glib() .into_glib()
@ -915,7 +915,7 @@ unsafe extern "C" fn aggregator_src_activate<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.src_activate(wrap.unsafe_cast_ref(), from_glib(mode), from_glib(active)) { match imp.src_activate(wrap.unsafe_cast_ref(), from_glib(mode), from_glib(active)) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -935,7 +935,7 @@ unsafe extern "C" fn aggregator_aggregate<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.aggregate(wrap.unsafe_cast_ref(), from_glib(timeout)) imp.aggregate(wrap.unsafe_cast_ref(), from_glib(timeout))
.into() .into()
}) })
@ -949,7 +949,7 @@ unsafe extern "C" fn aggregator_start<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -968,7 +968,7 @@ unsafe extern "C" fn aggregator_stop<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -987,7 +987,7 @@ unsafe extern "C" fn aggregator_get_next_time<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::ClockTime::NONE, { gst::panic_to_error!(&wrap, imp.panicked(), gst::ClockTime::NONE, {
imp.next_time(wrap.unsafe_cast_ref()) imp.next_time(wrap.unsafe_cast_ref())
}) })
.into_glib() .into_glib()
@ -1003,7 +1003,7 @@ unsafe extern "C" fn aggregator_create_new_pad<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), None, { gst::panic_to_error!(&wrap, imp.panicked(), None, {
let req_name: Borrowed<Option<glib::GString>> = from_glib_borrow(req_name); let req_name: Borrowed<Option<glib::GString>> = from_glib_borrow(req_name);
imp.create_new_pad( imp.create_new_pad(
@ -1029,7 +1029,7 @@ unsafe extern "C" fn aggregator_update_src_caps<T: AggregatorImpl>(
*res = ptr::null_mut(); *res = ptr::null_mut();
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
match imp.update_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) { match imp.update_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
Ok(res_caps) => { Ok(res_caps) => {
*res = res_caps.into_ptr(); *res = res_caps.into_ptr();
@ -1049,7 +1049,7 @@ unsafe extern "C" fn aggregator_fixate_src_caps<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), {
imp.fixate_src_caps(wrap.unsafe_cast_ref(), from_glib_full(caps)) imp.fixate_src_caps(wrap.unsafe_cast_ref(), from_glib_full(caps))
}) })
.into_ptr() .into_ptr()
@ -1063,7 +1063,7 @@ unsafe extern "C" fn aggregator_negotiated_src_caps<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.negotiated_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) { match imp.negotiated_src_caps(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -1084,7 +1084,7 @@ unsafe extern "C" fn aggregator_negotiate<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.negotiate(wrap.unsafe_cast_ref()) imp.negotiate(wrap.unsafe_cast_ref())
}) })
.into_glib() .into_glib()
@ -1100,7 +1100,7 @@ unsafe extern "C" fn aggregator_peek_next_sample<T: AggregatorImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr); let wrap: Borrowed<Aggregator> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), None, { gst::panic_to_error!(&wrap, imp.panicked(), None, {
imp.peek_next_sample(wrap.unsafe_cast_ref(), &from_glib_borrow(pad)) imp.peek_next_sample(wrap.unsafe_cast_ref(), &from_glib_borrow(pad))
}) })
.to_glib_full() .to_glib_full()

View file

@ -220,7 +220,7 @@ unsafe extern "C" fn base_parse_start<T: BaseParseImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr); let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -239,7 +239,7 @@ unsafe extern "C" fn base_parse_stop<T: BaseParseImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr); let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -260,7 +260,7 @@ unsafe extern "C" fn base_parse_set_sink_caps<T: BaseParseImpl>(
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr); let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
let caps: Borrowed<gst::Caps> = from_glib_borrow(caps); let caps: Borrowed<gst::Caps> = from_glib_borrow(caps);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.set_sink_caps(wrap.unsafe_cast_ref(), &caps) { match imp.set_sink_caps(wrap.unsafe_cast_ref(), &caps) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -282,8 +282,8 @@ unsafe extern "C" fn base_parse_handle_frame<T: BaseParseImpl>(
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr); let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
let wrap_frame = BaseParseFrame::new(frame, &wrap); let wrap_frame = BaseParseFrame::new(frame, &wrap);
let res = gst::panic_to_error!(&wrap, &imp.panicked(), Err(gst::FlowError::Error), { let res = gst::panic_to_error!(&wrap, imp.panicked(), Err(gst::FlowError::Error), {
imp.handle_frame(&wrap.unsafe_cast_ref(), wrap_frame) imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame)
}); });
match res { match res {
@ -308,7 +308,7 @@ unsafe extern "C" fn base_parse_convert<T: BaseParseImpl>(
let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr); let wrap: Borrowed<BaseParse> = from_glib_borrow(ptr);
let source = gst::GenericFormattedValue::new(from_glib(source_format), source_value); let source = gst::GenericFormattedValue::new(from_glib(source_format), source_value);
let res = gst::panic_to_error!(&wrap, &imp.panicked(), None, { let res = gst::panic_to_error!(&wrap, imp.panicked(), None, {
imp.convert(wrap.unsafe_cast_ref(), source, from_glib(dest_format)) imp.convert(wrap.unsafe_cast_ref(), source, from_glib(dest_format))
}); });

View file

@ -418,7 +418,7 @@ unsafe extern "C" fn base_sink_start<T: BaseSinkImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -437,7 +437,7 @@ unsafe extern "C" fn base_sink_stop<T: BaseSinkImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -458,7 +458,7 @@ unsafe extern "C" fn base_sink_render<T: BaseSinkImpl>(
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let buffer = from_glib_borrow(buffer); let buffer = from_glib_borrow(buffer);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.render(wrap.unsafe_cast_ref(), &buffer).into() imp.render(wrap.unsafe_cast_ref(), &buffer).into()
}) })
.into_glib() .into_glib()
@ -473,7 +473,7 @@ unsafe extern "C" fn base_sink_prepare<T: BaseSinkImpl>(
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let buffer = from_glib_borrow(buffer); let buffer = from_glib_borrow(buffer);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.prepare(wrap.unsafe_cast_ref(), &buffer).into() imp.prepare(wrap.unsafe_cast_ref(), &buffer).into()
}) })
.into_glib() .into_glib()
@ -488,7 +488,7 @@ unsafe extern "C" fn base_sink_render_list<T: BaseSinkImpl>(
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let list = from_glib_borrow(list); let list = from_glib_borrow(list);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.render_list(wrap.unsafe_cast_ref(), &list).into() imp.render_list(wrap.unsafe_cast_ref(), &list).into()
}) })
.into_glib() .into_glib()
@ -503,7 +503,7 @@ unsafe extern "C" fn base_sink_prepare_list<T: BaseSinkImpl>(
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let list = from_glib_borrow(list); let list = from_glib_borrow(list);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.prepare_list(wrap.unsafe_cast_ref(), &list).into() imp.prepare_list(wrap.unsafe_cast_ref(), &list).into()
}) })
.into_glib() .into_glib()
@ -518,7 +518,7 @@ unsafe extern "C" fn base_sink_query<T: BaseSinkImpl>(
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query_ptr); let query = gst::QueryRef::from_mut_ptr(query_ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
BaseSinkImpl::query(imp, wrap.unsafe_cast_ref(), query) BaseSinkImpl::query(imp, wrap.unsafe_cast_ref(), query)
}) })
.into_glib() .into_glib()
@ -532,7 +532,7 @@ unsafe extern "C" fn base_sink_event<T: BaseSinkImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.event(wrap.unsafe_cast_ref(), from_glib_full(event_ptr)) imp.event(wrap.unsafe_cast_ref(), from_glib_full(event_ptr))
}) })
.into_glib() .into_glib()
@ -547,7 +547,7 @@ unsafe extern "C" fn base_sink_get_caps<T: BaseSinkImpl>(
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let filter = Option::<gst::Caps>::from_glib_borrow(filter); let filter = Option::<gst::Caps>::from_glib_borrow(filter);
gst::panic_to_error!(&wrap, &imp.panicked(), None, { gst::panic_to_error!(&wrap, imp.panicked(), None, {
imp.caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref()) imp.caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref())
}) })
.map(|caps| caps.into_ptr()) .map(|caps| caps.into_ptr())
@ -563,7 +563,7 @@ unsafe extern "C" fn base_sink_set_caps<T: BaseSinkImpl>(
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let caps = from_glib_borrow(caps); let caps = from_glib_borrow(caps);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.set_caps(wrap.unsafe_cast_ref(), &caps) { match imp.set_caps(wrap.unsafe_cast_ref(), &caps) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -584,7 +584,7 @@ unsafe extern "C" fn base_sink_fixate<T: BaseSinkImpl>(
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
let caps = from_glib_full(caps); let caps = from_glib_full(caps);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), {
imp.fixate(wrap.unsafe_cast_ref(), caps) imp.fixate(wrap.unsafe_cast_ref(), caps)
}) })
.into_ptr() .into_ptr()
@ -597,7 +597,7 @@ unsafe extern "C" fn base_sink_unlock<T: BaseSinkImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.unlock(wrap.unsafe_cast_ref()) { match imp.unlock(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -616,7 +616,7 @@ unsafe extern "C" fn base_sink_unlock_stop<T: BaseSinkImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSink> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.unlock_stop(wrap.unsafe_cast_ref()) { match imp.unlock_stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {

View file

@ -606,7 +606,7 @@ unsafe extern "C" fn base_src_start<T: BaseSrcImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -625,7 +625,7 @@ unsafe extern "C" fn base_src_stop<T: BaseSrcImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -644,7 +644,7 @@ unsafe extern "C" fn base_src_is_seekable<T: BaseSrcImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.is_seekable(wrap.unsafe_cast_ref()) imp.is_seekable(wrap.unsafe_cast_ref())
}) })
.into_glib() .into_glib()
@ -658,7 +658,7 @@ unsafe extern "C" fn base_src_get_size<T: BaseSrcImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.size(wrap.unsafe_cast_ref()) { match imp.size(wrap.unsafe_cast_ref()) {
Some(s) => { Some(s) => {
*size = s; *size = s;
@ -684,7 +684,7 @@ unsafe extern "C" fn base_src_get_times<T: BaseSrcImpl>(
*start = gst::ffi::GST_CLOCK_TIME_NONE; *start = gst::ffi::GST_CLOCK_TIME_NONE;
*stop = gst::ffi::GST_CLOCK_TIME_NONE; *stop = gst::ffi::GST_CLOCK_TIME_NONE;
gst::panic_to_error!(&wrap, &imp.panicked(), (), { gst::panic_to_error!(&wrap, imp.panicked(), (), {
let (start_, stop_) = imp.times(wrap.unsafe_cast_ref(), buffer); let (start_, stop_) = imp.times(wrap.unsafe_cast_ref(), buffer);
*start = start_.into_glib(); *start = start_.into_glib();
*stop = stop_.into_glib(); *stop = stop_.into_glib();
@ -702,7 +702,7 @@ unsafe extern "C" fn base_src_fill<T: BaseSrcImpl>(
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
let buffer = gst::BufferRef::from_mut_ptr(buffer); let buffer = gst::BufferRef::from_mut_ptr(buffer);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.fill(wrap.unsafe_cast_ref(), offset, length, buffer) imp.fill(wrap.unsafe_cast_ref(), offset, length, buffer)
.into() .into()
}) })
@ -722,7 +722,7 @@ unsafe extern "C" fn base_src_alloc<T: BaseSrcImpl>(
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer; let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer;
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
match imp.alloc(wrap.unsafe_cast_ref(), offset, length) { match imp.alloc(wrap.unsafe_cast_ref(), offset, length) {
Ok(buffer) => { Ok(buffer) => {
*buffer_ptr = buffer.into_ptr(); *buffer_ptr = buffer.into_ptr();
@ -753,7 +753,7 @@ unsafe extern "C" fn base_src_create<T: BaseSrcImpl>(
Some(gst::BufferRef::from_mut_ptr(*buffer_ptr)) Some(gst::BufferRef::from_mut_ptr(*buffer_ptr))
}; };
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
match imp.create( match imp.create(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
offset, offset,
@ -828,7 +828,7 @@ unsafe extern "C" fn base_src_do_seek<T: BaseSrcImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
let mut s = from_glib_none(segment); let mut s = from_glib_none(segment);
let res = imp.do_seek(wrap.unsafe_cast_ref(), &mut s); let res = imp.do_seek(wrap.unsafe_cast_ref(), &mut s);
ptr::write(segment, *(s.to_glib_none().0)); ptr::write(segment, *(s.to_glib_none().0));
@ -847,7 +847,7 @@ unsafe extern "C" fn base_src_query<T: BaseSrcImpl>(
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query_ptr); let query = gst::QueryRef::from_mut_ptr(query_ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
BaseSrcImpl::query(imp, wrap.unsafe_cast_ref(), query) BaseSrcImpl::query(imp, wrap.unsafe_cast_ref(), query)
}) })
.into_glib() .into_glib()
@ -861,7 +861,7 @@ unsafe extern "C" fn base_src_event<T: BaseSrcImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.event(wrap.unsafe_cast_ref(), &from_glib_borrow(event_ptr)) imp.event(wrap.unsafe_cast_ref(), &from_glib_borrow(event_ptr))
}) })
.into_glib() .into_glib()
@ -876,7 +876,7 @@ unsafe extern "C" fn base_src_get_caps<T: BaseSrcImpl>(
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
let filter = Option::<gst::Caps>::from_glib_borrow(filter); let filter = Option::<gst::Caps>::from_glib_borrow(filter);
gst::panic_to_error!(&wrap, &imp.panicked(), None, { gst::panic_to_error!(&wrap, imp.panicked(), None, {
imp.caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref()) imp.caps(wrap.unsafe_cast_ref(), filter.as_ref().as_ref())
}) })
.map(|caps| caps.into_ptr()) .map(|caps| caps.into_ptr())
@ -890,7 +890,7 @@ unsafe extern "C" fn base_src_negotiate<T: BaseSrcImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.negotiate(wrap.unsafe_cast_ref()) { match imp.negotiate(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -911,7 +911,7 @@ unsafe extern "C" fn base_src_set_caps<T: BaseSrcImpl>(
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
let caps = from_glib_borrow(caps); let caps = from_glib_borrow(caps);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.set_caps(wrap.unsafe_cast_ref(), &caps) { match imp.set_caps(wrap.unsafe_cast_ref(), &caps) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -932,7 +932,7 @@ unsafe extern "C" fn base_src_fixate<T: BaseSrcImpl>(
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
let caps = from_glib_full(caps); let caps = from_glib_full(caps);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), {
imp.fixate(wrap.unsafe_cast_ref(), caps) imp.fixate(wrap.unsafe_cast_ref(), caps)
}) })
.into_ptr() .into_ptr()
@ -945,7 +945,7 @@ unsafe extern "C" fn base_src_unlock<T: BaseSrcImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.unlock(wrap.unsafe_cast_ref()) { match imp.unlock(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -964,7 +964,7 @@ unsafe extern "C" fn base_src_unlock_stop<T: BaseSrcImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<BaseSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.unlock_stop(wrap.unsafe_cast_ref()) { match imp.unlock_stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {

View file

@ -891,7 +891,7 @@ unsafe extern "C" fn base_transform_start<T: BaseTransformImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -910,7 +910,7 @@ unsafe extern "C" fn base_transform_stop<T: BaseTransformImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -932,7 +932,7 @@ unsafe extern "C" fn base_transform_transform_caps<T: BaseTransformImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), None, { gst::panic_to_error!(&wrap, imp.panicked(), None, {
let filter: Borrowed<Option<gst::Caps>> = from_glib_borrow(filter); let filter: Borrowed<Option<gst::Caps>> = from_glib_borrow(filter);
imp.transform_caps( imp.transform_caps(
@ -956,7 +956,7 @@ unsafe extern "C" fn base_transform_fixate_caps<T: BaseTransformImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), {
imp.fixate_caps( imp.fixate_caps(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
from_glib(direction), from_glib(direction),
@ -976,7 +976,7 @@ unsafe extern "C" fn base_transform_set_caps<T: BaseTransformImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.set_caps( match imp.set_caps(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(incaps), &from_glib_borrow(incaps),
@ -1001,7 +1001,7 @@ unsafe extern "C" fn base_transform_accept_caps<T: BaseTransformImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.accept_caps( imp.accept_caps(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
from_glib(direction), from_glib(direction),
@ -1020,7 +1020,7 @@ unsafe extern "C" fn base_transform_query<T: BaseTransformImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
BaseTransformImpl::query( BaseTransformImpl::query(
imp, imp,
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
@ -1043,7 +1043,7 @@ unsafe extern "C" fn base_transform_transform_size<T: BaseTransformImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.transform_size( match imp.transform_size(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
from_glib(direction), from_glib(direction),
@ -1070,7 +1070,7 @@ unsafe extern "C" fn base_transform_get_unit_size<T: BaseTransformImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.unit_size(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) { match imp.unit_size(wrap.unsafe_cast_ref(), &from_glib_borrow(caps)) {
Some(s) => { Some(s) => {
*size = s; *size = s;
@ -1094,7 +1094,7 @@ unsafe extern "C" fn base_transform_prepare_output_buffer<T: BaseTransformImpl>(
// FIXME: Wrong signature in FFI // FIXME: Wrong signature in FFI
let outbuf = outbuf as *mut *mut gst::ffi::GstBuffer; let outbuf = outbuf as *mut *mut gst::ffi::GstBuffer;
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
match imp.prepare_output_buffer(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf)) { match imp.prepare_output_buffer(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf)) {
Ok(PrepareOutputBufferSuccess::InputBuffer) => { Ok(PrepareOutputBufferSuccess::InputBuffer) => {
*outbuf = inbuf; *outbuf = inbuf;
@ -1118,7 +1118,7 @@ unsafe extern "C" fn base_transform_sink_event<T: BaseTransformImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.into_glib() .into_glib()
@ -1132,7 +1132,7 @@ unsafe extern "C" fn base_transform_src_event<T: BaseTransformImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.into_glib() .into_glib()
@ -1147,7 +1147,7 @@ unsafe extern "C" fn base_transform_transform<T: BaseTransformImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.transform( imp.transform(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(inbuf), &from_glib_borrow(inbuf),
@ -1169,7 +1169,7 @@ unsafe extern "C" fn base_transform_transform_ip<T: BaseTransformImpl>(
// FIXME: Wrong signature in FFI // FIXME: Wrong signature in FFI
let buf = buf as *mut gst::ffi::GstBuffer; let buf = buf as *mut gst::ffi::GstBuffer;
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
if from_glib(ffi::gst_base_transform_is_passthrough(ptr)) { if from_glib(ffi::gst_base_transform_is_passthrough(ptr)) {
imp.transform_ip_passthrough(wrap.unsafe_cast_ref(), &from_glib_borrow(buf)) imp.transform_ip_passthrough(wrap.unsafe_cast_ref(), &from_glib_borrow(buf))
.into() .into()
@ -1193,7 +1193,7 @@ unsafe extern "C" fn base_transform_transform_meta<T: BaseTransformImpl>(
let inbuf = gst::BufferRef::from_ptr(inbuf); let inbuf = gst::BufferRef::from_ptr(inbuf);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.transform_meta( imp.transform_meta(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
gst::BufferRef::from_mut_ptr(outbuf), gst::BufferRef::from_mut_ptr(outbuf),
@ -1223,7 +1223,7 @@ unsafe extern "C" fn base_transform_copy_metadata<T: BaseTransformImpl>(
return glib::ffi::GFALSE; return glib::ffi::GFALSE;
} }
gst::panic_to_error!(&wrap, &imp.panicked(), true, { gst::panic_to_error!(&wrap, imp.panicked(), true, {
match imp.copy_metadata( match imp.copy_metadata(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
gst::BufferRef::from_ptr(inbuf), gst::BufferRef::from_ptr(inbuf),
@ -1247,7 +1247,7 @@ unsafe extern "C" fn base_transform_before_transform<T: BaseTransformImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), (), { gst::panic_to_error!(&wrap, imp.panicked(), (), {
imp.before_transform(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf)); imp.before_transform(wrap.unsafe_cast_ref(), gst::BufferRef::from_ptr(inbuf));
}) })
} }
@ -1261,7 +1261,7 @@ unsafe extern "C" fn base_transform_submit_input_buffer<T: BaseTransformImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr); let wrap: Borrowed<BaseTransform> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.submit_input_buffer( imp.submit_input_buffer(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
from_glib(is_discont), from_glib(is_discont),
@ -1282,7 +1282,7 @@ unsafe extern "C" fn base_transform_generate_output<T: BaseTransformImpl>(
*buf = ptr::null_mut(); *buf = ptr::null_mut();
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
match imp.generate_output(wrap.unsafe_cast_ref()) { match imp.generate_output(wrap.unsafe_cast_ref()) {
Ok(GenerateOutputSuccess::Dropped) => crate::BASE_TRANSFORM_FLOW_DROPPED.into(), Ok(GenerateOutputSuccess::Dropped) => crate::BASE_TRANSFORM_FLOW_DROPPED.into(),
Ok(GenerateOutputSuccess::NoOutput) => gst::FlowReturn::Ok, Ok(GenerateOutputSuccess::NoOutput) => gst::FlowReturn::Ok,

View file

@ -130,7 +130,7 @@ unsafe extern "C" fn push_src_fill<T: PushSrcImpl>(
let wrap: Borrowed<PushSrc> = from_glib_borrow(ptr); let wrap: Borrowed<PushSrc> = from_glib_borrow(ptr);
let buffer = gst::BufferRef::from_mut_ptr(buffer); let buffer = gst::BufferRef::from_mut_ptr(buffer);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
PushSrcImpl::fill(imp, wrap.unsafe_cast_ref(), buffer).into() PushSrcImpl::fill(imp, wrap.unsafe_cast_ref(), buffer).into()
}) })
.into_glib() .into_glib()
@ -147,7 +147,7 @@ unsafe extern "C" fn push_src_alloc<T: PushSrcImpl>(
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer; let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer;
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
match PushSrcImpl::alloc(imp, wrap.unsafe_cast_ref()) { match PushSrcImpl::alloc(imp, wrap.unsafe_cast_ref()) {
Ok(buffer) => { Ok(buffer) => {
*buffer_ptr = buffer.into_ptr(); *buffer_ptr = buffer.into_ptr();
@ -170,7 +170,7 @@ unsafe extern "C" fn push_src_create<T: PushSrcImpl>(
// https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3 // https://gitlab.freedesktop.org/gstreamer/gstreamer-rs-sys/issues/3
let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer; let buffer_ptr = buffer_ptr as *mut *mut gst::ffi::GstBuffer;
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
match PushSrcImpl::create(imp, wrap.unsafe_cast_ref()) { match PushSrcImpl::create(imp, wrap.unsafe_cast_ref()) {
Ok(buffer) => { Ok(buffer) => {
*buffer_ptr = buffer.into_ptr(); *buffer_ptr = buffer.into_ptr();

View file

@ -53,6 +53,7 @@ macro_rules! skip_assert_initialized {
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
#[allow(clippy::match_same_arms)] #[allow(clippy::match_same_arms)]
#[allow(clippy::use_self)] #[allow(clippy::use_self)]
#[allow(clippy::needless_borrow)]
mod auto; mod auto;
pub use crate::auto::*; pub use crate::auto::*;

View file

@ -123,7 +123,7 @@ unsafe extern "C" fn gl_set_caps<T: GLBaseFilterImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<GLBaseFilter> = from_glib_borrow(ptr); let wrap: Borrowed<GLBaseFilter> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.gl_set_caps( match imp.gl_set_caps(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(incaps), &from_glib_borrow(incaps),
@ -146,7 +146,7 @@ unsafe extern "C" fn gl_start<T: GLBaseFilterImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<GLBaseFilter> = from_glib_borrow(ptr); let wrap: Borrowed<GLBaseFilter> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.gl_start(wrap.unsafe_cast_ref()) { match imp.gl_start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -163,7 +163,7 @@ unsafe extern "C" fn gl_stop<T: GLBaseFilterImpl>(ptr: *mut GstGLBaseFilter) {
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<GLBaseFilter> = from_glib_borrow(ptr); let wrap: Borrowed<GLBaseFilter> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), (), { gst::panic_to_error!(&wrap, imp.panicked(), (), {
imp.gl_stop(wrap.unsafe_cast_ref()) imp.gl_stop(wrap.unsafe_cast_ref())
}) })
} }

View file

@ -113,7 +113,7 @@ unsafe extern "C" fn gl_start<T: GLBaseSrcImpl>(ptr: *mut GstGLBaseSrc) -> glib:
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<GLBaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<GLBaseSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.gl_start(wrap.unsafe_cast_ref()) { match imp.gl_start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -130,7 +130,7 @@ unsafe extern "C" fn gl_stop<T: GLBaseSrcImpl>(ptr: *mut GstGLBaseSrc) {
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<GLBaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<GLBaseSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), (), { gst::panic_to_error!(&wrap, imp.panicked(), (), {
imp.gl_stop(wrap.unsafe_cast_ref()) imp.gl_stop(wrap.unsafe_cast_ref())
}) })
} }
@ -143,7 +143,7 @@ unsafe extern "C" fn fill_gl_memory<T: GLBaseSrcImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<GLBaseSrc> = from_glib_borrow(ptr); let wrap: Borrowed<GLBaseSrc> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.fill_gl_memory(wrap.unsafe_cast_ref(), &from_glib_borrow(memory)) { match imp.fill_gl_memory(wrap.unsafe_cast_ref(), &from_glib_borrow(memory)) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {

View file

@ -262,7 +262,7 @@ unsafe extern "C" fn filter<T: GLFilterImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<GLFilter> = from_glib_borrow(ptr); let wrap: Borrowed<GLFilter> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.filter( match imp.filter(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(input), &from_glib_borrow(input),
@ -287,7 +287,7 @@ unsafe extern "C" fn filter_texture<T: GLFilterImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<GLFilter> = from_glib_borrow(ptr); let wrap: Borrowed<GLFilter> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.filter_texture( match imp.filter_texture(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(input), &from_glib_borrow(input),
@ -308,7 +308,7 @@ unsafe extern "C" fn init_fbo<T: GLFilterImpl>(ptr: *mut GstGLFilter) -> glib::f
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<GLFilter> = from_glib_borrow(ptr); let wrap: Borrowed<GLFilter> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.init_fbo(wrap.unsafe_cast_ref()) { match imp.init_fbo(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -329,7 +329,7 @@ unsafe extern "C" fn set_caps<T: GLFilterImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<GLFilter> = from_glib_borrow(ptr); let wrap: Borrowed<GLFilter> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match GLFilterImpl::set_caps( match GLFilterImpl::set_caps(
imp, imp,
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
@ -356,7 +356,7 @@ unsafe extern "C" fn transform_internal_caps<T: GLFilterImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<GLFilter> = from_glib_borrow(ptr); let wrap: Borrowed<GLFilter> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), None, { gst::panic_to_error!(&wrap, imp.panicked(), None, {
let filter_caps: Borrowed<Option<Caps>> = from_glib_borrow(filter_caps); let filter_caps: Borrowed<Option<Caps>> = from_glib_borrow(filter_caps);
imp.transform_internal_caps( imp.transform_internal_caps(

View file

@ -61,5 +61,5 @@ unsafe extern "C" fn notify_timeout_trampoline<P, F: Fn(&P) + Send + Sync + 'sta
P: IsA<Discoverer>, P: IsA<Discoverer>,
{ {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
f(&Discoverer::from_glib_borrow(this).unsafe_cast_ref()) f(Discoverer::from_glib_borrow(this).unsafe_cast_ref())
} }

View file

@ -92,7 +92,7 @@ where
{ {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
match f( match f(
&RTSPAuth::from_glib_borrow(this).unsafe_cast_ref(), RTSPAuth::from_glib_borrow(this).unsafe_cast_ref(),
&from_glib_borrow(connection), &from_glib_borrow(connection),
&from_glib_borrow(peer_cert), &from_glib_borrow(peer_cert),
from_glib(errors), from_glib(errors),

View file

@ -23,6 +23,7 @@ macro_rules! skip_assert_initialized {
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
#[allow(clippy::match_same_arms)] #[allow(clippy::match_same_arms)]
#[allow(clippy::use_self)] #[allow(clippy::use_self)]
#[allow(clippy::needless_borrow)]
mod auto; mod auto;
pub use crate::auto::*; pub use crate::auto::*;

View file

@ -562,7 +562,7 @@ unsafe extern "C" fn video_decoder_open<T: VideoDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.open(wrap.unsafe_cast_ref()) { match imp.open(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -581,7 +581,7 @@ unsafe extern "C" fn video_decoder_close<T: VideoDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.close(wrap.unsafe_cast_ref()) { match imp.close(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -600,7 +600,7 @@ unsafe extern "C" fn video_decoder_start<T: VideoDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -619,7 +619,7 @@ unsafe extern "C" fn video_decoder_stop<T: VideoDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -638,7 +638,7 @@ unsafe extern "C" fn video_decoder_finish<T: VideoDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.finish(wrap.unsafe_cast_ref()).into() imp.finish(wrap.unsafe_cast_ref()).into()
}) })
.into_glib() .into_glib()
@ -651,7 +651,7 @@ unsafe extern "C" fn video_decoder_drain<T: VideoDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.drain(wrap.unsafe_cast_ref()).into() imp.drain(wrap.unsafe_cast_ref()).into()
}) })
.into_glib() .into_glib()
@ -667,7 +667,7 @@ unsafe extern "C" fn video_decoder_set_format<T: VideoDecoderImpl>(
ffi::gst_video_codec_state_ref(state); ffi::gst_video_codec_state_ref(state);
let wrap_state = VideoCodecState::<Readable>::new(state); let wrap_state = VideoCodecState::<Readable>::new(state);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.set_format(wrap.unsafe_cast_ref(), &wrap_state) { match imp.set_format(wrap.unsafe_cast_ref(), &wrap_state) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -693,7 +693,7 @@ unsafe extern "C" fn video_decoder_parse<T: VideoDecoderImpl>(
let wrap_adapter: Borrowed<gst_base::Adapter> = from_glib_borrow(adapter); let wrap_adapter: Borrowed<gst_base::Adapter> = from_glib_borrow(adapter);
let at_eos: bool = from_glib(at_eos); let at_eos: bool = from_glib(at_eos);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.parse(wrap.unsafe_cast_ref(), &wrap_frame, &wrap_adapter, at_eos) imp.parse(wrap.unsafe_cast_ref(), &wrap_frame, &wrap_adapter, at_eos)
.into() .into()
}) })
@ -709,7 +709,7 @@ unsafe extern "C" fn video_decoder_handle_frame<T: VideoDecoderImpl>(
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
let wrap_frame = VideoCodecFrame::new(frame, &*wrap); let wrap_frame = VideoCodecFrame::new(frame, &*wrap);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into() imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into()
}) })
.into_glib() .into_glib()
@ -722,7 +722,7 @@ unsafe extern "C" fn video_decoder_flush<T: VideoDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
VideoDecoderImpl::flush(imp, wrap.unsafe_cast_ref()) VideoDecoderImpl::flush(imp, wrap.unsafe_cast_ref())
}) })
.into_glib() .into_glib()
@ -735,7 +735,7 @@ unsafe extern "C" fn video_decoder_negotiate<T: VideoDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.negotiate(wrap.unsafe_cast_ref()) { match imp.negotiate(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -755,7 +755,7 @@ unsafe extern "C" fn video_decoder_getcaps<T: VideoDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), {
VideoDecoderImpl::caps( VideoDecoderImpl::caps(
imp, imp,
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
@ -775,7 +775,7 @@ unsafe extern "C" fn video_decoder_sink_event<T: VideoDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.into_glib() .into_glib()
@ -789,7 +789,7 @@ unsafe extern "C" fn video_decoder_sink_query<T: VideoDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.into_glib() .into_glib()
@ -803,7 +803,7 @@ unsafe extern "C" fn video_decoder_src_event<T: VideoDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.into_glib() .into_glib()
@ -817,7 +817,7 @@ unsafe extern "C" fn video_decoder_src_query<T: VideoDecoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.into_glib() .into_glib()
@ -832,7 +832,7 @@ unsafe extern "C" fn video_decoder_propose_allocation<T: VideoDecoderImpl>(
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -853,7 +853,7 @@ unsafe extern "C" fn video_decoder_decide_allocation<T: VideoDecoderImpl>(
let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoDecoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {

View file

@ -496,7 +496,7 @@ unsafe extern "C" fn video_encoder_open<T: VideoEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.open(wrap.unsafe_cast_ref()) { match imp.open(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -515,7 +515,7 @@ unsafe extern "C" fn video_encoder_close<T: VideoEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.close(wrap.unsafe_cast_ref()) { match imp.close(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -534,7 +534,7 @@ unsafe extern "C" fn video_encoder_start<T: VideoEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.start(wrap.unsafe_cast_ref()) { match imp.start(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -553,7 +553,7 @@ unsafe extern "C" fn video_encoder_stop<T: VideoEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.stop(wrap.unsafe_cast_ref()) { match imp.stop(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -572,7 +572,7 @@ unsafe extern "C" fn video_encoder_finish<T: VideoEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.finish(wrap.unsafe_cast_ref()).into() imp.finish(wrap.unsafe_cast_ref()).into()
}) })
.into_glib() .into_glib()
@ -588,7 +588,7 @@ unsafe extern "C" fn video_encoder_set_format<T: VideoEncoderImpl>(
ffi::gst_video_codec_state_ref(state); ffi::gst_video_codec_state_ref(state);
let wrap_state = VideoCodecState::<Readable>::new(state); let wrap_state = VideoCodecState::<Readable>::new(state);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.set_format(wrap.unsafe_cast_ref(), &wrap_state) { match imp.set_format(wrap.unsafe_cast_ref(), &wrap_state) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -609,7 +609,7 @@ unsafe extern "C" fn video_encoder_handle_frame<T: VideoEncoderImpl>(
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
let wrap_frame = VideoCodecFrame::new(frame, &*wrap); let wrap_frame = VideoCodecFrame::new(frame, &*wrap);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into() imp.handle_frame(wrap.unsafe_cast_ref(), wrap_frame).into()
}) })
.into_glib() .into_glib()
@ -622,7 +622,7 @@ unsafe extern "C" fn video_encoder_flush<T: VideoEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
VideoEncoderImpl::flush(imp, wrap.unsafe_cast_ref()) VideoEncoderImpl::flush(imp, wrap.unsafe_cast_ref())
}) })
.into_glib() .into_glib()
@ -635,7 +635,7 @@ unsafe extern "C" fn video_encoder_negotiate<T: VideoEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.negotiate(wrap.unsafe_cast_ref()) { match imp.negotiate(wrap.unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -655,7 +655,7 @@ unsafe extern "C" fn video_encoder_getcaps<T: VideoEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::Caps::new_empty(), { gst::panic_to_error!(&wrap, imp.panicked(), gst::Caps::new_empty(), {
VideoEncoderImpl::caps( VideoEncoderImpl::caps(
imp, imp,
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
@ -675,7 +675,7 @@ unsafe extern "C" fn video_encoder_sink_event<T: VideoEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.sink_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.into_glib() .into_glib()
@ -689,7 +689,7 @@ unsafe extern "C" fn video_encoder_sink_query<T: VideoEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.sink_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.into_glib() .into_glib()
@ -703,7 +703,7 @@ unsafe extern "C" fn video_encoder_src_event<T: VideoEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.src_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.into_glib() .into_glib()
@ -717,7 +717,7 @@ unsafe extern "C" fn video_encoder_src_query<T: VideoEncoderImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query)) imp.src_query(wrap.unsafe_cast_ref(), gst::QueryRef::from_mut_ptr(query))
}) })
.into_glib() .into_glib()
@ -732,7 +732,7 @@ unsafe extern "C" fn video_encoder_propose_allocation<T: VideoEncoderImpl>(
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.propose_allocation(wrap.unsafe_cast_ref(), query) { match imp.propose_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -753,7 +753,7 @@ unsafe extern "C" fn video_encoder_decide_allocation<T: VideoEncoderImpl>(
let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr); let wrap: Borrowed<VideoEncoder> = from_glib_borrow(ptr);
let query = gst::QueryRef::from_mut_ptr(query); let query = gst::QueryRef::from_mut_ptr(query);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.decide_allocation(wrap.unsafe_cast_ref(), query) { match imp.decide_allocation(wrap.unsafe_cast_ref(), query) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {

View file

@ -247,7 +247,7 @@ unsafe extern "C" fn video_filter_set_info<T: VideoFilterImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoFilter> = from_glib_borrow(ptr); let wrap: Borrowed<VideoFilter> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), false, { gst::panic_to_error!(&wrap, imp.panicked(), false, {
match imp.set_info( match imp.set_info(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(incaps), &from_glib_borrow(incaps),
@ -274,7 +274,7 @@ unsafe extern "C" fn video_filter_transform_frame<T: VideoFilterImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoFilter> = from_glib_borrow(ptr); let wrap: Borrowed<VideoFilter> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.transform_frame( imp.transform_frame(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&VideoFrameRef::from_glib_borrow(inframe), &VideoFrameRef::from_glib_borrow(inframe),
@ -293,7 +293,7 @@ unsafe extern "C" fn video_filter_transform_frame_ip<T: VideoFilterImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<VideoFilter> = from_glib_borrow(ptr); let wrap: Borrowed<VideoFilter> = from_glib_borrow(ptr);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
if from_glib(gst_base::ffi::gst_base_transform_is_passthrough( if from_glib(gst_base::ffi::gst_base_transform_is_passthrough(
ptr as *mut gst_base::ffi::GstBaseTransform, ptr as *mut gst_base::ffi::GstBaseTransform,
)) { )) {

View file

@ -68,7 +68,7 @@ unsafe extern "C" fn video_sink_show_frame<T: VideoSinkImpl>(
let wrap: Borrowed<VideoSink> = from_glib_borrow(ptr); let wrap: Borrowed<VideoSink> = from_glib_borrow(ptr);
let buffer = from_glib_borrow(buffer); let buffer = from_glib_borrow(buffer);
gst::panic_to_error!(&wrap, &imp.panicked(), gst::FlowReturn::Error, { gst::panic_to_error!(&wrap, imp.panicked(), gst::FlowReturn::Error, {
imp.show_frame(wrap.unsafe_cast_ref(), &buffer).into() imp.show_frame(wrap.unsafe_cast_ref(), &buffer).into()
}) })
.into_glib() .into_glib()

View file

@ -328,9 +328,9 @@ impl Ord for VideoFormatInfo {
fn cmp(&self, other: &Self) -> Ordering { fn cmp(&self, other: &Self) -> Ordering {
self.n_components() self.n_components()
.cmp(&other.n_components()) .cmp(&other.n_components())
.then_with(|| self.depth().cmp(&other.depth())) .then_with(|| self.depth().cmp(other.depth()))
.then_with(|| self.w_sub().cmp(&other.w_sub()).reverse()) .then_with(|| self.w_sub().cmp(other.w_sub()).reverse())
.then_with(|| self.h_sub().cmp(&other.h_sub()).reverse()) .then_with(|| self.h_sub().cmp(other.h_sub()).reverse())
.then_with(|| self.n_planes().cmp(&other.n_planes())) .then_with(|| self.n_planes().cmp(&other.n_planes()))
.then_with(|| { .then_with(|| {
// Format using native endianess is considered as bigger // Format using native endianess is considered as bigger
@ -363,8 +363,8 @@ impl Ord for VideoFormatInfo {
_ => Ordering::Equal, _ => Ordering::Equal,
} }
}) })
.then_with(|| self.pixel_stride().cmp(&other.pixel_stride())) .then_with(|| self.pixel_stride().cmp(other.pixel_stride()))
.then_with(|| self.poffset().cmp(&other.poffset())) .then_with(|| self.poffset().cmp(other.poffset()))
.then_with(|| { .then_with(|| {
// Prefer non-complex formats // Prefer non-complex formats
match ( match (
@ -401,7 +401,7 @@ impl Ord for VideoFormatInfo {
}) })
.then_with(|| { .then_with(|| {
// tie, sort by name // tie, sort by name
self.name().cmp(&other.name()) self.name().cmp(other.name())
}) })
} }
} }

View file

@ -23,6 +23,7 @@ macro_rules! skip_assert_initialized {
#[allow(clippy::too_many_arguments)] #[allow(clippy::too_many_arguments)]
#[allow(clippy::match_same_arms)] #[allow(clippy::match_same_arms)]
#[allow(clippy::use_self)] #[allow(clippy::use_self)]
#[allow(clippy::needless_borrow)]
mod auto; mod auto;
pub use crate::auto::*; pub use crate::auto::*;

View file

@ -218,7 +218,7 @@ where
P: IsA<Bin>, P: IsA<Bin>,
{ {
let f: &F = &*(f as *const F); let f: &F = &*(f as *const F);
match f(&Bin::from_glib_borrow(this).unsafe_cast_ref()) { match f(Bin::from_glib_borrow(this).unsafe_cast_ref()) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
err.log_with_object(&*Bin::from_glib_borrow(this)); err.log_with_object(&*Bin::from_glib_borrow(this));

View file

@ -743,7 +743,7 @@ impl<O: IsA<Element>> ElementExtManual for O {
let user_data: &mut Option<F> = &mut *(user_data as *mut _); let user_data: &mut Option<F> = &mut *(user_data as *mut _);
let callback = user_data.take().unwrap(); let callback = user_data.take().unwrap();
callback(&Element::from_glib_borrow(element).unsafe_cast_ref()); callback(Element::from_glib_borrow(element).unsafe_cast_ref());
} }
unsafe extern "C" fn free_user_data<O: IsA<Element>, F: FnOnce(&O) + Send + 'static>( unsafe extern "C" fn free_user_data<O: IsA<Element>, F: FnOnce(&O) + Send + 'static>(

View file

@ -27,6 +27,7 @@ macro_rules! skip_assert_initialized {
#[allow(clippy::match_same_arms)] #[allow(clippy::match_same_arms)]
#[allow(clippy::type_complexity)] #[allow(clippy::type_complexity)]
#[allow(clippy::use_self)] #[allow(clippy::use_self)]
#[allow(clippy::needless_borrow)]
mod auto; mod auto;
pub use crate::auto::functions::*; pub use crate::auto::functions::*;
pub use crate::auto::*; pub use crate::auto::*;

View file

@ -1157,7 +1157,7 @@ where
let (mut probe_info, data_type) = create_probe_info(info); let (mut probe_info, data_type) = create_probe_info(info);
let ret = func( let ret = func(
&Pad::from_glib_borrow(pad).unsafe_cast_ref(), Pad::from_glib_borrow(pad).unsafe_cast_ref(),
&mut probe_info, &mut probe_info,
); );
@ -1179,7 +1179,7 @@ where
let func: &F = &*((*pad).activatedata as *const F); let func: &F = &*((*pad).activatedata as *const F);
match func( match func(
&Pad::from_glib_borrow(pad).unsafe_cast_ref(), Pad::from_glib_borrow(pad).unsafe_cast_ref(),
Option::<crate::Object>::from_glib_borrow(parent) Option::<crate::Object>::from_glib_borrow(parent)
.as_ref() .as_ref()
.as_ref(), .as_ref(),
@ -1211,7 +1211,7 @@ where
let func: &F = &*((*pad).activatemodedata as *const F); let func: &F = &*((*pad).activatemodedata as *const F);
match func( match func(
&&Pad::from_glib_borrow(pad).unsafe_cast_ref(), Pad::from_glib_borrow(pad).unsafe_cast_ref(),
Option::<crate::Object>::from_glib_borrow(parent) Option::<crate::Object>::from_glib_borrow(parent)
.as_ref() .as_ref()
.as_ref(), .as_ref(),
@ -1244,7 +1244,7 @@ where
let func: &F = &*((*pad).chaindata as *const F); let func: &F = &*((*pad).chaindata as *const F);
let res: FlowReturn = func( let res: FlowReturn = func(
&Pad::from_glib_borrow(pad).unsafe_cast_ref(), Pad::from_glib_borrow(pad).unsafe_cast_ref(),
Option::<crate::Object>::from_glib_borrow(parent) Option::<crate::Object>::from_glib_borrow(parent)
.as_ref() .as_ref()
.as_ref(), .as_ref(),
@ -1271,7 +1271,7 @@ where
let func: &F = &*((*pad).chainlistdata as *const F); let func: &F = &*((*pad).chainlistdata as *const F);
let res: FlowReturn = func( let res: FlowReturn = func(
&Pad::from_glib_borrow(pad).unsafe_cast_ref(), Pad::from_glib_borrow(pad).unsafe_cast_ref(),
Option::<crate::Object>::from_glib_borrow(parent) Option::<crate::Object>::from_glib_borrow(parent)
.as_ref() .as_ref()
.as_ref(), .as_ref(),
@ -1295,7 +1295,7 @@ where
let func: &F = &*((*pad).eventdata as *const F); let func: &F = &*((*pad).eventdata as *const F);
func( func(
&Pad::from_glib_borrow(pad).unsafe_cast_ref(), Pad::from_glib_borrow(pad).unsafe_cast_ref(),
Option::<crate::Object>::from_glib_borrow(parent) Option::<crate::Object>::from_glib_borrow(parent)
.as_ref() .as_ref()
.as_ref(), .as_ref(),
@ -1321,7 +1321,7 @@ where
let func: &F = &*((*pad).eventdata as *const F); let func: &F = &*((*pad).eventdata as *const F);
let res: FlowReturn = func( let res: FlowReturn = func(
&Pad::from_glib_borrow(pad).unsafe_cast_ref(), Pad::from_glib_borrow(pad).unsafe_cast_ref(),
Option::<crate::Object>::from_glib_borrow(parent) Option::<crate::Object>::from_glib_borrow(parent)
.as_ref() .as_ref()
.as_ref(), .as_ref(),
@ -1366,7 +1366,7 @@ where
}; };
match func( match func(
&pad, pad,
Option::<crate::Object>::from_glib_borrow(parent) Option::<crate::Object>::from_glib_borrow(parent)
.as_ref() .as_ref()
.as_ref(), .as_ref(),
@ -1440,7 +1440,7 @@ where
// Steal the iterator and return it // Steal the iterator and return it
let ret = func( let ret = func(
&Pad::from_glib_borrow(pad).unsafe_cast_ref(), Pad::from_glib_borrow(pad).unsafe_cast_ref(),
Option::<crate::Object>::from_glib_borrow(parent) Option::<crate::Object>::from_glib_borrow(parent)
.as_ref() .as_ref()
.as_ref(), .as_ref(),
@ -1470,7 +1470,7 @@ where
let func: &F = &*((*pad).linkdata as *const F); let func: &F = &*((*pad).linkdata as *const F);
let res: crate::PadLinkReturn = func( let res: crate::PadLinkReturn = func(
&Pad::from_glib_borrow(pad).unsafe_cast_ref(), Pad::from_glib_borrow(pad).unsafe_cast_ref(),
Option::<crate::Object>::from_glib_borrow(parent) Option::<crate::Object>::from_glib_borrow(parent)
.as_ref() .as_ref()
.as_ref(), .as_ref(),
@ -1494,7 +1494,7 @@ where
let func: &F = &*((*pad).querydata as *const F); let func: &F = &*((*pad).querydata as *const F);
func( func(
&Pad::from_glib_borrow(pad).unsafe_cast_ref(), Pad::from_glib_borrow(pad).unsafe_cast_ref(),
Option::<crate::Object>::from_glib_borrow(parent) Option::<crate::Object>::from_glib_borrow(parent)
.as_ref() .as_ref()
.as_ref(), .as_ref(),
@ -1515,7 +1515,7 @@ unsafe extern "C" fn trampoline_unlink_function<
let func: &F = &*((*pad).unlinkdata as *const F); let func: &F = &*((*pad).unlinkdata as *const F);
func( func(
&Pad::from_glib_borrow(pad).unsafe_cast_ref(), Pad::from_glib_borrow(pad).unsafe_cast_ref(),
Option::<crate::Object>::from_glib_borrow(parent) Option::<crate::Object>::from_glib_borrow(parent)
.as_ref() .as_ref()
.as_ref(), .as_ref(),

View file

@ -941,7 +941,7 @@ mod tests {
let a = "Test, f1=(string)abc, f2=(uint)123;"; let a = "Test, f1=(string)abc, f2=(uint)123;";
let s = Structure::from_str(&a).unwrap(); let s = Structure::from_str(a).unwrap();
assert_eq!(s.get::<&str>("f1"), Ok("abc")); assert_eq!(s.get::<&str>("f1"), Ok("abc"));
assert_eq!(s.get::<u32>("f2"), Ok(123)); assert_eq!(s.get::<u32>("f2"), Ok(123));
@ -956,7 +956,7 @@ mod tests {
let a = None::<&Structure>.to_value(); let a = None::<&Structure>.to_value();
assert!(a.get::<Option<Structure>>().unwrap().is_none()); assert!(a.get::<Option<Structure>>().unwrap().is_none());
let b = Structure::from_str(&"foo").unwrap().to_value(); let b = Structure::from_str("foo").unwrap().to_value();
assert!(b.get::<Option<Structure>>().unwrap().is_some()); assert!(b.get::<Option<Structure>>().unwrap().is_some());
} }

View file

@ -120,7 +120,7 @@ unsafe extern "C" fn bin_add_element<T: BinImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Bin> = from_glib_borrow(ptr); let wrap: Borrowed<Bin> = from_glib_borrow(ptr);
panic_to_error!(&wrap, &imp.panicked(), false, { panic_to_error!(&wrap, imp.panicked(), false, {
match imp.add_element(wrap.unsafe_cast_ref(), &from_glib_none(element)) { match imp.add_element(wrap.unsafe_cast_ref(), &from_glib_none(element)) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -149,7 +149,7 @@ unsafe extern "C" fn bin_remove_element<T: BinImpl>(
return glib::ffi::GFALSE; return glib::ffi::GFALSE;
} }
panic_to_error!(&wrap, &imp.panicked(), false, { panic_to_error!(&wrap, imp.panicked(), false, {
match imp.remove_element(wrap.unsafe_cast_ref(), &from_glib_none(element)) { match imp.remove_element(wrap.unsafe_cast_ref(), &from_glib_none(element)) {
Ok(()) => true, Ok(()) => true,
Err(err) => { Err(err) => {
@ -169,7 +169,7 @@ unsafe extern "C" fn bin_handle_message<T: BinImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Bin> = from_glib_borrow(ptr); let wrap: Borrowed<Bin> = from_glib_borrow(ptr);
panic_to_error!(&wrap, &imp.panicked(), (), { panic_to_error!(&wrap, imp.panicked(), (), {
imp.handle_message(wrap.unsafe_cast_ref(), from_glib_full(message)) imp.handle_message(wrap.unsafe_cast_ref(), from_glib_full(message))
}); });
} }

View file

@ -135,7 +135,7 @@ unsafe extern "C" fn child_proxy_get_child_by_name<T: ChildProxyImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
imp.child_by_name( imp.child_by_name(
&from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(), from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(),
&glib::GString::from_glib_borrow(name), &glib::GString::from_glib_borrow(name),
) )
.to_glib_full() .to_glib_full()
@ -149,7 +149,7 @@ unsafe extern "C" fn child_proxy_get_child_by_index<T: ChildProxyImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
imp.child_by_index( imp.child_by_index(
&from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(), from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(),
index, index,
) )
.to_glib_full() .to_glib_full()
@ -161,7 +161,7 @@ unsafe extern "C" fn child_proxy_get_children_count<T: ChildProxyImpl>(
let instance = &*(child_proxy as *mut T::Instance); let instance = &*(child_proxy as *mut T::Instance);
let imp = instance.impl_(); let imp = instance.impl_();
imp.children_count(&from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref()) imp.children_count(from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref())
} }
unsafe extern "C" fn child_proxy_child_added<T: ChildProxyImpl>( unsafe extern "C" fn child_proxy_child_added<T: ChildProxyImpl>(
@ -173,7 +173,7 @@ unsafe extern "C" fn child_proxy_child_added<T: ChildProxyImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
imp.child_added( imp.child_added(
&from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(), from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(),
&from_glib_borrow(child), &from_glib_borrow(child),
&glib::GString::from_glib_borrow(name), &glib::GString::from_glib_borrow(name),
) )
@ -188,7 +188,7 @@ unsafe extern "C" fn child_proxy_child_removed<T: ChildProxyImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
imp.child_removed( imp.child_removed(
&from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(), from_glib_borrow::<_, ChildProxy>(child_proxy).unsafe_cast_ref(),
&from_glib_borrow(child), &from_glib_borrow(child),
&glib::GString::from_glib_borrow(name), &glib::GString::from_glib_borrow(name),
) )

View file

@ -332,7 +332,7 @@ impl<T: ElementImpl> ElementImplExt for T {
let instance = &*(ptr as *mut T::Instance); let instance = &*(ptr as *mut T::Instance);
let imp = instance.impl_(); let imp = instance.impl_();
panic_to_error!(element, &imp.panicked(), fallback(), { f(&imp) }) panic_to_error!(element, imp.panicked(), fallback(), { f(imp) })
} }
} }
@ -348,8 +348,8 @@ impl<T: ElementImpl> ElementImplExt for T {
let instance = &*(ptr as *mut Self::Instance); let instance = &*(ptr as *mut Self::Instance);
let imp = instance.impl_(); let imp = instance.impl_();
panic_to_error!(wrap, &imp.panicked(), fallback(), { panic_to_error!(wrap, imp.panicked(), fallback(), {
f(&imp, wrap.unsafe_cast_ref()) f(imp, wrap.unsafe_cast_ref())
}) })
} }
} }
@ -420,7 +420,7 @@ unsafe extern "C" fn element_change_state<T: ElementImpl>(
_ => StateChangeReturn::Failure, _ => StateChangeReturn::Failure,
}; };
panic_to_error!(&wrap, &imp.panicked(), fallback, { panic_to_error!(&wrap, imp.panicked(), fallback, {
imp.change_state(wrap.unsafe_cast_ref(), transition).into() imp.change_state(wrap.unsafe_cast_ref(), transition).into()
}) })
.into_glib() .into_glib()
@ -440,7 +440,7 @@ unsafe extern "C" fn element_request_new_pad<T: ElementImpl>(
// XXX: This is effectively unsafe but the best we can do // XXX: This is effectively unsafe but the best we can do
// See https://bugzilla.gnome.org/show_bug.cgi?id=791193 // See https://bugzilla.gnome.org/show_bug.cgi?id=791193
let pad = panic_to_error!(&wrap, &imp.panicked(), None, { let pad = panic_to_error!(&wrap, imp.panicked(), None, {
imp.request_new_pad( imp.request_new_pad(
wrap.unsafe_cast_ref(), wrap.unsafe_cast_ref(),
&from_glib_borrow(templ), &from_glib_borrow(templ),
@ -478,7 +478,7 @@ unsafe extern "C" fn element_release_pad<T: ElementImpl>(
return; return;
} }
panic_to_error!(&wrap, &imp.panicked(), (), { panic_to_error!(&wrap, imp.panicked(), (), {
imp.release_pad(wrap.unsafe_cast_ref(), &from_glib_none(pad)) imp.release_pad(wrap.unsafe_cast_ref(), &from_glib_none(pad))
}) })
} }
@ -491,7 +491,7 @@ unsafe extern "C" fn element_send_event<T: ElementImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Element> = from_glib_borrow(ptr); let wrap: Borrowed<Element> = from_glib_borrow(ptr);
panic_to_error!(&wrap, &imp.panicked(), false, { panic_to_error!(&wrap, imp.panicked(), false, {
imp.send_event(wrap.unsafe_cast_ref(), from_glib_full(event)) imp.send_event(wrap.unsafe_cast_ref(), from_glib_full(event))
}) })
.into_glib() .into_glib()
@ -506,7 +506,7 @@ unsafe extern "C" fn element_query<T: ElementImpl>(
let wrap: Borrowed<Element> = from_glib_borrow(ptr); let wrap: Borrowed<Element> = from_glib_borrow(ptr);
let query = QueryRef::from_mut_ptr(query); let query = QueryRef::from_mut_ptr(query);
panic_to_error!(&wrap, &imp.panicked(), false, { panic_to_error!(&wrap, imp.panicked(), false, {
imp.query(wrap.unsafe_cast_ref(), query) imp.query(wrap.unsafe_cast_ref(), query)
}) })
.into_glib() .into_glib()
@ -520,7 +520,7 @@ unsafe extern "C" fn element_set_context<T: ElementImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Element> = from_glib_borrow(ptr); let wrap: Borrowed<Element> = from_glib_borrow(ptr);
panic_to_error!(&wrap, &imp.panicked(), (), { panic_to_error!(&wrap, imp.panicked(), (), {
imp.set_context(wrap.unsafe_cast_ref(), &from_glib_borrow(context)) imp.set_context(wrap.unsafe_cast_ref(), &from_glib_borrow(context))
}) })
} }
@ -535,7 +535,7 @@ unsafe extern "C" fn element_set_clock<T: ElementImpl>(
let clock = Option::<crate::Clock>::from_glib_borrow(clock); let clock = Option::<crate::Clock>::from_glib_borrow(clock);
panic_to_error!(&wrap, &imp.panicked(), false, { panic_to_error!(&wrap, imp.panicked(), false, {
imp.set_clock(wrap.unsafe_cast_ref(), clock.as_ref().as_ref()) imp.set_clock(wrap.unsafe_cast_ref(), clock.as_ref().as_ref())
}) })
.into_glib() .into_glib()
@ -548,7 +548,7 @@ unsafe extern "C" fn element_provide_clock<T: ElementImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
let wrap: Borrowed<Element> = from_glib_borrow(ptr); let wrap: Borrowed<Element> = from_glib_borrow(ptr);
panic_to_error!(&wrap, &imp.panicked(), None, { panic_to_error!(&wrap, imp.panicked(), None, {
imp.provide_clock(wrap.unsafe_cast_ref()) imp.provide_clock(wrap.unsafe_cast_ref())
}) })
.to_glib_full() .to_glib_full()
@ -790,9 +790,9 @@ mod tests {
src.set_property("num-buffers", &100i32).unwrap(); src.set_property("num-buffers", &100i32).unwrap();
pipeline pipeline
.add_many(&[&src, &element.upcast_ref(), &sink]) .add_many(&[&src, element.upcast_ref(), &sink])
.unwrap(); .unwrap();
Element::link_many(&[&src, &element.upcast_ref(), &sink]).unwrap(); Element::link_many(&[&src, element.upcast_ref(), &sink]).unwrap();
pipeline.set_state(crate::State::Playing).unwrap(); pipeline.set_state(crate::State::Playing).unwrap();
let bus = pipeline.bus().unwrap(); let bus = pipeline.bus().unwrap();

View file

@ -128,7 +128,7 @@ unsafe extern "C" fn uri_handler_get_uri<T: URIHandlerImpl>(
let instance = &*(uri_handler as *mut T::Instance); let instance = &*(uri_handler as *mut T::Instance);
let imp = instance.impl_(); let imp = instance.impl_();
imp.uri(&from_glib_borrow::<_, URIHandler>(uri_handler).unsafe_cast_ref()) imp.uri(from_glib_borrow::<_, URIHandler>(uri_handler).unsafe_cast_ref())
.to_glib_full() .to_glib_full()
} }
@ -141,7 +141,7 @@ unsafe extern "C" fn uri_handler_set_uri<T: URIHandlerImpl>(
let imp = instance.impl_(); let imp = instance.impl_();
match imp.set_uri( match imp.set_uri(
&from_glib_borrow::<_, URIHandler>(uri_handler).unsafe_cast_ref(), from_glib_borrow::<_, URIHandler>(uri_handler).unsafe_cast_ref(),
glib::GString::from_glib_borrow(uri).as_str(), glib::GString::from_glib_borrow(uri).as_str(),
) { ) {
Ok(()) => true.into_glib(), Ok(()) => true.into_glib(),