Commit 38496eca authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

Pass events by value instead of reference

parent 484cf568
......@@ -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"
......
......@@ -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)
});
......
// 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)]
......
// 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;
......
// 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;
......
// 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;
......
// 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;
......
// 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;
......
// 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;
......
// 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;
......
// 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;
......
// 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;
......
// 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);
......
// 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;
......
// 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;
......
// 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;
......
// 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;
......
// 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;
......
// 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;
......
// 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;
......
// 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() }
//}
......
// 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;
......
// 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;
......
// 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;
......
// 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;
......
// 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;
......
// 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")]
......
// 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;
......
// 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;
......
// 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;
......
......@@ -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()))
}
}
}
......@@ -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(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment