Pass events by value instead of reference

This commit is contained in:
Sebastian Dröge 2017-08-01 13:58:50 +01:00
parent 484cf56890
commit 38496eca7d
32 changed files with 82 additions and 64 deletions

View file

@ -227,6 +227,11 @@ status = "generate"
# correct mutability
ignore = true
[[object.function]]
name = "send_event"
# Pass by value
ignore = true
[[object]]
name = "Gst.ElementFactory"
status = "generate"
@ -385,6 +390,21 @@ status = "generate"
# Correct mutability
ignore = true
[[object.function]]
name = "event_default"
# Pass by value
ignore = true
[[object.function]]
name = "push_event"
# Pass by value
ignore = true
[[object.function]]
name = "send_event"
# Pass by value
ignore = true
[[object]]
name = "Gst.GhostPad"
status = "generate"

View file

@ -24,7 +24,7 @@ fn main() {
println!("sending eos");
let ev = Event::new_eos().build();
pipeline.send_event(&ev);
pipeline.send_event(ev);
glib::Continue(false)
});

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
#[allow(unused_imports)]

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use ChildProxy;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use ClockTime;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use ffi;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use ClockTime;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use ffi;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use Caps;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use Bus;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use Bus;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use DeviceProvider;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use Bus;
@ -7,7 +7,6 @@ use Clock;
use ClockTime;
use ElementFactory;
use Error;
use Event;
use Format;
use Iterator;
use Message;
@ -181,8 +180,6 @@ pub trait ElementExt {
fn seek_simple(&self, format: Format, seek_flags: SeekFlags, seek_pos: i64) -> Result<(), glib::error::BoolError>;
fn send_event(&self, event: &Event) -> bool;
fn set_base_time(&self, time: ClockTime);
fn set_bus(&self, bus: &Bus);
@ -509,12 +506,6 @@ impl<O: IsA<Element> + IsA<glib::object::Object>> ElementExt for O {
}
}
fn send_event(&self, event: &Event) -> bool {
unsafe {
from_glib(ffi::gst_element_send_event(self.to_glib_none().0, event.to_glib_full()))
}
}
fn set_base_time(&self, time: ClockTime) {
unsafe {
ffi::gst_element_set_base_time(self.to_glib_none().0, time);

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use Caps;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use ffi;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use ffi;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use Bin;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use Object;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
mod bin;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use ClockTime;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use Caps;
@ -87,8 +87,6 @@ pub trait PadExt {
//fn create_stream_id_printf_valist<'a, P: IsA<Element>, Q: Into<Option<&'a str>>>(&self, parent: &P, stream_id: Q, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) -> Option<String>;
fn event_default<'a, P: IsA<Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q, event: &Event) -> bool;
//fn forward<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, forward: /*Unknown conversion*//*Unimplemented*/PadForwardFunction, user_data: P) -> bool;
fn get_allowed_caps(&self) -> Option<Caps>;
@ -161,8 +159,6 @@ pub trait PadExt {
fn peer_query_position(&self, format: Format) -> Option<i64>;
fn push_event(&self, event: &Event) -> bool;
//fn push_list(&self, list: /*Ignored*/&mut BufferList) -> FlowReturn;
fn query_accept_caps(&self, caps: &Caps) -> bool;
@ -175,8 +171,6 @@ pub trait PadExt {
fn query_position(&self, format: Format) -> Option<i64>;
fn send_event(&self, event: &Event) -> bool;
//fn set_activate_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, activate: /*Unknown conversion*//*Unimplemented*/PadActivateFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);
//fn set_activatemode_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, activatemode: /*Unknown conversion*//*Unimplemented*/PadActivateModeFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify);
@ -265,14 +259,6 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
// unsafe { TODO: call ffi::gst_pad_create_stream_id_printf_valist() }
//}
fn event_default<'a, P: IsA<Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q, event: &Event) -> bool {
let parent = parent.into();
let parent = parent.to_glib_none();
unsafe {
from_glib(ffi::gst_pad_event_default(self.to_glib_none().0, parent.0, event.to_glib_full()))
}
}
//fn forward<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, forward: /*Unknown conversion*//*Unimplemented*/PadForwardFunction, user_data: P) -> bool {
// unsafe { TODO: call ffi::gst_pad_forward() }
//}
@ -481,12 +467,6 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
}
}
fn push_event(&self, event: &Event) -> bool {
unsafe {
from_glib(ffi::gst_pad_push_event(self.to_glib_none().0, event.to_glib_full()))
}
}
//fn push_list(&self, list: /*Ignored*/&mut BufferList) -> FlowReturn {
// unsafe { TODO: call ffi::gst_pad_push_list() }
//}
@ -529,12 +509,6 @@ impl<O: IsA<Pad> + IsA<glib::object::Object>> PadExt for O {
}
}
fn send_event(&self, event: &Event) -> bool {
unsafe {
from_glib(ffi::gst_pad_send_event(self.to_glib_none().0, event.to_glib_full()))
}
}
//fn set_activate_function_full<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(&self, activate: /*Unknown conversion*//*Unimplemented*/PadActivateFunction, user_data: P, notify: /*Unknown conversion*//*Unimplemented*/DestroyNotify) {
// unsafe { TODO: call ffi::gst_pad_set_activate_function_full() }
//}

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use Caps;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use Bin;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use Error;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use ffi;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use Iterator;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
#[cfg(feature = "v1_10")]

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use Object;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use Element;

View file

@ -1,4 +1,4 @@
// This file was generated by gir (a01311c+) from gir-files (???)
// This file was generated by gir (f00d658) from gir-files (???)
// DO NOT EDIT
use Error;

View file

@ -12,6 +12,7 @@ use glib;
use glib::IsA;
use glib::translate::{from_glib, ToGlibPtr};
use QueryRef;
use Event;
use miniobject::MiniObject;
use ffi;
@ -44,6 +45,8 @@ impl Element {
pub trait ElementExtManual {
fn query(&self, query: &mut QueryRef) -> bool;
fn send_event(&self, event: Event) -> bool;
}
impl<O: IsA<Element>> ElementExtManual for O {
@ -55,4 +58,10 @@ impl<O: IsA<Element>> ElementExtManual for O {
))
}
}
fn send_event(&self, event: Event) -> bool {
unsafe {
from_glib(ffi::gst_element_send_event(self.to_glib_none().0, event.into_ptr()))
}
}
}

View file

@ -86,6 +86,10 @@ pub trait PadExtManual {
) -> bool;
fn proxy_query_caps(&self, query: &mut QueryRef) -> bool;
fn proxy_query_accept_caps(&self, query: &mut QueryRef) -> bool;
fn event_default<'a, P: IsA<::Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q, event: Event) -> bool;
fn push_event(&self, event: Event) -> bool;
fn send_event(&self, event: Event) -> bool;
}
impl<O: IsA<Pad>> PadExtManual for O {
@ -205,6 +209,26 @@ impl<O: IsA<Pad>> PadExtManual for O {
))
}
}
fn event_default<'a, P: IsA<::Object> + 'a, Q: Into<Option<&'a P>>>(&self, parent: Q, event: Event) -> bool {
let parent = parent.into();
let parent = parent.to_glib_none();
unsafe {
from_glib(ffi::gst_pad_event_default(self.to_glib_none().0, parent.0, event.into_ptr()))
}
}
fn push_event(&self, event: Event) -> bool {
unsafe {
from_glib(ffi::gst_pad_push_event(self.to_glib_none().0, event.into_ptr()))
}
}
fn send_event(&self, event: Event) -> bool {
unsafe {
from_glib(ffi::gst_pad_send_event(self.to_glib_none().0, event.into_ptr()))
}
}
}
unsafe extern "C" fn trampoline_pad_probe(