tracer: Re-order trait functions slightly for the order to make more sense

This commit is contained in:
Sebastian Dröge 2022-06-29 10:13:36 +03:00
parent 14f485d0b1
commit 9e77ab3212

View file

@ -14,7 +14,9 @@ pub trait TracerImpl: TracerImplExt + GstObjectImpl + Send + Sync {
fn bin_add_pre(&self, ts: u64, bin: &Bin, element: &Element) {} fn bin_add_pre(&self, ts: u64, bin: &Bin, element: &Element) {}
fn bin_remove_post(&self, ts: u64, bin: &Bin, success: bool) {} fn bin_remove_post(&self, ts: u64, bin: &Bin, success: bool) {}
fn bin_remove_pre(&self, ts: u64, bin: &Bin, element: &Element) {} fn bin_remove_pre(&self, ts: u64, bin: &Bin, element: &Element) {}
fn element_new(&self, ts: u64, element: &Element) {}
fn element_add_pad(&self, ts: u64, element: &Element, pad: &Pad) {} fn element_add_pad(&self, ts: u64, element: &Element, pad: &Pad) {}
fn element_remove_pad(&self, ts: u64, element: &Element, pad: &Pad) {}
fn element_change_state_post( fn element_change_state_post(
&self, &self,
ts: u64, ts: u64,
@ -24,12 +26,10 @@ pub trait TracerImpl: TracerImplExt + GstObjectImpl + Send + Sync {
) { ) {
} }
fn element_change_state_pre(&self, ts: u64, element: &Element, change: StateChange) {} fn element_change_state_pre(&self, ts: u64, element: &Element, change: StateChange) {}
fn element_new(&self, ts: u64, element: &Element) {}
fn element_post_message_post(&self, ts: u64, element: &Element, success: bool) {} fn element_post_message_post(&self, ts: u64, element: &Element, success: bool) {}
fn element_post_message_pre(&self, ts: u64, element: &Element, message: &Message) {} fn element_post_message_pre(&self, ts: u64, element: &Element, message: &Message) {}
fn element_query_post(&self, ts: u64, element: &Element, query: &Query, success: bool) {} fn element_query_post(&self, ts: u64, element: &Element, query: &Query, success: bool) {}
fn element_query_pre(&self, ts: u64, element: &Element, query: &Query) {} fn element_query_pre(&self, ts: u64, element: &Element, query: &Query) {}
fn element_remove_pad(&self, ts: u64, element: &Element, pad: &Pad) {}
// rustdoc-stripper-ignore-next // rustdoc-stripper-ignore-next
/// Hook to be called before the GstMiniObject has been fully initialized. /// Hook to be called before the GstMiniObject has been fully initialized.
fn mini_object_created(&self, ts: u64, object: std::ptr::NonNull<ffi::GstMiniObject>) {} fn mini_object_created(&self, ts: u64, object: std::ptr::NonNull<ffi::GstMiniObject>) {}
@ -129,11 +129,20 @@ define_tracer_hooks! {
let e = Element::from_glib_borrow(e); let e = Element::from_glib_borrow(e);
this.bin_remove_pre(ts, &b, &e) this.bin_remove_pre(ts, &b, &e)
}; };
ElementNew("element-new") = |this, ts, e: *mut ffi::GstElement| {
let e = Element::from_glib_borrow(e);
this.element_new(ts, &e)
};
ElementAddPad("element-add-pad") = |this, ts, e: *mut ffi::GstElement, p: *mut ffi::GstPad| { ElementAddPad("element-add-pad") = |this, ts, e: *mut ffi::GstElement, p: *mut ffi::GstPad| {
let e = Element::from_glib_borrow(e); let e = Element::from_glib_borrow(e);
let p = Pad::from_glib_borrow(p); let p = Pad::from_glib_borrow(p);
this.element_add_pad(ts, &e, &p) this.element_add_pad(ts, &e, &p)
}; };
ElementRemovePad("element-remove-pad") = |this, ts, e: *mut ffi::GstElement, p: *mut ffi::GstPad| {
let e = Element::from_glib_borrow(e);
let p = Pad::from_glib_borrow(p);
this.element_remove_pad(ts, &e, &p)
};
ElementChangeStatePost("element-change-state-post") = |this, ts, e: *mut ffi::GstElement, c: ffi::GstStateChange, r: ffi::GstStateChangeReturn| { ElementChangeStatePost("element-change-state-post") = |this, ts, e: *mut ffi::GstElement, c: ffi::GstStateChange, r: ffi::GstStateChangeReturn| {
let e = Element::from_glib_borrow(e); let e = Element::from_glib_borrow(e);
this.element_change_state_post(ts, &e, StateChange::from_glib(c), StateChangeReturn::from_glib(r)) this.element_change_state_post(ts, &e, StateChange::from_glib(c), StateChangeReturn::from_glib(r))
@ -142,10 +151,6 @@ define_tracer_hooks! {
let e = Element::from_glib_borrow(e); let e = Element::from_glib_borrow(e);
this.element_change_state_pre(ts, &e, StateChange::from_glib(c)) this.element_change_state_pre(ts, &e, StateChange::from_glib(c))
}; };
ElementNew("element-new") = |this, ts, e: *mut ffi::GstElement| {
let e = Element::from_glib_borrow(e);
this.element_new(ts, &e)
};
ElementPostMessagePost("element-post-message-post") = |this, ts, e: *mut ffi::GstElement, r: glib::ffi::gboolean| { ElementPostMessagePost("element-post-message-post") = |this, ts, e: *mut ffi::GstElement, r: glib::ffi::gboolean| {
let e = Element::from_glib_borrow(e); let e = Element::from_glib_borrow(e);
this.element_post_message_post(ts, &e, bool::from_glib(r)) this.element_post_message_post(ts, &e, bool::from_glib(r))
@ -165,11 +170,6 @@ define_tracer_hooks! {
let q = Query::from_glib_borrow(q); let q = Query::from_glib_borrow(q);
this.element_query_pre(ts, &e, &q) this.element_query_pre(ts, &e, &q)
}; };
ElementRemovePad("element-remove-pad") = |this, ts, e: *mut ffi::GstElement, p: *mut ffi::GstPad| {
let e = Element::from_glib_borrow(e);
let p = Pad::from_glib_borrow(p);
this.element_remove_pad(ts, &e, &p)
};
// TODO: unclear what to do here as the `GstMiniObject` here is not fully initialized yet… // TODO: unclear what to do here as the `GstMiniObject` here is not fully initialized yet…
MiniObjectCreated("mini-object-created") = |this, ts, o: *mut ffi::GstMiniObject| { MiniObjectCreated("mini-object-created") = |this, ts, o: *mut ffi::GstMiniObject| {
this.mini_object_created(ts, std::ptr::NonNull::new_unchecked(o)) this.mini_object_created(ts, std::ptr::NonNull::new_unchecked(o))